Long nights with the cellular module

I am a mess! I have been messing around with the cellular module and cannot get it to work. I have been changing here and there in the driver, but nothing seems to help. The AT command docs are pretty messy and unclear as well.

Can anyone have a look at the output and give me a clue about the problem:

CellularRadio : Turning ON
CellularRadio : Turning module on
CellularRadio : SENT: AT+CPAS
CellularRadio : SENT: AT+CREG?
CellularRadio : <AT+CREG?
+CREG: 1,0
OK
>
GSM Network Registered
CellularRadio : <AT
OK
>
CellularRadio : SENT: AT
CellularRadio : SENT: AT+CMGF=1
CellularRadio : <AT+CMGF=1
OK
>
CellularRadio : SENT: AT+CSDH=0
CellularRadio : SENT: AT+CPBS="SM"
CellularRadio : <AT+CSDH=0
ERROR
AT+CPBS="SM"
ERROR
>
CellularRadio : SENT: AT+CPMS="SM"
CellularRadio : SENT: AT+CNMI=2,1,0,1,0
CellularRadio : <AT+CPMS="SM"
ERROR
AT+CNMI=2,1,0,1,0
ERROR
>
CellularRadio : SENT: AT+COLP=1
CellularRadio : SENT: AT+CGREG=1
CellularRadio : <AT+COLP=1
ERROR
AT+CGREG=1
OK
>
CellularRadio : SENT: AT+CREG=1
CellularRadio : <AT+CREG=1
OK
>
CellularRadio : SENT: AT+CGREG?
CellularRadio : <AT+CGREG?
+CGREG: 1,0
OK
>
GPRS Network Registered
CellularRadio : SENT: AT+GSN
CellularRadio : <AT+GSN
861785009051446
OK
>
IMEI: 861785009051446
CellularRadio : SENT: AT+CIPMODE=1
CellularRadio : <AT+CIPMODE=1
ERROR
>
CellularRadio : SENT: AT+CSTT="bredband.oister.dk","",""
CellularRadio : SENT: AT+CIICR
CellularRadio : <AT+CSTT="bredband.oister.dk","",""
ERROR
AT+CIICR
ERROR
>
CellularRadio : <AT+CIFSR
ERROR
>
CellularRadio : SENT: AT+CIFSR

step by step, get your at command guide and find out why you get the first error :

CellularRadio : SENT: AT+CSDH=0
CellularRadio : SENT: AT+CPBS="SM"
CellularRadio : <AT+CSDH=0
ERROR

I’m not sure if the error comes from the SIM phonebook setting or hiding the Text Mode Parameters but this is the starting point. Deduction Watson :wink:

Feeling your pain NJBUCH! Trying to set up mine as a TCP server. Getting closer. Think you’re missing some command setups. Try adding these:

AT+CLPORT=“TCP”,“port # here”

AT+CIPCSGP=1,“apn here”,"",""

AT+CGDCONT=1,“apn here”,"",""

AT+CGATT=1

AT+CSNS=4

AT+CIPSERVER=1,2100

Should also check signal strength with AT+CSQ

Check that your on the network with AT+COPS?

Good luck! Please post your solution if you get it first!

Thanks logitechs, will try some of this…

Still wondering how anyone has gotten an IP connection up with this driver.

Will indeed share if I get it up and running.

Are you modifying the driver from Byron, or are you doing something new?

I’ve tinkered with the driver and simply doing some secondary activations after the driver does its thing. Still haven’t got it to get the static IP and allow TCP/IP connection.

Now I am really getting frustrated about this cellular module! I have NOT been able to even create a connection to anything yet.

I am thinking that the messages coming from the Sim900 chip is very limited and looking for hardcore debugging options… “ERROR” does not really help a lot :frowning:

Furthermore it could be feasible to connect the module directly to a terminal application on my pc to have a “direct interaction” - is that possible…like the camera module?

Any advice on documentation, debugging tips, and debugging tools are VERY WELCOME!

any time you send serial text to control a device, you csn “emulate” that using a PC and a terminal program, yes.

My suggestion: step through each command and tell which one is failing. ERROR is about the best you’ll get, but at least you’ll know what line threw it and therefore what probable causes were

edit: I also alerted Byron to this thread (he isn’t on here much) so he might pop over and help share his thoughts.

@ njbuch

The first steps are to:

  1. Test the SIM in a phone and see if it works
  2. Test the module with the default driver, debug mode on
  3. Consider next steps :slight_smile:

ERROR is a generic response indicating the command was not accepted, sorry if I’m repeating the obvious. There is also a special case, from the manual:

It’s unlikely you’re hitting this special case. Much more likely is that the module is busy, you didn’t give it at least 40 seconds to power up, or there is a problem with the SIM card (functionality not supported?)

Please also make sure you are using a recent version of the AT command manual (I’ve got 1.03 here) because some of the early ones had even less information.

