Use Supply Controller to avoid running SAM3 on voltages lower than 3.0V

Sometimes there is some leakage current via some I/O that's sufficient
to power up the  SAM3S.  Use the supply monitor to make sure the CPU
will be reset (and kept in reset) if the supply voltage is below 3.0V.
This commit is contained in:
Harald Welte 2017-03-03 18:48:13 +01:00
parent 3ecbf678db
commit aaba4af46c
1 changed files with 7 additions and 0 deletions

View File

@ -119,6 +119,13 @@ extern WEAK void LowLevelInit( void )
{
uint32_t timeout = 0;
/* Configure the Supply Monitor to reset the CPU in case VDDIO is
* lower than 3.0V. As we run the board on 3.3V, any lower voltage
* might be some kind of leakage that creeps in some way, but is not
* the "official" power supply */
SUPC->SUPC_SMMR = SUPC_SMMR_SMTH_3_0V | SUPC_SMMR_SMSMPL_CSM |
SUPC_SMMR_SMRSTEN_ENABLE;
/* enable both LED and green LED */
PIOA->PIO_PER |= LED_RED | LED_GREEN;
PIOA->PIO_OER |= LED_RED | LED_GREEN;