# Power save with BW16 arduino

**URL:** <https://forum.amebaiot.com/t/power-save-with-bw16-arduino/819>\
**Category:** SDK\
**Tags:** evb-bw16, rtl872xd\
**Created:** [September 27, 2021, 12:25am UTC](https://forum.amebaiot.com/t/power-save-with-bw16-arduino/819 "2021-09-27T00:25:59Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nguyen\_Thien](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.amebaiot.com/nguyen_thien/32/658_2.png) [@Nguyen\_Thien](https://forum.amebaiot.com/u/Nguyen_Thien)\
**Post date:** [September 27, 2021, 12:25am UTC](https://forum.amebaiot.com/t/power-save-with-bw16-arduino/819/1 "2021-09-27T00:25:59Z")

</div>

Hi Everyone!  
I am developing on RTL8729DN (BW16), I have loaded an example “DeepSleepMode”. I did not edit it

 ![image](https://us1.discourse-cdn.com/flex016/uploads/ameba/original/1X/b54eb7a9f44e3bbc3caf95ef9a4f84a650b8d60b.jpeg)  
But i did receive the unexpected result.  
 ![image](https://us1.discourse-cdn.com/flex016/uploads/ameba/original/1X/51cdfc8ff15eaea00ca06d3ce3496093d30d1712.jpeg)  
I use the hardware to connect WIFI “OK”.  
Please show me these miss!

Thank you so much !  
Thien.

---

<div class="post-metadata">

**Author:** ![xidameng](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.amebaiot.com/xidameng/32/18_2.png) [@xidameng](https://forum.amebaiot.com/u/xidameng)\
**Post date:** [September 27, 2021, 6:16am UTC](https://forum.amebaiot.com/t/power-save-with-bw16-arduino/819/2 "2021-09-27T06:16:03Z")

</div>

> [@Nguyen\_Thien](#):
>
> Please show me these miss!

Hi @Nguyen_Thien  
I am not sure if I can understand your question here… from your screenshot it seems the example works with your BW16, so what is the problem?

---

<div class="post-metadata">

**Author:** ![Nguyen\_Thien](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.amebaiot.com/nguyen_thien/32/658_2.png) [@Nguyen\_Thien](https://forum.amebaiot.com/u/Nguyen_Thien)\
**Post date:** [September 27, 2021, 7:46am UTC](https://forum.amebaiot.com/t/power-save-with-bw16-arduino/819/3 "2021-09-27T07:46:13Z")

</div>

Hi @xidameng!  
That example I downloaded into BW16. But it did not deepsleep. the result is in second scereenshot. I think if it is correct after 5 seconds is wakup 1 time.

Thanks!

---

<div class="post-metadata">

**Author:** ![xidameng](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.amebaiot.com/xidameng/32/18_2.png) [@xidameng](https://forum.amebaiot.com/u/xidameng)\
**Post date:** [September 27, 2021, 9:25am UTC](https://forum.amebaiot.com/t/power-save-with-bw16-arduino/819/4 "2021-09-27T09:25:51Z")

</div>

Hi @Nguyen_Thien

[https://www.amebaiot.com/en/amebad-arduino-deepsleepmode/](https://www.amebaiot.com/en/amebad-arduino-deepsleepmode/)

Please read this deepsleep example guide and understand that **ONLY** the following pins can be used for this feature

 ![image](https://us1.discourse-cdn.com/flex016/uploads/ameba/original/1X/4f9d03b18e2a440cece7a2e5d27140e3dc0ae320.png)

And unfortunately, due to design consideration and package, BW16 does **NOT** have all the pins that RTL8722DM has, so unfortunately, you can NOT directly use the example code written for RTL8722DM for your BW16.

For more information, you may download technical documents from the official website at,  
[https://www.amebaiot.com/en/](https://www.amebaiot.com/en/)

---

<div class="post-metadata">

**Author:** ![Nguyen\_Thien](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.amebaiot.com/nguyen_thien/32/658_2.png) [@Nguyen\_Thien](https://forum.amebaiot.com/u/Nguyen_Thien)\
**Post date:** [September 28, 2021, 9:46pm UTC](https://forum.amebaiot.com/t/power-save-with-bw16-arduino/819/5 "2021-09-28T21:46:28Z")

</div>

Thanks @xidameng!  
I would like deepsleep mode in pins (BW16). Please Can you guide me to edit that example?  
Maybe edit BW16 hardware.  
Thank you so much.  
Thien.

---

<div class="post-metadata">

**Author:** ![xidameng](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.amebaiot.com/xidameng/32/18_2.png) [@xidameng](https://forum.amebaiot.com/u/xidameng)\
**Post date:** [October 5, 2021, 10:19am UTC](https://forum.amebaiot.com/t/power-save-with-bw16-arduino/819/6 "2021-10-05T10:19:06Z")

</div>

Deepsleep is not really supported on BW16 if you choose to use Arduino IDE to compile binary, bcos deepsleep example need to change the bootloader but Arduino IDE only can edit the application firmware

---

<div class="post-metadata">

**Author:** ![Nguyen\_Thien](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.amebaiot.com/nguyen_thien/32/658_2.png) [@Nguyen\_Thien](https://forum.amebaiot.com/u/Nguyen_Thien)\
**Post date:** [October 6, 2021, 7:47am UTC](https://forum.amebaiot.com/t/power-save-with-bw16-arduino/819/7 "2021-10-06T07:47:42Z")

</div>

Thanks a lot! @xidameng.  
So If i dont use Arduino IDE.  
is there any way to Deepsleep mode in BW16?  
Thanks again!  
Thien.

---

<div class="post-metadata">

**Author:** ![xidameng](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.amebaiot.com/xidameng/32/18_2.png) [@xidameng](https://forum.amebaiot.com/u/xidameng)\
**Post date:** [October 6, 2021, 8:28am UTC](https://forum.amebaiot.com/t/power-save-with-bw16-arduino/819/8 "2021-10-06T08:28:27Z")

</div>

Hi @Nguyen_Thien  
Here is a deepsleep example from the Realtek Standard SDK,

> **[ambd\_sdk/project/realtek\_amebaD\_va0\_example/example\_sources/PMC/raw/pm\_dslp at...](https://github.com/ambiot/ambd_sdk/tree/master/project/realtek_amebaD_va0_example/example_sources/PMC/raw/pm_dslp)**
>
> master/project/realtek\_amebaD\_va0\_example/example\_sources/PMC/raw/pm\_dslp

To get started with the Standard SDK, please read the guide as follows,  
[https://www.amebaiot.com/en/ameba-sdk-getting-started-8722/](https://www.amebaiot.com/en/ameba-sdk-getting-started-8722/)

---

<div class="post-metadata">

**Author:** ![Nguyen\_Thien](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.amebaiot.com/nguyen_thien/32/658_2.png) [@Nguyen\_Thien](https://forum.amebaiot.com/u/Nguyen_Thien)\
**Post date:** [October 6, 2021, 11:50pm UTC](https://forum.amebaiot.com/t/power-save-with-bw16-arduino/819/9 "2021-10-06T23:50:25Z")

</div>

Hi. @xidameng.  
I see " Building the First GCC Project on Ameba-D" is a pretty difficult for me. If I use IAR IDE is it ok?  
There’s more , in Arduino IDE I have connected Wifi and BLUE ok. I’m afraid I won’t be able to do it.  
Can I still use the Arduino IDE after changing the bootloader? Because there is still Deepsleep in Arduino IDE example.  
Please help me.I wish you a good day!  
Thien.

---

<div class="post-metadata">

**Author:** ![xidameng](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.amebaiot.com/xidameng/32/18_2.png) [@xidameng](https://forum.amebaiot.com/u/xidameng)\
**Post date:** [October 7, 2021, 2:15am UTC](https://forum.amebaiot.com/t/power-save-with-bw16-arduino/819/10 "2021-10-07T02:15:17Z")

</div>

> [@Nguyen\_Thien](#):
>
> If I use IAR IDE is it ok?

Yes, you can use IAR for this example, the IAR project is at link here,

> <https://github.com/ambiot/ambd_sdk/tree/master/project/realtek_amebaD_va0_example/EWARM-RELEASE>
>
> //github.com/ambiot/ambd\_sdk/tree/master/project/realtek\_amebaD\_va0\_example/EWARM-RELEASE

> [@Nguyen\_Thien](#):
>
> Can I still use the Arduino IDE after changing the bootloader? Because there is still Deepsleep in Arduino IDE example.

Yes, you still can use Arduino IDE, which will wipe out the bootloader with deepsleep features when uploading

---

<div class="post-metadata">

**Author:** ![Nguyen\_Thien](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.amebaiot.com/nguyen_thien/32/658_2.png) [@Nguyen\_Thien](https://forum.amebaiot.com/u/Nguyen_Thien)\
**Post date:** [October 7, 2021, 9:21am UTC](https://forum.amebaiot.com/t/power-save-with-bw16-arduino/819/11 "2021-10-07T09:21:14Z")

</div>

Wow! it’s really cool. Im going to use the Arduino IDE after changing the bootloader.  
Now what do i do with the bootloader?  
Im downloading IAR…  
 ![image](https://us1.discourse-cdn.com/flex016/uploads/ameba/original/1X/2095cddb8219debc6e86338213635ed0f25e7780.png)  
Thien.

---

<div class="post-metadata">

**Author:** ![xidameng](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.amebaiot.com/xidameng/32/18_2.png) [@xidameng](https://forum.amebaiot.com/u/xidameng)\
**Post date:** [October 7, 2021, 9:23am UTC](https://forum.amebaiot.com/t/power-save-with-bw16-arduino/819/12 "2021-10-07T09:23:32Z")

</div>

You can read about IAR setup in this document

> <https://github.com/ambiot/ambd_sdk/blob/master/doc/AN0400%20Ameba-D%20Application%20Note.pdf>

---

<div class="post-metadata">

**Author:** ![Nguyen\_Thien](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.amebaiot.com/nguyen_thien/32/658_2.png) [@Nguyen\_Thien](https://forum.amebaiot.com/u/Nguyen_Thien)\
**Post date:** [October 7, 2021, 11:02am UTC](https://forum.amebaiot.com/t/power-save-with-bw16-arduino/819/13 "2021-10-07T11:02:32Z")

</div>

Hi, @xidameng  
Can I use “ImageTool\_v2.3.2\_AmebaD” to download BW16 through Uart?

 ![image](https://us1.discourse-cdn.com/flex016/uploads/ameba/original/1X/a417cd58befae1b0bd477f515abbd477954dbd2c.png)  
I have only “Silicon Labs CP210x USB to UART Bridge” tool or ST-link V2.  
Thanks for your enthusiasm! Because my knowledge is pretty poor.  
Thien.

---

<div class="post-metadata">

**Author:** ![xidameng](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.amebaiot.com/xidameng/32/18_2.png) [@xidameng](https://forum.amebaiot.com/u/xidameng)\
**Post date:** [October 7, 2021, 11:04am UTC](https://forum.amebaiot.com/t/power-save-with-bw16-arduino/819/14 "2021-10-07T11:04:36Z")

</div>

yes you can! make sure to download all 3 “bin” files and tick their boxes, and press button on board to enter Uart Download mode before you click the download button

---

<div class="post-metadata">

**Author:** ![Nguyen\_Thien](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.amebaiot.com/nguyen_thien/32/658_2.png) [@Nguyen\_Thien](https://forum.amebaiot.com/u/Nguyen_Thien)\
**Post date:** [October 8, 2021, 9:17am UTC](https://forum.amebaiot.com/t/power-save-with-bw16-arduino/819/15 "2021-10-08T09:17:57Z")

</div>

hi. @xidameng  
After install and i built all Project\_hp\_release and Project\_lp\_release. Then downloaded into BW16. The program worked. But now I don’t know how to proceed.  
Another thing is that I see in the program there are two pairs: Bootloader(KM0), main.c(KM0) and Bootloader(KM4), main.c(KM4). I don’t know how they work?

Thien.

---

<div class="post-metadata">

**Author:** ![Nguyen\_Thien](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.amebaiot.com/nguyen_thien/32/658_2.png) [@Nguyen\_Thien](https://forum.amebaiot.com/u/Nguyen_Thien)\
**Post date:** [October 10, 2021, 8:51am UTC](https://forum.amebaiot.com/t/power-save-with-bw16-arduino/819/16 "2021-10-10T08:51:42Z")

</div>

Hi @xidameng  
I have done Deepsleep mode already.  
I tried to implement the available example but it didn’t work. how do i execute an example “BT\_CONFIG”?  
 ![image](https://us1.discourse-cdn.com/flex016/uploads/ameba/original/1X/e14055ea62614594b900b1ff2ea2483193b27f8b.png)

Please help me!  
Thanks.

---

<div class="post-metadata">

**Author:** ![xidameng](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.amebaiot.com/xidameng/32/18_2.png) [@xidameng](https://forum.amebaiot.com/u/xidameng)\
**Post date:** [October 11, 2021, 1:45am UTC](https://forum.amebaiot.com/t/power-save-with-bw16-arduino/819/17 "2021-10-11T01:45:21Z")

</div>

> [@Nguyen\_Thien](#):
>
> The program worked

Congrats!

> [@Nguyen\_Thien](#):
>
> Bootloader(KM0), main.c(KM0) and Bootloader(KM4), main.c(KM4). I don’t know how they work?

Hi, what matters here are only 3 binary files, namely, km0\_boot\_all.bin (small core’s bootloader), km4\_boot\_all.bin(big core’s bootloader) and km0\_km4\_image2.bin(your application program which contains programs in main.c)

---

<div class="post-metadata">

**Author:** ![xidameng](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.amebaiot.com/xidameng/32/18_2.png) [@xidameng](https://forum.amebaiot.com/u/xidameng)\
**Post date:** [October 11, 2021, 1:53am UTC](https://forum.amebaiot.com/t/power-save-with-bw16-arduino/819/18 "2021-10-11T01:53:35Z")

</div>

> [@Nguyen\_Thien](#):
>
> how do i execute an example “BT\_CONFIG”?

There are two ways to play BT\_CONFIG,

1. Use Arduino IDE, go to example and look for BLEWiFiConfig
2. Use Standard SDK and follow instructions on the application notes under Bluetooth chapter to set up the environment and then check out AI-Thinker’s website for their instructions on how to use BT Config, links are as follows,

[https://github.com/ambiot/ambd\_sdk/blob/master/doc/AN0400%20Ameba-D%20Application%20Note.pdf](https://github.com/ambiot/ambd_sdk/blob/master/doc/AN0400%20Ameba-D%20Application%20Note.pdf)

[https://docs.ai-thinker.com/en/rtl87xx](https://docs.ai-thinker.com/en/rtl87xx)

---

<div class="post-metadata">

**Author:** ![Nguyen\_Thien](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.amebaiot.com/nguyen_thien/32/658_2.png) [@Nguyen\_Thien](https://forum.amebaiot.com/u/Nguyen_Thien)\
**Post date:** [October 11, 2021, 10:06pm UTC](https://forum.amebaiot.com/t/power-save-with-bw16-arduino/819/19 "2021-10-11T22:06:16Z")

</div>

But I cant use Deepsleep mode with Arduino IDE.

---

<div class="post-metadata">

**Author:** ![Nguyen\_Thien](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.amebaiot.com/nguyen_thien/32/658_2.png) [@Nguyen\_Thien](https://forum.amebaiot.com/u/Nguyen_Thien)\
**Post date:** [October 11, 2021, 11:22pm UTC](https://forum.amebaiot.com/t/power-save-with-bw16-arduino/819/20 "2021-10-11T23:22:58Z")

</div>

Before I have played BLEWiFiConfig example on Arduino IDE. But having Deepsleep problem.

Does the Standard SDK have to follow the “29.2.2 IAR Project” steps?

 ![image](https://us1.discourse-cdn.com/flex016/uploads/ameba/original/1X/414f8a810f8df465e7bb60cd5181e89ce6ece1db.png)

Thanks!  
Thien.

[Next page](https://forum.amebaiot.com/t/power-save-with-bw16-arduino/819.md?page=2)
