RAK5860 WisBlock Nb-Iot BG77 Series GNSS

Hi Jeroen

I think, our conversation was deleted ! Never mind…

The issue still persist and my projects/invested money goes nowhere !

Zoltan

Hi Friends,

Some news about BG77 GNSS usage with the RAK5860 ?
In this business no sleep ! I practiced this for over 35y.

Zoltan

Hi Bernd

Any news from the “SW Team” regarding the GNSS not fix issue ?

Zoltan Magdo

Hi

It’s something specific what it’s need to be set at RAK5860 WisBlock module to use the GNSS functionality ?

I used the Quectel recommendations to setup my RAK5860 with the following code:

#define BG77_POWER_KEY 17
String bg77_rsp = “”;

//this function is suitable for most AT commands of bg96. e.g. bg96_at(“ATI”)
void bg77_at(char *at, uint16_t timeout)
{
char tmp[256] = {0};
int len = strlen(at);
strncpy(tmp, at, len);
uint16_t t = timeout;
tmp[len] = ‘\r’;
Serial1.write(tmp);
delay(10);
while (t–)
{
if (Serial1.available())
{
bg77_rsp += char(Serial1.read());
}
delay(1);
}
Serial.println(bg77_rsp);
bg77_rsp = “”;
}

void ping_at(char *at)
{
char tmp[256] = {0};
int len = strlen(at);
uint16_t timeout = 10000;
strncpy(tmp, at, len);
tmp[len] = ‘\r’;
Serial1.write(tmp);
delay(10);

while (timeout–)
{
if (Serial1.available())
{
bg77_rsp += char(Serial1.read());
}
delay(1);
}
Serial.println(bg77_rsp);
bg77_rsp = “”;
}

