Skip to content

Commit ea95eb7

Browse files
authored
Merge pull request #890 from tannewt/brownout3
Support brownout to safe mode. Fixes #870
2 parents 317bb6d + f38ce10 commit ea95eb7

File tree

1 file changed

+10
-3
lines changed
  • ports/atmel-samd/supervisor

1 file changed

+10
-3
lines changed

ports/atmel-samd/supervisor/port.c

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -201,9 +201,16 @@ safe_mode_t port_init(void) {
201201
}
202202
#endif
203203

204-
// if (PM->RCAUSE.bit.BOD33 == 1 || PM->RCAUSE.bit.BOD12 == 1) {
205-
// return BROWNOUT;
206-
// }
204+
#ifdef SAMD21
205+
if (PM->RCAUSE.bit.BOD33 == 1 || PM->RCAUSE.bit.BOD12 == 1) {
206+
return BROWNOUT;
207+
}
208+
#endif
209+
#ifdef SAMD51
210+
if (RSTC->RCAUSE.bit.BODVDD == 1 || RSTC->RCAUSE.bit.BODCORE == 1) {
211+
return BROWNOUT;
212+
}
213+
#endif
207214

208215
if (board_requests_safe_mode()) {
209216
return USER_SAFE_MODE;

0 commit comments

Comments
 (0)