SAMD: configurable brownout, separate the variables
This commit is contained in:
parent
83a27edd20
commit
e0733d153e
@ -44,4 +44,4 @@
|
|||||||
#define DEFAULT_UART_BUS_RX (&pin_PA01)
|
#define DEFAULT_UART_BUS_RX (&pin_PA01)
|
||||||
#define DEFAULT_UART_BUS_TX (&pin_PA00)
|
#define DEFAULT_UART_BUS_TX (&pin_PA00)
|
||||||
|
|
||||||
#define BOARD_BROWNOUT_LEVEL (6)
|
#define SAMD21_BOD33_LEVEL (6)
|
||||||
|
@ -41,5 +41,4 @@
|
|||||||
#define IGNORE_PIN_PB10 1
|
#define IGNORE_PIN_PB10 1
|
||||||
#define IGNORE_PIN_PB11 1
|
#define IGNORE_PIN_PB11 1
|
||||||
|
|
||||||
#define BOARD_BROWNOUT_LEVEL (6)
|
#define SAMD5x_E5x_BOD33_LEVEL (100)
|
||||||
// 1.6V
|
|
||||||
|
@ -112,8 +112,11 @@
|
|||||||
#define CIRCUITPY_DEFAULT_STACK_SIZE 4096
|
#define CIRCUITPY_DEFAULT_STACK_SIZE 4096
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef BOARD_BROWNOUT_LEVEL (
|
#ifndef SAMD21_BOD33_LEVEL
|
||||||
#define BOARD_BROWNLOUT_LEVEL (39)
|
// Set brownout detection to ~2.7V. Default from factory is 1.7V,
|
||||||
|
// which is too low for proper operation of external SPI flash chips
|
||||||
|
// (they are 2.7-3.6V).
|
||||||
|
#define SAMD21_BOD33_LEVEL (39)
|
||||||
// 2.77V with hysteresis off. Table 37.20 in datasheet.
|
// 2.77V with hysteresis off. Table 37.20 in datasheet.
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -134,8 +137,11 @@
|
|||||||
#define CIRCUITPY_DEFAULT_STACK_SIZE (24*1024)
|
#define CIRCUITPY_DEFAULT_STACK_SIZE (24*1024)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef BOARD_BROWNOUT_LEVEL (
|
#ifndef SAMD5x_E5x_BOD33_LEVEL
|
||||||
#define BOARD_BROWNLOUT_LEVEL (200)
|
// Set brownout detection to ~2.7V. Default from factory is 1.7V,
|
||||||
|
// which is too low for proper operation of external SPI flash chips
|
||||||
|
// (they are 2.7-3.6V).
|
||||||
|
#define SAMD5x_E5x_BOD33_LEVEL (200)
|
||||||
// 2.7V: 1.5V + LEVEL * 6mV.
|
// 2.7V: 1.5V + LEVEL * 6mV.
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -206,11 +206,10 @@ static void rtc_init(void) {
|
|||||||
safe_mode_t port_init(void) {
|
safe_mode_t port_init(void) {
|
||||||
#if defined(SAMD21)
|
#if defined(SAMD21)
|
||||||
|
|
||||||
// Set brownout detection. Default from factory is 1.7V,
|
// Set brownout detection.
|
||||||
// which is too low for proper operation of external SPI flash chips (they are 2.7-3.6V).
|
|
||||||
// Disable while changing level.
|
// Disable while changing level.
|
||||||
SYSCTRL->BOD33.bit.ENABLE = 0;
|
SYSCTRL->BOD33.bit.ENABLE = 0;
|
||||||
SYSCTRL->BOD33.bit.LEVEL = BOARD_BROWNOUT_LEVEL;
|
SYSCTRL->BOD33.bit.LEVEL = SAMD21_BOD33_LEVEL;
|
||||||
SYSCTRL->BOD33.bit.ENABLE = 1;
|
SYSCTRL->BOD33.bit.ENABLE = 1;
|
||||||
|
|
||||||
#ifdef ENABLE_MICRO_TRACE_BUFFER
|
#ifdef ENABLE_MICRO_TRACE_BUFFER
|
||||||
@ -225,11 +224,10 @@ safe_mode_t port_init(void) {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(SAM_D5X_E5X)
|
#if defined(SAM_D5X_E5X)
|
||||||
// Set brownout detection to ~2.7V. Default from factory is 1.7V,
|
// Set brownout detection.
|
||||||
// which is too low for proper operation of external SPI flash chips (they are 2.7-3.6V).
|
|
||||||
// Disable while changing level.
|
// Disable while changing level.
|
||||||
SUPC->BOD33.bit.ENABLE = 0;
|
SUPC->BOD33.bit.ENABLE = 0;
|
||||||
SUPC->BOD33.bit.LEVEL = BOARD_BROWNOUT_LEVEL;
|
SUPC->BOD33.bit.LEVEL = SAMD5x_E5x_BOD33_LEVEL;
|
||||||
SUPC->BOD33.bit.ENABLE = 1;
|
SUPC->BOD33.bit.ENABLE = 1;
|
||||||
|
|
||||||
// MPU (Memory Protection Unit) setup.
|
// MPU (Memory Protection Unit) setup.
|
||||||
|
Loading…
Reference in New Issue
Block a user