STM32 USB CDC (Virtual Com Port) with CubeMX HAL in 6 minutes

preview_player
Показать описание
Create a project with USB CDC (Virtual Com Port, VCP) with STM32 microcontroller in CubeMX (HAL) and SystemWorkbench for STM32 in 6 minutes.
Рекомендации по теме
Комментарии
Автор

Thanks for this wizard. This is exactly what I was looking - simply how to print from STM32F4 Discovery to serial console over Micro USB. I'm using PlatformIO (with serial monitor) in VSCode IDE.

mirao-up
Автор

Thanks boss! Got me pointed in a direction.

tehnocmaster
Автор

Very helpful! Thanks for taking the time to put this together!

brentalanmiller
Автор

Excellent video, just what i needed, thank you !

jorgemendieta
Автор

Pretty unhelpful for anything serious. 1) you need to check to make sure the CDC isn't busy transmitting oo it will simply ignore your transmit. 2) Most CDC devices are going to need to receive data and there is nothing here about how to accomplish that or process the incoming data. This is a 6 minute video about configuring a project in CubeMX and 5 seconds of including a CDC_Transmit_FS() function call.

jwiegley
Автор

The main problem is, that this demo is not representativ because ST often update the MXCube, CubeIDE and the HAL library. If you ever looked into the HAL, you get shocked how bad the coding qualtity could be. Similar mention, if you look into the sources of freeRTOS.
The demonstrated demo works, if you use the HAL V1.1.2 from 23.sep.2016 and you advise the CubeMX using this old HAL. Any HAL Versions later, this does not works.

I am not know why this happens, because the generated Code looks similar. But the windows system device manager could not start the registered cdc device.

I had regenerate a final working version and migrate the ioc-file generated from an older version into the regular offered version of MXCube and regenerate the code for KeilMDK again. The result was similar - the new code looks very similar, but does'nt work.

As a cross check, i had recompiled the old project, where the ioc.file was picked from and this works pretty nice.

Well, i like the concept of the HAL- and the CMSIS libs to get the start up from scratch easiers. But teh code quality is very bad und looks that none of ST has ever heard from a common coding style. A debugging session of an unknown code with a soucre code style like freertos or HAL, is a horror task.

DDDA
Автор

Thanks a lot for this video! I am moving from simpler MCUs (like C51, ARM7) where i was able to know all the internal registers and its meanings. And now I am getting messy about all this stuff in STM32. Actually, is there any simple way for to check (get noticed) about awaiting incoming character(s) on RX? And get know when TXbuffer is empty or send it byte per byte? Usualy I am using the serial while doing few other thinks. I cannot stand still until the message is sent, . My usual way was checking serial (in main while loop) like this.


void Send232_2(void)
{
if (plssend232_2 == 0) plssend232_2 = RS232TXLENGTH;
}

void Serve232_2 (void)
{
unsigned char i=0;
unsigned char c = 0x00;
if (plssend232_2 > 0)
{
if ((COM1STA0 & BIT6) == BIT6) //if TX empty
{
i = RS232TXLENGTH - plssend232_2;
c = strts232_2[i];
if (c != 0)
{
COM1TX = c;
plssend232_2--;
}
else plssend232_2 = 0;
}// eof if buffempty
} //eof if plssend
}

bnwlf
Автор

so good. Withot some useLess information just howto exelent!

nozsavsev
Автор

i want to send sensor data through USB which contain INT data type, any idea ? cause I've facing some problem sending INT data types

aderoxie
Автор

Or you can just #include "usbd_cdc_if.h" in your main and then anything else you add there gets included too. SW4STM32 looks nicer than I remember! Keil is meant to be good but I'm finding it kinda clunky tbh...

Kefford
Автор

Is this possible to use USB CDC class for both WinUSB and VCP at the same time? Thanks!

caubeconan
Автор

i have stm32L476RG i am trying to get 3 cdc port, i am getting some problems . if someone help me i would give more detail to solve it . Thank you, helpfull video

sezaacar
Автор

Hi! thanks for this tutorial. How can i increase the speed receiving data from the pc? I need about 8Mbps using STM32F103, but I can only get half that speed!

luisantoniovieiravital
Автор

Yet another video that should have been a website. Also, adds zero explanation to using the wizzard. Who exactly needs that?

stefans
Автор

Another video with no audio. Makes it impossible to follw and pretty well useless. In addition, it is now too out of date since the interface has changed.

ianabercrombie