I have an application that uses a Cell Notecard and send updates once per hour. The host is an ESP32 running Micropython. This application will run for 1 to 2 months posting every hour. And then it dies. I cannot easily access the device so it is very difficult to debug this. I can get someone to cycle power on the device at which point everything starts up again and runs normally.
The device moves around so sometimes it is out of cell range or has a poor connection. This is normal. It supposed to re-connect and continue to transmit when it comes back into range.
I’ve gone through your sample programs, but none of them seem to check and handle errors. I’m considering adding watchdogs to both the host and notecard at the next service interval. But this is a brute force patch. I would really we to handle any errors more gracefully.
My host firmware is very simple:
On power up:
- send {req: hub.set, product: UID, mode: minimum}
- send {req: card.wireless, mode: auto, method: primary}
- send {req: card.location.mode, mode: continuous}
Main loop:
- poll measurement data
- On the hour:
- send {req: note.update, file: sensors.db, note: measurements, body: [data]}
- send {req: hub.sync}
- loop ( send {req: hub.sync.status} ) until response contains “time”
The hourly update uses “note.update” because I don’t want a pile of queued up notes when the device is out of cell range. I also poll for the response to get the latest cell tower time so that I can update the host RTC. All of my loops have timeouts to break them in case the notecard fails to respond.
Is there other Notecard errors I should be checking? How can I know if the Notecard is “locked up”? And if somehow is locked, how can I reset it?
Thanks
Kevin