Exceptions in Cellular module driver

Seems like the cellular module keeps getting in trouble.


#### Exception System.ArgumentOutOfRangeException - CLR_E_OUT_OF_RANGE (5) ####
#### Message: 
#### System.String::Substring [IP: 0000] ####
#### Gadgeteer.Modules.Seeed.CellularRadio::run [IP: 049b] ####

A first chance exception of type ‘System.ArgumentOutOfRangeException’ occurred in mscorlib.dll
CellularRadio : <[/quote]

This is something that pops up in the output debugger window when it tries to parse commands etc from the modem. I’ve haven’t tracked down the exact problem yet. Anyone else seen stuff like this with the cellular from Seeed?

Also, when this exception occur, sending and receiving of SMS becomes unstable.

Looks like the internal flag isModuleBusy is set, then Exception is happening and this flag never gets cleared out. The module gets in an inconsistent state where the driver waits for somthing to clear the busy flag, and all commands to the module is thrown away with the message that it’s still working (busy) on some prior command.

Let the stuff up and running last night and sendt a few SMS to the module now and then.

The module eventually stopped answering and VS.NET highlighted line 567 in the cellular module driver.

                    #region Check Sms Received (CMTI)
                    if (response.IndexOf("+CMTI:") > 0)

                        string cmd = "+CMTI:";
                        first = response.IndexOf(cmd) + cmd.Length;
                        last = response.IndexOf("\n", first);
                ----->  reply = (response.Substring(first, last - first)).Trim();
                        char[] sep = { ',' };
                        string[] split = reply.Split(sep);

                            int position = int.Parse(split[1]);
                            RetrieveSms(position, false);
                        catch (Exception)


Yep, you are right there where I was 1 year ago, its a shame that nothing has changed since then. By some serious debugging and tests you will probably be able to have the SMS stuff running reasonably stable.

My purpose of having the cellular module was TCP/IP and that was an impossible mission, I have been to send a few packets, and do some simple stuff, but the driver just ends up in inconsistent states that pulls the system down. I have given up on cellular with Gadgeteer with the current drivers. Some of us are crossing our fingers, that the 4.3 upgrade with PPP will motivate some folks to re-visit the driver and get us out of this tarpit.

1 Like

One year ago? Nothing have happened in a year? Really? If this has been a known bug for over a year and no one takes responsibility, why on earth is this product still shipping. It cannot do Text, cannot do TCP/IP and calls might work… This really is just an over priced dual-LED board… right now, sitting there blinking is all it can do. :wall:

Not being able to do SMS and Voice is a real show stopper for this project. I cannot believe I have to go and tell my boss that the $2-3k prototyping stuff I demanded we ordered from GHI can’t do the job after all.

This really, really is a shame. I was looking forward to ship .NET powered hardware. And lots of it.


I am glad I am not alone being a little to the dark side on this.

Afte some debugging, it seems that it all boils down to the serial port dropping some bits. Ow and then. The problem seems to be incomplete messages, line endings and so on… And that makes the parsing of commands go bananas. And that again can make the driver in an inconsistent state making the module not able to accept or send commands to the cellular device.

Hmm, thats probably good news, as this might get fixed in the 4.3? And with PPP things should be rolling nicely? :dance:

@ njbuch - do you think it’s a netmf related problem with the com port?

I’m about to start coding a custom board with a SIM900 module so if I find anything useful I will post it here…

@ Justin - If you havent bought the HW yet, you should look at the SIM900-DS or the Telit GL865-QUAD v3 module. Those also have PCM audio in/out if you want to digitize the call - or use an external DSP or Bluetooth stuff.

I’m about to order some dev boards with those so I can get digital sound.

@ danibjor - Audio isn’t needed in this project and the boards and parts are already sitting on my desk :slight_smile:

@ Justin - no worries. The SIM900 and SIM900-DS are pin compatible so it’s just a matter of swapping the module and drivers etc. should work.

Can someone else confirm there might be issues with serial that might have a role in these issues?

Serial works pretty reliably from my projects. I’d be surprised if it was a framework issue.

Hmm at least two issues fixed in latest gadgeteer core http://gadgeteer.codeplex.com/releases/view/119122

Both are related to linereceived which is Gadgeteer specific not netmf.

Hi Niels, I’ve not done any work with the Cellular Module yet but my own board running with a SIM900B is working fine with the G400 at 115200 bps and no handshaking at present. I am seeing no errors at all with the unit running for the last 24 hours. With the ChipworkX it was every few seconds at that speed.

I am starting work next week on adding TCP/IP via AT commands as I need the ability to download updates OTA and also send data to a server. It’s a stop gap until GHI comes out with working PPP. I’ll see then what happens with lots of data and hope that the G400 can keep up.

1 Like

Sounds super great. Thanks for info.

@ Dave McLaughlin - interesting. The standard cellular module driver is only using 19200 speed, and still fails on the Raptor.

Maybe it’s a problem with the use of the serialLine implementation in the module. I’ll dig more into this.