From ElectroDragon
Jump to navigation Jump to search

RDA5981 - WIFI

  • More hardware info refer to documents section, IC datasheet and hardware design guide



5981 IC.png

RDA5981 Features

Supported Feature Lists Specs note
ARM Contex M4 + FPU/MPU core 160MHZ frequency, super powerful MCU; -
Total system memory
  • Up to 288K-Byte internal SRAM for user
  • 160K-Byte SRAM for Wi-Fi stack, Flash cache
  • Integrated maximum 32Mbit SPI flash
  • maximum support 64M PSRAM expansion;
  • user available memory 192k (X01C) / 92K (X01A) byte (build in module) ?
USB2.0 interface support USB Host, support U disk (FAT file system);
SDIO maximum support 256G SD card;
AT command
  • support configuration save;
  • more than 100 AT commands
working temperature -30 ℃ to +80 ℃;
voltage 3.0V-3.5V; boot voltage> 3.0V;
serial 2x baud rate from 1200bps to 4Mbps;
I2S 2x BCLK support 96/192/384/512 / 44.1 / 88.2KHz;
I2C 1x
  • master or slave mode
  • maximum speed supports 3.4Mb/s;
SPI 4x
  • master mode
  • maximum clock frequency supports 20MHZ
  • maximum data length supports 64bit;
PWM 8x
  • PWM 4x, PWT 1x - standard PWM,
  • LPG 1x , suitable for flash light control
  • PWL 2x for monochrome light brightness control;
ADCv 2x
  • 10bit sampling
  • voltage measurement range is 0-2V (0-1.4V can be interrupted)
  • support the internal direct test input voltage, do not need peripheral circuits;
hardware AES / RSA encryption and decryption
interrupt 14x GPIO0-GPIO13, up to 16 GPIO available for interrupt
  • 2.4GHZ 802.11b/g/n, HT20 / HT40,
  • maximum 150Mbps, 20/40MHZ bandwidth
operating system mbed RTOS
certificationv ROHS, FCC, CE
Software supported MQTT, smartconfig, airkiss, Douers AI, etc
Other features
  • Small size: compact 5x5mm2 QFN-40
  • Highly-integrated: internal PMU/LDO/PA/LNA
  • Multi-choice: RDA5981A/B/C, 8Mb, 16Mb, 32Mb, and some else different specifications

Module Specfication

Power Use

  • Shutdown leakage 20uA
  • Standby current 3mA
  • Operating current 85mA
  • Note: Remove the LED
  • Note: Peak power should garanurtee up to 300mA

Power supply

  • VBAT = 3-5V
  • VIO for IO is 1.8-3.1V



Pin Definition

Pin Definition, GPIO mapping see below

Module Pins IC Name Description UNO Definition (or USB) SD
  • Ext. FLASH
  • SPI
  • UART
! Extra
1 IO4 General IOs PB_4
2 Reset
  • RESET, pull down RESET;
  • if the external MCU to control, you can directly connect the GPIO MCU
  • normal high, when RESET first pulled low, and then pulled high
3 IO1 General IOs PB_1 UART2_RX
4 IO2 General IOs PB_2 UART2_TX
5 IO3 General IOs PB_3 SD_D0
  • Download firmware, AT can use this serial port
  • the serial port speed from 1200bps to 460800bps
7 UART_TXD same as above
8 Pin13 IO8 General IOs, ADC PB_8 GPADC-1
9 IO7(should be not ADC) PB_7 SD_D1
  • General IOs
  • (Incorrect: can also be configured as ADC)
10 IO5 General IOs PB_5 SPI, FLASH: CS
11 Pin11 ADC0 (IO7) ADC pin
  • GPADC-0
  • also can measure battery by set register
12 USB_DP USB D+ pin
13 USB_DN USB D- pin
14 IO9 General IOs PB_9 SD_CLK
15 VCC33
  • Working power 3.0-3.5V
  • requires the maximum supply current of not less than 300mA
16 GND ground
17 IO0 General IOs PB_0 SD_CMD
18 IO21 General IOs PC_9
19 IO22 General IOs PD_0 CLK
20 IO23 General IOs PD_1 PSRAM_CS
21 IO24 General IOs PD_2 SI
22 IO25 General IOs PD_3 SO
23 IO12 General IOs PC_0 SD_D2
24 IO13 General IOs PC_1 SD_D3

Quick start guide

  • Baudrate - 926100, connect VCC33, GND, UART_TXD, UART_RXD can work
  • RDA - UNO91H Board Pin Mappin in GPIO_API.c, which used in demo code.


  • AT Commands lists please see on this page RDA5981_AT

