XMC1000 TIP of the day: Monitor the supply voltage

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Not applicable
XMC1000 devices provides a detector called External voltage detector (VDEL) to detect the voltage level.
VDEL detector compares the supply voltage against a pre-warning threshold voltage and if pre-warning interrupt (VDDPI) is enabled, it will be triggered if a level below this threshold is detected.
The threshold level is programmable via register ANAVDEL.VDEL_SELECT and VDDPI interrupt can be enabled via register SRMSK.VDDPI.
The VDDPI interrupt will be triggered via SCU.SR1 interrupt node.

Below the example code to setup the pre-warning interrupt (VDDPI) in DAVE3 IDE:

// Change VDEL setting
SCU_GENERAL->PASSWD = 0x000000C0UL;
SCU_ANALOG->ANAVDEL |= (0x01 << SCU_ANALOG_ANAVDEL_VDEL_SELECT_Pos & SCU_ANALOG_ANAVDEL_VDEL_SELECT_Msk) | (SCU_ANALOG_ANAVDEL_VDEL_EN_Msk);
SCU_GENERAL->PASSWD = 0x000000C3UL;

// Enable VDDP pre-warning interrupt
SCU_INTERRUPT->SRMSK |= SCU_INTERRUPT_SRMSK_VDDPI_Msk;

// Enable NVIC node for SCU.SR1
NVIC_EnableIRQ(SCU_1_IRQn);
0 Likes
0 Replies