1.32.27 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. In active mode, the voltage regulators can be selected on the fly between LDO (low-dropout) type regulator or Buck converter.

The SUPC supports connection of a battery backup to the VBAT power pin. It includes functionality that enables automatic power switching between main power and battery backup power. This ensures power to the backup domain when the main battery or power source is unavailable.

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.

The SUPC generates also a selectable reference voltage and a voltage dependent on the temperature which can be used by analog modules like the ADC.

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.

  • Modify the main voltage regulation selection.

  • Select temperature sensor channel to be used by the ADC 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_BOD33CallbackRegister(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_SelectVoltageRegulator Selects the main voltage regulator
SUPC_SelectTempSenorChannel Selects a specific channel of the temperature sensor
SUPC_SetOutputPin Sets a specific output pin (OUTx) to logic HIGH
SUPC_ClearOutputPin Clears a specific output pin (OUTx) to logic LOW
SUPC_BOD33CallbackRegister 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_TSSEL Enum Identifies the temperature sensor channels of SUPC peripheral
SUPC_VREGSEL Enum Identifies the Main Voltage Regulators
SUPC_BOD33_CALLBACK Typedef Defines the data type and function signature for the SUPC peripheral callback function