LTE connection

Use this forum to discuss LTE related topics concerning the Challenger and Connectivity boards.
les.goss
Posts: 7
Joined: Wed May 29, 2024 12:01 am

LTE connection

Post by les.goss »

Hi there, are there any decent examples of how to get this device connected? I have uploaded the example code and it just says "Modem Started" tho the sim shows as not connected! 1NCE sim and I'm from New Zealand.
Pontus
Site Admin
Posts: 42
Joined: Wed May 22, 2024 10:06 pm
Location: Östra Ingelstad
Contact:

Re: LTE connection

Post by Pontus »

Les,
To get started I just tested the sketch here with the following result:

Code: Select all

13:31:27.027 -> Wait...
13:31:32.943 -> Modem started !
13:31:33.940 -> Initializing modem...
13:31:33.940 -> [9305] ### TinyGSM Version: 0.11.5
13:31:33.940 -> [9305] ### TinyGSM Compiled Module:  TinyGsmClientSaraR4
13:31:33.973 -> [9326] ### Modem: u-blox SARA-R412M-02B
13:31:33.973 -> [9327] ### Modem: u-blox SARA-R412M-02B
13:31:34.006 -> Modem Info: Manufacturer: u-blox 
13:31:34.006 -> Model: SARA-R412M-02B 
13:31:34.006 -> Revision: M0.12.00 [Dec 04 2020 16:05:31] 
13:31:34.006 -> SVN: 07 
13:31:34.006 -> IMEI: 359159975181141
13:31:34.006 -> Waiting for network... success
13:31:51.880 -> Network connected
13:31:51.880 -> Connecting to iot.1nce.net success
13:31:51.914 -> GPRS connected
13:31:51.914 -> Performing HTTP GET request... [27301] ### Opening socket asynchronously!  Socket cannot be used until the URC '+UUSOCO' appears.
13:31:52.246 -> [27604] ### Waited 314 ms for socket to open
13:31:54.273 -> [29630] ### URC Data Received: 559 on 0
13:31:54.340 -> Response status code: 200
13:31:54.340 -> Response Headers:
13:31:54.340 ->  Server : nginx/1.22.1
13:31:54.340 ->  Date : Mon, 17 Jun 2024 11:29:33 GMT
13:31:54.340 ->  Content-Type : text/plain; charset=UTF-8
13:31:54.340 ->  Content-Length : 121
13:31:54.340 ->  Connection : close
13:31:54.340 ->  X-Powered-By : Express
13:31:54.340 ->  Access-Control-Allow-Origin : *
13:31:54.340 ->  Access-Control-Allow-Headers : X-Requested-With
13:31:54.340 ->  Cross-Origin-Resource-Policy : cross-origin
13:31:54.340 ->  Accept-Ranges : bytes
13:31:54.340 ->  Cache-Control : public, max-age=86400
13:31:54.340 ->  Last-Modified : Wed, 27 Sep 2017 09:03:12 GMT
13:31:54.340 ->  ETag : W/"79-15ec2936080"
13:31:54.340 -> Content length is: 121
13:31:54.373 -> Response:
13:31:54.373 -> 
13:31:54.373 ->   _____            _____  _____  _____
13:31:54.373 ->     |  | |\ | \_/ |  ___ |_____ |  |  |
13:31:54.373 ->     |  | | \|  |  |_____| _____||  |  |
13:31:54.373 -> 
13:31:54.373 -> 
13:31:54.373 -> Body length is: 121
13:31:54.373 -> [29720] ### Closing socket asynchronously!  Socket might remain open until arrival of +UUSOCL: 0
13:31:54.373 -> Server disconnected
13:31:54.638 -> GPRS disconnected
So this is what you should expect.
Now we just need to work out what is not working for you.

Could you please check out this article and see if it helps you in any way.
https://ilabs.se/how-to-debug-connectio ... a-modules/
les.goss
Posts: 7
Joined: Wed May 29, 2024 12:01 am

Re: LTE connection

