I have a project that uses a SIM800L GSM Module to receive commands and also to send data back home. Everything works 99.9% of the time but occasionally, the SIM800L will cause the whole system to lock up and only a reset will put things back right.
My project spends most of its time sleeping in Low Power Sleep Mode but wakes up on the hour to power up the GSM to listen for SMS messages. It’s then that the problem happens. It can work for hours or days without issue and then suddenly everything locks up when it comes to listening for an SMS message.
I believe I’ve narrowed the problem down to one of two possible causes.
This is what I think is most likely… The GSM Module sometimes cannot register to the network when it wakes up and that causes some sort of problem in the code which has not been handled correctly.
My network provider is fond of sending a dozen spam SMS messages per week advertising the next great package. Perhaps the code doesn’t know how to handle / reject them properly and that’s causing an issue somewhere?
The code I used to receive and process SMS messages was borrowed from the internet and adapted for my needs but I’m not entirely confident of it.
The project should wake up, check for the first SMS message stored on the SIM and if that SMS comes from the master number, process it. Otherwise, ignore the message and delete it and then go back to sleep again.
Somewhere along the lines, something is going wrong and bringing the process to a grinding halt.
The functions used are attached below.
Any help greatly received!
Code.txt (10.7 KB)