cancel
Showing results for 
Search instead for 
Did you mean: 

How to STOP USART during hitting breakpoint in debug on STM32G071

MPolá.1
Associate

I have 3 USARTs working on my STM32G071 nucleo board. One is for communication with PC and transfering settings registers. Second one comunicate with GPS. And third one just resend everything received from GPS module, it enables me see in PC, what GPS sending to MCU. When I need to debug code, I put breakpoint into place, where I have to examine code and when MCU hits breakpoint, it stops. But GPS still transmitting data and controller (should be paused on breakpoint) still retransmitting data to USART3. This is not behavior, which I need. I need to stop everything in controller, when code hist breakpoint. Is it possible to do that? I use LL libraries.

2 REPLIES 2

> I need to stop everything in controller, when code hist breakpoint. Is it possible to do that?

No.

Certain peripherals can be stopped - mainly timers - see DBG_APB_FZ1 and DBG_APB_FZ2 register; but not UART.

Also, debuggers should allow to disable interrupts - details how to do that, is dependent on the toolchain you are using, there should be a tickbox or something similar in the IDE for this.

However, while USART as such can't be disabled, the mcu should not *retransmit* while being stopped in breakpoint - how does it do that, using DMA?

JW

Hi

-> Also, debuggers should allow to disable interrupts - details how to do that, is dependent on the toolchain you are using, there should be a tickbox or something similar in the IDE for this.

I use SW4STM32 and as devolp board STM32G071 NUCLE board (NUCLEO-G071RB). If you know, where I can disable interrupts, it would be nice. But If you do not, I will check internet 🙂

-> However, while USART as such can't be disabled, the mcu should not *retransmit* while being stopped in breakpoint - how does it do that, using DMA?

No, it is for me absolutely strange behavior. Because in interrupt I only push one char into my buffer and in main() loop I work with that buffer and clone chars from GPS RX one to DEBUG TX one. So I think, that SW4STM32 shows me, that processor is stopped on breakpoint, but processor still running somehow. But when I disconnect all UARTs, it looks like it work just fine. I have problem with this behavior, because

  1. I cant debug step-by-step. When I push F5, nothing happened and it looks like processor is running???
  2. When code hits breakpoint and SW4STM32 shows me variables, they are sometimes wrong. I had in code samothing like this
msg[] = {´t´, ´e´, ´s´, ´t´}
volatile uint8_t msg_size = sizeof(msg);
volatile uint8_t msg_char_size = sizeof(msg[0]);
volatile uint8_t msg_legth = sizeof(msg)/sizeof(msg[0]);
  1. And put my breakpoint after this part of code and in debug view I saw absolutly random numbers in variables, but in instructions it was right.