cancel
Showing results for 
Search instead for 
Did you mean: 

During my USART initialization, I see that the board always sends an 0xff in the serial port. This happens when I'm initializing the port. I cannot find the issue for the life of me. Do you know what could be going wrong?

SSudh.12
Associate

I am not using CUBEand I am setting the registers myself.

2 REPLIES 2

Look at the pin using oscilloscope or logic analyzer. The problem will probably be the sequence of how you initialize the pin - first, it goes high, maybe due to expternal pullup or receiver pullung it up, then probably setting it to AF in GPIO while UART is still off or uninitialized it goes low for a while, until UART gets initialized and it goes high again.

I made this up as I don't know what exactly is your sequence, but the point is that there is some high-to-low-and-back-to-high sequence on the pin, with long enough low pulse, making the receiving end see it as a startbit.

Single-stepping through the initialization code while observing the pin should reveal you the source of that negative pulse.

JW

turboscrew
Senior III

When you get it fixed, you probably get 0x00. :D

That's how the U(S)ART works.

You can avoid it by enabling the pin after the 0x00 sending is done.