Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed FXOS8700CQ
Revision 14:0c353e212296, committed 2016-07-13
- Comitter:
- fkellermavnet
- Date:
- Wed Jul 13 00:39:08 2016 +0000
- Parent:
- 13:df9c49662797
- Child:
- 16:17c5916f2d12
- Commit message:
- Pulled in Steve Martin's new WNC initialization code.; Also removed the while(1) in case init fails, now it just continues to retry the initialization.
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Tue Jul 12 21:58:17 2016 +0000
+++ b/main.cpp Wed Jul 13 00:39:08 2016 +0000
@@ -47,6 +47,8 @@
DigitalOut mdm_power_on(PTB9); // 0 = turn modem on, 1 = turn modem off (should be held high for >5 seconds to cycle modem)
DigitalOut mdm_wakeup_in(PTC2); // 0 = let modem sleep, 1 = keep modem awake -- Note: pulled high on shield
+DigitalOut mdm_reset(PTC12); // active high
+
DigitalOut shield_3v3_1v8_sig_trans_ena(PTC4); // 0 = disabled (all signals high impedence, 1 = translation active
DigitalOut mdm_uart1_cts(PTD0);
@@ -132,9 +134,23 @@
}
int mdm_init(void) {
- // disable signal level translator
+ // disable signal level translator (necessary
+ // for the modem to boot properly)
shield_3v3_1v8_sig_trans_ena = 0;
+ // Hard reset the modem (doesn't go through
+ // the signal level translator)
+ mdm_reset = 1;
+
+ // wait a moment for the modem to react
+ wait_ms(10);
+
+ // Let modem boot
+ mdm_reset = 0;
+
+ // wait a moment for the modem to react
+ wait(1.0);
+
// power modem on //off
mdm_power_on = 0; //1;
@@ -151,6 +167,13 @@
mdm_uart1_cts = 0;
+ // wait a moment for the modem to react to signal
+ // conditions while the level translator is disabled
+ // (sorry, don't have enough information to know
+ // what exactly the modem is doing with the current
+ // pin settings)
+ wait(1.0);
+
// enable the signal level translator to start
// modem reset process (modem will be powered down)
shield_3v3_1v8_sig_trans_ena = 1;
@@ -163,7 +186,7 @@
const char * rsp_lst[] = { ok_str, error_str, NULL };
int rc = mdm_sendAtCmd("AT", rsp_lst, 500);
if (rc == 0)
- return timer.read();
+ return true; //timer.read();
wait_ms(1000 - (timer.read_ms() % 1000));
pc.printf("\r%d",timer.read_ms()/1000);
}
@@ -332,11 +355,12 @@
// Initialize the modem
printf(GRN "Modem initializing... will take up to 60 seconds" DEF "\r\n");
- i=mdm_init();
- if (!i) {
- pc.printf(RED "Modem initialization failed!" DEF "\n");
- while (1);
- }
+ do {
+ i=mdm_init();
+ if (!i) {
+ pc.printf(RED "Modem initialization failed!" DEF "\n");
+ }
+ } while (!i);
//Software init
software_init_mdm();