void setup()
{
// Open serial communications and wait for port to open:
Serial.begin(115200);
while (!Serial)
delay(10); // for nrf52840 with native usb
Serial.println(“RAK5860 Cellular TEST With Hologram sim card!”);

//BG77 init
pinMode(BG77_POWER_KEY, OUTPUT);
digitalWrite(BG77_POWER_KEY, 0);
delay(1000);
digitalWrite(BG77_POWER_KEY, 1);
delay(2000);
digitalWrite(BG77_POWER_KEY, 0);
Serial1.begin(115200);
delay(1000);
Serial.println("BG77 power up!");
bg77_at("ATI", 500);
delay(2000);

//Cellular
Serial.println("**Start Setup Cellular ");
bg77_at(“AT+CGDCONT=1,“IP”,“hologram””, 500);
delay(2000);
bg77_at(“AT+CGACT?”, 500);
delay(2000);
bg77_at(“AT+COPS=1,2,“53001"”, 1000);
delay(2000);
bg77_at(“AT+CFUN=1,0”, 500);
delay(2000);
bg77_at(“AT+CPIN?”, 500);
delay(2000);
bg77_at(“AT+QNWINFO”, 500);
delay(2000);
bg77_at(“AT+QCSQ”, 500);
delay(2000);
bg77_at(“AT+CSQ”, 500);
delay(2000);
bg77_at(“AT+QIACT=1”, 3000);
delay(2000);
Serial.println(”**End Setup Cellurar “);
// GPS
Serial.println(”**Start Setup GPS ");
bg77_at(“AT+QGPS?”, 1000);
delay(2000);
bg77_at(“AT+QPSMS?”, 1000);
delay(2000);
bg77_at(“AT+CPSMS=0”, 1000);
delay(2000);
// bg77_at(“AT+QGPSCFG=“priority”,0”, 1000);
// delay(2000);
bg77_at(“AT+QGPSEND”, 1000);
delay(2000);
bg77_at(“AT+QGPS=1”, 1000);
delay(2000);
//
Serial.println("Begin receive GPS Data ! ");
}

void loop() // run over and over//
{
bg77_at(“AT+QGPSLOC?”, 2000);
}

The result is:
11:19:59.270 -> RAK5860 Cellular TEST With Hologram sim card!
11:20:03.234 -> BG77 power up!
11:20:03.749 ->
11:20:03.749 -> RDY
11:20:03.749 ->
11:20:03.749 -> +CFUN: 1
11:20:03.749 ->
11:20:03.749 -> +QSIMSTAT: 1,1
11:20:03.749 ->
11:20:03.749 -> +CPIN: READY
11:20:03.749 ->
11:20:03.749 -> +QUSIM:
11:20:05.752 -> **Start Setup Cellular
11:20:06.264 ->
11:20:06.264 -> APP RDY
11:20:06.264 -> AT+CGDCONT=1,“IP”,“hologram”

11:20:06.264 -> OK
11:20:06.264 ->
11:20:08.736 -> AT+CGACT?

11:20:08.736 -> +CGACT: 1,0
11:20:08.736 -> +CGACT: 2,0
11:20:08.736 ->
11:20:08.736 -> OK
11:20:08.736 ->
11:20:11.718 -> AT+COPS=1,2,“53001”

11:20:14.240 ->
11:20:14.240 -> OK
11:20:14.240 ->
11:20:16.714 -> AT+CPIN?

11:20:16.714 -> +CPIN: READY
11:20:16.714 ->
11:20:16.714 -> OK
11:20:16.714 ->
11:20:19.229 -> AT+QNWINFO

11:20:19.229 -> +QNWINFO: “eMTC”,“53001”,“LTE BAND 3”,1917
11:20:19.229 ->
11:20:19.229 -> OK
11:20:19.229 ->
11:20:21.704 -> AT+QCSQ

11:20:21.704 -> +QCSQ: “eMTC”,-83,-105,194,-8
11:20:21.704 ->
11:20:21.704 -> OK
11:20:21.704 ->
11:20:24.224 -> AT+CSQ

11:20:24.224 -> +CSQ: 15,99
11:20:24.224 ->
11:20:24.224 -> OK
11:20:24.224 ->
11:20:29.166 -> AT+QIACT=1

11:20:29.166 -> OK
11:20:29.166 ->
11:20:31.175 -> **End Setup Cellurar
11:20:31.175 -> **Start Setup GPS
11:20:32.156 -> AT+QGPS?

11:20:32.156 -> +QGPS: 1
11:20:32.156 ->
11:20:32.156 -> OK
11:20:32.156 ->
11:20:35.141 -> AT+QPSMS?

11:20:35.141 -> +QPSMS: 0,“0”,“0”
11:20:35.141 ->
11:20:35.141 -> OK
11:20:35.141 ->
11:20:38.128 -> AT+CPSMS=0

11:20:38.128 -> OK
11:20:38.128 ->
11:20:41.116 -> AT+QGPSCFG=“priority”,0

11:20:41.116 -> OK
11:20:41.116 ->
11:20:44.102 -> AT+QGPSEND

11:20:47.091 ->
11:20:47.091 -> OK
11:20:47.091 -> AT+QGPS=1

11:20:49.098 -> Begin receive GPS Data !
11:20:51.056 ->
11:20:53.015 ->
11:20:54.971 ->
11:20:56.930 ->
11:20:58.916 ->
11:21:00.900 ->
11:21:02.811 ->
11:21:04.773 ->
11:21:06.737 ->
11:21:08.692 ->
11:21:10.698 ->
11:21:12.659 ->
11:21:14.618 ->
11:21:14.618 -> OK
11:21:14.618 ->
11:21:16.576 -> AT+QGPSLOC?

11:21:16.576 -> +CME ERROR: 516
11:21:16.576 ->
11:21:18.541 -> AT+QGPSLOC?

11:21:18.541 -> +CME ERROR: 516
11:21:18.541 ->
11:21:20.496 -> AT+QGPSLOC?

11:21:20.496 -> +CME ERROR: 516
11:21:20.496 ->
11:21:22.454 -> AT+QGPSLOC?

11:21:22.454 -> +CME ERROR: 516
11:21:22.454 ->
11:21:24.409 -> AT+QGPSLOC?

11:21:24.409 -> +CME ERROR: 516
11:21:24.409 ->
11:21:26.370 -> AT+QGPSLOC?

11:21:26.370 -> +CME ERROR: 516
11:21:26.370 ->
11:21:28.335 -> AT+QGPSLOC?

11:21:28.335 -> +CME ERROR: 516
11:21:28.335 ->
11:21:30.292 -> AT+QGPSLOC?

11:21:30.292 -> +CME ERROR: 516
11:21:30.292 ->
11:21:32.253 -> AT+QGPSLOC?

11:21:32.253 -> +CME ERROR: 516
11:21:32.253 ->
11:21:34.213 -> AT+QGPSLOC?

11:21:34.213 -> +CME ERROR: 516
11:21:34.213 ->
11:21:36.176 -> AT+QGPSLOC?

11:21:36.176 -> +CME ERROR: 516
11:21:36.176 ->
11:21:38.180 -> AT+QGPSLOC?

11:21:38.180 -> +CME ERROR: 516
11:21:38.180 ->
11:21:40.144 -> AT+QGPSLOC?

11:21:40.144 -> +CME ERROR: 516
11:21:40.144 ->
11:21:42.106 -> AT+QGPSLOC?

11:21:42.106 -> +CME ERROR: 516
11:21:42.106 ->
11:21:44.083 -> AT+QGPSLOC?

11:21:44.083 -> +CME ERROR: 516
11:21:44.083 ->
11:21:45.990 -> AT+QGPSLOC?

11:21:45.990 -> +CME ERROR: 516
11:21:45.990 ->
11:21:47.980 -> AT+QGPSLOC?

11:21:47.980 -> +CME ERROR: 516
11:21:47.980 ->
11:21:49.943 -> AT+QGPSLOC?

11:21:49.943 -> +CME ERROR: 516
11:21:49.943 ->
11:21:51.908 -> AT+QGPSLOC?

11:21:51.908 -> +CME ERROR: 516
11:21:51.908 ->
11:21:53.878 -> AT+QGPSLOC?

11:21:53.878 -> +CME ERROR: 516
11:21:53.878 ->
11:21:55.840 -> AT+QGPSLOC?

11:21:55.840 -> +CME ERROR: 516
11:21:55.840 ->
11:21:57.801 -> AT+QGPSLOC?

11:21:57.801 -> +CME ERROR: 516
11:21:57.801 ->
11:21:59.766 -> AT+QGPSLOC?

11:21:59.766 -> +CME ERROR: 516
11:21:59.766 ->
11:22:01.728 -> AT+QGPSLOC?

11:22:01.728 -> +CME ERROR: 516
11:22:01.728 ->
11:22:03.687 -> AT+QGPSLOC?

11:22:03.687 -> +CME ERROR: 516
11:22:03.687 ->
11:22:05.648 -> AT+QGPSLOC?

11:22:05.648 -> +CME ERROR: 516
11:22:05.648 ->
11:22:07.607 -> AT+QGPSLOC?

11:22:07.607 -> +CME ERROR: 516
11:22:07.607 ->
11:22:09.607 -> AT+QGPSLOC?

11:22:09.607 -> +CME ERROR: 516
11:22:09.607 ->
11:22:11.523 -> AT+QGPSLOC?

11:22:11.523 -> +CME ERROR: 516

How I get the GPS Data ?

Thanks
Zoltan

Hi

No solution until end of February ! The RAK SoftwareTeam don’t have a solution…
Please, If somebody find a solution, share to us !

Thanks
Zoltan

1 Like

Dear RAK team,

As I also want to proceed with this module (GPS function), is any update available?
Also please report when it is a hardware bug or something RAK cannot fix yet.

thanks Jeroen

(Happy Chinese New Year in advance!)

1 Like

Here is an example for RAK5860 to use data connection and collect GPS coordinates.
It is only tested by our SW team. I cannot verify, because the RAK5860 is not working in my country.

Please report any problems with the sketch. Once confirmed it works, we will add this to the WisBlock repo.

Sorry for copying the code here, but I cannot attach sketch files:

/**
   @file Hologram_Tcp.ino
   @author rakwireless.com
   @brief BG77 tcp test with Hologram, send gps data to server
   @version 0.1
   @date 2020-12-28
   @copyright Copyright (c) 2020
**/

#define BG77_POWER_KEY 17

String bg77_rsp = "";

//Hologarm tcp message format is jason. Remember to replace the card key in type k. 
//About key details: https://support.hologram.io/hc/en-us/articles/360035212714-Device-keys
//About message details: https://www.hologram.io/references/embedded-apis#send-a-message-to-the-hologram-cloud 
String hologram_msg_pre = "{\"k\":\"+C7pOb8=\",\"d\":";
String hologram_msg_suff = ",\"t\":\"TOPIC1\"}";
String hologram_msg = "";
String send_data_length_at = "";
String gps_data = "";

void setup()
{
  time_t serial_timeout = millis();
  Serial.begin(115200);
  while (!Serial)
  {
    if ((millis() - serial_timeout) < 5000)
    {
      delay(100);
    }
    else
    {
      break;
    }
  }
  Serial.println("RAK11200 Cellular TEST With Hologram sim card!");

  //BG77 init , Check if the modem is already awake
  time_t timeout = millis();
  bool moduleSleeps = true;
  Serial1.begin(115200);
  delay(1000);
  Serial1.println("ATI");
  //BG77 init
  while ((millis() - timeout) < 4000)
  {
    if (Serial1.available())
    {
      String result = Serial1.readString();
      Serial.println("Modem response after start:");
      Serial.println(result);
      moduleSleeps = false;
    }
  }
  if (moduleSleeps)
  {
    // Module slept, wake it up
    pinMode(BG77_POWER_KEY, OUTPUT);
    digitalWrite(BG77_POWER_KEY, 0);
    delay(1000);
    digitalWrite(BG77_POWER_KEY, 1);
    delay(2000);
    digitalWrite(BG77_POWER_KEY, 0);
    delay(1000);
  }
  Serial.println("BG77 power up!");

  //active and join to the net, this part may depend on some information of your operator.
  bg77_at("AT+CFUN=1,0", 500);
  delay(2000);
  bg77_at("AT+CPIN?", 500);
  delay(2000);
  bg77_at("AT+QNWINFO", 500);
  delay(2000);
  bg77_at("AT+QCSQ", 500);
  delay(2000);
  bg77_at("AT+CSQ", 500);
  delay(2000);
  bg77_at("AT+QIACT=1", 3000);
  delay(2000);

  //open tcp link with Hologram server
  bg77_at("AT+QIOPEN=1,0,\"TCP\",\"cloudsocket.hologram.io\",9999,0,1", 5000);
  delay(2000);
  
}

//this function is suitable for most AT commands of bg96. e.g. bg96_at("ATI")
void bg77_at(char *at, uint16_t timeout)
{
  char tmp[256] = {0};
  int gps_count = 100;
  int len = strlen(at);
  strncpy(tmp, at, len);
  uint16_t t = timeout;
  tmp[len] = '\r';
  if(strstr(tmp,"AT+QGPSLOC?") != NULL)
  {
    while (gps_count--)
    { 
      t = timeout;
      Serial1.write(tmp);
      while (t--)
      {
        if (Serial1.available())
        {
          gps_data += char(Serial1.read());
        }
        delay(1);
      }
      if(strstr(gps_data.c_str(),"OK") != NULL)
      {
        break;
      }
      if(strstr(gps_data.c_str(),"CME ERROR") != NULL)
      {
        gps_data = "";
      }      
      delay(100);
    }
    return;
  }
  Serial1.write(tmp);
  delay(10);
  while (t--)
  {
    if (Serial1.available())
    {
      bg77_rsp += char(Serial1.read());
    }
    delay(1);
  }
  Serial.println(bg77_rsp);
  bg77_rsp = "";
}

void send_test_data()
{
  //open gps, gsm/nb will stop work now
  bg77_at("AT+QGPS=1,1", 1000);
  //get gps data, this will cost some time
  bg77_at("AT+QGPSLOC?", 1000);
  //close gps
  bg77_at("AT+QGPSEND", 1000);  
  //combine the data packet
  hologram_msg = hologram_msg_pre+gps_data+hologram_msg_suff;
  gps_data = "";
  //send data length command
  char tmp[256] = {0};
  send_data_length_at = "AT+QISEND=0," + hologram_msg.length();
  strncpy(tmp, send_data_length_at.c_str(), send_data_length_at.length());
  bg77_at(tmp, 3000);
  delay(2000);
  //send data
  memset(tmp,0,256);
  strncpy(tmp, hologram_msg.c_str(), hologram_msg.length());
  bg77_at(tmp, 1000);
  delay(1000);
}

void loop()
{
  Serial.println("Send test data to Hologram via TCP!");
  send_test_data();
  //consider the gps fix time, interval should be long
  delay(300000);
}

Thank You Bernd

Just saw your post. I will check tomorrow morning and feedback my test results/

Zoltan

HI

Bad news. No GPS fix If I run your code. I got Error code 516 and no GPS data…

======================
13:04:21.788 → RAK11200 Cellular TEST With Hologram sim card!
13:04:25.755 → Modem response after start:
13:04:25.755 → ATI

13:04:25.755 → Quectel
13:04:25.755 → BG77
13:04:25.755 → Revision: BG77LAR02A02
13:04:25.755 →
13:04:25.755 → OK
13:04:25.755 →
13:04:25.755 → BG77 power up!
13:04:26.275 → AT+CFUN=1,0

13:04:26.275 → OK
13:04:26.275 →
13:04:28.759 → AT+CPIN?

13:04:28.759 → +CPIN: READY
13:04:28.759 →
13:04:28.759 → OK
13:04:28.759 →
13:04:31.259 → AT+QNWINFO

13:04:31.259 → +QNWINFO: “eMTC”,“53001”,“LTE BAND 3”,1917
13:04:31.259 →
13:04:31.259 → OK
13:04:31.259 →
13:04:33.770 → AT+QCSQ

13:04:33.770 → +QCSQ: “eMTC”,-79,-100,202,-7
13:04:33.770 →
13:04:33.770 → OK
13:04:33.770 →
13:04:36.261 → AT+CSQ

13:04:36.261 → +CSQ: 17,99
13:04:36.261 →
13:04:36.261 → OK
13:04:36.261 →
13:04:41.216 → AT+QIACT=1

13:04:41.216 → ERROR
13:04:41.216 →
13:04:48.071 → AT+QIOPEN=1,0,“TCP”,“cloudsocket.hologram.io”,9999,0,1

13:04:48.071 → OK
13:04:48.071 →
13:04:48.071 → +Q,
13:04:50.086 → Send test data to Hologram via TCP!
13:04:51.057 → AT+QGPS=1,1

13:04:56.264 → AT+QGPSEND

13:04:56.264 → OK
13:04:56.264 →
13:04:56.264 → *** hologram_msg: {“k”:“j%fe$L8l”,“d”:
13:04:56.264 → OK
13:04:56.264 → ,“t”:“TOPIC1”}
13:04:59.222 →
13:05:02.211 →

Is this the complete log?
I do not see the ‘AT+QGPSLOC?’ in your log file.

I will forward the log to our R&D, but I want to make sure it is complete. They tested at their location (China) and it worked.

give empty string as You can see the hologram_msg .

I inserted one extra debug line to print the hologram_msg
/*
//combine the data packet
hologram_msg = hologram_msg_pre+gps_data+hologram_msg_suff;
Serial.println("*** hologram_msg: "+ hologram_msg); // My extra line of code

*/

To be sure, I reset everything and I ran the code again. Got same log like before.

Hmm. worked in China… Can they show the China log file or some another country/continent where this code worked ?

I very appreciate if they can do it. Maybe it’s only a local issue to NZ and I have to change my approach to this issue ?!

I’m open to do more tests If it’s necessary to solve this technical/design issue…

Zoltan

Hi

Any good news from the SW Team ? Please let me know if I can do something at my side. Thanks,

Zoltan

Please check the following advice from our SW team:

  1. Check GPS antenna connection
  2. Test outside with a clear view to the sky
  3. As it can take a long time until a location is acquired, please change the example code

around line 95: int gps_count = 100 change to int gps_count = 500.
around line 144: bg77_at("AT+QGPSLOC?", 1000);1 change to bg77_at(“AT+QGPSLOC?”, 10000);`

1 Like

Ok Sir. I will do again and again !

The RAK5010 and RAK 8212/RAK8212-M modules give satellite fix with 7 to 8 satellite fix in short time from same place from where I’m using my WisBlock Modules.

I have to check with different GPS Antenna ?

Have You feedback from different Country/Continent users of RAK5860 about this code if it’s working for them ?

Very appreciate if somebody can send one successful Log file running the above code and not let me to fight alone !

Zoltan


The RAK Sw team advices to me are are not welcomed !
They must to be more careful about who is the target of they stupid advices !

ok.

  1. Check GPS antenna connection

  1. Test outside with a clear view to the sky !

    Done.

The Log:

18:28:17.546 → RAK11200 Cellular TEST With Hologram sim card!
18:28:21.523 → Modem response after start:
18:28:21.523 → ATI

18:28:21.523 → Quectel
18:28:21.523 → BG77
18:28:21.523 → Revision: BG77LAR02A02
18:28:21.523 →
18:28:21.523 → OK
18:28:21.523 →
18:28:21.523 → BG77 power up!
18:28:22.036 → AT+CFUN=1,0

18:28:22.036 → OK
18:28:22.036 →
18:28:24.982 → AT+CPIN?

18:28:24.982 → +CPIN: READY
18:28:24.982 →
18:28:24.982 → OK
18:28:24.982 →
18:28:27.051 → AT+QNWINFO

18:28:27.051 → +QNWINFO: “eMTC”,“53001”,“LTE BAND 3”,1917
18:28:27.051 →
18:28:27.051 → OK
18:28:27.051 →
18:28:29.540 → AT+QCSQ

18:28:29.540 → +QCSQ: “eMTC”,-74,-97,229,-11
18:28:29.540 →
18:28:29.540 → OK
18:28:29.540 →
18:28:32.011 → AT+CSQ

18:28:32.011 → +CSQ: 20,99
18:28:32.011 →
18:28:32.011 → OK
18:28:32.011 →
18:28:36.968 → AT+QIACT=1

18:28:36.968 → ERROR
18:28:36.968 →
18:28:43.847 → AT+QIOPEN=1,0,“TCP”,“cloudsocket.hologram.io”,9999,0,1

18:28:43.847 → OK
18:28:43.847 →
18:28:43.847 → +,
18:28:45.857 → Send test data to Hologram via TCP!
18:28:46.839 → AT+QGPS=1,1

18:29:14.635 → AT+QGPSEND

18:29:17.583 →
18:29:20.579 →
18:34:21.581 → Send test data to Hologram via TCP!
18:34:22.568 →
18:34:22.568 → OK
18:34:22.568 → AT+QGPS=1,1

18:34:34.191 → AT+QGPSEND

18:34:37.140 →
18:34:40.141 →
18:39:41.138 → Send test data to Hologram via TCP!
18:39:42.114 →
18:39:42.114 → OK
18:39:42.114 → AT+QGPS=1,1

18:39:54.820 → AT+QGPSEND

18:39:57.782 →
18:40:00.752 →
18:45:01.826 → Send test data to Hologram via TCP!
18:45:02.754 →
18:45:02.754 → OK
18:45:02.754 → AT+QGPS=1,1

18:45:14.391 → AT+QGPSEND

18:45:17.321 →
18:45:20.344 →

Any new advices to check Sirs ?

Shouldn’t not be a big issue to your intl. company to show your bright solving this issue but it is…
I can use your RAK5010/m devices until you figure out what it’s happening with this module. Don’t worry, still addict to RAK products…

1 Like