FONA808 GSM cannot connect to blynk-server.com

Hi,

Recently I have obtained the FONA808 arduino shield, I plugged it onto my Arduino Uno and everything works fine with the example sketches provided by the FONA library. I was able to obtain GPS coordinates and connect to the internet with GSM.
Since I want to use it with Blynk, I installed the TinyGSM library and loaded up the BlynkClient.ino, it had connected to the server smoothly, interactions were possible at that point.
However, when I tried to obtain a GPS coordinates as well as connecting to the Blynk server in the same sketch, it doesn’t work. I can see from the serial monitor that the GPS coordinates have been extracted, also it has connected to GPRS, but the problem is that it is stuck at Blynk.begin(auth, modem, apn, user, pass); and it will not connect to the blynk-cloud.com server. I am using the latest version of Blynk. Does anyone know what the issue might be?

#define BLYNK_PRINT Serial
#define TINY_GSM_MODEM_SIM808
#define FONA_RX 3
#define FONA_TX 2
#define FONA_RST 4

#include <TinyGsmClient.h>
#include <BlynkSimpleSIM800.h>
#include "Adafruit_FONA.h"
char auth[] = "";

char apn[]  = "giffgaff.com";
char user[] = "giffgaff";
char pass[] = "";

#include <SoftwareSerial.h>
SoftwareSerial SerialAT(3, 2); // RX, TX

SoftwareSerial fonaSS = SoftwareSerial(FONA_RX, FONA_TX); //for FONA808 GPS
SoftwareSerial *fonaSerial = &fonaSS;
Adafruit_FONA fona = Adafruit_FONA(FONA_RST);
TinyGsm modem(SerialAT);

float latitude, longitude, speed_kph, heading, speed_mph, altitude;
float GPSlat;
float GPSlon;

void turnOnGPS(){ 
  Serial.println(F("Adafruit FONA 808 & 3G GPS demo"));
  Serial.println(F("Initializing FONA... (May take a few seconds)"));
  fonaSerial->begin(9600);  //Software Serial fona begins
  if (! fona.begin(*fonaSerial)) {
    Serial.println(F("Couldn't find FONA"));
    while(1);
  }
  Serial.println(F("FONA is OK"));
  // Try to enable GPRS

  Serial.println(F("Enabling GPS..."));
  fona.enableGPS(true);
  
  delay(1000);
  Serial.print("GPSstatus: ");
  Serial.println(fona.GPSstatus());
  while(!(fona.GPSstatus() == 3)) //fona.getGPS is run until fona.GPSstatus() == 3 
  {
    Serial.print("GPSstatus: ");
    Serial.println(fona.GPSstatus());
    Serial.print("getNetworkStatus: ");
    Serial.println(fona.getNetworkStatus());
    
    boolean gps_success = fona.getGPS(&latitude, &longitude, &speed_kph, &heading, &altitude);
    
    delay(1000);
  }
  if(fona.GPSstatus() == 3) //when fona.GPSstatus() == 3, coordinates have been extracted
  {
    
    boolean gps_success = fona.getGPS(&latitude, &longitude, &speed_kph, &heading, &altitude);
    if (gps_success){

      Serial.print("GPS lat:");
      GPSlat = latitude, 6; 
      Serial.println(GPSlat); //Serial.print() only limits to show 2 d.p
      Serial.print("GPS long:");
      GPSlon = longitude, 6;
      Serial.println(GPSlon);
      Serial.print("GPS speed KPH:");
      Serial.println(speed_kph);
      Serial.print("GPS speed MPH:");
      speed_mph = speed_kph * 0.621371192;
      Serial.println(speed_mph);
      Serial.print("GPS heading:");
      Serial.println(heading);
      Serial.print("GPS altitude:");
      Serial.println(altitude);

      delay(100);
      fona.enableGPS(false);
      
    }else{
      Serial.println("Waiting for FONA GPS 3D fix...");
    }
 }
  
}

void setup()
{
  // Debug console
  Serial.begin(9600);
  
  delay(10);
  delay(2000);
  turnOnGPS(); //obtain GPS coordinates
  // Set GSM module baud rate
  fonaSerial->end(); //end serial communication with GPS to avoid conflict
  delay(500);
  SerialAT.begin(9600); //serial communication for blynk starts
  
  delay(3000);
 
  Serial.println("Initializing modem...");
  modem.restart();
  String modemInfo = modem.getModemInfo();
  Serial.print("Modem: ");
  Serial.println(modemInfo);
  // Unlock your SIM card with a PIN
  //modem.simUnlock("1234");
  
  Blynk.begin(auth, modem, apn, user, pass);
 
}

void loop()
{ 
  delay(2000);
  Blynk.run();
  Serial.println("Loop is over!");
  
}

Does anyone have any clue cause this is really frustrating :persevere:

I have the exact same problem with the FONA808 (also using Giffgaff).

GPRS connects OK but it just continually tries to connect to the server (I have used both Blynk Cloud and my own Local Server but the result is the same).

I notice it does connect successfully most of the time (e.g, I can see hardware connected in the blynk app) but something is causing it to disconnect again almost immediately.
Every so often I get ‘[3000559] Ready (ping: 1137ms).’ However, this is shortly followed by another connection attempt.
Lots of ‘Unhandled’ visible when TinyGSM debug is enabled. e.g:
[43316] <[02|00|01|00] #authtoken#
[44384] Cmd error
### Unhandled: ERR
or
### Unhandled: DATA ACCEPT:1,37
however, I don’t know if these are relevant? Would be great to get some suggestions for debugging this.

In order to get any progress, I would recommend you to follow the README and Diagnostics of TinyGSM library.
The link is provided right int the GSM example:

/*
  Attention! Please check out TinyGSM guide:
    http://tiny.cc/tiny-gsm-readme
*/

Here: http://tiny.cc/tiny-gsm-readme

Please then post an extended report as a separate topic.