CelluarRadio 4.3 - Possible Fix for most of the errors

Hello,
I have played with the CelluarRadio 4.3 (CR) driver (only SMS in my case). and I did get errors in the Serial Run Thread. The erros was typical related to string parsing (unlegal char index (eg -1). the problem was that those erros was random, I could use the same method and send the same message, sometime it worked 8-10 times, other times none…
I was just close to give up and planed to write a simpler sms driver when I did one last try…
I just changed the Serial Run Thread.Sleep time on the bottom of the loop from 100 to 1000.
Voila, 99% of the errors was gone, I have attacked my modem with messages…with not any crash.
The only reason I can think of is that the modem live it’s (“own life”) and must be allowed to finish it workload before we request more. anyway just a guess.

This is this is my first project ever in netmf.
So please test it and test it again before prod.
If you running in to more “veird” bugs, try to change the sleep time, it used many places in the driver.

R.E


//CellularRadio_43.cs
//The orgin file is here: https://bitbucket.org/ghi_elect/gadgeteer/src/2567b2403077/Modules/GHIElectronics/CellularRadio/CellularRadio_43/?at=master

                }
//Line 1047
                Thread.Sleep(1000); //The fix, changed sleep time from 100 to 1000
            }
        }
        #endregion

1 Like

@ eikeland - Did you by any chance try experimenting with other sleep periods?

Yes,
Tried frst with 500ms but had one crash, after I changed to 1000ms no more crash.
The one crash was when my program first checked for messages after start, it might not happend if I let the program wait a few more second after start before check for messages. I will try it.

@ eikeland - Thanks. It looks like there is a flaw in the internal serial worker where it can occasionally mess up like you saw. We will look into improving its reliability. The 1000ms sleep should work for now.