TRM240 just hangs when SIM card is inserted

We are trying to test RaspberryPi4 with TRM240 modem using this example:
https://wiki.teltonika-networks.com/view/Setting_up_mobile_interface_on_raspberry_pi

Communication script works when SIM card is not inserted, and we receive NO CARRIER error correctly.

However, whenever we insert SIM card, the communication stops. Modem does not respond to very first AT message and finally we get timeout error.

Does anyone have any possible solution for this? It doesn’t give us too much room to test, just no communication at all when the SIM card is inserted, and is OK when the SIM is removed.

root@aph1:/etc/chatscripts# pppd call gprs
pppd options in effect:
debug # (from /etc/ppp/peers/gprs)
nodetach # (from /etc/ppp/peers/gprs)
dump # (from /etc/ppp/peers/gprs)
noauth # (from /etc/ppp/peers/gprs)
remotename 3gppp # (from /etc/ppp/peers/gprs)
/dev/ttyUSB3 # (from /etc/ppp/peers/gprs)
115200 # (from /etc/ppp/peers/gprs)
lock # (from /etc/ppp/peers/gprs)
connect chat -s -v -f /etc/chatscripts/quectel-chat-connect -T internet # (from /etc/ppp/peers/gprs)
disconnect chat -s -v -f /etc/chatscripts/quectel-chat-disconnect # (from /etc/ppp/peers/gprs)
nocrtscts # (from /etc/ppp/peers/gprs)
modem # (from /etc/ppp/peers/gprs)
asyncmap 0 # (from /etc/ppp/options)
lcp-echo-failure 4 # (from /etc/ppp/options)
lcp-echo-interval 30 # (from /etc/ppp/options)
hide-password # (from /etc/ppp/peers/gprs)
novj # (from /etc/ppp/peers/gprs)
novjccomp # (from /etc/ppp/peers/gprs)
ipcp-accept-local # (from /etc/ppp/peers/gprs)
ipcp-accept-remote # (from /etc/ppp/peers/gprs)
ipparam 3gppp # (from /etc/ppp/peers/gprs)
noipdefault # (from /etc/ppp/peers/gprs)
ipcp-max-failure 30 # (from /etc/ppp/peers/gprs)
defaultroute # (from /etc/ppp/peers/gprs)
usepeerdns # (from /etc/ppp/peers/gprs)
noccp # (from /etc/ppp/peers/gprs)
noipx # (from /etc/ppp/options)
abort on (BUSY)
abort on (NO CARRIER)
abort on (NO DIALTONE)
abort on (ERROR)
abort on (NO ANSWER)
timeout set to 30 seconds
send (AT^M)
expect (OK)
^M
alarm
Failed
Script chat -s -v -f /etc/chatscripts/quectel-chat-connect -T internet finished (pid 2228), status = 0x3
Connect script failed

Hi, maybe SIM has PIN code?

Hello,

We apologize for the inconvenience, but it seems that the ppp package has been updated, causing our tutorial to become outdated. We’ll update the wiki page soon, but for now, here’s a quick fix to help you establish a mobile connection:

  1. Open the file /etc/chatscripts/quectel-chat-connect and make sure it contains the following lines:
ABORT "BUSY"
ABORT "NO CARRIER"
ABORT "NO DIALTONE"
ABORT "ERROR"
ABORT "NO ANSWER"
TIMEOUT 30
"" AT
OK ATE0OK AT+CEREG?
OK AT+CEREG=1
OK AT+COPS?
OK AT+COPS=0
OK AT+CGDCONT=1,"IP","<your desired APN>"
OK ATD*99#
CONNECT

Best regards,

Thanks for quick reply. Unfortunately after applying new script we see no changes in operation, it stops in the same moment as previously. Note, this is stock RaspberryPi4B 2GB RAM from JustPi package, with stock/default latest Raspbian image and followed by tutorial instructions.

(…)

timeout set to 30 seconds
send (AT^M)
expect (OK)
^M
alarm
Failed
Script chat -s -v -f /etc/chatscripts/quectel-chat-connect -T internet finished (pid 2188), status = 0x3
Connect script failed

Edit: after some repeated try of running the script we’ve seen that once it went one step more, however again locked:

(…)

timeout set to 30 seconds
send (AT^M)
expect (OK)
^M
OK
 -- got it

send (ATE0OK^M)
expect (AT+CEREG?)
alarm
Failed
Script chat -s -v -f /etc/chatscripts/quectel-chat-connect -T internet finished (pid 2590), status = 0x3
Connect script failed

Hello,

Please try unplugging your modem and then plugging it back in. This should reset the connection, allowing the script to run smoothly.

Best regards,

Hi,

It looks like there’s an issue in your script. The logs show that the Pi expects (AT+CEREG?) instead of OK. Please review your script to ensure it was copied or rewritten correctly.

2024-06-05-15-26-05-TRM240 just hangs when SIM card is inserted - Teltonika Networks - Teltonika Com

Best regards,

Thanks. I just copied the script that was sent by you in previous message here:

