Closed ssozonoff closed 6 years ago
I do need to clarify and fix this.
As of right now, STM32L0.stop() and STM32L0.sleep() wake only up if you call STM32L0.wakeup().
Some user observable change will also make it wake up (like receiving data from a UART). Need to reduce the set of automatic wakeup, to make this less confusing.
On Wed, Apr 4, 2018 at 4:17 PM, Serge Sozonoff notifications@github.com wrote:
Hi,
Not exactly clear on how device comes out of stop() mode. Would you kindly explain what is going on in this small attached code sample.
Why am I seeing the following print statements ?
Serial enabled! Hello World Going to sleep Do callback Loratx Do callback Loratx Do callback Loratx Do callback Loratx Do callback Loratx Do callback Loratx
I would have expected to see the loop execute until the following sleep... and I can only assume the reason this code works at all is that the timer callback also wakes up the device ?
Kind thanks, Serge
Code Sample
include
include
include "TimerMillis.h"
TimerMillis LoRaTimer;
void setup() {
Serial.begin(115200); delay(4000); Serial.println("Serial enabled!");
LoRaTimer.start(callbackLoRaTx, 5000, 35000); // 5 minute period, 1 minute delay }
void loop() {
Serial.println("Hello World"); delay(500); Serial.println("Going to sleep"); STM32L0.stop(); // Enter STOP mode and wait for an interrupt delay(1000);
}
void callbackLoRaTx(void) { Serial.println("Do callback Loratx"); }
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/GrumpyOldPizza/ArduinoCore-stm32l0/issues/4, or mute the thread https://github.com/notifications/unsubscribe-auth/AG4QfO30vP30BCvx35xRNkO_7A8PkWBdks5tlUZcgaJpZM4THlSY .
OK however in .stop() the interrupt still fires which in turn needs calls .wakeup() if I understand correctly ? Since the above mentioned code actually runs and prints output despite .wakeup() being called.
Thanks
Correct.
On Thu, Apr 5, 2018 at 11:44 PM, Serge Sozonoff notifications@github.com wrote:
OK however in .stop() the interrupt still fires which in turn calls .wakeup() if I understand correctly ?
Thanks
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/GrumpyOldPizza/ArduinoCore-stm32l0/issues/4#issuecomment-379154488, or mute the thread https://github.com/notifications/unsubscribe-auth/AG4QfPtONiJIVCyVhukg38FVUkbVWaETks5tlwDVgaJpZM4THlSY .
Hi,
Not exactly clear on how device comes out of stop() mode. Would you kindly explain what is going on in this small attached code sample.
Why am I seeing the following print statements ?
Serial enabled! Hello World Going to sleep Do callback Loratx Do callback Loratx Do callback Loratx Do callback Loratx Do callback Loratx Do callback Loratx
I would have expected to see the loop execute until the following sleep... and I can only assume the reason this code works at all is that the timer callback also wakes up the device ?
Kind thanks, Serge
Code Sample