2025-09-17 4:34 PM
I used STM32CubeMX to configure an STM32F401RETx USART6 for 115200 baud. I searched but could not find an example to start from. I enabled USART to register USART callbacks using the STM32MXCube Project Manager Advanced Settings. My project utilizes FreeRTOS, so I added that and created a simple default task to receive a character and output a message each time a character is received.
I used an FTDI TTL-232-RG-VIP-WE cable connected to GND, 3V3, PC6, and PC7, and to a Windows PC set for 115200/8/N/1.
At run time, I set a breakpoint where the character should appear in my receive buffer, and observed that I was getting garbage in. Also, I saw I was getting garbage out. I stepped the initialization, configuration, interrupts, and callbacks — all appeared to be working correctly.
In desperation, I experimented with the baud rate and found that I could send and receive good characters with the PC set to 38400 baud while the STM32F401 remained configured for 115200.
What is going on here? The project is attached.
2025-09-17 4:43 PM
Something in your calculations is out by a factor of 3
2025-09-17 4:57 PM
I don't think so. I made no calculations. The configuration was done entirely by STM32CubeMX. I walked through the code and the block rate being read correctly and the baudrate value was correct, as well. That leaves the math done by the macros that figure out the BRR setting, but does not seem possible.
2025-09-17 5:46 PM
You have HSE set to 24 MHz. Are you sure it isn't 8 MHz? What hardware is this?