Now by looking at it I see there might be error in your script here:

OK ATE0OK AT+CEREG?

I changed this and added new line after ATE0, although this did not change situation. Also I already replaced the “your desired APN” with the “internet” text.

I constantly reboot the TRM240 device before running script.

Please note, that communication hangs on very first AT command after the TRM240 was reconnected and booted (PWR and LTE leds are lit, NET led is blinking). See screenshot below:

Hi,

Yes, it is my mistake, it should be:

ABORT "BUSY"
ABORT "NO CARRIER"
ABORT "NO DIALTONE"
ABORT "ERROR"
ABORT "NO ANSWER"
TIMEOUT 30
"" AT
OK ATE0
OK AT+CEREG?
OK AT+CEREG=1
OK AT+COPS?
OK AT+COPS=0
OK AT+CGDCONT=1,"IP","<your desired APN>"
OK ATD*99#
CONNECT

I would advise rebooting both devices too.

Best regards,

Thanks.

Rebooted both devices, applied corrected script. The problem is still the same. Hangs after first AT command.

Note, I tested this on two new RPis and two new TRM240s. This screenshot below is after fresh reboot of both RPi and TRM240 devices:

Hello,

I’ve noticed there are still some errors in the script. There are escape characters in this line:

OK AT+CGDCONT=1,"IP","<your desired APN>"

2024-06-05-16-20-33-TRM240 just hangs when SIM card is inserted - Teltonika Networks - Teltonika Com

Also, make sure to use the correct APN. After making these changes, please reboot both devices by shutting them down, not just rebooting via command.

Kind regards,

Thanks, I corrected that too already - please see my message and screenshot here:

I power-cycled both devices.

The SIM card is default one from PLAY Poland network, we tested this with iPhone and the APN was set to internet

I also checked SIM card slot to confirm it is seated correctly.

I am going to try another SIM card from different operator to confirm if that is an issue.

Hello,

I rechecked my test device and experienced similar issues with responses not being delivered. However, after unplugging both devices from power, waiting for some time, and then plugging them back in, the issue you were having was fixed.

Additionally, are you able to get an internet connection from TRM240 plugged into another device like a PC or similar?

Best regards,

Hello,

This does not work at all.

What we tried:

  • two different and brand new devices Raspberry PIs 4B, both setup from scratch from stock Raspbian image
  • two different and brand new devices TRM240
  • two different and brand new SIM cards and two providers, both also tested on regular phone and confirmed working

Whenever SIM card is inserted and modem connects to LTE the serial communication hangs with no response.

We tried rebooting both devices multiple times. Frankly speaking if you encountered the same problem at least once we can not move forward with possible failures and scale this up.

We also tested by connecting modem to macOS 14.5 but nothing happens when device is connected and we could not find any documentation with configuration steps for macOS.

Our conclusion is that TRM240 does not support Raspberry PI and we will have to send these devices back. Thanks for your support.

Hi,

I doubt this is a TRM240 issue, as the connection is definitely possible. I recommend trying other Raspberry Pi images that don’t require CLI setup. Images like Ubuntu, Parrot, or others have automatic modem detection (though sometimes the APN needs to be entered depending on the device).

Here is an example of it working on Parrot Linux:

Best regards,

Hi Marcin,
go one step further “down to the hardware”.
Try accessing the TRM240 via minicom terminal.

Are you sure the modem is on /dev/ttyUSB3?
Sounds funny. Usually the devices are number starting with 0 (zero).
Minicom should tell you if there’s a device listening on a certain port.
Maybe the device number changes if you unplug and then replug it?

Just a few thoughts from a “serial communication guy”.

Regards,
Timelapse Admin

Thanks for your reply. The /dev/ttyUSB3 responds correctly when SIM card is not inserted, so I guess it’s not the case. The problems start only when the LTE led is lit, it even works for a few seconds when modem is connecting to LTE with card inserted.

We downloaded ParrotOS and will check it there. Where we can find tutorial/documentation how to setup ParrotOS to connect to TRM240 modem? We created new mobile connection, selected provider, APN etc. in System Settings but it does not work (i.e. is not visible in available networks), so we may need some additional steps to make the connection? Thanks.

Hi,

There is no tutorial because, in most cases, it is just plug and play. The TRM240 should work when connected to a Raspberry Pi with most newer Linux distros, as they have automatic modem recognition and setup, similar to Windows or other computers.

Best regards,

Thanks Marijus, understood and expected so, but unfortunately not in this case. Nothing happens when I plug TRM240 to Parrot OS. I created mobile connection manually via some wizard but it says the connection is not available, and it does not show up in the current network connections list.

Hi,

Maybe your TRM240 faulty? Have you successfully connected it to any device as a modem and obtained an internet connection?

Kind regards,

We have two TRM240s and two RaspberryPIs, both do not work. I connected TRM240 to MacBook without luck. Could be that’s just faulty hardware indeed, although I doubt it as we tested two devices. And I assume macOS does not support TRM240 out of the box (btw. it shows up as “Android device” in macOS).