SodaqMoja / Sodaq_nbIOT

Arduino library for the ublox NB-IoT modules
32 stars 16 forks source link

Feature: Do not poll CSQ/CGATT #3

Closed Ghostbird closed 6 years ago

Ghostbird commented 6 years ago

Instead of polling AT+CSQ? and later AT+CGATT? repeatedly, it might be nicer to issue AT+CEREG? during the startup. This will cause an Unsolicited Result Code (URC) to be sent:

+CEREG:0 when the radio is switched on. +CEREG:2 when the cdp is set and the device starts to connect to the network. +CEREG:1 (with additional data) once the device has successfully registered.

There are more responses indicating other interesting situations.

Source: SARA-N2 AT Commands Manual

Ghostbird commented 6 years ago

In practice, the CEREG URC is far less reliable than the manual suggests, so I too have resumed polling CGATT.