Support for LISA-N101
Fork of C027_Support by
This is a variant of the C027 driver code for the C027N version, i.e. the one with the Neul/Huawei/u-blox Cellular Internet of Things module on board. The AT command interface for this module is entirely different to the AT interface for the other u-blox modules, hence this fork of the driver. Work is underway to rearchitect the original C027 driver so that a merge can be done.
Diff: MDM.cpp
- Revision:
- 122:c6b2fa1928f2
- Parent:
- 121:2ec1046f7251
- Child:
- 124:a58c1a7c5e18
--- a/MDM.cpp Thu Mar 12 13:51:05 2015 +0000 +++ b/MDM.cpp Fri Mar 13 15:58:33 2015 +0000 @@ -205,7 +205,7 @@ } else if (sscanf(cmd, "CSS %*c,%2s,%*d",s) == 1) { //_net.reg = (strcmp("Z", s) == 0) ? REG_UNKNOWN : REG_HOME; } - } else if (_dev.dev == DEV_LISA_N101) { + } else if (_dev.dev == DEV_LISA_N100) { // Neul unsolicited responses ---------------------------- // New Message Indication // +NMI:<length>,<data> @@ -404,7 +404,7 @@ INFO("Modem::wakeup\r\n"); DigitalOut pin(pn, 1); while (i--) { - if (_dev.dev != DEV_LISA_N101) { + if (_dev.dev != DEV_LISA_N100) { // SARA-U2/LISA-U2 50..80us pin = 0; ::wait_us(50); pin = 1; ::wait_ms(10); @@ -432,44 +432,41 @@ INFO("Modem::init\r\n"); // Attempt to get the manufacturer model string sendFormated("AT+GMM\r\n"); - if (RESP_OK == waitFinalResp(_cbGmmString, _dev.model)) { - // If successful it's probably the Neul modem, do a specific check though - if (strstr (_dev.model, "Neul") == _dev.model) { - _dev.dev = DEV_LISA_N101; - // Neul modem specific init - printf ("Neul AT parser revision 0.1 (for interface NT1001).\n"); - // get the manufacturer ID string - sendFormated("AT+GMI\r\n"); - if (RESP_OK != waitFinalResp(_cbGmiString, _dev.manu)) - goto failure; + if ((RESP_OK == waitFinalResp(_cbGmmString, _dev.model)) && (strstr (_dev.model, "Neul") == _dev.model)) { + _dev.dev = DEV_LISA_N100; + // Neul modem specific init + printf ("Neul AT parser revision 0.1 (for interface NT1001).\n"); + // get the manufacturer ID string + sendFormated("AT+GMI\r\n"); + if (RESP_OK != waitFinalResp(_cbGmiString, _dev.manu)) + goto failure; #ifndef DISABLE_NEUL_TEST_COMMANDS - /* In a phase 1 deployment special initialisation command should be inserted here, for example: */ - /* sendFormated ("AT+DI=0\r\n"); - if (RESP_OK != waitFinalResp()) - goto failure; */ + /* In a phase 1 deployment special initialisation command should be inserted here, for example: */ + /* sendFormated ("AT+DI=0\r\n"); + if (RESP_OK != waitFinalResp()) + goto failure; */ #endif - // get the sw version - sendFormated("AT+GMR\r\n"); - if (RESP_OK != waitFinalResp(_cbGmrString, _dev.ver)) - goto failure; - // Don't set an error if this fails as it's not set on some modules - sendFormated("AT+GSN\r\n"); - waitFinalResp(NULL, NULL, 1000); + // get the sw version + sendFormated("AT+GMR\r\n"); + if (RESP_OK != waitFinalResp(_cbGmrString, _dev.ver)) + goto failure; + // Don't set an error if this fails as it's not set on some modules + sendFormated("AT+GSN\r\n"); + waitFinalResp(NULL, NULL, 1000); #ifdef C027N_USE_NMI - // Switch on new message indications - sendFormated("AT+NMI=1\r\n"); - if (RESP_OK != waitFinalResp()) - goto failure; + // Switch on new message indications + sendFormated("AT+NMI=1\r\n"); + if (RESP_OK != waitFinalResp()) + goto failure; #else - sendFormated("AT+NMI=0\r\n"); - if (RESP_OK != waitFinalResp()) - goto failure; + sendFormated("AT+NMI=0\r\n"); + if (RESP_OK != waitFinalResp()) + goto failure; #endif - // Switch on send message indications - sendFormated("AT+SMI=1\r\n"); - if (RESP_OK != waitFinalResp()) - goto failure; - } + // Switch on send message indications + sendFormated("AT+SMI=1\r\n"); + if (RESP_OK != waitFinalResp()) + goto failure; } else { // 3GPP/CDMA modem init // echo off @@ -691,7 +688,7 @@ _net.lac = 0xFFFF; _net.ci = 0xFFFFFFFF; // check registration - if (_dev.dev == DEV_LISA_N101) { + if (_dev.dev == DEV_LISA_N100) { // Neul modem -------------------------- sendFormated("AT+RAS\r\n"); if (RESP_OK != waitFinalResp(_cbRAS, &ok)) @@ -778,7 +775,7 @@ if (status) { memcpy(status, &_net, sizeof(NetStatus)); } - if (_dev.dev == DEV_LISA_N101) { + if (_dev.dev == DEV_LISA_N100) { ok = REG_DONE(_net.psd); // No CSD for the Neul modem } else { ok = REG_DONE(_net.csd) && REG_DONE(_net.psd);