arduino-lmic icon indicating copy to clipboard operation
arduino-lmic copied to clipboard

Easy way to restart arduino on `FAILURE`?

Open ubergesundheit opened this issue 7 years ago • 8 comments

How can I make sure my arduino restarts after the library encountered a FAILURE condition? I know of the asm volatile (" jmp 0");, but how can I integrate it into the library?

ubergesundheit avatar Nov 19 '16 16:11 ubergesundheit

I think the most reliable way would be to use watchdog, which will cause a real reset (but that requires a bootloader that clears MCUSR as well).

In any case, you would need to modify the hal_failed() function in hal.cpp. Perhaps it makes sense to make that function weak, so you can just define your own in the sketch to override it.

matthijskooijman avatar Nov 19 '16 17:11 matthijskooijman

Do you have any tips or pointers for me how I can make the hal_failed() function weak? My C/C++ is really bad.

ubergesundheit avatar Nov 19 '16 17:11 ubergesundheit

Add __attribute__((__weak__)) in its declaration IIRC (but Google should help with that).

matthijskooijman avatar Nov 19 '16 19:11 matthijskooijman

@matthijskooijman I think it would be nice to declare it as weak as default in the library.

Oliv4945 avatar Jan 20 '17 16:01 Oliv4945

Do you have any tips or pointers for me how I can make the hal_failed() function weak? My C/C++ is really bad.

Do you have any tips or pointers for me how I can make the hal_failed() function weak? My C/C++ is really bad. Hi Gerald, do you have solved the reset function in FAILURE condition?

geppoleppo avatar Oct 22 '19 14:10 geppoleppo

Sorry @geppoleppo, I didn't solve this

ubergesundheit avatar Oct 22 '19 19:10 ubergesundheit

Thanks

Il giorno mar 22 ott 2019 alle ore 21:09 Gerald Pape < [email protected]> ha scritto:

Sorry @geppoleppo https://github.com/geppoleppo, I didn't solve this

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/matthijskooijman/arduino-lmic/issues/57?email_source=notifications&email_token=AD54VHLOOYWOOWEC3VUFFMLQP5FWBA5CNFSM4CW5GKB2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEB63N6I#issuecomment-545109753, or unsubscribe https://github.com/notifications/unsubscribe-auth/AD54VHMC4TN3CTR4CXEHEDDQP5FWBANCNFSM4CW5GKBQ .

--

ing. Silvano Pisoni Ingegnere civile ambientale M. +39 393 98 60 814

*TERA engineering s.r.l.*Via dei Solteri 37/1, Trento T. +39 0461 93 17 64 www.tera-group.it https://mail.google.com/mail/u/0/www.tera-group.it

geppoleppo avatar Oct 22 '19 21:10 geppoleppo

Old thread but still open: it would be great if someone will give advice how to implement wdt with LMIC. Maybe with an example?

Roberto6969 avatar Feb 23 '20 16:02 Roberto6969