Realtek Ameba ARDUINO with BW16 (RTL8720DN)
===

***
# Breakdown rtlduino
- DevKit board
It is sharing platform for RTL-00, BW12, BW16, BW19 module.

Desoldering the BW16 from DevKit.

- BW16 module

Desoldering the shielding.



***
Ameba ARDUINO: Getting Started with BW16/RTL8720DN
https://www.amebaiot.com/zh/amebad-bw16-arduino-getting-started/
Arduino IDE Library
~~https://github.com/ambiot/ambd_arduino/raw/master/Arduino_package/package_realtek.com_amebad_early_index.json~~
https://github.com/ambiot/ambd_arduino/raw/master/Arduino_package/package_realtek.com_amebad_index.json
安裝後路徑, 僅供參考
C:\Users\<UserProfile>\Documents\ArduinoData\packages\realtek\hardware\AmebaD\3.0.10\variants\rtl8720dn_bw16
**!!! 可參考[Unofficial list of 3rd party boards support urls](https://github.com/arduino/Arduino/wiki/Unofficial-list-of-3rd-party-boards-support-urls) !!!**
***
如果您遇到 GitHub 下載問題,請參考以下“下載/軟體開發套件”中的鏈接。有3個部分。
1. “AmebaD_Arduino_patch1_SDK”,請至少選擇 1 個 SDK。目前有 5 個最新發布的 SDK 選項。
2. “AmebaD_Arduino_patch2_Tools”,請根據您的作業系統進行選擇。有 Windows、Linux 和 MacOS。
3. “AmebaD_Arduino_Source_Code”,此部分為可選下載,用來參考最新原始碼。
https://www.amebaiot.com/ameba-arduino-summary/
下載選擇的文件,然後解壓(patch1 和patch2 是必須的)。有“Install_中文.doc”/“Install_中文.pdf”供您參考安裝步驟。根據您的系統,請運行“Offline_SDK_installation_tool”文件夾中的安裝工具。
***
三个ADC输入:A0,A1,A2分别是PB1,PB2,PB3,直接analogRead(A0)即可
支持PWM输出(analogWrite,tone)的引脚是PA12,PA13,PA25,PA26
串口Serial是板载的USB转串口芯片,TX:PB1,RX:PB2
串口Serial1是用来下载固件的串口,TX:PA7,RX:PA8
SPI: PA12,13,14,15->MOSI,MISO,CLK,CS,最高速度50MHz
I2C(Wire): PA25->SCL,PA26->SDA
***
Here are some of the key features and specifications that the Rtlduino RTL8720DN board has:
B&T BW16 wireless module with:
* Realtek RTL8720DN MCU with KM4 Arm Cortex-M4 core @ 200 MHz and KM0 Arm Cortex-M0 core @ 20 MHz
* WiFi 2.4G and WiFi 5G with protocol 802.11 a/b/g/n 1×1 from 20/40 MHz up to MCS7
* WiFi low power mode support
* Bluetooth 5.0 LE support with a frequency range of 2.402GHz – 2.480GHz; Receiver sensitivity of -92 dBm; Transmit Power of +7 dBm
* IPEX connector or PCB Antenna
* 16x castellated holes with GPIO, 2x UART, 1x I2C, 1x SPI, 4x PWM, 1x ADC, 3.3V, GND, and,
* 3.3 ±5% supply voltage.
* **Temperature Range:** From -20°C to 85°C (operating); from -40°C to 125°C (storage)
* **Relative Humidity:** 10% ~ 90%
* **Dimensions:** 24 mm x 16 mm x 3 mm
* **Certifications:** FCC, CE, RoHS, and, SRRC
1x Micro USB port
2x 15-pin headers with BW16 I/Os
Reset button
Burn button
RGB LED
5V power supply via Micro USB port
Dimensions: 49 mm x 26 mm
***

***

***
***
https://www.arduino.cn/thread-101986-1-1.html
点击菜单栏里的对勾,代码应该可以成功通过编译。否则请检查之前的步骤是不是改错了什么东西。
接下来就要将代码上传到开发板上了,这也是这个开发板的第一个坑点:
这个芯片上传程序的串口是LOG_TX(PA7)和LOG_RX(PA8),而这个开发板的板载USB转串口芯片连接的是串口0:TX_0(PB1)和RX_0(PB2).
你可以使用另一个USB转串口模块来连接LOG_TX和LOG_RX串口,不过你也可以用两条线将PA7与PB1相连,PA8与PB2相连,这样就可以利用板载的USB转串口芯片上传程序。
这个开发板并没有自动下载的电路,你需要手动操作来进入下载模式:
在开发板通电的情况下,首先按住开发板右侧的"Burn"按钮不要松开,之后短按一下左侧的”RST“按钮,之后松开"Burn"按钮。此时以115200波特率打开串口监视器,如果你看见有方块在不断出现,那么已经进入了下载模式。
之后你就可以点击上传按钮,将程序烧录到开发板中。需要注意的是,在上传成功后你的程序并不会自动开始执行,你需要再手动按一次"RST"按钮。
这时你应该可以看到板载的绿灯在闪烁,这标志着你已经成功完成了以上所有的步骤。
***
```
#include <WiFi.h>
char ssid[] = "yourNetwork"; //设置SSID
char pass[] = "Password"; //设置密码
char channel[] = "1"; //设置wifi信道. 如果要使用5G Wifi,
//直接设置到对应的信道,比如52或153即可
int ssid_status = 0; //是否隐藏ssid, 为1则隐藏
void setup() {
//初始化串口
Serial.begin(115200);
int status = WL_IDLE_STATUS;
//启动WiFi热点
while (status != WL_CONNECTED) {
Serial.print("Attempting to start AP with SSID: ");
Serial.println(ssid);
status = WiFi.apbegin(ssid, pass, channel, ssid_status);
delay(10000);
}
//热点已启动
Serial.println("AP mode already started");
Serial.println();
}
void loop() {
}
```
https://github.com/happyme531/ambd_arduino
***
新的BW16模块内置的AT固件似乎加入了自恢復功能,會造成Arduino顯示程序下載成功,但Reset芯片之後又回到AT固件的問題。
解決方法, 可參考伴伴學友黑貓的共筆
https://hackmd.io/@PQ-vvZNjSByJgYWq22pEBQ/BkwiOOYTu
或者可以透過AT UART (baud rate:38400), 透過ATSC=0指令切換OTA1鏡像。
注意!切換後, 似乎AT固件就會丟失~~
***
https://forum.amebaiot.com/t/resources-bw16-troubleshooting-guide/678
https://forum.amebaiot.com/t/bw16/682
https://www.instructables.com/RTL8720DN/
https://hackmd.io/xyMnu03HSzG5Sdph2vddBQ
https://blog.csdn.net/Boantong_/article/details/108847305
https://www.instructables.com/RTL8720DN/