Looking for support with AT commands and troubleshooting knowledge (Hardware, Software). Arduino UNO, SIM800F GSM Shield.

Hello to everyone.
I will be very gratefull for support and knowledge sharing with AT commands and troubleshooting knowledge with hardware setup and software.
Hardware context :
  • Arduino Uno, SIM800F GSM shield , USB connection and power, Rx -Tx GSM connection strapped on Software Serial
  • Concerning SIM card. Inserted on a mobile phone, can send and receive SMS and phone communications. Data plan available.
Software context : I'm using Serial monitor to send AT commands and receive answers. Aim : to follow manually the proper AT sequence to send one piece of data to one field of one channel.
Code :
[code]
// Sending AT commands via Serial Monitor interface
#include<SoftwareSerial.h>
SoftwareSerial mySerial(2,3); // setting up GSM serial communication
void setup()
{
digitalWrite(8, HIGH); // Switching on GSM shield
delay(1100);
digitalWrite(8,LOW);
mySerial.begin(9600);
Serial.begin(9600);
Serial.println("Type AT command :");
}
void loop()
{
if (mySerial.available())
Serial.write(mySerial.read());
if (Serial.available())
mySerial.write(Serial.read());
}
[/code]
Setup :
  • AT returns OK, SMS ready, CALL ready
  • AT+CPIN? returns ready
As far I understand the proper sequence of AT commands to connect device to thingspeak server and send data should be this :
  • AT // is SIM800F ready ? good return is : OK
  • AT+CGREG? // is SIM800F registered on GPRS provider network ? good return is : +CGREG: 0,1 (edited)
  • AT+CGATT? // is GPRS attached or not ? good return is : +CGATT: 1
  • AT+CIPSHUT // resets previous IP session if any. good return is : SHUT OK
  • AT+CIPSTATUS // Check if IP stack is intitalized. good return is : STATE: IP INITIAL
  • AT+CIPMUX=0 // Sets single connection mode. good return is : OK
  • AT+CSTT="APN","","" // Starts task. good return is : OK
  • AT+CIPSTATUS // Not needed but for troubleshooting Check IP status. good return is : STATE: IP START
  • AT+CIICR // Brings up wireless connection. good return is : OK and quick flashing led (edited)
  • AT+CIPSTATUS // Not needed but for troubleshooting Check IP status. good return is : STATE: IP GPRSACT (edited)
  • AT+CIFSR // Gets local IP adress. good return is : anything else than "0.0.0.0"
  • AT+CIPSTART="TCP", "api.thingspeak....","80" // Starts connection with TCP protocol, TCP, domain name, port. good return is : CONNECT OK
  • AT+CIPSEND // Data sending request. good return is : >
  • > data string // Sends data to the proper field and channel
  • >#026 // Ctrl+Z input to indicate the end of data
  • AT+CIPSHUT // Shuts down UDP context. good return is : SHUT OK
At this time :
  • AT+CGREG? is returning : +CGREG: 1,0 which states : network registration is enabled, device is not registered and searching for operator's network (edited)
  • AT+CGATT? is returning : 0, which states GPRS is detached
  • AT+CIICR is returning +PDP: DEACT, ERROR
Question :
What may prevent network registration and getting a +CGREG: 0,1 return ? (edited)
How can I troubleshoot and assess actual situation ?
Thank you for your insights.

12 Comments