Post by les.goss »

Hi there, thanks for the info.

I uploaded the code to the challenger LTE board and had that board selected in arduino and got a compilation error
Connectivity.h: No such file or directory
4 | #include "Connectivity.h"

I then tried the Connectivity board and it compiled and uploaded to the Challenger board however only got this far

Connectivity RP2040 LTE/WiFi/BLE test program !
Waiting for modem to start..
Modem started !

then blinking led

Do not receive any AT commands either
les.goss
Posts: 7
Joined: Wed May 29, 2024 12:01 am

Re: LTE connection

Post by les.goss »

Changed the code to the following

/*
Simple test program to test access to the LTE modem on the Challenger RP2040 LTE board
*/
//#include "Connectivity.h"
#include "ChallengerLTE.h"

#define TERM Serial
#define DEBUG Serial1
#define SYSTEM_MNO_PROF 100
#define DEFAULT_PS_ENABLED 0

char buf[4096];
int led_state = LOW;

void send(const char *cmd);

// the setup function runs once when you press reset or power the board
void setup() {
pinMode(LED_BUILTIN, OUTPUT);
digitalWrite(LED_BUILTIN, led_state);
pinMode(18, OUTPUT);
digitalWrite(18, HIGH);

TERM.begin(115200); // Terminal
while (!TERM)
delay(10);
TERM.println("Connectivity RP2040 LTE/WiFi/BLE test program !");
TERM.println("Waiting for modem to start..");

// Power on modem
SARA_SERIAL_PORT.begin(115200);
if (!Challenger2040LTE.doPowerOn()) {
TERM.println("Failed to start the modem properly !");
while(1);


still the same result

Connectivity RP2040 LTE/WiFi/BLE test program !
Waiting for modem to start..
Modem started !
Pontus
Site Admin
Posts: 42
Joined: Wed May 22, 2024 10:06 pm
Location: Östra Ingelstad
Contact:

Re: LTE connection

Post by Pontus »

OK, so what board are you using now. Connectivity or Challenger ? They differ in what pins are assigned to control the modem so it is important to use the proper header file in the sketch and to select the correct board in the Arduino framework.

Assuming you are using the Connectivity board you need to change the #include statement in the previous post to include the Connectivity.h file instead. But I guess you have already done that since the modem seem to be responding.

When the modem has started you can now send AT commands. If you are using the Arduino IDE this would be done in the input line at the top of the terminal window. IMPORTANT ! Remember to set the line ending to Carriage Return, otherwise the modem will not react to your input.

Note that when running the example program you do not get any connection with the modem via the terminal.

let me know how it works out for you.
les.goss
Posts: 7
Joined: Wed May 29, 2024 12:01 am

Re: LTE connection

Post by les.goss »

Yes using the Challenger board. Tried carriage return and now the board doesn't do anything even after re uploading!
les.goss
Posts: 7
Joined: Wed May 29, 2024 12:01 am

Re: LTE connection

Post by les.goss »

Challenger board is working again however still the same result. Do not receive anything from AT commands

Red led comes on.

Connectivity RP2040 LTE/WiFi/BLE test program !
Waiting for modem to start..
Modem started !

then blinking green led.

Red led goes off after a few seconds then to quick faint flashing
Pontus
Site Admin
Posts: 42
Joined: Wed May 22, 2024 10:06 pm
Location: Östra Ingelstad
Contact:

Re: LTE connection

Post by Pontus »

This sounds a bit weird, The firmware is sending AT commands to the device and receiving response as a part of the startup sequence so your system works as expected. There is the possibility that it goes into sleep before you have the time to do anything. Try sending AT+CPSMS=0 directly after the system starts. This will disable all the power save features. It should look something like this:

Code: Select all

11:03:00.419 -> Connectivity RP2040 LTE/WiFi/BLE test program !
11:03:00.419 -> Waiting for modem to start..
11:03:06.388 -> Modem started !
11:03:12.259 -> at+cpsms=0
11:03:12.259 -> OK
Alternatively you can add the line SARA_SERIAL_PORT.println("AT+CPSMS=0"); as the last line in the setup function. This will also disable all sleep modes effectively.

A short note about the red LED. It is the charging light and will not work properly until a battery is connected on the battery connector. When no battery is present it actually reacts on the system load, which is why you see it flickering a bit. The fact that it goes out after a bit is why I am suspecting that it goes into sleep mode.
les.goss
Posts: 7
Joined: Wed May 29, 2024 12:01 am

Re: LTE connection

Post by les.goss »

One step forward I guess tho what next?

10:30:33.410 -> Connectivity RP2040 LTE/WiFi/BLE test program !
10:30:33.410 -> Waiting for modem to start..
10:30:39.627 -> Modem started !
10:30:40.620 -> AT+CPSMS=0
10:30:40.620 -> OK
10:30:49.170 -> AT
10:30:49.170 -> OK
10:31:11.602 -> AT+CEREG=2
10:31:11.602 -> OK
10:31:32.057 -> AT+COPS=?
10:31:32.057 -> ERROR

Why am I getting OK after AT+CEREG=2
Pontus
Site Admin
Posts: 42
Joined: Wed May 22, 2024 10:06 pm
Location: Östra Ingelstad
Contact:

Re: LTE connection

Post by Pontus »

OK, lets continue finding out what is going wrong here.
The AT+CEREG=2 simple starts a subscription to unsolicited messages from the modem so you don't have to poll the device for status changes. So the OK response there is OK.
The problem here is that the AT+COPS=? fails, so lets do a couple of things to begin with.
Sometimes when you fiddle around with the modem to much it ends up in a strange state so lets try and reset that.
We will do this by changing the MNO profile to something other than the current one and then change it back to what you have set before.

Start by checking the current MNO profile:

Code: Select all

-> AT+UMNOPROF?
-> +UMNOPROF: 100
As you can see in my case the current MNO profile is 100 as I am in Europe. I will now change it to 0 temporarily and then back to 100 to get it to reset all internal settings.

Code: Select all

-> AT+CFUN=0  (De register the module from the network)
-> OK
-> AT+UMNOPROF=0
-> OK
-> AT+CFUN=15  (This resets the module so it will take a few seconds for it to restart)
-> OK
-> AT   (Here I'm just checking that the module has restarted)
-> OK
Now I want to revert back to my original MNO profile again

Code: Select all

-> AT+CFUN=0
-> OK
-> AT+UMNOPROF=100
-> OK
-> AT+CFUN=15  (Again this resets the module so it will take a few seconds for it to restart)
-> OK
-> AT  (Started again)
-> OK
And now you should be able to run AT+COPS=? to find the networks in your area. All of these steps are explained in more detail in the SARA-R4 series - AT commands manual.

Code: Select all

-> AT+COPS=?
-> +COPS: (1,"Telenor SE","TelenorS","24008",7),(2,"Tele2","Tele2 SE","24007",7),(1,"TELIA S","TELIA","24001",0),(1,"Sweden Mobile","MobileS","24024",0),(1,"TELIA S","TELIA","24001",9),,(0,1,2,3,4),(0,1,2)
-> OK
Also important to notice you need to select the appropriate MNO profile for the area that you are located in. The SARA-R4 series - AT commands manual have a list with all the different profiles available in the different modems. You can also run the command AT+UMNOPROF=? to get a list of the available profiles. But should really be able to use MNO profile 1 since you are using a 1nce SIM card.

In some cases the modem might not auto connect and it might be necessary to connect directly using the AT+COPS command. In that case something like this can be used:

Code: Select all

AT+COPS=4,2,"24008"
Another thing you should also check is to see if you can reach the SIM card. You can do this by running the command AT+ICCID, this should give you and output like this:

Code: Select all

-> AT+ICCID
-> ICCID: 8988XXXXXXXXXX609492 (I've masked out some of the digits here for security purposes)
-> OK
Let me know how that works out for you.
Post Reply