FEZ spider with SEEED cellular radio reseting

Hi, I am trying to receive SMS through cellular radio. Problem comes when it registers itself to GSM network. I have disabled PIN on simcard. And I supply it by USB. I even tried power source that gives up to 2Amp, but still didn’t work. I have USB DP. I use visual studio 2012 and 4.3 microframework.

Anyone know why it resets? I tried to read in different posts, but couldn’t find this problem.

Show us your code, and take a picture of your setup.

Maybe try shorter wires.

1 Like

Print the replies from the AT commands to the debug output and post here what you are seeing. SMS is the easiest to get going.

Remember too, to set the SMS commands for TEXT mode (AT+CMGS=1) or it won’t work if you are using sending TEXT based commands. The default on most modems is PDU mode.

So there’s my code, I am using PowerOn function made by GHI, which should be


public void PowerOn()
		{
			if (this.powerOn) throw new InvalidOperationException("The module is already powered on.");

			this.serial.DiscardInBuffer();
			this.serial.DiscardOutBuffer();

			this.power.Write(false);
			Thread.Sleep(1000);
			this.power.Write(true);
			Thread.Sleep(2200);

			this.powerOn = true;
			this.running = true;
			this.responseBuffer = "";
			this.worker = new Thread(this.DoWork);
			this.worker.Start();

			this.SendATCommand("AT");

			//Disable echo
			this.SendATCommand("ATE0");

			//Set SMS mode to text
			this.SendATCommand("AT+CMGF=1");
			this.SendATCommand("AT+CSDH=0");

			// Set the phonebook to be stored in the SIM card
			this.SendATCommand("AT+CPBS=\"SM\"");

			// Set the sms to be stored in the SIM card
			this.SendATCommand("AT+CPMS=\"SM\"");

			// Sets how connected lines are presented
			this.SendATCommand("AT+COLP=1");

			// Enable GPRS network registration status
			this.SendATCommand("AT+CGREG=0");

			// Enable GSM network registration status
			this.SendATCommand("AT+CREG=1");
		}

My code:


using System;
using System.Collections;
using System.Threading;
using Microsoft.SPOT;
using Microsoft.SPOT.Presentation;
using Microsoft.SPOT.Presentation.Controls;
using Microsoft.SPOT.Presentation.Media;
using Microsoft.SPOT.Presentation.Shapes;
using Microsoft.SPOT.Touch;

using Gadgeteer.Networking;
using GT = Gadgeteer;
using GTM = Gadgeteer.Modules;
using Gadgeteer.Modules.GHIElectronics;

namespace GadgeteerApp1
{
    public partial class Program
    {
        //VARIABLES
        GT.Timer timer = new GT.Timer(5000);
        TimeSpan uptime = GT.Timer.GetMachineTime();
        
        // MAIN PROGRAM --- This method is run when the mainboard is powered up or reset.   
        void ProgramStarted()
        {           
            //Event handlers initialization
            //Cellular radio
            cellularRadio.ModuleInitialized += new CellularRadio.ModuleInitializedHandler(cellularRadio_ModuleInitialized);
            //Button
            button.ButtonPressed += new Button.ButtonEventHandler(button_ButtonPressed);
            button2.ButtonPressed += new Button.ButtonEventHandler(button2_ButtonPressed);
            //Timers
            timer.Tick += new GT.Timer.TickEventHandler(timer_Tick);
            /* Phone state request handlers */
            cellularRadio.PhoneActivityRequested += new CellularRadio.PhoneActivityRequestedHandler(cellularRadio_PhoneActivityRequested);
            cellularRadio.PinStateRequested += new CellularRadio.PinStateRequestedHandler(cellularRadio_PinStateRequested);
            cellularRadio.SignalStrengthRequested += new CellularRadio.SignalStrengthRequestedHandler(cellularRadio_SignalStrengthRequested);
            cellularRadio.GsmNetworkRegistrationChanged += new CellularRadio.GsmNetworkRegistrationChangedHandler(cellularRadio_GsmNetworkRegistrationChanged);
            /* SIM information requests handlers */
            cellularRadio.OperatorRequested += new CellularRadio.OperatorRequestedHandler(cellularRadio_OperatorRequested);
            cellularRadio.ImeiRequested += new CellularRadio.ImeiRequestedHandler(cellularRadio_ImeiRequested);
            /* Network states handlers */
            cellularRadio.GprsAttached += new CellularRadio.GprsAttachedHandler(cellularRadio_GprsAttached);
            /* SMS & call handlers */
            cellularRadio.SmsReceived += new CellularRadio.SmsReceivedHandler(cellularRadio_SmsReceived);
            cellularRadio.SmsListRequested += new CellularRadio.SmsListRequestedHandler(cellularRadio_SmsListRequested);
            //Handlers END

            //Debug things turned on
            Mainboard.SetDebugLED(true);
            button.TurnLedOn();
            //Power on modules
            cellularRadio.DebugPrintEnabled = true;
            cellularRadio.PowerOn(40);

            //Main part of program
            uptime = GT.Timer.GetMachineTime();

            Debug.Print("Program Started at " + uptime.Minutes + "m " + uptime.Seconds + "s");
//            timer.Start();
        }


/*timers */
        void timer_Tick(GT.Timer timer)
        {
            uptime = GT.Timer.GetMachineTime();

            Debug.Print("Uptime: " + uptime.Minutes +"m "+ uptime.Seconds +"s");
        }
/*button handlers*/
        void button_ButtonPressed(Button sender, Button.ButtonState state)
        {
            uptime = GT.Timer.GetMachineTime();

            Debug.Print("button: " + uptime.Minutes + "m " + uptime.Seconds + "s");
        }

