I'm trying to debug my NEO7M GPS-tracker with STM32H7. NEO chip has UART interface so I set up UART and start coding (Keil v5). It's clear but not for me.

What's going on here:

NEO7M is transmitting data periodically so it looks like DATA----IDLE----DATA----IDLE. All I need is to receive the whole information and send it to some parsing functions.

In main.c I have this:

ReadTime(RecievedData, Time);

And these functions look like this:

void ReadGPS(char *RecievedData){
    HAL_UARTEx_ReceiveToIdle_IT(&huart1, (uint8_t*)RecievedData, GPS_DATA_SIZE);

void ReadTime(char *RecievedData, uint8_t *Time){
    ***parsing algorithm***

So I'm pulling RecievedData pointer to ReadGPS function, reading payload and then using RecievedData in parsing function. Great!

My problem:

If I start a debug session without any breakpoints, in Watch Window data in RecievedData variable changes and parsers work great. BUT when I start using breakpoints, only first symbol of RecievedData is changing, and another 400 symbols are the same as before, and parsers give me wrong information. I tried to use UART receiving function without interrupt, but got the same.


This is how it looks like when code running without breakpoints. I see whole UART data packet updating every second.

When I use step by step mode only the first symbol of recieved data is updating.


2 Answers 2


The problem could be if you debug, the GPS doesn't stop sending data and the buffers fill up. This means you need to have some kind of code to clear the receive buffer or handle the case of receiving two or more packets or half a packet. The way to know is check the receive buffer while debugging and compare the received packet with a normal packet.

  • \$\begingroup\$ Thank you but I cant understand why only the first character is changing. GPS doesn't stop sending data, it's true. I can start recieving in the middle of data while debugging, but in this case I would get new buffer starting in the middle of data, not just first character. \$\endgroup\$ Dec 9, 2021 at 16:21
  • \$\begingroup\$ Update your question with the all of the buffer information. \$\endgroup\$
    – Voltage Spike
    Dec 9, 2021 at 16:31

Do I understand correctly that (A) the GPS just continually spews data packets, and (B) you have code that successfully receives the packets, and (C) you are trying to debug higher-level code that does something with the packets that have been received?

If all those things are true, then I would write a program to capture a whole sequence of packets to a file, and then I would debug and/or test the higher-level code on my development PC while it reads the saved packets from a file.

  • \$\begingroup\$ Now way. I'm working on system that must process the data in real-time by itself. \$\endgroup\$ Dec 9, 2021 at 16:25
  • \$\begingroup\$ @dimanchique, I don't understand. Does "now way" mean that at least one of my (A), (B), or (C) above is not true? Or does it mean something else? When I'm developing a real-time, embedded application, I strive to ensure that most of the code can be tested and debugged independently of "time" and, independently of the target platform. What can't be tested in a time-independent way often can be tested with "simulated" real-time. \$\endgroup\$ Dec 9, 2021 at 16:37
  • \$\begingroup\$ FYI: The kind of thing I'm talking about... I'll sometimes have two projects that build from the same source code; One project builds the image for the embedded system, and the other project builds a PC application in which I can test and debug most of the code. If the application needs to talk to external devices (e.g., your GPS unit,) then I'll build simulators into the PC app that mimic the device in repeatable (often, scriptable) ways. If the application depends on real-time, then the PC version will get "timestamps" from a simulated source that the tests can control, etc. \$\endgroup\$ Dec 9, 2021 at 16:55
  • \$\begingroup\$ @dimanchique the phrase is no way \$\endgroup\$
    – jsotola
    Dec 9, 2021 at 17:42
  • \$\begingroup\$ @SolomonSlow sorry, I didn't understand you :) A, B and C is true but problem is how to recieve data correctly not how to work with this data. That's what I mean \$\endgroup\$ Dec 9, 2021 at 18:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.