cancel
Showing results for 
Search instead for 
Did you mean: 

stm32f722ZE Nucleo UART sample code problem

David Pekin
Senior
Posted on January 10, 2018 at 21:56

Hello, 

I've just built the UART sample code for the 722ze Nucleo board and have a problem. I have not modified the code (except for the transmitted character buffer).  The sample code shows setting up the unit for a 9600 N81 format.  The character buffer that is transmitted is 153 characters long.  When I transmit from the Nucleo I receive the correct number of characters on the RealTerm serial capture program but it's gibberish.  None of the ASCII characters are discernable and I can't make heads or tails of how the bits might be shifted...  For example, I am sending '12345' which in hex is 0x31 0x32 0x33 0x34 0x35  and I receive 0xEB 0x9B 0x99 0x97 0x95.  

Has anyone seen anything like this? 

14 REPLIES 14
Posted on January 10, 2018 at 22:33

Over the VCP, or RS232?

RS232 is at different levels and inverted wrt CMOS levels from STM32 USART

Make sure PLL and HSE_VALUE reflect the 8 MHz clock, not 25 MHz

If in doubt output 'U' (0x55) in a stream, and scope the signals.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
T J
Lead
Posted on January 10, 2018 at 22:37

maybe you have a grounding problem, did you check the baud rate on the scope ?

same number of chars ? maybe you are not reading the correct buffer ?

T J
Lead
Posted on January 11, 2018 at 01:14

You wont be getting inverted data because the start bit is randomly being set within the data bit stream, lucky to receive the correct number of bytes.

but I think that inside the STM processor, some parts will be evaporating as we speak..

best not to connect it directly like that.

did you try to invert the data input pin ? it is a function of this usart. not sure how to use it, but your data will look right for a minute or two.

The processor will not last long, or maybe only the serial receive port will become disconnected internally.

Posted on January 11, 2018 at 00:37

Ahh...  That might be the issue. I've attached the RS232 serial TX & RX directly to the PC6 and PC7 I think.  So I need a serial driver chip between PC6&7 I assume?

Posted on January 11, 2018 at 00:38

 ,

 ,

Thanks. , I'm getting the correct ♯ of characters. ,  ,I think I need a serial driver chip between the GPIO pins and the RS232 pins I guess.

Posted on January 11, 2018 at 00:58

MAX3232 type chip, lots of translation boards on eBay, if you need to get to RS232 levels

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
ranran
Senior II

Hi,

I have the same issue.

Is there a way to do this "voltage conversion" in software using UART hal driver?

Thanks

It is an electronics/signals issue, it can't be fudged in software.

RS232 signal levels have clearly defined expectations, the STM32 pin interface doesn't meet those.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
ranran
Senior II

I understand.

We nee to have serial console.

It means that there is no option for a serial console using nucleo board, unless we use a signal converted chip . Thanks,