cancel
Showing results for 
Search instead for 
Did you mean: 

Is it possible to view registers of a running target inside STM32Cube?

GHrib.1
Associate III

I would like to view/modify values of registers while in debugging perspective, while the target is in running state. So far I have discovered that you can view registers only during pause(resume) of program in the SFRs window. Is it possible to have some type of continous refresh of registers values?

15 REPLIES 15

In your code create u16 variable and insert SFR for monitor to it in some refresh code place. For example systick int .

_IO uint16_t mon_odr;
 
mon_odr= GPIOx->ODR;

I'm using other tools..

With peripherals you need to be careful as they are not "memory cells", but are windows into complex state machines and combinatorial logic. GPIO ODR/IDR are relatively innocuous, but can be acted upon via other methods, ie BSRR, or not reflective of the state, ie ODR != IDR

The real hazards are with data registers for say USART, SPI, etc and FIFOs where "looking" at them changes, or advances, some secondary state. Also be wary of RMW action on things like TIM->SR, there's a specific write method without the race condition, and 8+ cycle window of uncertainty.

Generally best to read something into a temporary variable in the normal course of interaction, and view that.

Obviously lots of approaches, just be wary that ARM debugging tends to be more invasive, ie done through the front door, not peering in the windows.

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

There is no GPIOA_ODR symbol defined in code. Most likely you have to enter GPIOA->ODR .

Again an ST's employee not even understanding the question...

Jot.eS
Associate

You must use the memory address of the register.

E.g. if the address of GPIO_ODR is 0x40020014, then you have to write *0x40020014 in the live expression window. Please note the asterisk in front of the address.

Thank you, I got some response, but it isn't best for readability. Live expression view presumes that this pointer is pointing to an integer, which is correct (register is 32-bit). If you want to see the values of register bit by bit, you have to convert int to binary. My question is if i can somehow tell the Live expression that i would like to see only one bit?