Open hubaksis opened 4 years ago
No, I've never seen that before. Google tells me that it's an ESP problem trying to access an invalid register. This library definitely doesn't touch the esp's registers directly, so I'm guessing there's a core problem with your board. Are you using the latest Arduino core? Is it possible that you have remnants of an old firmware flash hiding somewhere in your esp's memory?
Sometimes weird issues can also be caused by unstable power, particularly at peak draw moments like connecting and receiving data. Most 2G and 3G module specifications require a stable 2 amp power supply, which is quite a bit (4x) what most Arduino style boards can supply. From my experience, you really can't get away with anything less.
Thank you for the advice. I've tried to go back to different cores: 2.4.1, 2.4.2, 2.6.2, 2.6.3 - the result is the same.
I'll try to add more debug messages to try to find the correct spot when this happens.
The power supply is ok (external, up to 5A) and everything works find with a bit different code, but I would like to try TinyGSM for my needs.
Thank you.
Found the issue.
Firstly, when working with SIM5320, you need to wait for the PB DONE response after the modem restarts. Can't find it in docs, but I noticed that it can be busy and unresponsive before this response.
bool restartImpl() {
if (!testAT()) { return false; }
sendAT(GF("+REBOOT"));
if (waitResponse(10000L) != 1) {
return false;
}
//delay(3000L); // TODO(?): Test this delay!
if (waitResponse(40000L, GF(GSM_NL "PB DONE")) != 1) {
DBG("### No PB DONE:");
return false;
}
return init();
}
Secondly, the issue above happens in 'modemGetConnected' method here:
for (int muxNo = 0; muxNo < TINY_GSM_MUX_COUNT; muxNo++) {
// +CIPCLOSE:<link0_state>,<link1_state>,...,<link9_state>
sockets[muxNo]->sock_connected = stream.parseInt();
}
As soon as I commented the line with stream.parseInt(), it started to work.
In the log above you can see that it reads only 2 numbers before the exception:
+CIPCLOSE: 1,0Fatal exception....
Maybe the stream is empty? Any advise?
Thank you.
I really don't know how this library could be causing that fatal exception. All it is doing is using basic functions of the Arduino stream class. If those aren't working, that's a deeper problem than the library can handle. I'll dig around more though and make sure I don't have a messed up mux number causing a null pointer or something bad of that sort.
I've never touched a real SIM5320, just read the manual and helped other people with it, so I'll take your word for the PB DONE
message and add a wait for it.
I've narrowed the issue to the sockets array. Maybe it is not initialized as setting TINY_GSM_MUX_COUNT to 1 solves the issue. I'll post an update if I find anything. As for PB DONE - it means PhoneBook loaded. I haven't find any references in the AT Command manual, this is just an observation that the modem is completely ready and nothing happens after that message.
Aha! I think it is a null pointer problem on my side. Can you try the most recent version and see if it's fixed?
@hubaksis is right about waiting for PB DONE
or even PB DONEDS
just in case you use two SIM cards in a DUAL SIM modem... because i was facing this same issue whenever I tried to subscribe to some MQTT topics just after I got the URC +CGEV: EPS PDN ACT 1
and the pub/sub never happened, so, I waited for PB DONEDS
and it goes alright as I'm currently testing it. For the record, I'm using this modem called A7670 just in case anyone wanna know.
UPDATE: I actually decided to give up on MQTT and now I'm currently using UDP instead of TCP, which seems to work faster and reliable on some mobile operators in my country.
What type of issues is this?
[x ] Bug or issue with library functionality (ie, sending data over TCP/IP)
What are you working with?
Main processor board: ESP8266 (Wemod D1 mini Pro) Modem: SIM5320 TinyGSM version: 0.10.1 Code: TinyGSM/examples/HttpClient/
Scenario, steps to reproduce
Change the example like the steps below
define TINY_GSM_MODEM_SIM5360
include
SoftwareSerial SerialAT(D2, D4);
define DUMP_AT_COMMANDS
Define your apn.
Expected result
The request is sent
Actual result
Exception
AT command log
I'll try to add logging around methods that send latest AT commands and provide a result. Maybe this is an already known issue and can be easily fixed?
Thanks