I got caught by this. Drove me crazy for a while until I dug a little deeper. The code turned on gps using AT+QGPS=4. This seems reasonable, but it doesn't work. I changed it to AT+QGPS=1. Seems for mode 4 you need to regularly upload the ephemeris and other data to the module for fast TTFF (time to first fix). Mode 1 is the bog standard mode, so it is a little slow to start up.
Line 136 in RAK8212.js AT+QGPS=4 -> AT+QGPS=1
Other issues I've found are:
CREG? works for gsm but for CAT-M1 and CAT-NB1, CEREG? is the command to query if we are connected to the network. Interestingly, I have one BG96 module that works with CREG? and returns 0,1 when online, but two others that report 0,3 which translates to connection refused but CEREG returns 0,1. Somehow it seems GSM is not enabled in two of my modules - I'm not sure how I did this! Note that this was using the same or different SIMs, so not an account/SIM issue.
Line 156 of QuectelBG96.js CREG -> CEREG
There's some issues with the registered handlers being forgotten - the first http request works, but subsequent ones don't have the data and close handlers called - I see there's some changes to the AT and BG96 modules done recently, so I'll try that today.
To configure the BG96 for CAT-M1 and CAT-NB1, do the following:
AT+QCFG="band",f,8000004,8000000 -> this sets the bands in use (28 and 3). These settings are for Australia. If you don't set this, then the module scans all bands and can be very slow to connect - I had 3 minutes to connect to CAT-NB1 initially! Now it is around 30 seconds. Currently only band 28 has CAT-NB1 out here.
AT+QCFG="nwscanmode",030201 to favour CAT-NB1 first
AT+QCFG="nwscanmode",020301 to favour CAT-M1 first
then
AT+QCFG="iotopmode",1 to force CAT-NB1. 0 to force CAT-M1 or 2 for either.
The commands only need to be sent once - the module remembers these settings.
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
I got caught by this. Drove me crazy for a while until I dug a little deeper. The code turned on gps using AT+QGPS=4. This seems reasonable, but it doesn't work. I changed it to AT+QGPS=1. Seems for mode 4 you need to regularly upload the ephemeris and other data to the module for fast TTFF (time to first fix). Mode 1 is the bog standard mode, so it is a little slow to start up.
Line 136 in RAK8212.js AT+QGPS=4 -> AT+QGPS=1
Other issues I've found are:
CREG? works for gsm but for CAT-M1 and CAT-NB1, CEREG? is the command to query if we are connected to the network. Interestingly, I have one BG96 module that works with CREG? and returns 0,1 when online, but two others that report 0,3 which translates to connection refused but CEREG returns 0,1. Somehow it seems GSM is not enabled in two of my modules - I'm not sure how I did this! Note that this was using the same or different SIMs, so not an account/SIM issue.
Line 156 of QuectelBG96.js CREG -> CEREG
There's some issues with the registered handlers being forgotten - the first http request works, but subsequent ones don't have the data and close handlers called - I see there's some changes to the AT and BG96 modules done recently, so I'll try that today.
To configure the BG96 for CAT-M1 and CAT-NB1, do the following:
AT+QCFG="band",f,8000004,8000000 -> this sets the bands in use (28 and 3). These settings are for Australia. If you don't set this, then the module scans all bands and can be very slow to connect - I had 3 minutes to connect to CAT-NB1 initially! Now it is around 30 seconds. Currently only band 28 has CAT-NB1 out here.
AT+QCFG="nwscanmode",030201 to favour CAT-NB1 first
AT+QCFG="nwscanmode",020301 to favour CAT-M1 first
then
AT+QCFG="iotopmode",1 to force CAT-NB1. 0 to force CAT-M1 or 2 for either.
The commands only need to be sent once - the module remembers these settings.