khoih-prog / GSM_Generic

Enables GSM/GRPS network connection using the GSM/GPRS modules. Use this library to make/receive voice calls, to send and receive SMS using Generic GSM/GPRS modules, such as u-blox SARA-U201 module.This library also allows you to connect to internet through the GPRS networks. You can either use Web Clients and Servers.
GNU General Public License v3.0
16 stars 7 forks source link

TOBY-L2 support issue #8

Open raphaelmoncaut opened 2 years ago

raphaelmoncaut commented 2 years ago

Arduino IDE version: 1.8.16 MCU board : Adafruit Feather M0 Adalogger OS : Windows 10 20H2

Hi ! I tried to use the lib with a TOBY-L210 modem and it doesn't work well.

I used it on a Adafruit Feather M0 Adalogger with the SendSMS example. I changed the the defines in order to select the Generic UBLOX modem and also selected the right serial ports for both Debug and GSM.

Everything is working well with the LISA-U200 but as soon as I replace it with the TOBY-L210, nothing works.

The first obvious issue is the fact that the lib doesn't wait long enough for the modem to reboot because, for some reason, my TOBY-L2 takes about 18 seconds to reboot (not absolutely sure that's normal but is seems like it is).

The second issue i found pretty quickly is that the TOBY-L2 modems does not support AT commands terminated by both CR and LF for the reason that is written in the first note in the part 1.3.3 of the AT Commands Manual.

After kind of patching these two issues, the sketch seemed to begin correctly until it reached the AT+CMGF=1 command. The modem's response to this command doesn't seem making any sense to me and it changes everytime. After that response, the program gets stuck at this point.

At this point I'm kind of confused on what's going wrong.

Here is an example of console output (with debug level = 6) until the program gets stuck :


Starting SendSMS on SAMD_ZERO
GSM_Generic v1.6.1
[GSM] begin: UART baud = 9600
AT+CFUN=16
[GSM] begin: reset error
[GSM] GSM::begin: _gsmData._state = GSM_ERROR
Not connected
[GSM] begin: UART baud = 9600
AT+CFUN=16
AT+CFUN=16

OK
AT
AT

OK
AT
AT

OK
[GSM] begin: Check autosense
AT
AT

OK
[GSM] begin: Modem OK
AT+CPIN?
AT+CPIN?

+CPIN: SIM PIN

OK
AT+CPIN="0294"
AT+CPIN="0294"

OK
AT+CMGF=1
U*
|

An other example of weird response (note that, this time, the CMGF is ok but the next ccommand is f*cked up) :

AT+CMGF=1
AT+CMGF=1

OK
AT+UDCONF=1,1
URA"D1

I tried sending the AT+CMGF=1 command by hand using a serial terminal in a similar context (after sending all the preceding commands) and I don't get this kind of weird response.

Do someone have an idea of what's happening ? Is it intended to add proper support for TOBY modems ?

tcpipchip commented 2 years ago

i am not sure, but to use the TOBY-L2 with GSM GENERIC, you must to use the AT COMMAND to make it work with 2G band RAT at+urat=

khoih-prog commented 2 years ago

Thanks @tcpipchip

@raphaelmoncaut

I also suggest you to start testing with TinyGSM library, after you're sure all AT commands are OK with TOBY-R2, then post either change the command sequence in Modem_UBLOX_Generic.h and Modem_UBLOX_Extra_Generic.h or creating new files for TOBY-R2. Then post the working solution using PR or here. Then I'll make the change and release a new version.

Thanks,