1.9.21 Supply Controller (SUPC)
The Supply Controller (SUPC) manages the voltage reference, power supply and supply monitoring of the device. It is also able to control two output pins.
The SUPC controls the voltage regulators for the core (VDDCORE) and backup (VDDBU) domains. It sets the voltage regulators according to the sleep modes, or the user configuration.
The SUPC embeds two Brown-Out Detectors. BOD33 monitors the voltage applied to the device (VDD or VBAT) and BOD12 monitors the internal voltage to the core (VDDCORE). The BOD33 can monitor the supply voltage continuously (continuous mode) or periodically (sampling mode), in normal or low power mode.
Using The Library
The Brown-Out Detector (BOD33) when enabled, monitors the VDD supply and compares the voltage with the brown-out threshold level. When VDD crosses the brown-out threshold level, the BOD33 can perform one of the following actions,
-
Generate a reset
-
Generates an interrupt
-
Puts the device in battery backup sleep mode
The triggering voltage threshold for the BOD33 and the action can be configured via fuse bits in the NVM User Row. These bits can also be written after disabling BOD33. Brown out interrupt enables user to save critical data to prepare the system for a power-down.
SUPC Peripheral library provides non-Blocking API's and they can be used to perform below functionalities. Settings configured via MHC are written into SUPC registers when initialization function is called.
-
Initialize BOD33, VREF and VREG of the SUPC peripheral.
-
Set or clear OUTx pins of the SUPC peripheral.
Callback method
This example demonstrates how to get callback on brown-out detection to save critical work.
MY_APP_OBJ myAppObj; void BOD_EventHandler(uintptr_t context) { // The context was set to an application specific object. // It is now retrievable easily in the event handler. MY_APP_OBJ myAppObj = (MY_APP_OBJ *) context; // Brown-out interrupt occurred. Save critical data. } int main(void) { /* Register callback function */ SUPC_CallbackRegister(BOD_EventHandler, (uintptr_t)&myAppObj); while(true) { } }
Library Interface
Supply Controller peripheral library provides the following interfaces:
Functions
Name | Description |
---|---|
SUPC_Initialize | Initializes the SUPC peripheral |
SUPC_SetOutputPin | Sets a specific output pin (OUTx) to logic HIGH |
SUPC_ClearOutputPin | Clears a specific output pin (OUTx) to logic LOW |
SUPC_CallbackRegister | Registers the function to be called when a Brown Out Event has occurred |
Data types and constants
Name | Type | Description |
---|---|---|
SUPC_OUTPIN | Enum | Identifies the output pins of SUPC peripheral |
SUPC_CALLBACK | Typedef | Defines the data type and function signature for the SUPC peripheral callback function |