cancel
Showing results for 
Search instead for 
Did you mean: 

USART comm between 2 boards with debug break points

dibs
Associate II
Posted on October 12, 2013 at 18:16

I am using two STM32F407x boards.

board 1 sends a data packet continuously

board 2 parses data continuously

In order to see if the data is being parsed correctly, I am adding break points in the code. The problem is that this seems to be making the USART act erratically. It will seem to fail to hit break points or sometimes receive the wrong data.

I am fairly certain that I have both set up in the same manner. Any ideas as to what is causing this behavior?
5 REPLIES 5
Posted on October 12, 2013 at 19:09

Do you have the debugger displaying USART registers? This is likely interfere with them.

Do you dwell in an interrupt or while() loop excessively? This will likely cause under/over flow conditions.

Does the USART handling code recognize and deal with Error status returns, and clearing them? Are you seeing any Error status?

Have you tried modelling your parsing routines on a PC?

Have you considered using GPIO or LED indicators to indicate internal state rather than stopping the processor dead in a debugger?
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
dibs
Associate II
Posted on October 14, 2013 at 03:50

Let me back up and ask a more fundamental question. When I stop the processor with a break point in a debugger, will any of the peripherals still function?

I seem to remember reading somewhere that you have the option of having timers continue to count while stopped at a breakpoint. This may just be wrong or it may be debugger dependent.

Posted on October 14, 2013 at 14:42

It depends, and probably won't help if the serial data is coming in at 9600 baud (~960 chars/sec) and you're stuck at a debugger prompt. The USART peripheral can only hold one byte while receiving a second.

Having the debugger stop a TIM during the breakpoint also probably doesn't help if you were driving a motor with a lot of inertia/momentum. I think the option is to stop timer and watchdogs, normally they'd keep going, but interrupts etc would not get serviced.
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
dibs
Associate II
Posted on October 24, 2013 at 02:21

I understand that while i am stuck in a breakpoint, the USART will still be receiving data. I am interested in being able to recover from such a state. Resuming from a break condition should cause errors that I need to be dealing with anyways.

For instance, this should almost always cause an overrun error. What would be the recovery procedure there? I have been trying various things, but they don't seem to be working.

Posted on October 24, 2013 at 04:55

Typically errors are clear by reading the USARTx->DR

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