cancel
Showing results for 
Search instead for 
Did you mean: 

Couldn't able to freeze IWDG in stop 2 mode

SPare.9
Associate II

Hi,

Greetings,

I would like to freeze the IWDG in stop 2 mode.

Code is available here:

// Read bit and regitster   

                        LOG_Print("Flash->OPTR Value(Before):%#x\n",READ_BIT(FLASH->OPTR, FLASH_OPTR_IWDG_STOP));

                        value = READ_REG(FLASH->OPTR);

                        LOG_Print("Read value of reg is:%#x",value);

                        osDelay(5000);

         //claer the FLASH_OPTR_IWDG_STOP bit to freez the IWDG Counter:   

                        value &= ~(FLASH_OPTR_IWDG_STOP);

                        LOG_Print("Updated value of reg is:%#x",value);

                        FLASH_If_WriteProtectionClear();

                        osDelay(5000);

                        WRITE_REG(FLASH->OPTR,value);

                        osDelay(5000);

         // Rechecking the written value & Bit

                        LOG_Print("Flash->OPTR Value(After):%#x\n",READ_BIT(FLASH->OPTR, FLASH_OPTR_IWDG_STOP));

                        value = READ_REG(FLASH->OPTR);

                        LOG_Print("Read value of reg is:%#x",value);

                        osDelay(5000);

                       HAL_PWREx_EnterSTOP2Mode(PWR_STOPENTRY_WFI);

Below is the Output:

Flash->OPTR Value(Before):0x20000

Read value of reg is:0xffeff8aa

Updated value of reg is:0xffedf8aa

Flash->OPTR Value(After):0

Read value of reg is:0xffedf8aa

As per the manual, if the bit is zero counter does freeze, but I see my MCU is restarring as the counter watchdog counter goes off.

0 REPLIES 0