Getting Started
Ameba ARDUINO: Getting Started with BW16
Required Environment
RTL8720DN Dual-Band Wi-Fi board currently supports Windows XP/7/8/10 32-bits and 64-bits operating systems. In this documentation, please use Arduino IDE with version 1.8.15 or later.
Introduction to BW16
Realtek RTL8720DN is a Wi-Fi and Bluetooth IC that supports 2.4GHz and 5GHz dual bands for Wi-Fi communication, and Bluetooth Low Energy (BLE) 5.0. BW16 is a module manufactured by B&T, this module is a highly integrated Wi-Fi and Bluetooth module with the RTL8720DN as the main SoC (System on Chip), it can be regarded as an SoC for the Wi-Fi and Bluetooth application with typical SBCs.
RTL8720DN (BW16) has a smaller size than AmebaD and AmebaD MINI as shown in the above figure. It uses Micro USB to supply power, which is common in many smart devices. Please refer to the following figure and table for the pin diagram and function of RTL8720DN (BW16).
# |
PIN name |
GPIO |
ADC |
PWM |
UART |
SPI |
I2C |
---|---|---|---|---|---|---|---|
D0(PA7) |
GPIOA_7 |
✓ |
UART_LOG_TX |
||||
D1(PA8) |
GPIOA_8 |
✓ |
UART_LOG_RX |
||||
D2(PA27) |
GPIOA_27 |
✓ |
|||||
D3(PA30) |
GPIOA_30 |
✓ |
|||||
D4(PB1) |
GPIOB_1 |
✓ |
Serial_TX |
||||
D5(PB2) |
GPIOB_2 |
✓ |
Serial_RX |
||||
D6(PB3) |
GPIOB_3 |
✓ |
A2 |
||||
D7(PA25) |
GPIOA_25 |
✓ |
I2C0_CLK |
||||
D8(PA26) |
GPIOA_26 |
✓ |
✓ |
I2C0_SDA |
|||
D9(PA15) |
GPIOA_15 |
✓ |
SPI_CS |
||||
D10(PA14) |
GPIOA_14 |
✓ |
SPI_CLK |
||||
D11(PA13) |
GPIOA_13 |
✓ |
✓ |
SPI_MISO |
|||
D12(PA12) |
GPIOA_12 |
✓ |
✓ |
SPI_MOSI |
Setting up Development Environment
Step 1. Installing the Driver
Step 2. Set up Arduino IDE
From version 1.6.5, Arduino IDE supports third-party hardware. TTherefore, we can use Arduino IDE to develop applications on RTL8720DN (BW16), and the basic examples of Arduino can run on RTL8720DN (BW16) too. Refer to the Basic Examples.
Arduino IDE can be downloaded in the Arduino website.
When the installation is finished, open Arduino IDE. To set up RTL8722DM correctly in Arduino IDE, go to “File” -> “Preferences”.
And paste the following URL into “Additional Boards Manager URLs” field:
https://github.com/ambiot/ambd_arduino/raw/master/Arduino_package/package_realtek.com_amebad_index.json
RTL8720DN (BW16) will be supported from v3.0.8 officially.
Next, go to “Tools” -> “Board” -> “Boards Manager”:
The “Boards Manager” requires about 10~20 seconds to refresh all hardware files (if the network is in bad condition, it may take longer). Every time the new hardware is connected, we need to reopen the Board Manager. So, we close the “Boards Manager”, and then open it again. Find “Realtek AmebaD Boards (32-bits ARM Cortex-M4 @200MHz)” in the list, click “Install”, then the Arduino IDE starts to download required files for RTL8722DM.
“AmebaD_Arduino_patch1_SDK”, please select at least 1 of the SDKs. There are 5 latest released SDK options.
“AmebaD_Arduino_patch2_Tools”, please select according to your operation system. There are Windows, Linux and MacOS.
“AmebaD_Arduino_Source_Code”, this section is optional download only wants to refer the latest source code.
Download the files selected, then unzip (patch1 and patch2 are compulsory). There are “Install.doc”/“Install.pdf” for you to refer installation steps. According to your system, please run the installation tool in the “Offline_SDK_installation_tool” folder.
After the installation tool running successfully, you may open Arduino IDE and proceed to “Tools” -> “Board“ -> “Boards Manager…”. Try to find “Realtek AmebaD Boards (32-bits ARM Cortex-M4 @200MHz)”` in the list, click “Install”, then the Arduino IDE starts to download required files for AmebaD.
Finally, we select RTL8722DM as current connected board in “Tools” -> “Board” -> “Ameba ARM (32-bits) Boards” ->” RTL8722DM”:
How to upload firmware into BW16
Uploading Solution
Method 1: Use AmebaD Image Tool to erase flash
Step 1 – Download and prepare the Image Tool
Step 2 – Setup the Image Tool
In the “Chip Select” option, choose “AmebaD(8721D)” which is also suitable for RTL8720DN chip.
Select correct COM Port that you are using.
Set the Baudrate to “115200”.
Then key in the Flash Erase starting position from Memory Address of 0x0800 0000.
The size to be 2048 KB.
Set the module to “Download mode” first, then click the “Erase” button.
Step 3 – Download Image using Arduino IDE
Optional Uploading Solution
OTA (Over The Air)
Ai-Thinker is providing a guide for OTA firmware upload in Section 6.1 of B&T “RTL8720D AT Command User Manual” of which can be retrieved from this link here.
Try the First Example
Step 1. Compile & Upload
LED_BUILTIN
is a green onboard LED.
Change LED_BUILTIN
to LED_B
or LED_R
for different colors such as blue and red.
Here we use LED_B
for demonstration purpose.Step 2.Run the Blink example
References
Introduction of RTL8720DN on Instructable: https://www.instructables.com/RTL8720DN/
Load Arduino image into BW16: How to load BW16 program with Arduino – #13
RTL8720DN (BW16) IMG2 SIGN Invalid Solution: RTL8720DN(BW16) IMG2 SIGN Invalid Solution
FTDI Driver Download from here: https://ftdichip.com/wp-content/uploads/2021/02/CDM21228_Setup.zip
(End)
備註
If you face any issue, please refer to the FAQ and Trouble shooting sections on 支援 page.