cancel
Showing results for 
Search instead for 
Did you mean: 

is it possible to watch the "write-only" bits in the debug mode?

JSmit.19
Associate III

I am using an STM32L4 MCU and IAR Embedded Workbench. I noted that when I start a debug session in the register window the "write-only" bits of a certain register are field with the letter "w" (for example in GPIOx_BSRR). I was wondering if this is the behavior just in the IAR debugger or it happens for other debuggers as well and is there a way to watch these bits in particular when they are written or not.

19 REPLIES 19

No, they read as 0.

JW

No what?! The debugger cannot read it because it returns 0 you mean? Or it can be read but it leads to 0? Does it depend on the debugger?

Uwe Bonnes
Principal III

It depends on the exact bit definition as (hopefully) explained in the reference manual. And no, you will not get the state of that bit with any debugger.

Thanks, the second part addressed my question. "you will not get the state of that bit with any debugger"

I was kinda hoping that when they are "written" the debugger shows a change of state or something like that.

Uwe Bonnes
Principal III

You can set a watchpoint on that register address to see when and what is written.

That's the point, how? the register window should watch that register itself but it does not show anything when those bits are written, I could try another way to watch them in the debugger but the result should be the same.

Uwe Bonnes
Principal III

Your debugger should be able to set watchpoints, read the docs. In gdb I type e.g. "watch -l <expression>" . On running gdb at the moment I am not sure if e.g. is "GPIOA_>BSRR" or "&GPIOA_>BSRR"

JSmit.19
Associate III

What I meant was the debugger IS indeed watching them, they are different ways to watch though, when I open a register window for GPIOA for example all the registers are shown in that window, I could also set a watchpoint just for a certain register of the GPIOA, that should not change anything, I'll try though.

My point was looking at the register window (again in which the registers should be watched) when I write in a "write-only" bit the debugger does not show any change of state.

JSmit.19
Associate III

@Uwe Bonnes​ I tried different ways to watch the BSRR register for all of them the value was "unavailable".

Have you ever watched BSRR or any other  "write-only" bit? What do you see/expect in watch?