According to https://m2msupport.net/m2msupport/atcreg-network-registration/ +CREG: 1,0 means that it is registered to the home network and technology is GSM, whereas 0,1 would mean not registered or searching, GSM Compact service.
Thank you Walter for the answer and the link to m2m support.
I will give a fresh look to other commands and come back with further questions.
Ok.
AT+CREG=1 command leaded to a +CREG: 1,0 return meaning device is registered to home network with GSM access technology.
Next instructions :
AT+CGATT? returned +CGATT: 0 which mean GPRS is detached.
At+CGATT=1 keeps returning ERROR.
At this time I understand that i miss knowldege and information about the OSI model and how to make the right sequence to send data to thingspeak with the hardware i'm using.
AT OK, AT+CPIN? READY, AT+CREG? +CREG: 1,0 seems to be adequate for physical(1) and datalink(2) layers of OSI model.
AT+CGATT=1 seems to be for the network(3) layer. But GPRS connection is currently bugging and I don't know why, most probably because i'm not doing the right things. This because I definitly miss knowledge, and don't know where to find it.
Please help.
Edit1 : I don't kow if it helps. ATD*99# returned CONNECT, a bunch of signs, and finally NO CARRIER.
Edit2 : AT+CGATT=1 returned +CME ERROR : 100
https://forums.quectel.com/t/at-cgact-1-1-cme-error-100/4963 maybe??
Thank you Walter. ERROR 100 is unknown, which doesn't bring us any clue.
Do you know what is necessary (necessary and right conditions) before attaching GPRS, please ?
Notice the part where someone says it happened to them when they were already in a session.
I have never used gprs. My modem experience was in the era of dial-up (but I did use some fancy modems in those days.)
16:00:20.303 -> AT+CGDCONT?
16:00:20.303 -> +CGDCONT: 1,"IP","Free","0.0.0.0",0,0
16:00:20.350 -> +CGDCONT: 2,"IP","","0.0.0.0",0,0
16:00:20.397 -> +CGDCONT: 3,"IP","","0.0.0.0",0,0
16:00:20.444 ->
16:00:20.444 -> OK
Hello,
According to this site AT+CREG? will have different returns depending on a former AT+CREG write command...
  1. AT+CREG=0 followed by AT+CREG? will return 0,0 if device is not registered, 0,1 if device is registered, 0,2 if device is looking for a network, etc.
  2. AT+CREG=1 followed by AT+CREG? will return 1,0 if device is not registered, 1,1 if device is registered, 1,2 if device is looking for a network, etc.
  3. AT+CREG=2 followed by AT+CREG? will return 2,0,<netLac>,<netCellID>,(0-7) access technology if device is not registered, 2,1,<netLac>,<netCellID>,(0-7) access technology if device is registered, 2,2,<netLac>,<netCellID>,(0-7) access technology if device is looking for a network
So +CREG: 0,0 or +CREG: 1,0 or +CREG: 2,0 mean you're not connected to network.
So next command AT+CGATT=1 won't work.
So first action is to fix the reason why you can't connect to network and before this to know which network you want to connect to.
Same site is discussing here which AT commands corresponds to which network.
  1. +CREG: 1,1 2G – GSM (circuit switched)
  2. +CGREG: 1,1 2G data – GPRS (packet switched)
  3. +CEREG: 1,5 Cat M1 or NB-IoT
AT last...
I changed SIM, and the above sequence works.
So you have only one cause if you get +CREG:1,0 or +CGREG:1,0 : YOUR SIM DOESN'T WORK !!!
this is a cause to work with your provider.
It appears to me that the meaning of the return codes is vendor-specific. For some vendors, +CREG= sets the output format for +CREG? queries
Thank you, Emmanuel, for sharing that you got it working by switching your SIM card.
You are welcome Vinod.
After one month of wandering, I've found that my SIM is partially down, and my GSM shield too. Two problems without any diagnosing methods. SIM worked well in a mobile phone but didn't worked on 2G networks. It was unable to attach to GPRS.
Here are some AT commands that worked well, while SIM and SHIELD didn't...
Start by typing AT+CMEE=2 to get verbose error messages.
  1. if AT+CPIN? returns READY, it's not due to a PIN missing
  2. AT+CCID should return your SIM number
  3. if AT+CSMINS? returns you either +CSMINS: 0,1 or 1,1 your sim is inserted, 0,0 or 1,0 means it's not
  4. AT+CIMI should return your IMSI code which is needed for network registration
  5. AT+GSN should return you the IMEI code of your GSM chip
  6. AT+GMM should return you your GSM chip model
  7. AT&V should return you Default profile, User profile and Active profile, the last one is actual profile used, with parameters set to values shown. Go see your AT command manual for your GSM chip.
  8. AT+CSQ should return you a value <> 99, 0 is best.
The shield perfectly sent data to thingspeak, but didn't sent any SMS... So I spent days checking and testing working programs that didn't worked.
Partially working devices are time gluttons.

Sign in to comment.

Answers (0)

Communities

More Answers in the  ThingSpeak Community

Categories

Find more on Waveform Design and Signal Synthesis in Help Center and File Exchange

Asked:

on 23 May 2022

Commented:

on 2 Jun 2022

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!