Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modem.begin Function in GSM.cpp File for AT+CREG command Hangs #121

Open
aylashiv opened this issue Aug 21, 2020 · 1 comment
Open

Modem.begin Function in GSM.cpp File for AT+CREG command Hangs #121

aylashiv opened this issue Aug 21, 2020 · 1 comment
Labels
type: imperfection Perceived defect in any part of project

Comments

@aylashiv
Copy link

Hi,

I have been using the MKRGSM library and MKR1400 Board, for our application, were it connects to the Azure IoT hub for every 2.5 minutes and relays the data to the hub, the potential issue lies in the GSMcpp file were the modem.begin function calls the CREG command, this CREG command is a blocking call, therefore the program stops for the response untill it does not respind with CREG:0,1.
Though we have tried with timeout approach by introducing a certain time limit to try and gets out of the blocking loop, but the program behaves differently, we have tried with serial prints to know were exactly the Program Hangs, but no gain. we are totally clueless at which point it gets hang even though the timeout has been introduced,

I Seek Suggestions from the Arduino Software community/makers, could help us solve this issue.

@CptHolzschnauz
Copy link
Contributor

The flaky behaviour is caused in the communication between the modem and the network, the mkrgsm lib is just sending the correct AT commands to the modem. If you use the sample sketch, the whole process braced with a while commmand stops somewhen. This makes the start suceed unpredictable. The start can also hang while changing the baud rate:
See #123
For me, i did a primitive startup solution with good results:
int gsm_conn_counter = 0; do { gsmAccess.begin(PINNUMBER); gprs.attachGPRS(GPRS_APN, GPRS_LOGIN, GPRS_PASSWORD); if ((gsmAccess.begin(PINNUMBER) == GSM_READY) && (gprs.attachGPRS(GPRS_APN, GPRS_LOGIN, GPRS_PASSWORD) == GPRS_READY) ) { connected = true; Serial.print("Mobile Uplink Ready!"); delay(1000); break; } else { Serial.print("Mobile Uplink Not Ready! Trying again.."); delay(1000); if (gsm_conn_counter > 3) { Serial.print("Start without Mobile Network.."); delay(2000); } gsm_conn_counter ++; } } while (gsm_conn_counter <= 2);

@per1234 per1234 added the type: imperfection Perceived defect in any part of project label Dec 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: imperfection Perceived defect in any part of project
Projects
None yet
Development

No branches or pull requests

3 participants