Ai-Thinker BW16 Arduino Development Environment Setup Tutorial 

This week, LCSC Electronics supplier Ai-Thinker introduced How to set up the Arduino development environment for its BW16 module and development board. 

Ai-Thinker adheres to the first principle of trustworthiness and ease of use. Whether the product supports Arduino has always attracted the attention of customers and developers. First, let’s briefly introduce the BW16 module and development board.

BW16 module and development board

The BW16-Kit development board is a dual-band WiFi + Bluetooth low energy Bluetooth 5.0 dual-mode module that operates at 2.4GHZ/5.8GHZ. It measures 50.4*25.4(±0.2) mm and uses a Type C power supply, which is commonly found in many smart devices.

BW16 Pin map

BW16 Pin map

 

When clearing flash or uploading firmware, the development board requires upload mode.

Development Environment Setup Steps
Step 1. Environment Configuration

The BW16 (RTL8720DN) development board currently supports Windows OS 32-bit or 64-bit, Linux OS (Ubuntu) and macOS. For the best experience, please use the latest version of your operating system.

Step 2. Set Up Arduino IDE

Starting with version 1.6.5, the Arduino IDE supports third-party hardware. The Arduino IDE is used to develop applications on the BW16, as well as the Arduino basic example link (refer to the basic example link).

Arduino IDE can be downloaded from the Arduino website: https://www.arduino.cc/en/Main/Software

After the installation is complete, open the Arduino IDE. Please open “File” -> “Preferences”;

And copy the following URL into the “Additional Boards Manager URLs” field:

https://github.com/ambiot/ambd_arduino/raw/master/Arduino_package/package_realtek.com_amebad_index.json

Starting from version v3.0.8, Ameba Arduino will support the BW16 development board.

Then,Open “Tools” -> “Board” -> “Boards Manager”:

“Boards Manager” takes approximately a few seconds to refresh all hardware files (it may take longer if the network condition is poor). Find “Realtek Ameba Boards (32-bits ARM Cortex-M33 @200MHz)” in the list, click “Install”, and the Arduino IDE will automatically start downloading the files required by AmebaD including BW16.

If you encounter GitHub download issues, please refer to “Downloads/Software Development Kit” in the link below. There are 3 parts:

  •  “AmebaD_Arduino_patch1_SDK”, please select at least 1 SDK. There are currently 5 recently released SDK options.
  1. “AmebaD_Arduino_patch2_Tools”, please select according to your operating system. Available in Windows, Linux and MacOS.
  2. “AmebaD_Arduino_Source_Code”, this part is an optional download for reference to the latest source code.

Download the selected file and unzip it (patch1 and patch2 are required).

There is “Install.doc”/”Install.pdf” for your reference installation steps. Depending on your system, please run the installation tool in the “Offline_SDK_installation_tool” folder.

After the installation is successful, you can open the Arduino IDE and select “Tools” -> “Board” -> “Ameba ARM (32-bits) Boards” ->” BW16(RTL8720DN)” to select AmebaD as the currently connected development board.

Step 3. Install the Serial Port

Connect the development board to the computer via Micro USB:

BW16

After the corresponding connection, the USB driver will be automatically installed. If you have driver issues with the connection board, please go to http://www.wch- ic.com/downloads/CH341SER_ZIP.html 

See USB driver. Check the COM port number in the Device Administrator of your Windows operating system:

Go to Tools->Port and select the correct COM port.

Enter “Tools” -> “Serial Monitor”, set the baud rate to “115200”, and then press the RST button to check the serial port connection.

Step 4. Clear Flash

Depending on the production batch, some development boards may have built-in preset B&T firmware. The firmware information is as shown in the figure below:

The firmware is in the OTA section. All newly compiled firmware will be automatically replaced by OTA firmware. Therefore, the OTA firmware needs to be cleared before the compiled firmware can be used.

Method 1: “Erase Flash Enable” after Arduino SDK V3.1.3.

Choose“Tools”->“Erase Flash”->“Enable”;

Then enter upload mode.

  • Automatically select “Tools”->”Auto Upload Mode”->”Enable”.

Next, select Sketch->Upload. “Erase flash done” appears.

 

Press the RST button to check the serial monitor and rebuild the board. If there is only “#”, it means the flash is cleared successfully. Remember to select “Tools”->”Erase Flash”->”Disable”.

Try the example:
Step 1. Compile and Upload

Arduino IDE provides many built-in examples that can be compiled, uploaded and run directly on the development board. Here, we take “Blink” as an example for our first attempt.

Open “File” -> “Examples” -> “01.Basics” -> “Blink”:

 

Onboard RGB LED, default “LED_BUILTIN” is green.

Change “LED_BUILTIN” to “LED_R”, “LED_G” or “LED_B” for red, green or blue.

Next, compile the example code directly. “Sketch”->”Verify/Compile”. Then if there are no compilation errors, then “Sketch” -> “Upload”.

  • Check and select “Tools” -> “Erase Flash” -> “Disable”.
  • Enter upload mode. Manual or automatic. Select “Tools” -> “Auto Upload Mode” -> “Enable”/”Disable”.
  • “Verify/Compile” and “Upload”. “Upload” includes “Verify/Compile”, “Verify/Compile” can be skipped.

If the upload is successful, “All images are sent successfully!” will be displayed.

Step 2. Execute Blink Example

The board will automatically reset, if the board does not support auto-upload mode, please press the RST button. The onboard RGB LED will flash.

In each example, Arduino not only provides example code, but also provides detailed documentation, including wiring diagrams, example code descriptions, technical details, etc. These examples can be used directly on the BW16. See Blink details at the following link:

https://www.arduino.cc/en/Tutorial/BuiltInExamples/Blink

Hope it can help you quickly use the BW16 module or development board. If you have any other questions, please feel free to leave us a message.

LCSC is the authorized distributor of Ai-Thinker. LCSC is a global distributor with an extensive selection of electronic components, with more than 4 million registered customers worldwide. And, LCSC electronics is known to customers for offering in-stock inventory for fast delivery since LCSC owns 130,000㎡ intelligent warehouses. Select Ai-Thinker’s IoT module and other products at LCSC Electronics.

Newsletter
Connect with us
Customer Service: 0086-755-83210457
Logistics Dept.: 0086-755-83233027
9:30am to 12pm and 1:30pm to 10pm,
Monday through Friday, UTC/GMT +8.

SSL encrypted
payment
© 2024 LCSC.COM All Rights Reserved. 粤ICP备17041818号