This driver for Atmel® | SMART ARM®-based microcontrollers provides an interface for the configuration and management of the device's Brown Out Detector (BOD) modules, to detect and respond to under-voltage events and take an appropriate action.
The following peripherals are used by this module:
The following devices can use this module:
The outline of this documentation is as follows:
There are no prerequisites for this module.
The SAM devices contain a number of Brown Out Detector (BOD) modules. Each BOD monitors the supply voltage for any dips that go below the set threshold for the module. In case of a BOD detection the BOD will either reset the system or raise a hardware interrupt so that a safe power-down sequence can be attempted.
The time between a BOD interrupt being raised and a failure of the processor to continue executing (in the case of a core power failure) is system specific; care must be taken that all critical BOD detection events can complete within the amount of time available.
For extra information, see Extra Information for BOD Driver. This includes:
For a list of examples related to this driver, see Examples for BOD Driver.
Data Structures | |
struct | bodvdd_config |
Configuration structure for a BODVDD module. More... | |
Enumerations | |
enum | bodvdd_action { BODVDD_ACTION_NONE = SUPC_BODVDD_ACTION(0), BODVDD_ACTION_RESET = SUPC_BODVDD_ACTION(1), BODVDD_ACTION_INTERRUPT = SUPC_BODVDD_ACTION(2), BODVDD_ACTION_BACKUP = SUPC_BODVDD_ACTION(3) } |
Brown Out Detector detection actions. More... | |
enum | bodvdd_mode_in_active { BODVDD_ACTCFG_CONTINUOUS = 0, BODVDD_ACTCFG_SAMPLED = SUPC_BODVDD_ACTCFG } |
Brown Out Detector sampling modes in active sleep mode. More... | |
enum | bodvdd_mode_in_standby { BODVDD_STDBYCFG_CONTINUOUS = 0, BODVDD_STDBYCFG_SAMPLED = SUPC_BODVDD_STDBYCFG } |
Brown Out Detector sampling modes in standby sleep mode. More... | |
enum | bodvdd_prescale { BODVDD_PRESCALE_DIV_2 = SUPC_BODVDD_PSEL(0), BODVDD_PRESCALE_DIV_4 = SUPC_BODVDD_PSEL(1), BODVDD_PRESCALE_DIV_8 = SUPC_BODVDD_PSEL(2), BODVDD_PRESCALE_DIV_16 = SUPC_BODVDD_PSEL(3), BODVDD_PRESCALE_DIV_32 = SUPC_BODVDD_PSEL(4), BODVDD_PRESCALE_DIV_64 = SUPC_BODVDD_PSEL(5), BODVDD_PRESCALE_DIV_128 = SUPC_BODVDD_PSEL(6), BODVDD_PRESCALE_DIV_256 = SUPC_BODVDD_PSEL(7), BODVDD_PRESCALE_DIV_512 = SUPC_BODVDD_PSEL(8), BODVDD_PRESCALE_DIV_1024 = SUPC_BODVDD_PSEL(9), BODVDD_PRESCALE_DIV_2048 = SUPC_BODVDD_PSEL(10), BODVDD_PRESCALE_DIV_4096 = SUPC_BODVDD_PSEL(11), BODVDD_PRESCALE_DIV_8192 = SUPC_BODVDD_PSEL(12), BODVDD_PRESCALE_DIV_16384 = SUPC_BODVDD_PSEL(13), BODVDD_PRESCALE_DIV_32768 = SUPC_BODVDD_PSEL(14), BODVDD_PRESCALE_DIV_65536 = SUPC_BODVDD_PSEL(15) } |
Brown Out Detector input clock prescale values. More... | |
Configuration and Initialization | |
static void | bodvdd_get_config_defaults (struct bodvdd_config *const conf) |
Get default BODVDD configuration. More... | |
enum status_code | bodvdd_set_config (struct bodvdd_config *const conf) |
Configure a Brown Out Detector module. More... | |
static enum status_code | bodvdd_enable (void) |
Enables a configured BODVDD module. More... | |
static enum status_code | bodvdd_disable (void) |
Disables an enabled BODVDD module. More... | |
static bool | bodvdd_is_detected (void) |
Checks if the BODVDD low voltage detection has occurred. More... | |
static void | bodvdd_clear_detected (void) |
Clears the low voltage detection state of the BODVDD. More... | |
enum bodvdd_action |
Brown Out Detector detection actions.
List of possible BODVDD actions when a BODVDD module detects a brown-out condition.
Brown Out Detector sampling modes in active sleep mode.
List of possible BODVDD module voltage sampling modes in active sleep mode.
Enumerator | |
---|---|
BODVDD_ACTCFG_CONTINUOUS |
BODVDD will sample the supply line continuously. |
BODVDD_ACTCFG_SAMPLED |
BODVDD will use the BODVDD sampling clock (1kHz) to sample the supply line. |
Brown Out Detector sampling modes in standby sleep mode.
List of possible BODVDD module voltage sampling modes in standby sleep mode.
Enumerator | |
---|---|
BODVDD_STDBYCFG_CONTINUOUS |
BODVDD will sample the supply line continuously. |
BODVDD_STDBYCFG_SAMPLED |
BODVDD will use the BODVDD sampling clock (1kHz) to sample the supply line. |
enum bodvdd_prescale |
Brown Out Detector input clock prescale values.
List of possible BODVDD controller prescaler values, to reduce the sampling speed of a BODVDD to lower the power consumption.
|
inlinestatic |
Clears the low voltage detection state of the BODVDD.
Clears the low voltage condition of the BODVDD module, so that new low voltage conditions can be detected.
|
inlinestatic |
Disables an enabled BODVDD module.
Disables the BODVDD module that was previously enabled.
STATUS_OK | If the BODVDD was successfully disabled |
References STATUS_OK.
|
inlinestatic |
Enables a configured BODVDD module.
Enables the BODVDD module that has been previously configured.
STATUS_OK | If the BODVDD was successfully enabled |
References STATUS_OK.
Referenced by configure_bodvdd().
|
inlinestatic |
Get default BODVDD configuration.
The default BODVDD configuration is:
[out] | conf | BODVDD configuration struct to set to default settings |
References bodvdd_config::action, Assert, BODVDD_ACTCFG_CONTINUOUS, BODVDD_ACTION_RESET, BODVDD_PRESCALE_DIV_2, BODVDD_STDBYCFG_CONTINUOUS, bodvdd_config::hysteresis, bodvdd_config::level, bodvdd_config::mode_in_active, bodvdd_config::mode_in_standby, bodvdd_config::prescaler, and bodvdd_config::run_in_standby.
Referenced by configure_bodvdd().
|
inlinestatic |
Checks if the BODVDD low voltage detection has occurred.
Determines if the BODVDD has detected a voltage lower than its configured threshold.
true | If the BODVDD has detected a low voltage condition |
false | If the BODVDD has not detected a low voltage condition |
enum status_code bodvdd_set_config | ( | struct bodvdd_config *const | conf | ) |
Configure a Brown Out Detector module.
Configures a given BOD module with the settings stored in the given configuration structure.
[in] | conf | Configuration settings to use for the specified BODVDD |
STATUS_OK | Operation completed successfully |
STATUS_ERR_INVALID_ARG | An invalid BOD was supplied |
STATUS_ERR_INVALID_OPTION | The requested BOD level was outside the acceptable range |
References bodvdd_config::action, Assert, bodvdd_config::hysteresis, bodvdd_config::level, bodvdd_config::mode_in_active, bodvdd_config::mode_in_standby, bodvdd_config::prescaler, bodvdd_config::run_in_standby, STATUS_ERR_INVALID_ARG, and STATUS_OK.
Referenced by configure_bodvdd().