cancel
Showing results for 
Search instead for 
Did you mean: 

How can i set baud rate greater than 115200 for virtual com port?

fzhan.2
Associate II

I'm now using NUCLEO-L476RG. My PC connects to the board by virtual com port? And i try to set a baud rate greater than 115200 but the data received from usart2 is wrong. However, when i set the baud rate less than 115200, it works well.

So i wanna ask that if 115200 is the upper limitation of virtual com port? If not, how can i set a higher one?

19 REPLIES 19
AScha.3
Chief II

virtual com port is by USB connection and runs at about 10Mbit.  baud rate setting is just a number, that has to be valid.

and what about usart2 ? not USB obviously - so what you doing ??

If you feel a post has answered your question, please click "Accept as Solution".

Actually, i just start​ learning stm32, so i am sorry i did not explain it clearly.

I would like to transmit data from PC to stm32 and also from stm32 to PC. For the connection of PC and stm32, it is established with a usb to mini-usb cable. Affter installing the driver, there is a virtual com port in my PC, and i can send data to stm32 through the virtual com port.

And the stm32 runs a program that receives data from and transmit data to the usart2. That is to say, when PC sends data to virtual com port, stm32 receives data from usart2; and when stm32 sends data to usart2, PC receives data from virtual com port.

And the problem is that, 115200 is too slow for data transmission, but when i set it higher, the data will go wrong.

Let me guess... you're only changing the baud rate on the PC side?

If yes, that won't work, the STM32 must be set accordingly.

I'm afraid not. Actually i set both baud rates of PC and stm32. And i've also set the baud rate lower than 115200 such as 9600 and 57600, and they all worked well.

By the way, i've found that there are people who with similar problems. The links are below.

NUCLEO-L152RE - Sending data at 115200 baud on USART2 kills ST-LINK VCP

Virtual Serial port for STLink V2

ok, now i understand.

i made some speed tests on F103 , USB-> VCP and it was faster than expected;

about 10Mbit (close to the 12Mb USB "full" speed , no hub, nothing else on usb bus) , PC with XPsp2 that time, 10y ago;

just some problem was the setting of the buffers, also on XP .

so 115k is for shure not the limit, but i dont remember, what we did/adjust , to get the full speed. (at first it didnt work -- as usual. 🙂 )

i remember, first setup was , receive data with max. speed and just throw away the received data blocks (to see, what is possible, without any delays from buffering, scanning , send to uart ... )

so try this first, to find out max. speed.

If you feel a post has answered your question, please click "Accept as Solution".
gbm
Lead III

ST-Link VCOM works at least to 921600 b/s (surprise). Nucleo-L476 (and a bunch of few other Nucleos, mostly with STM32L MCUs) have a quirk - there is no 8 MHz clock feed from ST-Link to the MCU. To get the correct and stable baud rate you need to use PLL fed by MSI (NOT HSI16, which sems to be the current default in CubeMX), and enable the LSE oscilator. Then the CubeMX will automagically synchronize MSI to LSE. If you don't do that, remember that HAL removes the factory callibration of internal oscillators, so your clock frequency may not be too close to the nominal one.

yep, thats "the about 10Mbit" , we had in our tests also.

If you feel a post has answered your question, please click "Accept as Solution".

0693W00000WJK9dQAH.pngI guess that to use PLL fed by MSI is to use the settings shown in the figure. But still failed, did i do something wrong?

Well, thank you for testing. But i dont understand what i need to do. What does "receive data with max. speed and just throw away the received data blocks" means?😂