Power Control Manager responsible for controlling the different power states of the device. More...
Macros | |
#define | PCM_KEY 0x695A0000 |
#define | PCM_AM_LDO_VCORE0 0x00 |
#define | PCM_AM_LDO_VCORE1 0x01 |
#define | PCM_AM_DCDC_VCORE0 0x04 |
#define | PCM_AM_DCDC_VCORE1 0x05 |
#define | PCM_AM_LF_VCORE0 0x08 |
#define | PCM_AM_LF_VCORE1 0x09 |
#define | PCM_LPM0_LDO_VCORE0 0x10 |
#define | PCM_LPM0_LDO_VCORE1 0x11 |
#define | PCM_LPM0_DCDC_VCORE0 0x14 |
#define | PCM_LPM0_DCDC_VCORE1 0x15 |
#define | PCM_LPM0_LF_VCORE0 0x18 |
#define | PCM_LPM0_LF_VCORE1 0x19 |
#define | PCM_LPM3 0x20 |
#define | PCM_LPM4 0x21 |
#define | PCM_LPM35_VCORE0 0xC0 |
#define | PCM_LPM45 0xA0 |
#define | PCM_VCORE0 0x00 |
#define | PCM_VCORE1 0x01 |
#define | PCM_VCORELPM3 0x02 |
#define | PCM_LDO_MODE 0x00 |
#define | PCM_DCDC_MODE 0x01 |
#define | PCM_LF_MODE 0x02 |
#define | PCM_SHUTDOWN_PARTIAL PCM_LPM35_VCORE0 |
#define | PCM_SHUTDOWN_COMPLETE PCM_LPM45 |
#define | PCM_DCDCERROR PCM_IE_DCDC_ERROR_IE |
#define | PCM_AM_INVALIDTRANSITION PCM_IE_AM_INVALID_TR_IE |
#define | PCM_SM_INVALIDCLOCK PCM_IE_LPM_INVALID_CLK_IE |
#define | PCM_SM_INVALIDTRANSITION PCM_IE_LPM_INVALID_TR_IE |
Functions | |
bool | PCM_setCoreVoltageLevel (uint_fast8_t voltageLevel) |
uint8_t | PCM_getCoreVoltageLevel (void) |
bool | PCM_setCoreVoltageLevelWithTimeout (uint_fast8_t voltageLevel, uint32_t timeOut) |
bool | PCM_setCoreVoltageLevelNonBlocking (uint_fast8_t voltageLevel) |
bool | PCM_setPowerMode (uint_fast8_t powerMode) |
bool | PCM_setPowerModeWithTimeout (uint_fast8_t powerMode, uint32_t timeOut) |
bool | PCM_setPowerModeNonBlocking (uint_fast8_t powerMode) |
uint8_t | PCM_getPowerMode (void) |
bool | PCM_setPowerState (uint_fast8_t powerState) |
bool | PCM_setPowerStateWithTimeout (uint_fast8_t powerState, uint32_t timeout) |
uint8_t | PCM_getPowerState (void) |
bool | PCM_setPowerStateNonBlocking (uint_fast8_t powerState) |
bool | PCM_shutdownDevice (uint32_t shutdownMode) |
bool | PCM_gotoLPM0 (void) |
bool | PCM_gotoLPM3 (void) |
bool | PCM_gotoLPM0InterruptSafe (void) |
bool | PCM_gotoLPM3InterruptSafe (void) |
bool | PCM_gotoLPM4 (void) |
bool | PCM_gotoLPM4InterruptSafe (void) |
void | PCM_enableRudeMode (void) |
void | PCM_disableRudeMode (void) |
void | PCM_enableInterrupt (uint32_t flags) |
void | PCM_disableInterrupt (uint32_t flags) |
uint32_t | PCM_getInterruptStatus (void) |
uint32_t | PCM_getEnabledInterruptStatus (void) |
void | PCM_clearInterruptFlag (uint32_t flags) |
void | PCM_registerInterrupt (void(*intHandler)(void)) |
void | PCM_unregisterInterrupt (void) |
Power Control Manager responsible for controlling the different power states of the device.
For changing between power levels, the user will be able to switch back and forth between PCM_VCORE0 and PCM_VCORE1 using the PCM_setCoreVoltageLevel function. While using this function it is important to note that the underlying power mode will be preserved. For example, if PCM_setCoreVoltageLevel is called with the PCM_VCORE1 parameter while the devices is in PCM_AM_LDO_VCORE0 mode, the power state will be changed to PCM_AM_LDO_VCORE1. If the same API is called with the same parameter in PCM_AM_DCDC_VCORE0 mode, the power state will be changed to PCM_AM_DCDC_VCORE1 mode.
The same preservation logic also applies while switching between power modes. If the PCM_setPowerMode function is called with the PCM_DCDC_MODE parameter while the device is in PCM_AM_LDO_VCORE0 mode, the device will change to PCM_AM_DCDC_VCORE0 mode (leaving the voltage level unchanged).
Low Power Entry Functions:
When using these low power modes entry functions, it is important to note that the original state of the device before low power mode entry is retained. After the devices wakes up from low power mode, the original power mode is restored. For example, say that the device is in PCM_AM_DCDC_VCORE0 mode and then the user calls the PCM_gotoLPM3 API. Since MSP432 devices are not allowed to go into LMP3 while in a DCDC power mode, the API will have the intelligence to first change into PCM_AM_LDO_VCORE0 mode, and then go to LPM3. When the device wakes up, the API will automatically switch back to PCM_AM_DCDC_VCORE0 mode. If the user wants to go into DSL in the previous example without the state preservation, the PCM_setPowerState function should be used with the PCM_LPM3 parameter.
Below is a very brief code example showing how to change power levels with the PCM module. This is done in order to facilitate a higher frequency of 48Mhz. For a set of more detailed code examples, please refer to the code examples in the examples/ directory of the SDK release:
#define PCM_KEY 0x695A0000 |
Referenced by PCM_disableRudeMode(), PCM_enableRudeMode(), PCM_gotoLPM3(), and PCM_shutdownDevice().
#define PCM_AM_LDO_VCORE0 0x00 |
Referenced by PCM_getCoreVoltageLevel(), and PCM_getPowerMode().
#define PCM_AM_LDO_VCORE1 0x01 |
Referenced by PCM_getCoreVoltageLevel(), and PCM_getPowerMode().
#define PCM_AM_DCDC_VCORE0 0x04 |
Referenced by PCM_getCoreVoltageLevel(), and PCM_getPowerMode().
#define PCM_AM_DCDC_VCORE1 0x05 |
Referenced by PCM_getCoreVoltageLevel(), and PCM_getPowerMode().
#define PCM_AM_LF_VCORE0 0x08 |
Referenced by PCM_getCoreVoltageLevel(), and PCM_getPowerMode().
#define PCM_AM_LF_VCORE1 0x09 |
Referenced by PCM_getCoreVoltageLevel(), and PCM_getPowerMode().
#define PCM_LPM0_LDO_VCORE0 0x10 |
Referenced by PCM_getCoreVoltageLevel(), and PCM_getPowerMode().
#define PCM_LPM0_LDO_VCORE1 0x11 |
Referenced by PCM_getCoreVoltageLevel(), and PCM_getPowerMode().
#define PCM_LPM0_DCDC_VCORE0 0x14 |
Referenced by PCM_getCoreVoltageLevel(), and PCM_getPowerMode().
#define PCM_LPM0_DCDC_VCORE1 0x15 |
Referenced by PCM_getCoreVoltageLevel(), and PCM_getPowerMode().
#define PCM_LPM0_LF_VCORE0 0x18 |
Referenced by PCM_getCoreVoltageLevel(), and PCM_getPowerMode().
#define PCM_LPM0_LF_VCORE1 0x19 |
Referenced by PCM_getCoreVoltageLevel(), and PCM_getPowerMode().
#define PCM_LPM3 0x20 |
Referenced by PCM_getCoreVoltageLevel().
#define PCM_LPM4 0x21 |
#define PCM_LPM35_VCORE0 0xC0 |
#define PCM_LPM45 0xA0 |
Referenced by PCM_shutdownDevice().
#define PCM_VCORE0 0x00 |
Referenced by PCM_getCoreVoltageLevel().
#define PCM_VCORE1 0x01 |
Referenced by PCM_getCoreVoltageLevel().
#define PCM_VCORELPM3 0x02 |
Referenced by PCM_getCoreVoltageLevel().
#define PCM_LDO_MODE 0x00 |
Referenced by PCM_getPowerMode(), and PCM_gotoLPM3().
#define PCM_DCDC_MODE 0x01 |
Referenced by PCM_getPowerMode(), and PCM_gotoLPM3().
#define PCM_LF_MODE 0x02 |
Referenced by PCM_getPowerMode().
#define PCM_SHUTDOWN_PARTIAL PCM_LPM35_VCORE0 |
Referenced by PCM_shutdownDevice().
#define PCM_SHUTDOWN_COMPLETE PCM_LPM45 |
Referenced by PCM_shutdownDevice().
#define PCM_DCDCERROR PCM_IE_DCDC_ERROR_IE |
#define PCM_AM_INVALIDTRANSITION PCM_IE_AM_INVALID_TR_IE |
#define PCM_SM_INVALIDCLOCK PCM_IE_LPM_INVALID_CLK_IE |
#define PCM_SM_INVALIDTRANSITION PCM_IE_LPM_INVALID_TR_IE |
bool PCM_setCoreVoltageLevel | ( | uint_fast8_t | voltageLevel | ) |
Sets the core voltage level (Vcore). The function will take care of all power state transitions needed to shift between core voltage levels. Because transitions between voltage levels may require changes power modes, the power mode might temporarily be change. The power mode will be returned to the original state (with the new voltage level) at the end of a successful execution of this function.
Refer to the device specific data sheet for specifics about core voltage levels.
voltageLevel | The voltage level to be shifted to.
|
uint8_t PCM_getCoreVoltageLevel | ( | void | ) |
Returns the current powers state of the system see the PCM_setCoreVoltageLevel function for specific information about the modes.
Possible return values include:
References ASSERT, PCM_AM_DCDC_VCORE0, PCM_AM_DCDC_VCORE1, PCM_AM_LDO_VCORE0, PCM_AM_LDO_VCORE1, PCM_AM_LF_VCORE0, PCM_AM_LF_VCORE1, PCM_getPowerState(), PCM_LPM0_DCDC_VCORE0, PCM_LPM0_DCDC_VCORE1, PCM_LPM0_LDO_VCORE0, PCM_LPM0_LDO_VCORE1, PCM_LPM0_LF_VCORE0, PCM_LPM0_LF_VCORE1, PCM_LPM3, PCM_VCORE0, PCM_VCORE1, and PCM_VCORELPM3.
bool PCM_setCoreVoltageLevelWithTimeout | ( | uint_fast8_t | voltageLevel, |
uint32_t | timeOut | ||
) |
Sets the core voltage level (Vcore). This function will take care of all power state transitions needed to shift between core voltage levels. Because transitions between voltage levels may require changes power modes, the power mode might temporarily be change. The power mode will be returned to the original state (with the new voltage level) at the end of a successful execution of this function.
This function is similar to PCMSetCoreVoltageLevel, however a timeout mechanism is used.
Refer to the device specific data sheet for specifics about core voltage levels.
voltageLevel | The voltage level to be shifted to.
|
timeOut | Number of loop iterations to timeout when checking for power state transitions. This should be used for debugging initial power/hardware configurations. After a stable hardware base is established, the PCMSetCoreVoltageLevel function should be used |
bool PCM_setCoreVoltageLevelNonBlocking | ( | uint_fast8_t | voltageLevel | ) |
Sets the core voltage level (Vcore). This function is similar to PCM_setCoreVoltageLevel, however there are no polling flags to ensure a state has changed. Execution is returned back to the calling program correctly. For MSP432, changing into different power modes/states require very specific logic. This function will initiate only one state transition and then return. It is up to the user to keep calling this function until the correct power state has been achieved.
Refer to the device specific data sheet for specifics about core voltage levels.
voltageLevel | The voltage level to be shifted to.
|
bool PCM_setPowerMode | ( | uint_fast8_t | powerMode | ) |
Switches between power modes. This function will take care of all power state transitions needed to shift between power modes. Note for changing to DCDC mode, specific hardware considerations are required.
Refer to the device specific data sheet for specifics about power modes.
powerMode | The voltage modes to be shifted to. Valid values are:
|
Referenced by PCM_gotoLPM3().
bool PCM_setPowerModeWithTimeout | ( | uint_fast8_t | powerMode, |
uint32_t | timeOut | ||
) |
Switches between power modes. This function will take care of all power state transitions needed to shift between power modes. Note for changing to DCDC mode, specific hardware considerations are required.
This function is similar to PCMSetPowerMode, however a timeout mechanism is used.
Refer to the device specific data sheet for specifics about power modes.
powerMode | The voltage modes to be shifted to. Valid values are:
|
timeOut | Number of loop iterations to timeout when checking for power state transitions. This should be used for debugging initial power/hardware configurations. After a stable hardware base is established, the PCMSetPowerMode function should be used |
bool PCM_setPowerModeNonBlocking | ( | uint_fast8_t | powerMode | ) |
Sets the core voltage level (Vcore). This function is similar to PCM_setPowerMode, however there are no polling flags to ensure a state has changed. Execution is returned back to the calling program correctly. For MSP432, changing into different power modes/states require very specific logic. This function will initiate only one state transition and then return. It is up to the user to keep calling this function until the correct power state has been achieved.
Refer to the device specific data sheet for specifics about core voltage levels.
powerMode | The voltage modes to be shifted to. Valid values are:
|
uint8_t PCM_getPowerMode | ( | void | ) |
Returns the current powers state of the system see the PCM_setPowerState function for specific information about the modes.
References ASSERT, PCM_AM_DCDC_VCORE0, PCM_AM_DCDC_VCORE1, PCM_AM_LDO_VCORE0, PCM_AM_LDO_VCORE1, PCM_AM_LF_VCORE0, PCM_AM_LF_VCORE1, PCM_DCDC_MODE, PCM_getPowerState(), PCM_LDO_MODE, PCM_LF_MODE, PCM_LPM0_DCDC_VCORE0, PCM_LPM0_DCDC_VCORE1, PCM_LPM0_LDO_VCORE0, PCM_LPM0_LDO_VCORE1, PCM_LPM0_LF_VCORE0, and PCM_LPM0_LF_VCORE1.
Referenced by PCM_gotoLPM3().
bool PCM_setPowerState | ( | uint_fast8_t | powerState | ) |
Switches between power states. This is a convenience function that combines the functionality of PCM_setPowerMode and PCM_setCoreVoltageLevel as well as the LPM0/LPM3 functions.
Refer to the device specific data sheet for specifics about power states.
powerState | The voltage modes to be shifted to. Valid values are:
|
Referenced by PCM_gotoLPM3().
bool PCM_setPowerStateWithTimeout | ( | uint_fast8_t | powerState, |
uint32_t | timeout | ||
) |
Switches between power states. This is a convenience function that combines the functionality of PCM_setPowerMode and PCM_setCoreVoltageLevel as well as the LPM modes.
This function is similar to PCM_setPowerState, however a timeout mechanism is used.
Refer to the device specific data sheet for specifics about power states.
powerState | The voltage modes to be shifted to. Valid values are:
|
timeout | Number of loop iterations to timeout when checking for power state transitions. This should be used for debugging initial power/hardware configurations. After a stable hardware base is established, the PCMSetPowerMode function should be used |
uint8_t PCM_getPowerState | ( | void | ) |
Returns the current powers state of the system see the PCMChangePowerState function for specific information about the states.
Refer to PCM_setPowerState for possible return values.
Referenced by PCM_getCoreVoltageLevel(), PCM_getPowerMode(), and PCM_gotoLPM3().
bool PCM_setPowerStateNonBlocking | ( | uint_fast8_t | powerState | ) |
Sets the power state of the part. This function is similar to PCM_getPowerState, however there are no polling flags to ensure a state has changed. Execution is returned back to the calling program correctly. For MSP432, changing into different power modes/states require very specific logic. This function will initiate only one state transition and then return. It is up to the user to keep calling this function until the correct power state has been achieved.
Refer to the device specific data sheet for specifics about core voltage levels.
powerState | The voltage modes to be shifted to. Valid values are:
|
bool PCM_shutdownDevice | ( | uint32_t | shutdownMode | ) |
Transitions the device into LPM3.5/LPM4.5 mode.
Refer to the device specific data sheet for specifics about shutdown modes.
The following events will cause a wake up from LPM3.5 mode:
The following events will cause a wake up from the LPM4.5 mode:
shutdownMode | Specific mode to go to. Valid values are:
|
References ASSERT, CPU_wfi(), PCM_KEY, PCM_LPM45, PCM_SHUTDOWN_COMPLETE, and PCM_SHUTDOWN_PARTIAL.
bool PCM_gotoLPM0 | ( | void | ) |
Transitions the device into LPM0.
Refer to the device specific data sheet for specifics about low power modes.
References CPU_wfi().
Referenced by PCM_gotoLPM0InterruptSafe().
bool PCM_gotoLPM3 | ( | void | ) |
Transitions the device into LPM3
Refer to the device specific data sheet for specifics about low power modes. Note that since LPM3 cannot be entered from a DCDC power modes, the power mode is first switched to LDO operation (if in DCDC mode), LPM3 is entered, and the DCDC mode is restored on wake up.
References CPU_wfi(), PCM_DCDC_MODE, PCM_getPowerMode(), PCM_getPowerState(), PCM_KEY, PCM_LDO_MODE, PCM_setPowerMode(), and PCM_setPowerState().
Referenced by PCM_gotoLPM3InterruptSafe(), and PCM_gotoLPM4().
bool PCM_gotoLPM0InterruptSafe | ( | void | ) |
Transitions the device into LPM0 while maintaining a safe interrupt handling mentality. This function is meant to be used in situations where the user wants to go to LPM0, however does not want to go to "miss" any interrupts due to the fact that going to LPM0 is not an atomic operation. This function will modify the PRIMASK and on exit of the program the master interrupts will be disabled.
Refer to the device specific data sheet for specifics about low power modes.
References Interrupt_disableMaster(), Interrupt_enableMaster(), and PCM_gotoLPM0().
bool PCM_gotoLPM3InterruptSafe | ( | void | ) |
Transitions the device into LPM3 while maintaining a safe interrupt handling mentality. This function is meant to be used in situations where the user wants to go to LPM3, however does not want to go to "miss" any interrupts due to the fact that going to LPM3 is not an atomic operation. This function will modify the PRIMASK and on exit of the program the master interrupts will be disabled.
Refer to the device specific data sheet for specifics about low power modes. Note that since LPM3 cannot be entered from a DCDC power modes, the power mode is first switched to LDO operation (if in DCDC mode), the LPM3 is entered, and the DCDC mode is restored on wake up.
References Interrupt_disableMaster(), Interrupt_enableMaster(), and PCM_gotoLPM3().
bool PCM_gotoLPM4 | ( | void | ) |
Transitions the device into LPM4. LPM4 is the exact same with LPM3, just with RTC_C and WDT_A disabled. When waking up, RTC_C and WDT_A will remain disabled until reconfigured by the user.
References PCM_gotoLPM3(), RTC_C_holdClock(), and WDT_A_holdTimer().
Referenced by PCM_gotoLPM4InterruptSafe().
bool PCM_gotoLPM4InterruptSafe | ( | void | ) |
Transitions the device into LPM4 while maintaining a safe interrupt handling mentality. This function is meant to be used in situations where the user wants to go to LPM4, however does not want to go to "miss" any interrupts due to the fact that going to LPM4 is not an atomic operation. This function will modify the PRIMASK and on exit of the program the master interrupts will be disabled.
Refer to the device specific data sheet for specifics about low power modes. Note that since LPM3 cannot be entered from a DCDC power modes, the power mode is first switched to LDO operation (if in DCDC mode), LPM4 is entered, and the DCDC mode is restored on wake up.
References Interrupt_disableMaster(), Interrupt_enableMaster(), and PCM_gotoLPM4().
void PCM_enableRudeMode | ( | void | ) |
Enables "rude mode" entry into LPM3 and shutdown modes. With this mode enabled, an entry into shutdown or LPM3 will occur even if there are clock systems active. The system will forcibly turn off all clock/systems when going into these modes.
References PCM_KEY.
void PCM_disableRudeMode | ( | void | ) |
Disables "rude mode" entry into LPM3 and shutdown modes. With this mode disabled, an entry into shutdown or LPM3 will wait for any active clock requests to free up before going into LPM3 or shutdown.
References PCM_KEY.
void PCM_enableInterrupt | ( | uint32_t | flags | ) |
Enables individual power control interrupt sources.
flags | is a bit mask of the interrupt sources to be enabled. Must be a logical OR of:
|
This function enables the indicated power control interrupt sources. Only the sources that are enabled can be reflected to the processor interrupt; disabled sources have no effect on the processor.
void PCM_disableInterrupt | ( | uint32_t | flags | ) |
Disables individual power control interrupt sources.
flags | is a bit mask of the interrupt sources to be enabled. Must be a logical OR of:
|
This function disables the indicated power control interrupt sources. Only the sources that are enabled can be reflected to the processor interrupt; disabled sources have no effect on the processor.
uint32_t PCM_getInterruptStatus | ( | void | ) |
Gets the current interrupt status.
Referenced by PCM_getEnabledInterruptStatus().
uint32_t PCM_getEnabledInterruptStatus | ( | void | ) |
Gets the current interrupt status masked with the enabled interrupts. This function is useful to call in ISRs to get a list of pending interrupts that are actually enabled and could have caused the ISR.
References PCM_getInterruptStatus().
void PCM_clearInterruptFlag | ( | uint32_t | flags | ) |
Clears power system interrupt sources.
The specified power system interrupt sources are cleared, so that they no longer assert. This function must be called in the interrupt handler to keep it from being called again immediately upon exit.
flags | is a bit mask of the interrupt sources to be cleared. Must be a logical OR of
|
void PCM_registerInterrupt | ( | void(*)(void) | intHandler | ) |
Registers an interrupt handler for the power system interrupt.
intHandler | is a pointer to the function to be called when the power system interrupt occurs. |
This function registers the handler to be called when a clock system interrupt occurs. This function enables the global interrupt in the interrupt controller; specific PCM interrupts must be enabled via PCM_enableInterrupt(). It is the interrupt handler's responsibility to clear the interrupt source via PCM_clearInterruptFlag .
References INT_PCM, Interrupt_enableInterrupt(), and Interrupt_registerInterrupt().
void PCM_unregisterInterrupt | ( | void | ) |
Unregisters the interrupt handler for the power system.
This function unregisters the handler to be called when a power system interrupt occurs. This function also masks off the interrupt in the interrupt controller so that the interrupt handler no longer is called.
References INT_PCM, Interrupt_disableInterrupt(), and Interrupt_unregisterInterrupt().