Better diagnostics
This commit is contained in:
@@ -9,6 +9,11 @@
|
|||||||
*
|
*
|
||||||
**************************************************************/
|
**************************************************************/
|
||||||
|
|
||||||
|
// Select your modem:
|
||||||
|
#define TINY_GSM_MODEM_SIM800
|
||||||
|
//#define TINY_GSM_MODEM_SIM900
|
||||||
|
//#define TINY_GSM_MODEM_M590
|
||||||
|
|
||||||
// Increase buffer fo see less commands
|
// Increase buffer fo see less commands
|
||||||
#define GSM_RX_BUFFER 256
|
#define GSM_RX_BUFFER 256
|
||||||
|
|
||||||
@@ -48,25 +53,36 @@ void setup() {
|
|||||||
// Set GSM module baud rate
|
// Set GSM module baud rate
|
||||||
SerialAT.begin(115200);
|
SerialAT.begin(115200);
|
||||||
delay(3000);
|
delay(3000);
|
||||||
|
|
||||||
// Restart takes quite some time
|
|
||||||
// To skip it, call init() instead of restart()
|
|
||||||
modem.restart();
|
|
||||||
|
|
||||||
// Unlock your SIM card with a PIN
|
|
||||||
//modem.simUnlock("1234");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void loop() {
|
void loop() {
|
||||||
|
// Restart takes quite some time
|
||||||
|
// To skip it, call init() instead of restart()
|
||||||
|
SerialMon.print("Initializing modem...");
|
||||||
|
if (!modem.restart()) {
|
||||||
|
SerialMon.println(" fail");
|
||||||
|
SerialMon.println(F("************************"));
|
||||||
|
SerialMon.println(F(" Is your modem connected properly?"));
|
||||||
|
SerialMon.println(F(" Is your serial speed (baud rate) correct?"));
|
||||||
|
SerialMon.println(F(" Is your modem powered on?"));
|
||||||
|
SerialMon.println(F(" Do you use a good, stable power source?"));
|
||||||
|
SerialMon.println(F(" Try useing File -> Examples -> TinyGSM -> tools -> AT_Debug to find correct configuration"));
|
||||||
|
SerialMon.println(F("************************"));
|
||||||
|
delay(10000);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Unlock your SIM card with a PIN
|
||||||
|
//modem.simUnlock("1234");
|
||||||
|
|
||||||
SerialMon.print("Waiting for network...");
|
SerialMon.print("Waiting for network...");
|
||||||
if (!modem.waitForNetwork()) {
|
if (!modem.waitForNetwork()) {
|
||||||
SerialMon.println(" fail");
|
SerialMon.println(" fail");
|
||||||
SerialMon.println("************************");
|
SerialMon.println(F("************************"));
|
||||||
SerialMon.println(" Is your sim card locked?");
|
SerialMon.println(F(" Is your sim card locked?"));
|
||||||
SerialMon.println(" Do you have a good signal?");
|
SerialMon.println(F(" Do you have a good signal?"));
|
||||||
SerialMon.println(" Is antenna attached?");
|
SerialMon.println(F(" Is antenna attached?"));
|
||||||
SerialMon.println(" Does the SIM card work with your phone?");
|
SerialMon.println(F(" Does the SIM card work with your phone?"));
|
||||||
SerialMon.println("************************");
|
SerialMon.println(F("************************"));
|
||||||
delay(10000);
|
delay(10000);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -76,10 +92,10 @@ void loop() {
|
|||||||
SerialMon.print(apn);
|
SerialMon.print(apn);
|
||||||
if (!modem.gprsConnect(apn, user, pass)) {
|
if (!modem.gprsConnect(apn, user, pass)) {
|
||||||
SerialMon.println(" fail");
|
SerialMon.println(" fail");
|
||||||
SerialMon.println("************************");
|
SerialMon.println(F("************************"));
|
||||||
SerialMon.println(" Is GPRS enabled by network provider?");
|
SerialMon.println(F(" Is GPRS enabled by network provider?"));
|
||||||
SerialMon.println(" Try checking your card balance.");
|
SerialMon.println(F(" Try checking your card balance."));
|
||||||
SerialMon.println("************************");
|
SerialMon.println(F("************************"));
|
||||||
delay(10000);
|
delay(10000);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@@ -9,6 +9,14 @@
|
|||||||
*
|
*
|
||||||
**************************************************************/
|
**************************************************************/
|
||||||
|
|
||||||
|
// Select your modem:
|
||||||
|
#define TINY_GSM_MODEM_SIM800
|
||||||
|
//#define TINY_GSM_MODEM_SIM900
|
||||||
|
//#define TINY_GSM_MODEM_M590
|
||||||
|
|
||||||
|
#include <TinyGsmClient.h>
|
||||||
|
#include <StreamDebugger.h>
|
||||||
|
|
||||||
// Set serial for debug console (to the Serial Monitor, speed 115200)
|
// Set serial for debug console (to the Serial Monitor, speed 115200)
|
||||||
#define SerialMon Serial
|
#define SerialMon Serial
|
||||||
|
|
||||||
@@ -20,8 +28,6 @@
|
|||||||
//#include <SoftwareSerial.h>
|
//#include <SoftwareSerial.h>
|
||||||
//SoftwareSerial SerialAT(2, 3); // RX, TX
|
//SoftwareSerial SerialAT(2, 3); // RX, TX
|
||||||
|
|
||||||
#include <TinyGsmClient.h>
|
|
||||||
#include <StreamDebugger.h>
|
|
||||||
StreamDebugger debugger(SerialAT, SerialMon);
|
StreamDebugger debugger(SerialAT, SerialMon);
|
||||||
TinyGsm modem(debugger);
|
TinyGsm modem(debugger);
|
||||||
|
|
||||||
@@ -36,7 +42,7 @@ void setup() {
|
|||||||
|
|
||||||
if (!modem.init()) {
|
if (!modem.init()) {
|
||||||
SerialMon.println(F("***********************************************************"));
|
SerialMon.println(F("***********************************************************"));
|
||||||
SerialMon.println(F(" Cannot initialize module!"));
|
SerialMon.println(F(" Cannot initialize modem!"));
|
||||||
SerialMon.println(F(" Use File -> Examples -> TinyGSM -> tools -> AT_Debug"));
|
SerialMon.println(F(" Use File -> Examples -> TinyGSM -> tools -> AT_Debug"));
|
||||||
SerialMon.println(F(" to find correct configuration"));
|
SerialMon.println(F(" to find correct configuration"));
|
||||||
SerialMon.println(F("***********************************************************"));
|
SerialMon.println(F("***********************************************************"));
|
||||||
|
Reference in New Issue
Block a user