Last active
March 17, 2022 12:30
-
-
Save phlegx/eee55617ffd67ae82cd0d71ddd9eb131 to your computer and use it in GitHub Desktop.
Mbed OS 5.15.8: Disable power save mode.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
nsapi_error_t UBLOX_AT::init() | |
{ | |
setup_at_handler(); | |
_at->lock(); | |
_at->flush(); | |
_at->at_cmd_discard("", ""); | |
nsapi_error_t err = NSAPI_ERROR_OK; | |
#ifdef UBX_MDM_SARA_G3XX | |
err = _at->at_cmd_discard("+CFUN", "=0"); | |
if (err == NSAPI_ERROR_OK) { | |
_at->at_cmd_discard("E0", ""); // echo off | |
_at->at_cmd_discard("+CMEE", "=1"); // verbose responses | |
config_authentication_parameters(); | |
err = _at->at_cmd_discard("+CFUN", "=1"); // set full functionality | |
} | |
#elif defined(UBX_MDM_SARA_U2XX) || defined(UBX_MDM_SARA_R41XM) | |
err = _at->at_cmd_discard("+CFUN", "=4"); | |
if (err == NSAPI_ERROR_OK) { | |
_at->at_cmd_discard("E0", ""); // echo off | |
_at->at_cmd_discard("+CMEE", "=1"); // verbose responses | |
/* Taken from Mbed OS Ublox cellular base library. */ | |
_at->at_cmd_discard("&K3", ""); /* Turn off RTC/CTS handshaking. K3: Ublox default, K0: Ublox Mbed lib (dont work). */ | |
_at->at_cmd_discard("&C1", ""); /* Set DCD circuit(109), changes in accordance with the carrier detect status. C1: Ublox default, C1: Ublox Mbed lib. */ | |
_at->at_cmd_discard("&D1", ""); /* Set DTR circuit, we ignore the state change of DTR. D1: Ublox default, D0: Ublox Mbed lib. */ | |
/* Disable power saving modes with AT commands: */ | |
_at->at_cmd_discard("+CEDRXS", "=0,2"); | |
_at->at_cmd_discard("+CPSMS", "=0"); | |
_at->at_cmd_discard("+UPSMR", "=0"); | |
_at->at_cmd_discard("+UPSV", "=0"); | |
/* Or with Mbed function: | |
* set_power_save_mode(0, 0); | |
*/ | |
config_authentication_parameters(); | |
err = _at->at_cmd_discard("+CFUN", "=1"); // set full functionality | |
} | |
#else | |
_at->unlock(); | |
return NSAPI_ERROR_UNSUPPORTED; | |
#endif | |
return _at->unlock_return_error(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment