Skip to content

Commit f38ce10

Browse files
committed
Support brownout to safe mode. Fixes #870
1 parent 6479cb0 commit f38ce10

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
@@ -203,9 +203,16 @@ safe_mode_t port_init(void) {
203203
}
204204
#endif
205205

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

210217
if (board_requests_safe_mode()) {
211218
return USER_SAFE_MODE;

0 commit comments

Comments
 (0)