cyrusbuilt / ArduinoCrashMonitor

Event-driven crash monitor service for Arduino/Genuino.
GNU General Public License v3.0
5 stars 0 forks source link

Possible to make compatible with SAM based controllers? #3

Closed caiello3 closed 4 years ago

caiello3 commented 4 years ago

Hello,

I have been working on a project based on the Arduino MKR NB 1500, which has a SAM based controller. It keeps crashing but I can't figure out why (I've had it looked over by experienced devs with no obvious issue in the code) so I was hoping to use this. I know this is for AVR based controllers only, but what I'm wondering is if it is possible to make this compatible with SAM based controllers? I am relatively new to coding, so I'm not sure if the dependency is only on the avr/wdt.h or if it is deeper rooted than that. From what I've read there is a WDT for the MKR NB 1500's SAM D21 controller. Sorry for the ignorance here.

Thanks!

cyrusbuilt commented 4 years ago

I'm certain it probably is possible. I already made another library called ESPCrashMonitor that works with the ESP32 and ESP8266 chips. I'll look into the SAM stuff. I dont have a SAM-based board at the moment, so I won't be able to test it.

On Fri, Jan 24, 2020, 20:13 caiello3 notifications@github.com wrote:

Hello,

I have been working on a project based on the Arduino MKR NB 1500, which has a SAM based controller. I know this is for AVR based controllers only, but what I'm wondering is if it is possible to make this compatible with SAM based controllers? I am relatively new to coding, so I'm not sure if the dependency is only on the avr/wdt.h or if it is deeper rooted than that. From what I've read there is a WDT for the MKR NB 1500's SAM D21 controller. Sorry for the ignorance here.

Thanks!

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/cyrusbuilt/ArduinoCrashMonitor/issues/3?email_source=notifications&email_token=AAXDSNGYVC63IOWZ6Q66X5LQ7OG3TA5CNFSM4KLODUC2YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4IIU7BVA, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAXDSNGCTNGD4Q63YPJEOVLQ7OG3TANCNFSM4KLODUCQ .

caiello3 commented 4 years ago

that would be awesome if you made a SAM-compatible version. Is that something you'd be interested/able to do anytime soon? I would be willing to mail you one of my SAM-based boards (MKR NB 1500) to test, assuming you'd send it back.

cyrusbuilt commented 4 years ago

I've already started working on it. I've figured out how to enable/disable the watchdog function on the D21 which is a little tricky because it requires synchronizing on some state flags, but still working out how to feed the watchdog and if possible also implement some type of crash logging/reporting like in the other 2 libraries. As for the hardware, that may not be be necessary if you would be willing to beta test the library for me.

On Sat, Jan 25, 2020 at 10:20 PM caiello3 notifications@github.com wrote:

that would be awesome if you made a SAM-compatible version. Is that something you'd be interested/able to do anytime soon? I would be willing to mail you one of my SAM-based boards (MKR NB 1500) to test, assuming you'd send it back.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/cyrusbuilt/ArduinoCrashMonitor/issues/3?email_source=notifications&email_token=AAXDSNGPICRQKDLJHZ5ENL3Q7T6PDA5CNFSM4KLODUC2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEJ5KYEI#issuecomment-578464785, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAXDSNH7JU46ESMKBMD3B3DQ7T6PDANCNFSM4KLODUCQ .

caiello3 commented 4 years ago

Hey Chris,

You rock for jumping into this so quickly! I may need some guidance on how to properly implement/ test it, as I'm pretty new to this, but I'm certainly more than happy to help.

Thanks! Chris

On Mon, Jan 27, 2020, 7:04 AM Chris Brunner notifications@github.com wrote:

I've already started working on it. I've figured out how to enable/disable the watchdog function on the D21 which is a little tricky because it requires synchronizing on some state flags, but still working out how to feed the watchdog and if possible also implement some type of crash logging/reporting like in the other 2 libraries. As for the hardware, that may not be be necessary if you would be willing to beta test the library for me.

Chris Brunner, CSM Senior Software Engineer c: 937.572.0801 o: 937.886.9166[image: Smart Data Logo] http://wearesmartdata.com/

On Sat, Jan 25, 2020 at 10:20 PM caiello3 notifications@github.com wrote:

