Portenta H7 - Cat. M1/NB shield does not connect over LTE Cat-M1

While working with the Portenta H7 Cat. M1/NB shield, I found out that the Thales Cinterion TX62 cellular modem only connects over NB-IoT, NOT over LTE Cat-M1.

When defining CATM1 in the GSM.begin(), it doesn't connect and eventually moves to NB-IoT after a few tries.

I used:

if(GSM.begin(pin, apn, username, pass, CATM1)){

When looking at the debug logs, it shows the device is connected to NB-IoT:
The last digit: 9 indicates NB-IoT ( 7 indicates Cat-M1)

+CEREG: 2<cr><ln><cr><ln>+CEREG: 5,"2D5B","0187FB66",9

Any pointers on how to make the shield connect over LTE CAT-M1?

Does anyone know a way to directly communicate with the cellular modem to send AT Commands? This way I can do run some test.


Arduino code used:

#include <GSM.h>

char pin[]      = SECRET_PIN;       //example "1234"
char apn[]      = SECRET_APN;       //example "live.provider.com"
char username[] = SECRET_USERNAME;
char pass[]     = SECRET_PASSWORD;

void setup() {
  Serial.begin(115200);
  while(!Serial) {}
  GSM.debug(Serial);

    if(GSM.begin(pin, apn, username, pass, CATM1)){
        Serial.println("connected");
    // ...
    }
}

Reference:

1 Like

Update

Turned out that the Cat M1 bands are disabled by default.

AT^SCFG="Radio/Band/CatM"
^SCFG: "Radio/Band/CatM","00000000"

To enable the Cat M1 bands, enter the following command (use 80000 is for B20):

AT^SCFG="Radio/Band/CatM","80000"  
^SCFG: "Radio/Band/CatM","00080000"

Reference: check the AT Commands manual at the Thales website - link.

Arduino sketch to directly communicate with the Cinterion TX62 module:

 /*
  SerialPassthrough sketch

  Some boards, like the Arduino 101, the MKR1000, Zero, or the Micro, have one
  hardware serial port attached to Digital pins 0-1, and a separate USB serial
  port attached to the IDE Serial Monitor. This means that the "serial
  passthrough" which is possible with the Arduino UNO (commonly used to interact
  with devices/shields that require configuration via serial AT commands) will
  not work by default.

  This sketch allows you to emulate the serial passthrough behaviour. Any text
  you type in the IDE Serial monitor will be written out to the serial port on
  Digital pins 0 and 1, and vice-versa.

  On the 101, MKR1000, Zero, and Micro, "Serial" refers to the USB Serial port
  attached to the Serial Monitor, and "Serial1" refers to the hardware serial
  port attached to pins 0 and 1. This sketch will emulate Serial passthrough
  using those two Serial ports on the boards mentioned above, but you can change
  these names to connect any two serial ports on a board that has multiple ports.

  created 23 May 2016
  by Erik Nyquist
*/
#include "mbed.h"

#define MBED_CONF_GEMALTO_CINTERION_RTS   PI_10
#define MBED_CONF_GEMALTO_CINTERION_TX    PA_0
#define MBED_CONF_GEMALTO_CINTERION_RX    PI_9
mbed::DigitalOut on(PJ_7, 1);
mbed::DigitalOut rts(MBED_CONF_GEMALTO_CINTERION_RTS, 0);

arduino::UART SerialGemalto(MBED_CONF_GEMALTO_CINTERION_TX, MBED_CONF_GEMALTO_CINTERION_RX, NC, NC);

void setup() {
  Serial.begin(115200);
  //while(!Serial)
  SerialGemalto.begin(115200);
  on = 0;
  delay(200);
  on = 1;
   
  delay(200);
  pinMode(PJ_7,INPUT_PULLDOWN);

}

void loop() {
  if (Serial.available()) {      // If anything comes in Serial (USB),
    char c = Serial.read();
    SerialGemalto.write(c);   // read it and send it out Serial1 (pins 0 & 1)
    //Serial1.write(c);
  }

  if (SerialGemalto.available()) {     // If anything comes in Serial1 (pins 0 & 1)
    char c = SerialGemalto.read();
    Serial.write(c);   // read it and send it out Serial (USB)
  }
}

Hello @laurenssl .
I have been struggling with the Portenta Shield and a CAT-M1 SIM Card, but it doesn't connect to the network. I believe I have the same problem described here.
Can you please share the code on how to pass the AT commands to the modem via the function SerialGemalto.write()? In my case I need LTE 1800 (B3) so the argument is "4" according to the manual.
I wasn't able to use the script here. I would appreciate a more detailed code, thank you!

Hi @salrog22,

You can copy the above Arduino sketch. After uploading, you can open the Serial Monitor and start sending AT Commands to configure the modem.

To enable band Cat-M1 band 3, use:

AT^SCFG="Radio/Band/CatM","4"  

I've written a tutorial on how to do configure the modem using AT Commands. Maybe you find this helpful. See:

Thanks for the detailed instructions, but it does not work for me. After 30s, I have an ERROR (including other commands from your tutorial).
09:10:35.721 -> AT^SCFG="Radio/Band/CatM","4"
09:11:05.689 -> ERROR

I believe the UART communication to the modem is not setup properly.

  1. Why do you use the SERIAL0 pins instead of SERIAL1?
  2. Why is the CTS pin not being used? (Quoting Page 103 of the Thales Manual: "It is strongly recommended to always use RTS/CTS hardware flow control.")
  3. Is there a need to press the push button PB1 (ON MOD)?

Let me know if you have an updated script to the UART configuration above.

The SerialPassthrough sketch worked for my right away. I didn't touch the PB1, nor any setting regarding the CTS pin/SERIAL0 etc.

A few checks you can execute:

  • Did you establish a connection with the modem?

    AT
    OK
    
  • Reset the modem:

    AT&F
    
  • Does it recognize the SIM?

    AT+CPIN?
    +CPIN: READY
    
  • Check the RAT priority settings:

    AT^SXRAT?
    ^SXRAT: 10, 7
    
  • Check what bands are currently set:

    AT^SCFG="Radio/Band/CatM"
    ^SCFG: "Radio/Band/CatM","00080000"
    

Hope this helps

I have tried all those commands, AT, AT&F, etc... For all of them I get an ERROR.
Any other idea what is going on?

Hi @laurenssl
What is the version of the Board Manager Mbed OS Portenta you are using when compiling the SerialPassthrough sketch?
Do you have any LEDs turned ON on the Shield Board (not on the Portenta board)?
Thanks!

Hi @salrog22
ERROR response after ~30s for each command means that it was not properly terminated.
Each command shall end with (be terminated) character.
This ERROR means that module timed out on receiving character.

BR
Tymek

Hi @tymoteusz_tymek ,

You were absolutely right, thanks for that!
I forgot to select the option "Both NL & CR" in the Arduino IDE Serial Monitor.
Now I can pass commands to the modem.

1 Like

Hi @salrog22 ,

I'm glad this resolved your problem :slight_smile:

In case you have other question regarding the module - feel free to ask.

BR
Tymek

Hi @tymoteusz_tymek,

Actually I do have another question regarding the GNSS module.
I am unable to obtain a valid position fix.
I'm using direct AT commands to the modem to configure the GNSS and obtain NMEA Sentences.
I'm using the active antenna suggested by the Arduino datasheet (ECHO 19).
I'm using the example from the Cinterion® TX62-W AT Command Set (page 406).
This is my output:

16:14:58.475 -> $GPGSV,4,1,16,02,29,135,00,05,13,069,00,06,,,00,10,02,309,00,15F
16:14:58.475 -> $GPGSV,4,2,16,11,05,136,00,12,18,142,00,13,,,00,15,20,020,00,1
5F
16:14:58.503 -> $GPGSV,4,3,16,16,,,00,18,49,347,00,20,,,00,22,08,235,00,169
16:14:58.503 -> $GPGSV,4,4,16,23,15,333,00,24,61,066,00,25,21,181,00,26,,,00,1
5C
16:14:58.503 -> $BDGSV,1,1,0,4*40
16:14:58.503 -> $GPGSA,A,1,,,,,,,,,,,,,,,*1E
16:14:58.503 -> $BDGSA,A,1,,,,,,,,,,,,,,,0F
16:14:58.503 -> $GNGSA,A,1,,,,,,,,,,,,,,,00
16:14:58.503 -> $GNVTG,,T,,M,,N,,K,N
32
16:14:58.503 -> $GNRMC,,V,,,,,,,,,,N,V
37
16:14:58.549 -> $GPGGA,,,,,,0,,,,,,,,*66

Although I have 16 satellites in view, even after waiting 20 minutes, I have invalid position fix. Any ideas how to solve this?

Thanks!

Hi @salrog22

I would recommend you to use A-GPS - module will connect to the internet and download XTRA assist data files and sync time with an NTP server.
AT^SGPSC="Engine/StartMode",1
Check if this helps.

About active antenna usage - please make sure that voltage is present on GPS antenna connector. If it's not - check if R29 is populated and then configure module GPIO7 to high state to enable LNA supply (bias).

BR
Tymek

Hi @tymoteusz_tymek,

  • Yes, I am using XTRA.
  • Indeed, voltage is not activated by default. I have used the following code:
    AT^SPIO=1
    AT^SCPIN=1,7,1,1
    Now 3V has been confirmed with a multimeter.

Nevertheless, I still have no GPS response (although I have a blue sky above me).

18:19:39.095 -> $GPGSV,1,1,0,154
18:19:39.095 -> $BDGSV,1,1,0,4
40
18:19:39.095 -> $GPGSA,A,1,,,,,,,,,,,,,,,*1E
18:19:39.095 -> $BDGSA,A,1,,,,,,,,,,,,,,,0F
18:19:39.095 -> $GNGSA,A,1,,,,,,,,,,,,,,,00
18:19:39.095 -> $GNVTG,,T,,M,,N,,K,N
32
18:19:39.095 -> $GNRMC,,V,,,,,,,,,,N,V
37
18:19:39.095 -> $GPGGA,,,,,,0,,,,,,,,*66

Can you please send me the exact scripts to config, activate and run the GPS? The example on page 406 of the Command Set is not working for me.

Can you please also explain how to configure the LTE Network prior to activating the GPS as well? Should I be attached to network only or also activate Internet service connection?
In my case I am confirming that I have Internet connection with a command "AT^SISX=Ping".

18:43:53.424 -> AT^SISX=Ping,1,"8.8.8.8",5,5000
18:43:53.472 -> AT^SISX=Ping,1,"8.8.8.8",5,5000

18:43:53.700 -> ^SISX: "Ping",1,1,"8.8.8.8",229
18:43:53.748 -> ^SISX: "Ping",1,1,"8.8.8.8",76
18:43:53.836 -> ^SISX: "Ping",1,1,"8.8.8.8",79
18:43:53.928 -> ^SISX: "Ping",1,1,"8.8.8.8",80
18:43:54.017 -> ^SISX: "Ping",1,1,"8.8.8.8",81
18:43:54.017 -> ^SISX: "Ping",2,1,5,5,0,0
18:43:54.017 -> ^SISX: "Ping",3,1,76,229,109
18:43:54.017 ->
18:43:54.017 -> OK
18:44:02.781 -> AT^SGPSC="Engine/StartMode",1
18:44:02.781 -> AT^SGPSC="Engine/StartMode",1

18:44:02.781 -> ^SGPSC: "Engine/StartMode","1"
18:44:02.781 ->
18:44:02.781 -> OK
18:44:06.818 -> AT^SGPSC="Engine",3
18:44:06.818 -> AT^SGPSC="Engine",3

18:44:06.866 -> ^SGPSC: "Engine","0","12"
18:44:06.866 ->
18:44:06.866 -> OK

Any chance there's a problem on gpsOneXTRA side?
Any idea what is going on? Thanks!

Hi @salrog22
can you check which FW module is running? (command ATI1)
It might be that you have a bit older version where DNS for XTRA server was "broken"

Please also let me know what is the version of AT command spec you are referring to.

About network connectivity before starting AGPS - you just need to be registered to a network.
NTP sync and XTRA download activate contexts on their own, but it's OK if you activate PDP context manually (AT^SICA=1,1) and do a AT^SISX=ping test.

BR
Tymek

ATI1
ATI1
Cinterion
TX62-W
REVISION 01.001
A-REVISION 01.000.05

OK

Is this the latest Firmware? Can you confirm that in this version the DNS server is broken?

I’ve read about the “AT^SNFOTA” Firmware Upgrade, but can you please provide me the complete set of commands to upgrade it to a working version of the GPS? Just want to make sure I don’t damage the board.

I’m referring to the document AT Command Set Revision: 01.000 / DocId: TX62-W_ATC_V01000.

Let me know how to fix this, thanks.

Just for future record in case someone is looking for update.

This release fixes DNS problem for GNSS XTRA file download.

Here is Release 1.2 FW and documentation available.
Update is recommended via USB connection to the module.
https://files.c-wm.net/index.php/s/cBSeJEs9PopFnDK
PW: Portenta_2022

1 Like

@tymoteusz_tymek How does one acheive a USB connection to the module?

[2022-08-30 14:29:21]
[2022-08-30 14:29:22]Initializing firmware update...
[2022-08-30 14:29:24]Waiting for re-enumerated USB port...
[2022-08-30 14:29:30]Warning: Timeout waiting for 1st ACK before swup start!
[2022-08-30 14:38:36]
[2022-08-30 14:38:36]Initializing firmware update...
[2022-08-30 14:39:05]WARNING: AT-Command-Mode not detected (trying fall back with 115200)!

edit: it appears you need to solder wires onto it.

Hi @laurenssl , I am sorry to ping you but it seems you have a good knowledge over the Portenta and its shield.

I did what you said to setup the shield and its working very well thanks !
But I have an issue... I am using GSM and GPS libraries which works well as long as I am not using both at same time.

I can do:

  • GSM.begin(...)
  • Make GET request from GSM
  • I get the HTML page I requested

I can do:

  • GPS.begin(...)
  • I get the GPS fix correctly

But I cannot do:

  • GSM.begin(...)
  • GPS.begin()
  • Make GET request from GSM
  • I get an error for that GET request (the library is getting GPS data in middle of the request call)
  • I cannot get the fix from GPS as long as the GSM request is running and returning data

It seems that its because boths data are read from Serial and they are interfering with each others (GSM got GPS in middle of GET request and GPS got HTML in middle of GPS data).

First question, is it possible to use SoftwareSerial for GPS data ?
If yes, do you have hints because sources I get on forums are simple link to docs that dont give examples or they are too advanced for me so I can understand whats intersting to me.
If not, do you have any solution to avoid killing GPS during GSM calls (internet/sms/call) ?

Thanks !

Hi @BluuJo,

I experienced the same. AFAIK it's not possible to send data when the GPS is active.

In order to send GPS data I need to:

  • GSM.begin(...)
  • GPS.begin()
  • Wait for a GPS fix
  • Store GPS coordinates in variables
  • GPS.end();
  • Send the GPS coordinates using ArduinoHTTPClient or ArduinoMQTTClient.

Now there's another problem (I already contacted Arduino support about this). Once you run GPS.end(); you cannot restart the GPS again using GPS.begin(). So, thus far I've only been able to send GPS data once.

Hope this helps. I don't think it's possible to use SoftwareSerial for GPS data.