Seeed-Studio / GPRS_SIM900

library for GPRS shield with sim900 module.
MIT License
138 stars 96 forks source link

get rid of error from AT+CMGF=1 #39

Closed chindro closed 4 years ago

chindro commented 5 years ago

When calling init() the first time the AT+CMGF=1 command always returns an ERROR. The second attempt is working. I'm using SIM800L. 1 Does anyone else experience this? 2 It seems like this command works only after the module put these lines on the serial: +CPIN: READY Call Ready SMS Ready So I thought of waiting for "SMS Ready" to arrive before issuing the AT+CMGF=1 command. As the manual does not say anything about "SMS Ready", I'm not sure if this is reliable. What do you think? Edit: I just tried using AT+CFUN?, but this does not work since this command always returns 1 after setting AT+CFUN=1.

chindro commented 5 years ago

Just a reminder for myself: Try running AT+CMGF=1 in a loop until it's successful.