Example program demonstrating proper powering down of Telit radio and putting the processor into STOP mode.

Dependencies:   WakeUp mbed mtsas SpiFlash25

Fork of Dragonfly_Cellular_Ping_Example by MultiTech

Files at this revision

API Documentation at this revision

Comitter:
mfiore
Date:
Tue Mar 01 17:41:47 2016 +0000
Parent:
4:91a322a2ec86
Commit message:
put SPI flash in low power mode too

Changed in this revision

SpiFlash25.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r 91a322a2ec86 -r e493656a4a1a SpiFlash25.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/SpiFlash25.lib	Tue Mar 01 17:41:47 2016 +0000
@@ -0,0 +1,1 @@
+https://developer.mbed.org/teams/MultiTech/code/SpiFlash25/#751745dd637f
diff -r 91a322a2ec86 -r e493656a4a1a main.cpp
--- a/main.cpp	Mon Feb 29 19:28:01 2016 +0000
+++ b/main.cpp	Tue Mar 01 17:41:47 2016 +0000
@@ -26,6 +26,7 @@
 #include "mbed.h"
 #include "mtsas.h"
 #include "WakeUp.h"
+#include "SpiFlash25.h"
 
 // This line controls the regulator's battery charger.
 // BC_NCE = 0 enables the battery charger
@@ -55,6 +56,8 @@
 // It goes to 0 after the radio has successfully shut down
 DigitalIn vdd1_8_mon(PC_5);
 
+SpiFlash25 flash(SPI_MOSI, SPI_MISO, SPI_SCK, SPI_CS1);
+
 bool init_mtsas();
 void enterStopMode(const uint32_t interval);
 
@@ -94,6 +97,8 @@
         logInfo("changing regulator to 1A mode");
         bc_en1 = 0;
         bc_en2 = 1;
+        logInfo("waking up the SPI flash");
+        flash.wakeup();
         logInfo("powering on radio");
         radio_pwr = 1;
         radio_reset = 1;
@@ -150,6 +155,8 @@
             
         logInfo("radio powered off after %fs", tmr.read());
         radio_pwr = 0;
+        logInfo("putting the SPI flash in deep power down");
+        flash.deep_power_down();
         logInfo("putting regulator in 100mA mode");
         bc_en1 = 0;
         bc_en2 = 0;