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 | bod_config |
Configuration structure for a BOD module. More... | |
Enumerations | |
enum | bod { BOD_BOD33 } |
Brown Out Detector hardware instance IDs. More... | |
enum | bod_action { BOD_ACTION_NONE = SYSCTRL_BOD33_ACTION(0), BOD_ACTION_RESET = SYSCTRL_BOD33_ACTION(1), BOD_ACTION_INTERRUPT = SYSCTRL_BOD33_ACTION(2) } |
Brown Out Detector detection actions. More... | |
enum | bod_mode { BOD_MODE_CONTINUOUS = 0, BOD_MODE_SAMPLED = SYSCTRL_BOD33_MODE } |
Brown Out Detector sampling modes. More... | |
enum | bod_prescale { BOD_PRESCALE_DIV_2 = SYSCTRL_BOD33_PSEL(0), BOD_PRESCALE_DIV_4 = SYSCTRL_BOD33_PSEL(1), BOD_PRESCALE_DIV_8 = SYSCTRL_BOD33_PSEL(2), BOD_PRESCALE_DIV_16 = SYSCTRL_BOD33_PSEL(3), BOD_PRESCALE_DIV_32 = SYSCTRL_BOD33_PSEL(4), BOD_PRESCALE_DIV_64 = SYSCTRL_BOD33_PSEL(5), BOD_PRESCALE_DIV_128 = SYSCTRL_BOD33_PSEL(6), BOD_PRESCALE_DIV_256 = SYSCTRL_BOD33_PSEL(7), BOD_PRESCALE_DIV_512 = SYSCTRL_BOD33_PSEL(8), BOD_PRESCALE_DIV_1024 = SYSCTRL_BOD33_PSEL(9), BOD_PRESCALE_DIV_2048 = SYSCTRL_BOD33_PSEL(10), BOD_PRESCALE_DIV_4096 = SYSCTRL_BOD33_PSEL(11), BOD_PRESCALE_DIV_8192 = SYSCTRL_BOD33_PSEL(12), BOD_PRESCALE_DIV_16384 = SYSCTRL_BOD33_PSEL(13), BOD_PRESCALE_DIV_32768 = SYSCTRL_BOD33_PSEL(14), BOD_PRESCALE_DIV_65536 = SYSCTRL_BOD33_PSEL(15) } |
Brown Out Detector input clock prescale values. More... | |
Configuration and Initialization | |
static void | bod_get_config_defaults (struct bod_config *const conf) |
Get default BOD configuration. More... | |
enum status_code | bod_set_config (const enum bod bod_id, struct bod_config *const conf) |
Configure a Brown Out Detector module. More... | |
static enum status_code | bod_enable (const enum bod bod_id) |
Enables a configured BOD module. More... | |
static enum status_code | bod_disable (const enum bod bod_id) |
Disables an enabled BOD module. More... | |
static bool | bod_is_detected (const enum bod bod_id) |
Checks if a specified BOD low voltage detection has occurred. More... | |
static void | bod_clear_detected (const enum bod bod_id) |
Clears the low voltage detection state of a specified BOD. More... | |
enum bod |
enum bod_action |
Brown Out Detector detection actions.
List of possible BOD actions when a BOD module detects a brown out condition.
enum bod_mode |
enum bod_prescale |
Brown Out Detector input clock prescale values.
List of possible BOD controller prescaler values, to reduce the sampling speed of a BOD to lower the power consumption.
|
inlinestatic |
Clears the low voltage detection state of a specified BOD.
Clears the low voltage condition of a specified BOD module, so that new low voltage conditions can be detected.
[in] | bod_id | BOD module to clear |
References Assert, and BOD_BOD33.
Referenced by run_bod_test().
|
inlinestatic |
Disables an enabled BOD module.
Disables the specified BOD module that was previously enabled.
[in] | bod_id | BOD module to disable |
STATUS_OK | If the BOD was successfully disabled |
STATUS_ERR_INVALID_ARG | An invalid BOD was supplied |
References Assert, BOD_BOD33, STATUS_ERR_INVALID_ARG, and STATUS_OK.
Referenced by run_bod_test().
|
inlinestatic |
Enables a configured BOD module.
Enables the specified BOD module that has been previously configured.
[in] | bod_id | BOD module to enable |
STATUS_OK | If the BOD was successfully enabled |
STATUS_ERR_INVALID_ARG | An invalid BOD was supplied |
References Assert, BOD_BOD33, STATUS_ERR_INVALID_ARG, and STATUS_OK.
Referenced by configure_bod(), configure_bod33(), and run_bod_init_test().
|
inlinestatic |
Get default BOD configuration.
The default BOD configuration is:
[out] | conf | BOD configuration struct to set to default settings |
References bod_config::action, Assert, BOD_ACTION_RESET, BOD_MODE_CONTINUOUS, BOD_PRESCALE_DIV_2, bod_config::hysteresis, bod_config::level, bod_config::mode, bod_config::prescaler, and bod_config::run_in_standby.
Referenced by configure_bod(), configure_bod33(), and run_bod_init_test().
Checks if a specified BOD low voltage detection has occurred.
Determines if a specified BOD has detected a voltage lower than its configured threshold.
[in] | bod_id | BOD module to check |
true | If the BOD has detected a low voltage condition |
false | If the BOD has not detected a low voltage condition |
References Assert, and BOD_BOD33.
Referenced by run_bod_test().
enum status_code bod_set_config | ( | const enum bod | bod_id, |
struct bod_config *const | conf | ||
) |
Configure a Brown Out Detector module.
Configures a given BOD module with the settings stored in the given configuration structure.
[in] | bod_id | BOD module to configure |
[in] | conf | Configuration settings to use for the specified BOD |
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 bod_config::action, Assert, BOD_BOD33, BOD_MODE_SAMPLED, bod_config::hysteresis, if(), bod_config::level, bod_config::mode, bod_config::prescaler, bod_config::run_in_standby, STATUS_ERR_INVALID_ARG, and STATUS_OK.
Referenced by configure_bod(), configure_bod33(), and run_bod_init_test().