Skip to main content
SSudh.12
Visitor II
May 30, 2019
Question

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?

  • May 30, 2019
  • 2 replies
  • 808 views

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

This topic has been closed for replies.

2 replies

waclawek.jan
Super User
May 30, 2019

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
May 31, 2019

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.