cancel
Showing results for 
Search instead for 
Did you mean: 

UART Framing errors when not running on ST-Link

chrisk
Associate

I'm using UART4 on an STM32H743x processor to talk to an external device.

The program works great when running on the debugger ST-Link).

When I program the part, remove the ST-Link and power-cycle the board, I get a framing error on every byte received at the UART. I know this because I blip a scope output GPIO when a framing error is detected by the receive ISR.

I will give my firstborn to anyone who could shed any light on this problem.

3 REPLIES 3
TDK
Guru

Do your baud rates match? Data bits match? Stop bits match? Parity matches?

Based on your description sounds like a parity bit is missing or wrong.

It's gotta be one of those. Use a scope, figure it out. Be aware the internal HSI is not super accurate, although on the STM32H7 it's probably good enough.

If you feel a post has answered your question, please click "Accept as Solution".
chrisk
Associate

The code works perfectly when the ST-Link is running it. The same exact code gets a framing error on every received byte, when the code is running off the ST-Link.

The parameters aren't changing, and they are correct, 115200, 8, n, 1.

And the received data line signal looks identical on the scope with the ST-Link attached or removed, so what's going into the receive pin of the processor isn't changing.

TDK
Guru

Could be a lot of noise on the line that gets exasperated by ST-Link being disconnected. Do you have an analog signal trace? Does it work at lower baud rates?

The manual is very specific on what triggers a framing error. It's super likely that's what triggering the framing error bit. Are you clearing the bit in the ISR to ensure you're actually re-triggering it on every byte?

Gotta be an error somewhere. You haven't given a lot of info except it works with ST-Link disconnected and doesn't work with it connected. You may have better debugging luck ignoring the ST-Link aspect of the problem.

If you feel a post has answered your question, please click "Accept as Solution".