        void button2_ButtonPressed(Button sender, Button.ButtonState state)
        {
            uptime = GT.Timer.GetMachineTime();

            Debug.Print("button2: " + uptime.Minutes + "m " + uptime.Seconds + "s");
            cellularRadio.RequestSms(1,true);

        }

/*cellular radio handlers*/
        void cellularRadio_ModuleInitialized(CellularRadio sender)
        {
            uptime = GT.Timer.GetMachineTime();

            Debug.Print("Cellular radio initialized at " + uptime.Minutes + "m " + uptime.Seconds + "s");
        }
        /* Phone state request handlers */
        void cellularRadio_PhoneActivityRequested(CellularRadio sender, CellularRadio.PhoneActivity activity)
        {
            Debug.Print("Phone activity: ");
            switch (activity.ToString())
            {
                case "0": Debug.Print("Ready"); break;               //     The module couldn't find a network.
                case "1": Debug.Print("Ringing"); break;             //     The module is registered to a network.  
                case "2": Debug.Print("CallInProgress"); break;      //     The module is searching for a network.
                case "3": Debug.Print("Unknown"); break;             //     The module tried to register to a network, but it was denied.
                case "4": Debug.Print("CommLineBusy"); break;        //     Unknown failure.
            }
        }
        void cellularRadio_PinStateRequested(CellularRadio sender, CellularRadio.PinState state)
        {
            uptime = GT.Timer.GetMachineTime();

            Debug.Print("Uptime: " + uptime.Minutes + "m " + uptime.Seconds + "s");
            Debug.Print("Pin state:" + state.ToString());
            
            switch (state.ToString())
            {
                case "0": Debug.Print("Ready"); break;           //     The SIM is unlocked and ready to be used.
                case "1": Debug.Print("Pin"); break;             //     The SIM is locked waiting for the PIN.
                case "2": Debug.Print("Puk"); break;             //     The SIM is locked waiting for the PUK.
                case "3": Debug.Print("PhPin"); break;           //     The SIM is waiting for phone to SIM card (antitheft).
                case "4": Debug.Print("PhPuk"); break;           //     The SIM is waiting for phone to SIM PUK (antitheft).
                case "5": Debug.Print("Pin2"); break;            //     The SIM is waiting for second PIN.
                case "6": Debug.Print("Puk2"); break;            //     The SIM is waiting for second PUK.
                case "7": Debug.Print("NotPresent"); break;      //     The SIM is not present.
            }
        }

        void cellularRadio_SignalStrengthRequested(CellularRadio sender, CellularRadio.SignalStrength state)
        {
            Debug.Print("Signal strength:" + state.ToString());
        }

