Deep Sleep Configuration

Hello,
I need to put the (BW16) RTL8720DN to deep sleep. I am using the PowerSave Arduino library. Everything works fine. But I want to configure the wake-up condition. Let’s say I want to wake up the MCU at the falling edge or LOW level. How can I configure this thing for a specified GPIO?

https://www.amebaiot.com/en/amebad-arduino-deepsleepmode/

Thanks, you @M-ichae-l
I have seen this tutorial. And did not find out how to configure the wake-up condition. I want to wake up BW16 when the signal goes from HIGH to LOW. How can we configure this thing?

This link is broken :frowning:

Hi @boatbodger

You can refer to Power Save — Ameba Arduino AIoT Documentation v1.1 documentation

I’m using the SDK for my main development on the BW61 module - my aim being to wake up from deepsleep on a timer (about once every three hours to check battery level), and immediately on one of the AON GPIO pins. I find the wakeup on timer works fine, but can’t get the GPIO to work.

So I’m now trying Arduino to test the GPIO wakeup function. using a BW61 module

Thankyou for this link. Rather bizarrely, when I click the link in the email, I am taken to

whereas if I click it from the post when logged in to the forum, I arrive at

And they are very different!

The first reference gives a lot of additional information - including reference to a flag:

#define RETENTION

and the ability to ‘OR’ the wakeup sources.

The RETENTION flag may be my problem - using the Arduino examples, I’m finding that when in deepsleep, my chosen wake-up pin appears to be outputting a hard zero - not just a weak pulldown

However, I notice that the screenshots are from Arduino 1.8.13 (first link) and 1.8.16 (second link), whereas I’m using Arduino 2.3.8

Hi @boatbodger ,

Sorry for the confusion. Please refer to the second reference only as it is the official documentation source. We would like to ask if you are intending to implement dual wake-up sources, i.e. timer + AON GPIO? If yes, currently, this feature is only available on AmebaPro2 SDK PowerMode examples. You may want to refer to the implementation there for this feature. The Arduino IDE versions should not affect the compilation or outcome of the example code.

Thank you for this additional information.

Yes, I do need timer+AON GPIO.

Can I use the Pro2 SDK to build images for the BW16 board (which has the RTL8720DN chip), and if so, how should I set it up? The list of chips it supports does not appear to include the BW16.

When I tried that before, the chip appeared to reject the flashloader. For this reason, I’ve been working with the ameba-rtos-d SDK.

Hi @boatbodger ,

The AmebaPro2 SDK can only be used for AMB82-mini board (RTL8735B). You are right, BW16 board should be used with the Ameba D SDK. Currently, we have just added the dual wake-up sources to AmebaPro2 SDK and not yet support for Ameba D boards. If you wish to implement this feature for your project, you may refer to the AmebaPro2 SDK PowerMode examples and port them over to the Ameba D SDK.

Thankyou for confirming the need to use Ameba D SDK for the BW16

I’m pleased to say I’ve been able to get this dual wake-up requirement to work successfully.

I made changes to

component\soc\realtek\amebad\fwlib\usrcfg\rtl8721dlp_sleepcfg.c which is well-commented.

I also found I needed to make changes to

component/soc/realtek/amebad/fwlib/usercfg\rtl8721dlp_pinmapcfg.c

to set the correct pin conditions for the wake-up pins.

And finally, I had to remember to re-build the km0 part of the package using ‘make’ in ameba-rtos-d/project/realtek_amebaD_va0_example/GCC-RELEASE/project_lp

I greatly appreciate your help.

Chris