mostly garbage serial UART output from STM32F091RC on target board

31 Oct 2016

Expected first printf line of software to serial output to Windows7 PC is: main() ****** SW START Project 2016-10-30 x1

Actual serial output (at TeraTerm or PuTTY); ▒▒▒▒()` jj*jj*jj*jj*jj*j ▒▒`Ӕ▒Ҕ ▒▒▒▒▒▒▒ ` r01v-q0-30`▒q

Serial worked great with NUCLEO evaluation board. ie. Serial pc(USBTX, USBRX); Now, I'm running the actual target board with a STM32F091RC. ie. Serial pc(SERIAL_TX, SERIAL_RX); At 9600, some chars are correct, most are garbage. I've tried alternate target and cables, same problem. PC's Terminal program (TeraTerm or PuTTY) set at 8,n,1. Looked in mbed library; default config is 8 data, no parity, 1 stop.

USB/serial converter cable is: FTDIChip TTL-232R-RPi (normally for Raspberry Pi).

01 Nov 2016

Is the CPU clock the same on the target board as on the eval board?

The mbed libraries set the clock dividers based on the clock rate for the selected target board, if the final hardware has a different clock rate then all of the timing will be off. It doesn't take much of a timing error to throw RS232 off.

15 Nov 2016

Hi,

I dont know why, but my 411 board has a problem like this..

Firstly, please restart TerraTerm, at higher speeds, it often falls into another ascii chart, very annoying

Also, the 411 usart timebase/baudrate doesnt calculate properly. the bits were only 1.3uSec wide when they should be 8.6uS wide..

I had to:

    int baudRatio = 1.5/8.680 * 115200;
    baud(baudRatio);
15 Nov 2016

When I look at it now, it is obvious the baud rate timers are set up x6 rate..

so on my 411 problem

baud (115200 /6);   //this works