Main Site Documentation

Confused using cellular radio module


#1

I try it years ago, but not success. Now I try again, still bad.
There are several drivers for GHI driver, Seed driver, Byron’s Driver, Progressio’s Driver.
Also, there isn’t existing a Tutorial for this. It is hard to start it.

I review the forums trying a code to start but not success.

    public partial class Program
    {
        // This method is run when the mainboard is powered up or reset.   
        void ProgramStarted()
        {
            /*******************************************************************************************
            Modules added in the Program.gadgeteer designer view are used by typing 
            their name followed by a period, e.g.  button.  or  camera.
            
            Many modules generate useful events. Type +=<tab><tab> to add a handler to an event, e.g.:
                button.ButtonPressed +=<tab><tab>
            
            If you want to do something periodically, use a GT.Timer and handle its Tick event, e.g.:
                GT.Timer timer = new GT.Timer(1000); // every second (1000ms)
                timer.Tick +=<tab><tab>
                timer.Start();
            *******************************************************************************************/


            // Use Debug.Print to show messages in Visual Studio's "Output" window during debugging.
            Debug.Print("Program Started");
            cellularRadio.DebugPrintEnabled = true;
            cellularRadio.PowerOn(40);
            cellularRadio.SendATCommand("AT");
            cellularRadio.SendATCommand("AT+CPIN=0000");
            cellularRadio.SendATCommand("AT+CMGF=1");
            cellularRadio.SmsReceived += new CellularRadio.SmsReceivedHandler(cellularRadio_SmsReceived);
            cellularRadio.SmsRetrieved += new CellularRadio.SmsRetrievedHandler(cellularRadio_SmsRetrieved);
            cellularRadio.ModuleInitialized += new CellularRadio.ModuleInitializedHandler(cellularRadio_ModuleInitialized);
            
        }

       
        void cellularRadio_SmsRetrieved(CellularRadio sender, CellularRadio.Sms message)
        {
            if (message != null)
            {
                Debug.Print("RETRIEVED");
                Debug.Print("FROM: " + message.TelephoneNumber);
                Debug.Print("MSG: " + message.TextMessage);
                Debug.Print("WHEN: " + message.Timestamp);
                Debug.Print("STATUS: " + message.Status);
                Debug.Print("POS:" + message.Index);
            }
        }

        void cellularRadio_ModuleInitialized(CellularRadio sender)
        {
            Debug.Print("MODULE INITIALIZED");
        }

        void cellularRadio_SmsReceived(CellularRadio sender, CellularRadio.Sms message)
        {
            if (message != null)
    {
        Debug.Print("NEW SMS");
        Debug.Print("FROM: " + message.TelephoneNumber);
        Debug.Print("MSG: " + message.TextMessage);
        Debug.Print("WHEN: " + message.Timestamp);
        Debug.Print("STATUS: " + message.Status);
        Debug.Print("POS:" + message.Index);
    }
        }
    }

output

[quote]Program Started
The thread ‘’ (0x3) has exited with code 0 (0x0).
CellularRadio : Turning ON
CellularRadio : Turning module on
CellularRadio : <
RDY

CellularRadio : <
+CREG: 2

+CREG: 0

+CGREG: 0

+CFUN: 1

+CPIN: SIM PIN

CellularRadio : <AT

OK

CellularRadio : SENT: AT

CellularRadio : SENT: AT+CMGF=1

CellularRadio : <AT+CMGF=1

OK

CellularRadio : SENT: AT+CSDH=0

CellularRadio : <AT+CSDH=0

ERROR

CellularRadio : SENT: AT+CPBS=“SM”

CellularRadio : SENT: AT+CPMS=“SM”

CellularRadio : <AT+CPBS=“SM”

ERROR
AT+CPMS=“SM”

ERROR

CellularRadio : SENT: AT+CNMI=2,1,0,1,0

CellularRadio : SENT: AT+COLP=1

CellularRadio : <AT+CNMI=2,1,0,1,0

ERROR
AT+COLP=1

ERROR

CellularRadio : SENT: AT+CGREG=1

CellularRadio : SENT: AT+CREG=1

The thread ‘’ (0x5) has exited with code 0 (0x0).
CellularRadio : <AT+CGREG=1

OK
AT+CREG=1

OK

[/quote]


#2

Thanks, the problem is the pin code.
I disable the pin code check.
Now the SMS receive and send can work now.
Next step is using GPRS part to post data.
I will still study and test.


#3

Let us know how it goes, the cellular module is indeed not working very well for many.

And please post, it looks like your code is pretty well-structured.

The GPRS connection with the cellular module has never been possible to me.

Cheers


#4

The problems is that there are many methods the module provides.
For example,

 cellularRadio.AttachGPRS();
            cellularRadio.ConfigureTCPServer();
            cellularRadio.ConnectTCP();
            cellularRadio.SendTcpData();

But we don’t know what methods we should use,for GPRS and the order for using this method?
Do we use AT command before using this method?


#5

Report:

I test GPRS by follow code , seems has a progress but still has error.
Anyone can point me what’s wrong for my steps or code.
Thank you very much.

void ProgramStarted()
        {
          
            // Use Debug.Print to show messages in Visual Studio's "Output" window during debugging.
            Debug.Print("Program Started");
            cellularRadio.DebugPrintEnabled = true;
            cellularRadio.PowerOn(5);
            cellularRadio.SendATCommand("AT");
            cellularRadio.SendATCommand("AT+CGATT=1");
            cellularRadio.SendATCommand("AT+CGDCONT=1,\"IP\",\"CMNET\"");
            cellularRadio.SendATCommand("AT+CGACT=1,1");
           
            cellularRadio.AttachGPRS("internet","","");
                      
            cellularRadio.GprsNetworkRegistrationChanged += new CellularRadio.GprsNetworkRegistrationChangedHandler(cellularRadio_GprsNetworkRegistrationChanged);
           

        }
		
		void cellularRadio_GprsNetworkRegistrationChanged(CellularRadio sender, CellularRadio.NetworkRegistrationState networkState)
        {
            Debug.Print("GPRS");           
            Debug.Print(networkState.ToString()) ;
            cellularRadio.ConnectTCP("www.google.com",80);
        }
		

#6

The other post is that I face a problem for using Byron’s driver.
Thanks Byron, he is help me.

And the post here,is that I was trying to use GHI’s driver to do the GPRS steps by steps.