Using firmware written for Particle Electron in Boron

Dear all

Apology for a rookie question and if it has been covered before (my prior search had brought nothing relevant though).

I have this firmware (below) which was written a couple of years ago for Particle Electron 2G (SARA G350). It used to work ok. I now wonder if this code can work on Boron 2G/3G Global like this one Boron 2G/3G Global Starter Kit with EtherSIM – Particle Retail and what to bear in mind (like minimum OS requirements, what libraries from the ones I use should be different)? Sorry if this is not specific enough or too generic.

Firmware (designed to put the device in deep sleep, then wake up, hook to cellular, parse its ID, post it, repeat)


#include "Particle.h"

char cellular_data[200] = "";
int cb(int type, const char* buf, int len, char* cellular_data);
//This function to use instead delay() to avoid blocking code - period in milli seconds
void mydelay(int period);
//This function to start deep sleep mode
void sleepInMinutes(void);

void setup () {
  mydelay(70000);// need to wait for 70 sec to allow enough time for cellular and particle connect if possible
  //I use serial for debugging purpose only

void loop() {
  if ((RESP_OK == Cellular.command(cb, cellular_data, 10000, "AT+CGED=3\r\n"))
  && (strcmp(cellular_data, "") != 0)) {
    Serial.printlnf("Cellular info: %s\r\n", cellular_data);
  else {
    Serial.printlnf("Cellular info not found");
  if (strlen(cellular_data) > 0) {
    Particle.publish("cellData", cellular_data, PRIVATE);
    //To obey publish limit
    //Reset string to not publish the same one again
    cellular_data[0] = '\0';

int cb(int type, const char* buf, int len, char* cellular_data) {
  if ((type == TYPE_PLUS) && cellular_data) {
    if(sscanf(buf, "\r\n+CGED: %[^\r]\r\n", cellular_data) == 1)
  return WAIT;

void sleepInMinutes(void) {
  Particle.publish("Sleep", "Go To Deep Sleep For 3 minutes", PRIVATE);
  //sleep for 20 minutes
  System.sleep(SLEEP_MODE_DEEP, 180 );

void mydelay(int period) {
  int time_now = millis();
  while(millis() < time_now + period) {
    //wait delay ms

That code will probably work on the Boron 2G/3G. However there is a Device OS call for getting cellular information now. This is more important for other devices because AT+CGED does not work on R410 and R510 LTE Cat M1 devices, or Quectel EG91-E/EX LTE Cat 1 devices. but CellularGlobalIdentity works on all cellular devices.

	CellularGlobalIdentity cgi = {0};
	cgi.size = sizeof(CellularGlobalIdentity);
	cgi.version = CGI_VERSION_LATEST;

	cellular_result_t res = cellular_global_identity(&cgi, NULL);
	if (res == SYSTEM_ERROR_NONE) {
		// cgi.cell_id, cgi.location_area_code, cgi.mobile_country_code, cgi.mobile_network_code