Search code examples
esp32arduino-esp8266sim-cardarduino-esp32

Control SIM7080G CAT-M/NB-IoT Unit from ESP32-DevKitC-32E


We want to control SIM7080G CAT-M/NB-IoT Unit from ESP32-DevKitC-32E.

SIM7080G CAT-M/NB-IoT Unit https://shop.m5stack.com/products/sim7080g-cat-m-nb-iot-unit

ESP32-DevKitC-32E https://www.espressif.com/en/products/devkits/esp32-devkitc

We created a project with PlatformIO and installed TinyGSM, EspSoftwareSerial and ArduinoHttpClient.

We wired #16 to CAT-M's TXD and #17 to CAT-M's RXD and modified the code as follows.

- #ifndef __AVR_ATmega328P__
- #define SerialAT Serial1
- 
- // or Software Serial on Uno, Nano
- #else
- #include <SoftwareSerial.h>
- SoftwareSerial SerialAT(2, 3); // RX, TX
- #endif
+ #include <SoftwareSerial.h>
+ SoftwareSerial SerialAT(16, 17); // RX, TX

We modified the defines as follows.

- #define TINY_GSM_MODEM_SIM800
+ // #define TINY_GSM_MODEM_SIM800
- // #define TINY_GSM_MODEM_SIM7080
+ #define TINY_GSM_MODEM_SIM7080

We have edited the following information to match the SIM inserted in our CAT-M.

- const char apn[]      = "YourAPN";
- const char gprsUser[] = "";
- const char gprsPass[] = "";
+ const char apn[]      = "OurAPN";
+ const char gprsUser[] = "OurUser";
+ const char gprsPass[] = "OurPass";

However, it seemed to be failing to connect only to keep logging Unhandled as follows.

[2062] Modem responded at rate 115200
Initializing modem...
[18066] ### Unhandled: +CPIN: N E@DY

␂
[19066] ### Unhandled: 15104

Modem Info: 
[20067] ### Unhandled: ␂ERROR
[22068] ### Unhandled: ERO
[24069] ### Unhandled: ␄ERRO
[26070] ### Unhandled: ERROH
[28071] ### Unhandled: EROR␂
Waiting for network...[30072] ### Unhandled: +C@REG: 0,0OK
[31073] ### Unhandled: +␝ 0

We tried deleting the following sections, but nothing changed

-  SerialMon.println("Initializing modem...");
-  modem.restart();
-  // modem.init();

-  String modemInfo = modem.getModemInfo();
-  SerialMon.print("Modem Info: ");
-  SerialMon.println(modemInfo);

We believe that something must be initialized in the following areas.

  // !!!!!!!!!!!
  // Set your reset, enable, power pins here
  // !!!!!!!!!!!

The following document mentions PWRKEY, but the SIM7080G CAT-M/NB-IoT Unit does not have that terminal.

SIM7080G_Hardware_Design_V1.04 https://www.simcom.com/product/SIM7080G.html

We are not that familiar with one-board microcomputers or single-board computers. What can we do to communicate via CAT-M?


Solution

  • We rewired and reprogrammed them and they worked as expected. We could not figure out the cause, but they were successfully resolved. Thank you.