Can you please post examples of how you are interacting with the driver? It’s very sensitive to order of operations and correct state interlocking. It’s worth having the TCP application note as well “SIM900_TCPIP_Application Note_V1.02.pdf”.

I’m not sure you should be calling CIPMODE before you have a GPRS connection, for example. CIPMODE=1 (transparent data) requires a couple of other setup steps.

We wrote our own :slight_smile:

1 Like

Great, this sounds promising. I just had a look in to application note - wondering why this document has sneaked outside my attention - it should be possible to mingle something better out of the chip with this.

I will use the next week on trying out your ideas. And report back.

I know that my SIM card is not able to send SMS (not needed), but thinking how to have a status of possible functions supported by the SIM card (provider). Is it possible to have the chip tell me if IP-server is supported?

Thanks again!

SUCCESS! I finally figured out how to setup the cellular board as a TCP server! Here is my config steps:

  1. Use the PowerOn() command. Defaults to wait 40 seconds after cycling the power.
  2. Have your program wait the 40 seconds also because the PowerOn() command won’t.
  3. Use SendATCommand(“AT+CIPMUX=1”) command.
  4. Wait 2 seconds.
  5. Use SendATCommand(“AT+CSTT=“your APN here””)
  6. Wait 2 seconds.
  7. Use SendATCommand(“AT+CGDCONT=1,“IP”,“your APN here”,”",0,0")
  8. Wait 2 seconds.
  9. Use SendATCommand(“AT+CIICR”)
  10. Wait 5 seconds. This brings up the GPRS wireless connection so it take a bit of time.
  11. Use SendATCommand(“AT+CIFSR”)
  12. Wait 2 seconds. IP address retrieved from service provide should display!
  13. Use SendATCommand(“AT+CIPSERVER=1,“port number here””) Service provider must provide you with this valid port number!
  14. Debug window should display SERVER OK!
  15. Attempt a socket connection to IP shown with your computer. Typed characters will display in the debug window.

Now I need to figure out how to use the received data. Doesn’t seem to be an event for it. Thoughts???

2 Likes

@ logictechs - Good job! :slight_smile:

@ logictechs - Really good job! I owe you a few beers, I wish we could sit down and discuss how to proceed from here over a few pints!

Anyway, as I understand the application note, each connection to the server is allocated a number, and you get the “+RECEIVE,0,39<insert 39 bytes of data here>” for each transmission to the server. That’s the closest we get an event-trigger I think.

If you maintain the CellularRadioManager.cs and CellularRadio_42.cs, you should add the parsing of this string to the main thread and create corresponding event handlers for it.

There is still lots of coding to do.

Meantime I have realized that my SIM-card was not M2M enabled, and I am waiting for a new one to arrive.

I’m actually trying to rewrite the driver now from Seeed website so it configs for server correctly. This way, we can use the commands implemented already in it and not have to do it in our app code. Then I’ll tinker with adding a server receive data event.

About your sim…my sim is activated with MO(mobile originated) and MT(mobile terminated). That means it can make and send a call(connection) from non-mobile devices only. Your MM config would only allow connections from another mobile device. Keep that in mind when you’re trying to connect from a desktop/laptop computer. You’ll only be able to connect with another mobile device. Unless you have the other options I listed activated also.

Scratch rewriting the driver to setup the modem as server idea! Figured out a much easier solution. We need to wait for the modem to register to the network. I was using a timer but then I thought about the network registration change event. So I came up with this event handler to ensure it’s are always ready as a server:

void cellularRadio_NetworkRegistrationEvent(CellularRadio sender, CellularRadio.NetworkRegistrationState networkState)
        {
            Debug.Print("NETWORK EVENT " + networkState);

            if (networkState == CellularRadio.NetworkRegistrationState.Registered)
            {
                cellularRadio.SendATCommand("AT+CIPMUX=1");
                cellularRadio.AttachGPRS("your APN here", "", "");
                cellularRadio.ConfigureTCPServer(your port number here);
                cellularRadio.SendATCommand("AT+CSQ");
            }
        }

The CIPMUX=1 is the fix to allow the normal driver functions to work correctly for server setup. I wanted to see the signal strength so I added the +CSQ command also. Now to figure out receiving and working with data.

Can someone add a “AT+CMEE=2” somewhere early to the driver? This will tell the modem to send a proper error message instead of just “ERROR”. Well, it works for all my GSM modems…

In my next attack I will try some extended error reporting!

I have been thinking about the approach. I am not sure about the GHI plans for a cellular module, so we are left a little dangling in regards to modifying the driver and how to collaborate on it??

drivers are on codeplex, feel free to propose changes here or there and GHI can look to include them. I’m sure Gus and team will love the input.

Note that the module supports 2 data modes, TRANSPARENT and AT. Transparent mode allows you to have freeform conversations with the server without the module getting in the way (it acts like a connected modem).

AT mode means you need to continue parsing AT responses and unsolicited response codes, which can make writing your higher-level application a little more difficult, as well as requiring more rework of the driver.