edit

Overview

This wiki introduce how to update the latest firmware for the Wireless Core Realtek RTL8720 on Wio Terminal, as well as installing all the dependent libraries for Wio Terminal to enable wireless connectivity.

Note

We are moving the Wi-Fi Software to the new eRPC Structure which is more stable and can work with the Bluetooth at the same time! Please follow through to update to eRPC Wi-Fi firmware and related libraries!

Update the Wireless Core Firmware

First, we need to update the firmware for the Realtek RTL8720 Wireless core on Wio Terminal. This is essential and must update to the latest firmware before proceeding to examples.

attention icon

Attention

Please update the Wi-Fi Core before usage!

Step 1 - Arduino Configuration

To be able to update the firmware on the RTL8720, we need to enable the Serial connection from SAMD51 to RTL8720. This is done by a simple Arduino Program.

uf2 Method

For convenience, we the provide uf2 methods of uploading Wio Terminal's firmware. Simply download the uf2 files from below.

Entering the bootloader mode by sliding the power switch twice quickly. For more reference, please also see here.

An external drive named Arduino should appear in your PC. Drag the the downloaded rtl8720_update_v2.uf2 files into the Arduino drive and it will reset the Wio Terminal and loaded loaded the sketch!

You should see that Burn RTL8720 fw on the Wio Terminal's screen. This means that it is currently in the burning firmware mode!

You can also find the source code of the rtl8720_update_v2.uf2 here.

Step 2 - Download the Latest Firmware

Note: This is the latest eRPC Structure Firmware for RTL8720

CLI Methods

Now, you can flash the RTL8720 firmware to Wio Terminal using the CLI methods.

Download the CLI tools as follows using Terminal:

$ cd ~
$ git clone https://github.com/LynnL4/ambd_flash_tool

CLI Example Usage

  • For macOS and LinuxOS, please use the ambd_flash_tool.py script.

  • For Windows OS, please use the ambd_flash_tool.exe script.

Usage under Window OS:

Let's take macOS as an example, which is the ambd_flash_tool.py script.

  • Open terminal and navigate to the file location. Run python3 ambd_flash_tool.py in the location and you should see the help usage:

NOTE: Make you have Python 3 installed on your PC (macOS and LinuxOS), and the script will auto-download all the dependent libraries.

In some cases, you may only have Python 3 on your PC, then replace python3 ambd_flash_tool.py with python ambd_flash_tool.py.

  • To erase the initial firmware inside the RTL8720, run:

It supports Auto-Detect Port function!

$ python3 ambd_flash_tool.py erase

NOTE: The initial erase process may take a while. Please be patient and do not close windows.

It should look something like this:

  • To flash the new downloaded firmware into the RTL8720, run:
$ python3 ambd_flash_tool.py flash -d [RTL8720-firmware-path]

Replace [RTL8720-firmware-path] with the path you downloaded the RTL8720 from above.

This location should contain km0_boot_all.bin, km0_km4_image2.bin and km4_boot_all.bin these 3 files.

If everything goes well, you should see all a successful message. Now you have flashed the new RTL8720 firmware into the RTL8720 core!

Libraries Installations (eRPC)

There are few Arduino Libraries that are needed for the Wireless connectivity. Follow through to install all the libraries needed:

Note

Please update the Seeed SAMD ArduinoCore to the latest version(>=1.8.1)!

1. Install the Seeed_Arduino_rpcWiFi

  1. Visit the Seeed_Arduino_rpcWiFi repositories and download the entire repo to your local drive.

  2. Now, the Seeed_Arduino_rpcWiFi library can be installed to the Arduino IDE. Open the Arduino IDE, and click sketch -> Include Library -> Add .ZIP Library, and choose the Seeed_Arduino_rpcWiFi file that you've have just downloaded.

InstallLibrary

2. Install the Seeed_Arduino_rpcUnified

  1. Visit the Seeed_Arduino_rpcUnified repositories and download the entire repo to your local drive.

  2. Now, the Seeed_Arduino_rpcUnified library can be installed to the Arduino IDE. Open the Arduino IDE, and click sketch -> Include Library -> Add .ZIP Library, and choose the Seeed_Arduino_rpcUnified file that you've have just downloaded.

3. Install the Seeed_Arduino_mbedtls

  1. Visit the Seeed_Arduino_mbedtls repositories and download the entire repo to your local drive.

  2. Now, the Seeed_Arduino_mbedtls library can be installed to the Arduino IDE. Open the Arduino IDE, and click sketch -> Include Library -> Add .ZIP Library, and choose the Seeed_Arduino_mbedtls file that you've have just downloaded.

4. Install the Seeed_Arduino_FS

  1. Please follow the Wio Terminal FS Overview to install dependent libraries.

NOTE: The following are dependencies of the old AT-Command Structure Wi-Fi firmware and related libraries.This software does not work with Bluetooth at the same time and is getting depreciated, please move the eRPC firmware if possible!

RTL8720 AT-Command Structure Firmware

This is the AT-Command Structure RTL8720 Firmware.

AT-Firmware Libraries Installation

There are few Arduino Libraries that are needed for the Wireless connectivity. Follow through to install all the libraries needed:

1. Install the Seeed_Arduino_atWiFi

  1. Visit the Seeed_Arduino_atWiFi > repositories and download the entire repo to your local drive.

  2. Now, the Seeed_Arduino_atWiFi library can be installed to the Arduino IDE. Open the Arduino IDE, and click sketch -> Include Library -> Add .ZIP Library, and choose the Seeed_Arduino_atWiFi file that you've have just downloaded.

InstallLibrary

2. Install the Seeed-Arduino-FreeRTOS

  1. Visit the Seeed-Arduino-FreeRTOS repositories and download the entire repo to your local drive.

  2. Now, the Seeed-Arduino-FreeRTOS library can be installed to the Arduino IDE. Open the Arduino IDE, and click sketch -> Include Library -> Add .ZIP Library, and choose the Seeed-Arduino-FreeRTOS file that you've have just downloaded.

3. Install the Seeed_Arduino_atUnified

  1. Visit the Seeed_Arduino_atUnified repositories and download the entire repo to your local drive.

  2. Now, the Seeed_Arduino_atUnified library can be installed to the Arduino IDE. Open the Arduino IDE, and click sketch -> Include Library -> Add .ZIP Library, and choose the Seeed_Arduino_atUnified file that you've have just downloaded.

4. Install the Seeed-Studio/esp-at-lib

  1. Visit the Seeed-Studio/esp-at-lib > repositories and download the entire repo to your local drive.

  2. Now, the esp-at-lib library can be installed to the Arduino IDE. Open the Arduino IDE, and click sketch -> Include Library -> Add .ZIP Library, and choose the esp-at-lib file that you've have just downloaded.

5. Install the Seeed_Arduino_mbedtls

  1. Visit the Seeed_Arduino_mbedtls repositories and download the entire repo to your local drive.

  2. Now, the Seeed_Arduino_mbedtls library can be installed to the Arduino IDE. Open the Arduino IDE, and click sketch -> Include Library -> Add .ZIP Library, and choose the Seeed_Arduino_mbedtls file that you've have just downloaded.

6. Install the Seeed_Arduino_atWiFiClientSecure

  1. Visit the Seeed_Arduino_atWiFiClientSecure repositories and download the entire repo to your local drive.

  2. Now, the Seeed_Arduino_atWiFiClientSecure library can be installed to the Arduino IDE. Open the Arduino IDE, and click sketch -> Include Library -> Add .ZIP Library, and choose the Seeed_Arduino_atWiFiClientSecure file that you've have just downloaded.