        void cellularRadio_GsmNetworkRegistrationChanged(CellularRadio sender, CellularRadio.NetworkRegistrationState networkState)
        {
            CellularRadio.ReturnedState state;
            uptime = GT.Timer.GetMachineTime();

            Debug.Print("Uptime: " + uptime.Minutes + "m " + uptime.Seconds + "s");
            Debug.Print("GSM network state:" + networkState.ToString());
            switch(networkState.ToString())
            {
                case "0":
                    {
                        Debug.Print("NotSearching"); 
                        break;
                    }   //     The module couldn't find a network.
                case "1": { 
                    Debug.Print("Registered");
                    break; 
                }       //     The module is registered to a network.  
                case "2": Debug.Print("Searching"); break;              //     The module is searching for a network.
                case "3": Debug.Print("Registration Denied"); break;     //     The module tried to register to a network, but it was denied.
                case "4": Debug.Print("Unknown failure"); break;        //     Unknown failure.
                case "5": Debug.Print("Error"); break;                  //     There was an error.
            }
            cellularRadio.RequestSignalStrength();
        }

        /* SIM information requests handlers */
        void cellularRadio_OperatorRequested(CellularRadio sender, string operatorName)
        {
            Debug.Print("Operator:" + operatorName);
        }

        void cellularRadio_ImeiRequested(CellularRadio sender, string imei)
        {
            Debug.Print("IMEI:" + imei);
        }

        /* Network states handlers */
        void cellularRadio_GprsAttached(CellularRadio sender, string ipAddress)
        {
            uptime = GT.Timer.GetMachineTime();

            Debug.Print("Uptime: " + uptime.Minutes + "m " + uptime.Seconds + "s");
            Debug.Print("IP adress:" + ipAddress);
        }

        /* SMS & call handlers */
        void cellularRadio_SmsListRequested(CellularRadio sender, ArrayList smsList)
        {
            int length = 0;
            int unread = 0;

            uptime = GT.Timer.GetMachineTime();

            Debug.Print("Uptime: " + uptime.Minutes + "m " + uptime.Seconds + "s");
            Debug.Print("Sms list:");
            length = smsList.Capacity;
            foreach (CellularRadio.Sms sms in smsList)
            {
                if (sms.Status == CellularRadio.SmsState.ReceivedUnread)
                    unread++;
            }

            Debug.Print("You have " + unread.ToString() + " unread messages.");
        }

        void cellularRadio_SmsReceived(CellularRadio sender, CellularRadio.Sms message)
        {
            uptime = GT.Timer.GetMachineTime();

            Debug.Print("Uptime: " + uptime.Minutes + "m " + uptime.Seconds + "s");
            Debug.Print("SMS:" + message.ToString());
            message.Status = CellularRadio.SmsState.ReceivedRead;
        }
    }
}


And I don’t know ho to get those AT commands responses, I used cellularRadio.DebugPrintEnabled = true; yet nothing shows in Output window :frowning:

Thus my output is
The thread ‘’ (0x2) has exited with code 0 (0x0).
Using mainboard GHI Electronics FEZ Spider version 1.0
Program Started at 1m 23s
The thread ‘’ (0x3) has exited with code 0 (0x0).
Uptime: 2m 5s
Pin state:0
Ready
Uptime: 2m 6s
GSM network state:2
Searching
Signal strength:0
The thread ‘’ (0x6) has exited with code 0 (0x0).
Cellular radio initialized at 2m 7s
Uptime: 2m 15s
GSM network state:1
Registered

I deleted my prev replies because I don’t think they contributed anything to the issues at hand here. I’m clearly not Gadgeteer-oriented enough. I will fix that by stocking up on a bunch of gadgeteer toys after the May 1 product announcements. Apologies for the noise.

By the way - you may want to read this too since it is a similar sms issue with the Seeed board : https://www.ghielectronics.com/community/forum/topic?id=12072

@ mcalsyn - Get back to work, my slush fund is in need of topping up :naughty:

Sorry Bill - told my wife I would only work half days from now on, so 12 hrs will have to do.

1 Like

@ mcalsyn - Good lad, now get those updates finished - it’s release time :wink:

1 Like

Try power it through the connector. USB is not enough for this module. Btw, that is clearly stated in the product page ;).

1 Like

@ mcalsyn - Based on your use of the medium length Gadgeteer cables if have never succeeded. Find the shortest one you can, or create your own with thick wires and the gplug or breakout module.

As I wrote before, I tried to power it through connector and i tried it now several times, still nothing. I will try change SIM card for different operetor.

just changing to a separate power supply may not be enough - what were the properties of that power pack ? In particular, how many amps can it supply (as you need that level of capacity in peak times with that module)

9V and 2amp, 18w max

I tried new project and It works! dunno what was blocking it