that would be awesome if you made a SAM-compatible version. Is that something you'd be interested/able to do anytime soon? I would be willing to mail you one of my SAM-based boards (MKR NB 1500) to test, assuming you'd send it back.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub < https://github.com/cyrusbuilt/ArduinoCrashMonitor/issues/3?email_source=notifications&email_token=AAXDSNGPICRQKDLJHZ5ENL3Q7T6PDA5CNFSM4KLODUC2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEJ5KYEI#issuecomment-578464785 , or unsubscribe < https://github.com/notifications/unsubscribe-auth/AAXDSNH7JU46ESMKBMD3B3DQ7T6PDANCNFSM4KLODUCQ

.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/cyrusbuilt/ArduinoCrashMonitor/issues/3?email_source=notifications&email_token=AD7O5PBHJUUFMHDPCMLUJXDQ73EV3A5CNFSM4KLODUC2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEJ7IONQ#issuecomment-578717494, or unsubscribe https://github.com/notifications/unsubscribe-auth/AD7O5PAHDMWQ2E3KUKZQPLLQ73EV3ANCNFSM4KLODUCQ .

cyrusbuilt commented 4 years ago

I got the core library code and an example written and it compiles. Supports SAM D21 and D51 variants. I gotta write some support files in order to package it up as a library and run it through CI, but I should be able to have it completed sometime Tuesday (I think).

On Mon, Jan 27, 2020 at 9:17 AM caiello3 notifications@github.com wrote:

Hey Chris,

You rock for jumping into this so quickly! I may need some guidance on how to properly implement/ test it, as I'm pretty new to this, but I'm certainly more than happy to help.

Thanks! Chris

On Mon, Jan 27, 2020, 7:04 AM Chris Brunner notifications@github.com wrote:

I've already started working on it. I've figured out how to enable/disable the watchdog function on the D21 which is a little tricky because it requires synchronizing on some state flags, but still working out how to feed the watchdog and if possible also implement some type of crash logging/reporting like in the other 2 libraries. As for the hardware, that may not be be necessary if you would be willing to beta test the library for me.

On Sat, Jan 25, 2020 at 10:20 PM caiello3 notifications@github.com wrote:

that would be awesome if you made a SAM-compatible version. Is that something you'd be interested/able to do anytime soon? I would be willing to mail you one of my SAM-based boards (MKR NB 1500) to test, assuming you'd send it back.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub <

https://github.com/cyrusbuilt/ArduinoCrashMonitor/issues/3?email_source=notifications&email_token=AAXDSNGPICRQKDLJHZ5ENL3Q7T6PDA5CNFSM4KLODUC2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEJ5KYEI#issuecomment-578464785

, or unsubscribe <

https://github.com/notifications/unsubscribe-auth/AAXDSNH7JU46ESMKBMD3B3DQ7T6PDANCNFSM4KLODUCQ

.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub < https://github.com/cyrusbuilt/ArduinoCrashMonitor/issues/3?email_source=notifications&email_token=AD7O5PBHJUUFMHDPCMLUJXDQ73EV3A5CNFSM4KLODUC2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEJ7IONQ#issuecomment-578717494 , or unsubscribe < https://github.com/notifications/unsubscribe-auth/AD7O5PAHDMWQ2E3KUKZQPLLQ73EV3ANCNFSM4KLODUCQ

.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/cyrusbuilt/ArduinoCrashMonitor/issues/3?email_source=notifications&email_token=AAXDSNHRCP6K5YV6HWGLHNDQ73UGRA5CNFSM4KLODUC2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEJ7UUNY#issuecomment-578767415, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAXDSNFUVKSVLGK4PA2BID3Q73UGRANCNFSM4KLODUCQ .

caiello3 commented 4 years ago

Awesome! I'll be on the lookout and ready to test when it's ready.

On Mon, Jan 27, 2020, 1:28 PM Chris Brunner notifications@github.com wrote:

I got the core library code and an example written and it compiles. Supports SAM D21 and D51 variants. I gotta write some support files in order to package it up as a library and run it through CI, but I should be able to have it completed sometime Tuesday (I think).

Chris Brunner, CSM Senior Software Engineer c: 937.572.0801 o: 937.886.9166[image: Smart Data Logo] http://wearesmartdata.com/

On Mon, Jan 27, 2020 at 9:17 AM caiello3 notifications@github.com wrote:

Hey Chris,

You rock for jumping into this so quickly! I may need some guidance on how to properly implement/ test it, as I'm pretty new to this, but I'm certainly more than happy to help.

Thanks! Chris

On Mon, Jan 27, 2020, 7:04 AM Chris Brunner notifications@github.com wrote:

I've already started working on it. I've figured out how to enable/disable the watchdog function on the D21 which is a little tricky because it requires synchronizing on some state flags, but still working out how to feed the watchdog and if possible also implement some type of crash logging/reporting like in the other 2 libraries. As for the hardware, that may not be be necessary if you would be willing to beta test the library for me.

Chris Brunner, CSM Senior Software Engineer c: 937.572.0801 o: 937.886.9166[image: Smart Data Logo] http://wearesmartdata.com/

On Sat, Jan 25, 2020 at 10:20 PM caiello3 notifications@github.com wrote:

that would be awesome if you made a SAM-compatible version. Is that something you'd be interested/able to do anytime soon? I would be willing to mail you one of my SAM-based boards (MKR NB 1500) to test, assuming you'd send it back.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub <

https://github.com/cyrusbuilt/ArduinoCrashMonitor/issues/3?email_source=notifications&email_token=AAXDSNGPICRQKDLJHZ5ENL3Q7T6PDA5CNFSM4KLODUC2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEJ5KYEI#issuecomment-578464785

, or unsubscribe <

https://github.com/notifications/unsubscribe-auth/AAXDSNH7JU46ESMKBMD3B3DQ7T6PDANCNFSM4KLODUCQ

.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub <

https://github.com/cyrusbuilt/ArduinoCrashMonitor/issues/3?email_source=notifications&email_token=AD7O5PBHJUUFMHDPCMLUJXDQ73EV3A5CNFSM4KLODUC2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEJ7IONQ#issuecomment-578717494

, or unsubscribe <

https://github.com/notifications/unsubscribe-auth/AD7O5PAHDMWQ2E3KUKZQPLLQ73EV3ANCNFSM4KLODUCQ

.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub < https://github.com/cyrusbuilt/ArduinoCrashMonitor/issues/3?email_source=notifications&email_token=AAXDSNHRCP6K5YV6HWGLHNDQ73UGRA5CNFSM4KLODUC2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEJ7UUNY#issuecomment-578767415 , or unsubscribe < https://github.com/notifications/unsubscribe-auth/AAXDSNFUVKSVLGK4PA2BID3Q73UGRANCNFSM4KLODUCQ

.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/cyrusbuilt/ArduinoCrashMonitor/issues/3?email_source=notifications&email_token=AD7O5PENGPZNYBXXPH4TARLQ74RUDA5CNFSM4KLODUC2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEKARWBQ#issuecomment-578886406, or unsubscribe https://github.com/notifications/unsubscribe-auth/AD7O5PAOBLDS5U2CR3HTZSLQ74RUDANCNFSM4KLODUCQ .

cyrusbuilt commented 4 years ago

It's not done, but keep an eye on this repo: https://github.com/cyrusbuilt/SAMCrashMonitor

So far it builds fine in CI: https://travis-ci.com/cyrusbuilt/SAMCrashMonitor/builds/146275020

cyrusbuilt commented 4 years ago

Ok its ready for testing. Download the source as zip and extract it to the 'lib' folder in your PlatformIO project, or if you are using the Arduino IDE following whatever instructions for manually installing libraries. Once installed, you can include it in your sketch with:

include "SAMCrashMonitor.h"

And then in your setup() function add:

SAMCrashMonitor.dump(Serial); int timeoutActual = SAMCrashMonitor.enableWatchdog(); Serial.print("Watchdog enabled with timeout value: "); Serial.println(timeoutActual);

and in your loop() function add: SAMCrashMonitor.iAmAlive();

If you want to force a hang and test the reset, add the following either in your loop() or setup() after enabling the watchdog:

while(true) { ;; }

Let me know how it behaves. Assuming it works as expected, I'll release the library to the PlatformIO library registry so it can be installed with 'pio lib install SAMCrashMonitor'.

caiello3 commented 4 years ago

I will test tonight and let you know how it goes. If I encounter any issues I'll document them in the SAMCrashMonitor repo.