Install toolchain for mbedOS

Prerequests MDK > 5.15, python > 2.7

python --version
arm-none-eabi-gcc --version
pip --version
hg --version
pip install mbed-cli

futher toolchain for mbedOS

  • github page mbed-os general, not include target-RDA examples, basically not useful for this here - https://github.com/ARMmbed/mbed-os,
  • Get SDK and code examples for RDA5981 from here.
  • Folder explaination
  1. WiFi Stack - Contents features / FEATURE_LWIP is WiFi Stack + LWIP for WLAN and TCP / IP networking.
  2. HAL - The directory hal / targets / TARGET_RDA is a hardware virtualization layer that includes the underlying drivers for each peripheral.
  3. RTX - Contents rtos is a CMSIS-RTOS RTX source code from ARM. It is a real-time operating system based on time slice and priority.
  4. Features - Directory Features / Some of the RDA5981 available under TARGET_RDA
  5. Test Cases - Table of Contents TESTS / TARGET_RDA contains several test cases for the RDA5981 that allow you to test peripherals and protocol stacks separately.
5981 toolchain error 01.jpg
  • enter into mbedOS folder, this requirements are in mbedOS reqirement.txt file.
pip install -r requirements.txt
  • if someone falls in the "Couldn't find index page for 'setuptools_scm' (maybe misspelled?)" bug ... simple install it by: pip install setuptools_scm (reference link)
  • Set MDK ARMCC path for mbedOS
mbed config --global ARM_PATH C:\Keil_v5\ARM\ARMCC\   ---> get feedback --> [mbed] C:\Keil_v5\ARM\ARMCC\ now set as global ARM_PATH

First complier > test case > timer

  • command: mbed compile -m UNO_91H -t ARM --source TESTS/TARGET_RDA/timer/ --source ./
  • To recomplie again, need clean, otherwise will get error, to clean, simply add -c after above command
mbed compile -m UNO_91H -t ARM --source TESTS/TARGET_RDA/timer/ --source ./ -c
  • Explanation: -m MCU target, -t complier toolchain, --source source code directory -c clean before complie
  • compile in progress
Compile [ 88.9%]: Thread.cpp
Compile [ 89.4%]: rtos_idle.c
Compile [ 90.0%]: HAL_CM.c
Compile [ 90.6%]: RTX_Conf_CM.c
Compile [ 91.1%]: HAL_CM4.c
Compile [ 91.7%]: SVC_Table.S
Compile [ 92.2%]: rt_CMSIS.c
Compile [ 92.8%]: rt_Event.c
Compile [ 93.3%]: rt_List.c
Compile [ 93.9%]: rt_Mailbox.c
Compile [ 94.4%]: rt_MemBox.c
Compile [ 95.0%]: rt_Memory.c
Compile [ 95.6%]: rt_Mutex.c
Compile [ 96.1%]: rt_OsEventObserver.c
Compile [ 96.7%]: rt_Robin.c
Compile [ 97.2%]: rt_Semaphore.c
Compile [ 97.8%]: rt_System.c
Compile [ 98.3%]: rt_Task.c
Compile [ 98.9%]: rt_Time.c
Compile [ 99.4%]: rt_Timer.c
Compile [100.0%]: main.cpp
Link: timer
Elf2Bin: timer
| Module    | .text | .data |   .bss |
| Misc      | 28621 |   235 | 294672 |
| Subtotals | 28621 |   235 | 294672 |
Allocated Heap: unknown
Allocated Stack: unknown
Total Static RAM memory (data + bss): 294907 bytes
Total RAM memory (data + bss + heap + stack): 294907 bytes
Total Flash memory (text + data + misc): 28856 bytes
Image: .\BUILD\UNO_91H\ARM\timer.bin
  • build file direction at .\BUILD\UNO_91H\ARM\timer.bin
Mbed baudrate.png
  • baudrate can change in file mbed_lib.json -> stdio-baud-rate, but must be 用 921600、460800、230400、115200 common value
  • optional step to compile, generate cpp file? - mbed compile


Example code

  • all in SDK example folders: C:\mbedOS\TESTS\TARGET_RDA
  • SPI flash
  • SDcard - in C:\mbedOS:
mbed compile -m UNO_91H -t ARM --source TESTS/TARGET_RDA/sdcard_sdmmc/ --source ./ -c
  • I2S
  • USB

Test in Progress

  • Some files are GIF animation






RDA Flash downloader