Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
6 years, 8 months ago.
sleep() on the STM32L073
have a STM32L073RZT6 running with no external crystals. I started the project with MBED and exported to Kyle uVision. The project works great and now I need to be able to put it to sleep for 3 seconds, wake the L073 to power up an RF transceiver to check for incoming packets, and then go back to sleep. I cannot leave the transceiver in low-power RX mode and use its interrupt output pin for incoming packets (takes too much power) so I must be able to achieve low-power (<1mA) operation via a sleep mode that the L073 can wake from using an internal peripheral.
If I call sleep() by itself the L073 goes to sleep and current draw for the system is great at 300uA. Problem is I currently cannot find a way wake the L073 from this sleep.
With this code I can use the sleep() function and use an interrupt to wake up but the current draw is about 5mA during sleep:
bool expired; global void int_acq1() { expired=1; } interrupt routine
expired=0; Ticker MyTimer; MyTimer.attach(&int_acq1, 3.0); 3 second tick while(expired==0) sleep();
I am now running the latest version of MBED (5.7.6 or 159 in mbed.h).
Questions: 1. Why does sleep() behave differently, depending on the preceding line of code? If there is no Ticker code preceding the call to sleep then sleep is a very deep (300uA) sleep that will require wake with interrupt via GPIO pin (since all timers/peripherals in the L073 are off). With the Ticker code preceding the call to sleep() then current consumption is too high (5mA). 2. Where can I find documentation that explicitly explains this characteristic of sleep()? I have searched MBED and countless other places and found much on the sleep() function - but nothing on this specific topic of preceding code. 3. Is what I'm wanting to do even possible with MBED?
Thx, Don