Ameba ARDUINO: Getting Started with AMB82 MINI (RTL8735B)

Introduction

Ameba is an easy-to-program platform for developing all kind of IoT applications. AMB82 MINI is equipped with various peripheral interfaces, including WiFi, BLE, GPIO INT, I2C, UART, SPI, PWM, ADC. Through these interfaces, AMB82 MINI can connect with electronic components such as LED, switches, manometer, hygrometer, PM2.5 dust sensors, …etc. Besides, AMB82 MINI has 3 key features, Audio codec, Video codec and NN (build in NPU for AIoT).

The collected data can be uploaded via WiFi and be utilized by applications on smart devices to realize IoT implementation.

AMB82 MINI board

get-start-1

AMB82 MINI 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 functions.

AMB82 MINI Pinmap

get-start-2

 GPIO pinGPIO INTADCPWMUARTSPII2CSWDLED
0PF5   SPI1_MISO   
1PF6  SPI1_SCLK   
2PF7  SPI1_MOSI   
3PF8  SPI1_SS   
4PF11      
5PF12      
6PF13      
7PF14      
8PF15      
9PF2A2   I2C1_SDA  
10PF1A1   I2C1_SCL  
11PF0A0      
12PE4   SPI_SSI2C_SDA  
13PE3   SPI_MOSII2C_SCL  
14PE2  SERIAL3_RXSPI_MISO   
15PE1  SERIAL3_TXSPI_SCLK   
16PD18       
17PD17       
18PD16  SERIAL2_RX    
19PD15  SERIAL2_TX    
20PD14       
21PA2A6 SERIAL1_TX    
22PA3A7 SERIAL1_RX    
23PF9     LED_BUILTIN / LEB_B (blue)
24PE6      LED_G (green)
25PF4  LOG_TX    
26PF3*A3 LOG_RX    
27PA1A5   I2C2_SDASWD_CLK 
28PA0A4   I2C2_SCLSWD_DATA 
29PF10       

Set up developing environment

Step 1. OS environment

AMB82 MINI board currently supports Windows OS 32-bits or 64-bits, Linux OS (Ubuntu) and macOS. To have the best experiences, please use the latest version of OS.

Step 2. Installing the Driver

First, connect AMB82 MINI to the computer via Micro USB:

get-start-3

If this is the first time connects board to computer, the USB driver for board will be automatic installed.

If you have driver issue of connect board to computer please go to https://ftdichip.com/drivers/ for USB driver.

Check the COM port number in Device Manager of computer:

get-start-4

Step 3. Set up Arduino IDE

From version 1.6.5, Arduino IDE supports third-party hardware. Therefore, we can use Arduino IDE to develop applications, and the Arduino basic examples are supported.
Arduino IDE can be downloaded in the Arduino website: https://www.arduino.cc/en/Main/Software
When the installation is finished, open Arduino IDE. To set up correctly in Arduino IDE, go to “File” -> “Preferences”.

get-start-4

And paste the following URL into the “Additional Boards Manager URLs” field: https://github.com/ambiot/ambpro2_arduino/raw/main/Arduino_package/package_realtek.com_amebapro2_index.json

Next, go to “Tools” -> “Board” -> “Boards Manager”:

get-start-3

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. Find “Realtek Ameba Boards” in the list, click “Install”, then the Arduino IDE starts to download required files.

get-start-4

After the installation tool running successfully, you may open Arduino IDE and proceed to “Tools” -> “Board” -> “Boards Manager…”. Try to find “Realtek Ameba Boards” in the list, click “Install”, then the Arduino IDE starts to download required files.

Finally, we select board in “Tools” -> “Board” -> “AmebaPro2 ARM (32-bits) Boars” -> “AMB82-MINI”

get-start-4

Try the First Example

Step 1. Selection Ameba Modes

There are many different Modes for user to select for different settings of compile and upload. Please refer the following picture and table.

get-start-14

Mode NameUsageRemarks
* Erase FlashErase all firmware from flash. 
* Auto Flash ModeEnable the auto flash mode, avoid manual enter the upload mode of the board. 
* Upload ModeChoose upload mode between Normal Mode and Speed Mode.
Normal Mode: Upload all bins as a flash bin.
Speed Mode: only upload specific bin to specific flash address.
It is recommended to use Normal Mode at least once, for the first time use the board.
** Vidoe ISP BinSpeed Mode, only, upload Video ISP Bin to its flash address.
Normal Mode, upload a flash bin includes Vidoe ISP Bin.
 
** Neural Network BinSpeed Mode, Only, upload Neural Network Bin to its flash address.
Normal Mode, upload a flash bin includes Neural Network Bin.
 
* Standard Lib EnableChoose the standard library function for compile and upload. 

Step 2. Compile

Arduino IDE provides many built-in examples, which can be compiled, uploaded, and run directly on the boards. Here, we take the “Blink” example as the first try.
Open “File” -> “Examples” -> “01.Basics” -> “Blink”:

get-start-14

Arduino IDE opens a new window with the complete sample code.

Next, we compile the sample code directly; click “Sketch” -> “Verify/Compile”.

Arduino IDE prints the compiling messages in the bottom area of the IDE window. When the compilation is finished, you will get the message as following.

get-start-14

Afterwards, we will upload the compiled code to board.

Step 3. Upload

Please make sure board is connected to computer, then click “Sketch” -> “Upload”.

The Arduino IDE will compile first then upload. Users are required to enter the upload mode of the board. To enter upload mode, first press and hold the UART_DOWNLOAD button, then press and release the RESET button, lastly release the UART_DOWNLOAD button. There is a 5-seconds count down set as a reminder to enter the upload mode.

Additionally, if the board that used has enabled the “Auto Flash Mode”, please ignore above instruction.

get-start-14

It is optional for users to check if the board entered the upload mode. Open serial monitor/terminal and look for “Download Image over UART1”.

get-start-14

When upload completed, the “Done uploading” message is printed.

Step 4. Run the Blink example

In each example, Arduino not only provides sample code, but also detailed documentation, including wiring diagram, sample code explanation, technical details, …etc. Please refer the detailed information of the Blink example:
https://www.arduino.cc/en/Tutorial/Blink
In short, this example makes on-board LED blinks.

get-start-14

If you encounter any problem, please refer to Q&A.

Please confirm that QQ communication software is installed