I tried to enable the VDD monitor within the SMBus ISR to enable flash write/erase routines. However, the flash write/erase routines failed. What is wrong?
EFM8LB1 has SFRPAGE support, and the VDD monitor register is only accessible when SRFPAGE equals 0x00.
When the device enters the SMBus ISR, the SRFPAGE register automatically switches to 0x20 to enable quick access to the SMBus registers. This means that without updating the SFRPAGE register manually, firmware will not be able to access the VDD monitor within the SMBus ISR. To enable the VDD monitor within the SMBus ISR, add the following code:
vddMonInitSFRPAGE = SFRPAGE; SFRPAGE = 0x00; VDM0CN = 0x80; // Enable VDD monitor RSTsrc=0x02; // Enable VDD monitor as a reset source SFRPAGE = vddMonInitSFRPAGE;