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 peripheral is 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 | bod12_config |
Configuration structure for a BOD12 module. More... | |
struct | bod33_config |
Configuration structure for a BOD33 module. More... | |
Enumerations | |
enum | bod12_action { BOD12_ACTION_NONE = SUPC_BOD12_ACTION(0), BOD12_ACTION_RESET = SUPC_BOD12_ACTION(1), BOD12_ACTION_INTERRUPT = SUPC_BOD12_ACTION(2) } |
Brown Out Detector detection actions. More... | |
enum | bod12_mode_in_active { BOD12_ACTCFG_CONTINUOUS = 0, BOD12_ACTCFG_SAMPLED = SUPC_BOD12_ACTCFG } |
Brown Out Detector sampling modes in active sleep mode. More... | |
enum | bod12_mode_in_standby { BOD12_STDBYCFG_CONTINUOUS = 0, BOD12_STDBYCFG_SAMPLED = SUPC_BOD12_STDBYCFG } |
Brown Out Detector sampling modes in standby sleep mode. More... | |
enum | bod12_prescale { BOD12_PRESCALE_DIV_2 = SUPC_BOD12_PSEL(0), BOD12_PRESCALE_DIV_4 = SUPC_BOD12_PSEL(1), BOD12_PRESCALE_DIV_8 = SUPC_BOD12_PSEL(2), BOD12_PRESCALE_DIV_16 = SUPC_BOD12_PSEL(3), BOD12_PRESCALE_DIV_32 = SUPC_BOD12_PSEL(4), BOD12_PRESCALE_DIV_64 = SUPC_BOD12_PSEL(5), BOD12_PRESCALE_DIV_128 = SUPC_BOD12_PSEL(6), BOD12_PRESCALE_DIV_256 = SUPC_BOD12_PSEL(7), BOD12_PRESCALE_DIV_512 = SUPC_BOD12_PSEL(8), BOD12_PRESCALE_DIV_1024 = SUPC_BOD12_PSEL(9), BOD12_PRESCALE_DIV_2048 = SUPC_BOD12_PSEL(10), BOD12_PRESCALE_DIV_4096 = SUPC_BOD12_PSEL(11), BOD12_PRESCALE_DIV_8192 = SUPC_BOD12_PSEL(12), BOD12_PRESCALE_DIV_16384 = SUPC_BOD12_PSEL(13), BOD12_PRESCALE_DIV_32768 = SUPC_BOD12_PSEL(14), BOD12_PRESCALE_DIV_65536 = SUPC_BOD12_PSEL(15) } |
Brown Out Detector input clock prescale values. More... | |
enum | bod33_action { BOD33_ACTION_NONE = SUPC_BOD33_ACTION(0), BOD33_ACTION_RESET = SUPC_BOD33_ACTION(1), BOD33_ACTION_INTERRUPT = SUPC_BOD33_ACTION(2), BOD33_ACTION_BACKUP = SUPC_BOD33_ACTION(3) } |
Brown Out Detector detection actions. More... | |
enum | bod33_mode_in_active { BOD33_ACTCFG_CONTINUOUS = 0, BOD33_ACTCFG_SAMPLED = SUPC_BOD33_ACTCFG } |
Brown Out Detector sampling modes in active sleep mode. More... | |
enum | bod33_mode_in_standby { BOD33_STDBYCFG_CONTINUOUS = 0, BOD33_STDBYCFG_SAMPLED = SUPC_BOD33_STDBYCFG } |
Brown Out Detector sampling modes in standby sleep mode. More... | |
enum | bod33_prescale { BOD33_PRESCALE_DIV_2 = SUPC_BOD33_PSEL(0), BOD33_PRESCALE_DIV_4 = SUPC_BOD33_PSEL(1), BOD33_PRESCALE_DIV_8 = SUPC_BOD33_PSEL(2), BOD33_PRESCALE_DIV_16 = SUPC_BOD33_PSEL(3), BOD33_PRESCALE_DIV_32 = SUPC_BOD33_PSEL(4), BOD33_PRESCALE_DIV_64 = SUPC_BOD33_PSEL(5), BOD33_PRESCALE_DIV_128 = SUPC_BOD33_PSEL(6), BOD33_PRESCALE_DIV_256 = SUPC_BOD33_PSEL(7), BOD33_PRESCALE_DIV_512 = SUPC_BOD33_PSEL(8), BOD33_PRESCALE_DIV_1024 = SUPC_BOD33_PSEL(9), BOD33_PRESCALE_DIV_2048 = SUPC_BOD33_PSEL(10), BOD33_PRESCALE_DIV_4096 = SUPC_BOD33_PSEL(11), BOD33_PRESCALE_DIV_8192 = SUPC_BOD33_PSEL(12), BOD33_PRESCALE_DIV_16384 = SUPC_BOD33_PSEL(13), BOD33_PRESCALE_DIV_32768 = SUPC_BOD33_PSEL(14), BOD33_PRESCALE_DIV_65536 = SUPC_BOD33_PSEL(15) } |
Brown Out Detector input clock prescale values. More... | |
enum | bod33_vol_monitor { BOD33_VMON_VDD = 0, BOD33_VMON_VBAT = SUPC_BOD33_VMON } |
Brown Out Detector voltage monitors. More... | |
Configuration and Initialization | |
static void | bod33_get_config_defaults (struct bod33_config *const conf) |
Get default BOD33 configuration. More... | |
enum status_code | bod33_set_config (struct bod33_config *const conf) |
Configure a Brown Out Detector module. More... | |
static enum status_code | bod33_enable (void) |
Enables a configured BOD33 module. More... | |
static enum status_code | bod33_disable (void) |
Disables an enabled BOD33 module. More... | |
static bool | bod33_is_detected (void) |
Checks if the BOD33 low voltage detection has occurred. More... | |
static void | bod33_clear_detected (void) |
Clears the low voltage detection state of the BOD33. More... | |
static void | bod12_get_config_defaults (struct bod12_config *const conf) |
Get default BOD12 configuration. More... | |
enum status_code | bod12_set_config (struct bod12_config *const conf) |
Configure a Brown Out Detector module. More... | |
static enum status_code | bod12_enable (void) |
Enables a configured BOD12 module. More... | |
static enum status_code | bod12_disable (void) |
Disables an enabled BOD12 module. More... | |
static bool | bod12_is_detected (void) |
Checks if the BOD12 low voltage detection has occurred. More... | |
static void | bod12_clear_detected (void) |
Clears the low voltage detection state of the BOD12. More... | |
enum bod12_action |
Brown Out Detector detection actions.
List of possible BOD12 actions when a BOD12 module detects a brown-out condition.
enum bod12_mode_in_active |
Brown Out Detector sampling modes in active sleep mode.
List of possible BOD12 module voltage sampling modes in active sleep mode.
Enumerator | |
---|---|
BOD12_ACTCFG_CONTINUOUS |
BOD12 will sample the supply line continuously. |
BOD12_ACTCFG_SAMPLED |
BOD12 will use the BOD12 sampling clock (1KHz) to sample the supply line. |
Brown Out Detector sampling modes in standby sleep mode.
List of possible BOD12 module voltage sampling modes in standby sleep mode.
Enumerator | |
---|---|
BOD12_STDBYCFG_CONTINUOUS |
BOD12 will sample the supply line continuously. |
BOD12_STDBYCFG_SAMPLED |
BOD12 will use the BOD12 sampling clock (1KHz) to sample the supply line. |
enum bod12_prescale |
Brown Out Detector input clock prescale values.
List of possible BOD12 controller prescaler values, to reduce the sampling speed of a BOD12 to lower the power consumption.
enum bod33_action |
Brown Out Detector detection actions.
List of possible BOD33 actions when a BOD33 module detects a brown-out condition.
enum bod33_mode_in_active |
Brown Out Detector sampling modes in active sleep mode.
List of possible BOD33 module voltage sampling modes in active sleep mode.
Enumerator | |
---|---|
BOD33_ACTCFG_CONTINUOUS |
BOD33 will sample the supply line continuously. |
BOD33_ACTCFG_SAMPLED |
BOD33 will use the BOD33 sampling clock (1KHz) to sample the supply line. |
Brown Out Detector sampling modes in standby sleep mode.
List of possible BOD33 module voltage sampling modes in standby sleep mode.
Enumerator | |
---|---|
BOD33_STDBYCFG_CONTINUOUS |
BOD33 will sample the supply line continuously. |
BOD33_STDBYCFG_SAMPLED |
BOD33 will use the BOD33 sampling clock (1KHz) to sample the supply line. |
enum bod33_prescale |
Brown Out Detector input clock prescale values.
List of possible BOD33 controller prescaler values, to reduce the sampling speed of a BOD33 to lower the power consumption.
enum bod33_vol_monitor |
|
inlinestatic |
Clears the low voltage detection state of the BOD12.
Clears the low voltage condition of BOD12 module, so that new low voltage conditions can be detected.
|
inlinestatic |
Disables an enabled BOD12 module.
Disables the BOD12 module that was previously enabled.
STATUS_OK | If the BOD12 was successfully disabled |
References STATUS_OK.
|
inlinestatic |
Enables a configured BOD12 module.
Enables the BOD12 module that has been previously configured.
STATUS_OK | If the BOD12 was successfully enabled |
References STATUS_OK.
|
inlinestatic |
Get default BOD12 configuration.
The default BOD12 configuration is:
[out] | conf | BOD12 configuration struct to set to default settings |
References bod12_config::action, Assert, BOD12_ACTCFG_CONTINUOUS, BOD12_ACTION_RESET, BOD12_PRESCALE_DIV_2, BOD12_STDBYCFG_CONTINUOUS, bod12_config::hysteresis, bod12_config::level, bod12_config::mode_in_active, bod12_config::mode_in_standby, bod12_config::prescaler, and bod12_config::run_in_standby.
|
inlinestatic |
Checks if the BOD12 low voltage detection has occurred.
Determines if the BOD12 has detected a voltage lower than its configured threshold.
true | If the BOD12 has detected a low voltage condition |
false | If the BOD12 has not detected a low voltage condition |
enum status_code bod12_set_config | ( | struct bod12_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 BOD12 |
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 bod12_config::action, Assert, bod12_config::hysteresis, bod12_config::level, bod12_config::mode_in_active, bod12_config::mode_in_standby, bod12_config::prescaler, bod12_config::run_in_standby, STATUS_ERR_INVALID_ARG, and STATUS_OK.
|
inlinestatic |
Clears the low voltage detection state of the BOD33.
Clears the low voltage condition of BOD33 module, so that new low voltage conditions can be detected.
|
inlinestatic |
Disables an enabled BOD33 module.
Disables the BOD33 module that was previously enabled.
STATUS_OK | If the BOD33 was successfully disabled |
References STATUS_OK.
|
inlinestatic |
Enables a configured BOD33 module.
Enables the BOD33 module that has been previously configured.
STATUS_OK | If the BOD33 was successfully enabled |
References STATUS_OK.
|
inlinestatic |
Get default BOD33 configuration.
The default BOD33 configuration is:
[out] | conf | BOD33 configuration struct to set to default settings |
References bod33_config::action, Assert, bod33_config::backuplevel, BOD33_ACTCFG_CONTINUOUS, BOD33_ACTION_NONE, BOD33_PRESCALE_DIV_2, BOD33_STDBYCFG_CONTINUOUS, BOD33_VMON_VDD, bod33_config::hysteresis, bod33_config::level, bod33_config::mode_in_active, bod33_config::mode_in_standby, bod33_config::monitor, bod33_config::prescaler, bod33_config::run_in_backup, and bod33_config::run_in_standby.
|
inlinestatic |
Checks if the BOD33 low voltage detection has occurred.
Determines if the BOD33 has detected a voltage lower than its configured threshold.
true | If the BOD33 has detected a low voltage condition |
false | If the BOD33 has not detected a low voltage condition |
enum status_code bod33_set_config | ( | struct bod33_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 BOD33 |
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 bod33_config::action, Assert, bod33_config::backuplevel, bod33_config::hysteresis, bod33_config::level, bod33_config::mode_in_active, bod33_config::mode_in_standby, bod33_config::monitor, bod33_config::prescaler, bod33_config::run_in_backup, bod33_config::run_in_standby, STATUS_ERR_INVALID_ARG, and STATUS_OK.