Skip to main content
Visitor II
December 31, 2024
Question

STM32G050 Debug with IWDG enabled

  • December 31, 2024
  • 1 reply
  • 1285 views

I enabled IWDG on my STM32G050C8T6 and it works correctly but I also want to be able to debug the MCU with IWDG enabled. According to the MCU family's reference manual I should set  bit 12 (DBG_IWDG_STOP) of DBG APB freeze register 1 (DBG_APB_FZ1) to disable IWDG clock counter when the core is halted.

The DBG APB freeze register 1 can be written by debugger under system reset.

BlazejK_0-1735630035425.png

But I do not know how to write to this register. I tried to change it using STM32CubeProgrammer but it does not work.

BlazejK_1-1735630179780.png

I also tried to do this using st-link utility and gdb but the DBG_APB_FZ1 is still 0.

BlazejK_2-1735630247355.png

How to set this register so I can debug my device with IWDG enabled?

 

 

    This topic has been closed for replies.

    1 reply

    ST Employee
    December 31, 2024

    Hello @BlazejK

    You can do this either with STM32Cubeprogrammer, through the OB tab, look for the DBG_APB_FZ1 register and set bit 12 (DBG_IWDG_STOP), apply the changes and reset the device.

    Or, you can do that by SW, by writing a mask to the DBGMCU register: 

    DBGMCU->APB1FZ1 |= (1 << 12); 
    BlazejKAuthor
    Visitor II
    December 31, 2024

    Hello @Sarra.S 

    Thank you for replying.

    Unfortunately there is no DBG_APB_FZ1 register in OB tab.

    BlazejK_0-1735634071142.png

    And trying to set this bit in software was the first thing I tried to do since I have already used this option in other STM32 device family (and it was working there) but with the current MCU when I set the appropriate bit and then read the register the register is 0 (debug variable equals 0).

     SET_BIT( DBG->APBFZ1, DBG_APB_FZ1_DBG_IWDG_STOP );
     uint32_t debug = DBG->APBFZ1;