Power save with BW16 arduino

Yes, if you use IAR, please follow the steps there

I have tried it. Edited and download program into chip. But I don’t know has to call example in main function?

You can NOT call example in main function.

Each example has its own main function and is a standalone program, so you need to check the example code, and manually put those functional code into your own main.c and then re-compile the program

hi. @xidameng
I tried like this:
Edit macro.
image.
After in main.c , I called bt_config_app_init();
image
Already built, dowloaded into BW16. using the WifiConfig app in IOS. But still can’t see the device. Please help me find where is wrong?
Thanks!
Thien.

Hi @Nguyen_Thien ,

to run the BT Config default example, please follow these steps:

  1. In platform_autoconf.h, you should enable CONFIG_BT_EN, CONFIG_BT and CONFIG_BT_CONFIG. Thus, it should look like:
#define CONFIG_BT_EN 1
#define CONFIG_BT 1
#undef  CONFIG_BT_PERIPHERAL
#undef  CONFIG_BT_CENTRAL
#undef  CONFIG_BT_SCATTERNET
#undef  CONFIG_BT_BEACON
#define CONFIG_BT_CONFIG 1
  1. Open the file rtl8721dhp_intfcfg.c found in ambd_sdk-master\component\soc\realtek\amebad\fwlib\usrcfg, and edit it so that #define FTL_MEM_CUSTEM 1
  2. You should not modify main.c. Instead, you should use the default main.c.
  3. Compile and upload the images
  4. After restarting the board, connect to the serial port, and send this command: ATBB=1. You should see a log output that looks something like this:
#ATBB=1
[ATBB]:_AT_BT_CONFIG_[ON]
Start upperStack
[BT Config Wifi] BT Config Wifi ready
[BT Config Wifi] ADV started
[MEM] After do cmd, available heap 120608
  1. You can start scanning for the board on the WiFiConfig app. It should be able to find the device

Detailed instructions on how to compile and run BLE examples can be found in AN0400 Application Note Chapter 29.2, and UM0201 BT User Manual Chapter 4.3

1 Like

Thanks @wyy!
I use BW16 module. But go to Step 5:
I don’t know what pins to connect to the serial port.
I connected the program dowload pins(PA7, PA8) and get the result.
image
And tried typing #ATBB=1 but got nothing.
Thanks.
Thien.

PA7 PA8 are the correct pins.
Try changing the line ending in Serial monitor to Carriage return or Both NL & CR

i Tried changing the line ending in Serial monitor to Carriage return or Both NL & CR
The result is now:

unknown command ‘ATBB=1’
[MEM] After do cmd, available heap 163008

image

I’m using “Serial monitor” of Arduino. Can I change another app?

I normally use teraterm, but serial monitor should also work.
unknown command seems to indicate that the image is not compiled properly, since the code required for it to recognize the command is not there.

Hi @wyy , @xidameng
I’m so glad I did it.
As you say:“My image is not compiled properly”. I edited it but in the wrong place.
Thank you very much for the support.
Thien.

1 Like