3.35.14 Supply Controller (SUPC)

The Supply Controller (SUPC) controls the supply voltages of the system. The SUPC also generates the slow

clock by selecting either the low-power RC oscillator or the low-power crystal oscillator.

Using The Library

SUPC Peripheral library provides API's and they can be used to perform below functionalities.

  • To put the device either in Sleep, Backup or Wait mode.

  • To read and write the General Purpose Backup Register (GPBR).

  • Generate supply monitor callback to save critical data to prepare the system for a power down. Supply monitor can generate interrupt or Reset the device when supply voltage crosses below the specified threshold level.

The examples shows the code to enter sleep, backup and wait mode.

while(1)
{
    switch(cmd)
    {
        case SLEEP_MODE:
        {
            SUPC_SleepModeEnter();
            break;
        }
        case WAIT_MODE:
        {
            SUPC_WaitModeEnter(PMC_FSMR_FLPM_FLASH_DEEP_POWERDOWN, WAITMODE_WKUP_WKUP7);
            break;
        }
        case BACKUP_MODE:
        {
            SUPC_BackupModeEnter();
            break;
        }
    }
}

Library Interface

Supply Controller peripheral library provides the following interfaces:

Functions

NameDescription
SUPC_InitializeInitializes SUPC x module of the device
SUPC_SleepModeEnterPuts the device into Sleep mode
SUPC_WaitModeEnterPuts the device into Wait mode
SUPC_BackupModeEnterPuts the device into Backup mode
SUPC_GPBRReadReads the data from General Purpose Backup Register(GPBR)
SUPC_GPBRWriteWrites data to the General Purpose Backup Register(GPBR)
SUPC_CallbackRegisterAllows application to register callback with PLIB

Data types and constants

NameTypeDescription
WAITMODE_WKUP_SOURCEEnumIdentifies the wakeup input source
WAITMODE_FLASH_STATEEnumIdentifies Flash Low-power mode
SUPC_CALLBACKTypedefPointer to a SUPC callback function