I’m using the LoRa example. I have the exact same problem as the last commenter on this post: How to get <340uA in deepsleep for DISCO_L072CZ_LRWAN1 · Issue #119 · ARMmbed/mbed-os-example-lorawan · GitHub
I have the following code for testing:
if (lorawan.initialize(&ev_queue) != LORAWAN_STATUS_OK)
printf("\r\n LoRa initialization failed! \r\n");
printf("Uptime: %llu ", stats.uptime / 1000);
printf("Sleep time: %llu ", stats.sleep_time / 1000);
printf("Deep Sleep: %llu\n", stats.deep_sleep_time / 1000);
The above code leads to a current of 0.430uA. If i remove the lorawan.initialize, the current drops to 70uA. Which is still no perfect but much better. According to the printf statements in both cases i’m entering the deep sleep mode. The above is only a code for testing but the exact same thing happends when using the lora example and entering the dispatch forever loop. The current between sending is 0.430uA. Which is way too high for a battery powered application.
Any idea why the lorawan initialization increases the deep sleep power consumption by that much?
How can i solve this? Any help would be appreciated.
Nothing in the readme for that example mentions compatibility with sleep modes.
You aren’t in deep sleep based on 430uA regardless of what printf says.
Assuming that you are using the CMWX1ZZABZ, there are a few things to consider:
- Is MBED_CONF_EVENTS_USE_LOWPOWER_TIMER_TICKER defined?
- Have you told the power manager you want to enter deep sleep?
- Does using print keep you out of deep sleep?
I’ve never tried to get MBED into deep sleep. I assume deep sleep in this case is stop mode with LPTIM on.
I suspect not defining MBED_CONF_EVENTS_USE_LOWPOWER_TIMER_TICKER will keep you out of stop mode.
Printf almost certainly uses a clock that is turned off in stop mode. If its running when you try to enter stop mode, the power manager will either keep you out of stop mode or weird stuff will happen.
edit: one last thing, I think MBED leaves the TCXO powered all the times on this module. This will increase energy consumption compared to turning it on and off.
Hi thanks for your answer.
First of yes i am using the CMWX1ZZABZ.
- yes is defined
- no i don’t .From my understanding, in mbed there is an idle thread, which if the cpu has nothing to do, the idle thread puts the system automatically to sleep. (mbed_rtx_idle.cpp)
- That i don’t know. I don’t think so as i dont print anything between the events.
I know the mbed leaves the tcxo powered all the time. I turn it off in my code ( which decreases current consumption from 1.6mA to 0.43mA during wait/sleep/idle time.
MBED_TICKLESS is also defined. I don’t know what im doing wrong. 0.43mA is just too much :(.
Anyways thank you. Any more ideas? Ideas?
Mainly right now im wondering why lorawan.initialize increases the current consumption 5x during sleep time.
Sorry, I misunderstood your original post. I thought you meant the device consumed (430-70)uA when the LoRaWAN stack wasn’t running, not that the device consumed 70uA total.
OK, that changes things, 70uA looks more like some form of deep sleep.
I’m out of suggestions.