cancel
Showing results for 
Search instead for 
Did you mean: 

Crazy UART

davhak
Associate II
Posted on November 21, 2015 at 23:23

Dear All,

I use STM32F415VGTx to establish connection with another node using UART4 (PA0 and PA1 pins) (8bit, 1 stop bit, no parity) using baudrate 10400 (also tried 9600). I have configured USARTs of the same MCU with other nodes without problems. The problem with UART4 is that I can receive bytes from other node correctly but when try to send from STM32F415 a certain byte it seems that it is sent correctly or not depending on the value of the byte.

Tracking with oscilloscope/logic analyzer shows that for example sending byte 0x0F works (I can see start bit (low level), then high level for 4 0-bits and again low level for 4 1-bits + stop bit). However sending 0xFF shows on the PA0 (UART.TX pin) as if would sent 0x00 (only start bit is seen then a a continuous high level signal). I have tracked the disassembly code till writing the UART->DR register with the intended byte and saw that DR is written the right byte.

I tried to change the device with another similar one but the problem remains.

Although it seems a crazy question but is that possible that STM32F415 UART4 (PA0/PA1 pins) has some wrong logic implemented?

Thanks a lot for any hint.
2 REPLIES 2
Posted on November 22, 2015 at 00:22

Data on a USART is sent LSB first

ie

0x0F -> 00001111 on the wire as 11110000

0x01 -> 00000001 -> 1000000

0xFF -> 11111111 -> 11111111

The RS232 drivers will invert the data, but that's another matter.

..has some wrong logic implemented?

No

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
davhak
Associate II
Posted on November 22, 2015 at 10:15

Thank you so much!

Very good to know that it's crazy me and not UART.