Closed iKK001 closed 3 years ago
As RP2040 is a very new board with very new core, DeepSleep Mode is not well-tested as in many other boards (ESP32, ESP8266).
It's not as simple as what you're doing using WiFi.end()
, etc. then expect everything simply will return to normal.
I suggest you have a look at these, and use one of those methods correctly, and try with the simplest WiFi Client code to see if it's working or not..
void sleep_goto_dormant_until_pin(uint gpio_pin, bool edge, bool high) {
bool low = !high;
bool level = !edge;
// Configure the appropriate IRQ at IO bank 0
assert(gpio_pin < NUM_BANK0_GPIOS);
uint32_t event = 0;
if (level && low) event = IO_BANK0_DORMANT_WAKE_INTE0_GPIO0_LEVEL_LOW_BITS;
if (level && high) event = IO_BANK0_DORMANT_WAKE_INTE0_GPIO0_LEVEL_HIGH_BITS;
if (edge && high) event = IO_BANK0_DORMANT_WAKE_INTE0_GPIO0_EDGE_HIGH_BITS;
if (edge && low) event = IO_BANK0_DORMANT_WAKE_INTE0_GPIO0_EDGE_LOW_BITS;
gpio_set_dormant_irq_enabled(gpio_pin, event, true);
_go_dormant();
// Execution stops here until woken up
// Clear the irq so we can go back to dormant mode again if we want
gpio_acknowledge_irq(gpio_pin, event);
}
You can also post question on Arduino or Raspberry Forum to ask for help.
I'd appreciate it if you can share your success here to benefit other users.
As this issue has nothing to do with the library, I'm closing it now.
Good Luck,
For ESP32 and ESP8266 DeepSleep, you can have a look at my outdated
SmallProjects library and this sample project code : SmartFarm_DeepSleep
Another library to look and try
I am using the
Arduino Nano RP2040 Connect
board and I succesfully have it running with your example code (i.e. Examples-->WiFiManager_NINA_Lite-->RP2040_WiFiNINA)In order to save battery, I changed the example code so that the RP2040 goes into some sort of sleep mode:
The sleep-mode consists of a) turning OFF all LED's b) turning OFF the WiFi-module c) turning OFF the RP2040 itself (not sure how to actually achieve this - any library-hint highly appreciated)
As for b)
turning OFF the WiFi-module
, I get a crash and need some help on this. I have the following sw-setup, observation and question:SW-Setup:
Inside my go_to_sleep()-method I use the following cmds to make the WiFi module go to sleep:
Inside my wakeup()-method I use the same WiFi-startup routines as your example shows. The wakeup()-method works nicely at startup. But it crashes unfortunately wafter the go_to_sleep()-method.
Observation:
At the moment of wakeup, the WiFiManager does not startup. It stalls at the
WiFiManager_Generic->begin(HOST_NAME);
line. The WiFi cannot be restarted onceWiFi.disconnect()
andWiFi.end()
cmds.Questions:
WiFiManager_Generic->begin(HOST_NAME);
work after mygo_to_sleep()
-method ?WiFi.disconnect()
andWiFi.end()
) ?WiFiManager_Generic->begin(HOST_NAME);
cmd in order to make the WiFi-Module re-initialize after a sleep period ?Thank you for any help on this.