Example program for UART power saving configuration of cellular modem. This program can be used with UBLOX_C030_R412M board. It has nothing to do with 3GPP power saving mode.
Dependencies: ublox-at-cellular-interface ublox-cellular-base ublox-cellular-base-n2xx ublox-at-cellular-interface-n2xx
Diff: main.cpp
- Revision:
- 1:aa486dbe9ee8
- Parent:
- 0:2688ab2f93c2
- Child:
- 2:0d940d7fc284
--- a/main.cpp Wed Jun 12 12:28:43 2019 +0500 +++ b/main.cpp Mon Jun 17 16:39:19 2019 +0500 @@ -16,7 +16,6 @@ #include "mbed.h" #include "UbloxATCellularInterface.h" -#include "CellularContext.h" #include "UbloxATCellularInterfaceN2xx.h" // You must select the correct interface library for your board, by @@ -25,13 +24,10 @@ // // C030_U201 C030_N211 C027 // UbloxATCellularInterface Y - Y -// OnboardCellularInterface Y - Y // UbloxATCellularInterfaceN2xx - Y - // Note: the N211 module supports only UDP, not TCP -// OnboardCellularInterface uses LWIP and the PPP cellular interface -// on the mbed MCU, while using UbloxATCellularInterface and -// UbloxATCellularInterfaceN2xx uses an IP stack on the cellular +// UbloxATCellularInterface and UbloxATCellularInterfaceN2xx uses an IP stack on the cellular // module and hence uses less RAM (significant on C027). This also // allows other AT command operations (e.g. sending an SMS) to happen // during a data transfer (for which you should replace the @@ -39,7 +35,6 @@ // library). However, it is slower than using the LWIP/PPP on the mbed // MCU interface since more string parsing is required. #define INTERFACE_CLASS UbloxATCellularInterface -//#define INTERFACE_CLASS OnboardCellularInterface //#define INTERFACE_CLASS UbloxATCellularInterfaceN2xx // The credentials of the SIM in the board. If PIN checking is enabled @@ -128,7 +123,6 @@ static void cbButton() { buttonPressed = true; - pulseEvent(); } #ifdef CURRENT_MEASUREMENT @@ -207,9 +201,29 @@ // Attach a function to the user button userButton.rise(&cbButton); + interface->set_credentials(APN, USERNAME, PASSWORD); + interface->init(PIN); + + printf("Checking if already registered !\n"); + + if ( (interface->is_registered_csd() || interface->is_registered_psd() || interface->is_registered_eps()) ) { + printf("De-registering...\n\n"); + interface->nwk_deregistration(); + } + + if (interface->set_modem_rat(UbloxATCellularInterface::GPRS_EGPRS)) { + printf("GPRS_EGPRS RAT configured\n"); + } + else { + printf("GPRS_EGPRS RAT not configured\n"); + } + + if (interface->reboot_modem()) { + printf("Reboot successful"); + } + good(); printf("Starting up, please wait up to 180 seconds for network registration to complete...\n"); - interface->set_credentials(APN, USERNAME, PASSWORD); for (x = 0; interface->connect(PIN) != 0; x++) { if (x > 0) { bad();