Contributed by 无垠的广袤, organized by Ai-Thinker
[Ai-WB2-32S Dev Board Review] Introduction, Environment Setup, Firmware Flashing
[Ai-WB2-32S Dev Board Review] Introduction, Environment Setup, Firmware Flashing
The Ai-WB2-32S development board is designed around the Ai-WB2-32S module. It features an onboard USB-to-TTL serial chip CH340C, an LDO voltage regulator circuit, an RGB tri-color LED, a Reset button, a Bootloader button, and more. All GPIOs are brought out for easy debugging and development.
Introduction


Module
The Ai-WB2-32S is a Wi-Fi & BT module developed by Ai-Thinker Technology Co., Ltd. It is built around the BL602 chip as the core processor and supports the Wi-Fi 802.11b/g/n and BLE 5.0 protocols.
The BL602 chip integrates a low-power 32-bit RISC CPU, 276KB RAM, and a rich set of peripherals,
including SDIO, SPI, UART, I2C, IR remote, PWM, ADC, DAC, PIR, and GPIO.
It can be widely used in the Internet of Things (IoT), mobile devices, wearable electronics, smart home, and other fields.
Key Features
- SMD-38 package
- Supports IEEE 802.11 b/g/n protocols
- Wi-Fi security: WPS/WEP/WPA/WPA2 Personal/WPA3
- Supports 20 MHz bandwidth with a maximum data rate of 72.2 Mbps
- Bluetooth Low Energy 5.0, Bluetooth Mesh
- Supports Station + BLE mode, Station + SoftAP + BLE mode
- 32-bit RISC CPU, 276KB RAM
- Secure boot with support for ECC-256 signed images
- Supports QSPI/SPI Flash on-the-fly AES decryption (OTFAD) and AES 128 CTR mode
- AES 128/192/256-bit encryption engine
- Supports SHA-1/224/256
- True random number generator (TRNG)
- Public key accelerator (PKA) supporting big-number basic operations; software provides APIs for signing, verification, etc.
- Supports SDIO, SPI, UART, I2C, IR remote, PWM, ADC, DAC, PIR, GPIO, etc.
- Integrated Wi-Fi MAC/BB/RF/PA/LNA/BT
- Supports multiple sleep modes with a deep sleep current of 12 μA
- Universal AT commands for a quick start
- Supports secondary development with integrated Windows and Linux development environments
Parameters

Module Package


Module Schematic

Dev Board Schematic

Development Environment Setup
Refer to the official Windows environment setup tutorial: <https://blog.csdn.net/Boantong_/article/details/128480919>
Note that when configuring environment variables, the path must not contain spaces.
Here is a brief rundown of the process:
Download and install the Eclipse IDE: download;
Download and install msys2: download, then run the following commands and press Enter to install git and make,
pacman -S git pacman -S make
to enable project file deployment and program compilation;
Deploy the Ai-WB2 series SDK development package: right-click the target disk, select Open Git Bash here, and type the following command
- git clone --recursive https://gitee.com/Ai-Thinker-Open/Ai-Thinker-WB2
Use the Git tool to clone the firmware package; once the clone completes, you can close the git command window.
Firmware Flashing
For an already-built firmware image, proceed as follows:

Select the target firmware path - select the dev board's serial port - set the serial download baud rate - Open Uart;
While holding the Boot button, briefly press the RST button to enter download mode;
Click the Create & Download button - the progress bar reaches 100% and shows All Success;
Briefly press the RST button to reset the board.
Firmware Verification
Serial Output
Open a serial port assistant, select the dev board's serial port, set the baud rate to 115200 with no parity bit, 8 data bits, and 1 stop bit, open the port, and press the EN key to reset the MCU. The board information is then printed as follows:

Serial Debugging
According to the schematic,

the onboard LED lights up at high level, and the GPIO pins for the RGB are IO14, IO17, and IO3 respectively.
According to the GPIO output configuration command protocol,
AT+SYSGPIOWRITE=<pin>,<level>
the response is OK.
This allows you to control the output level of the corresponding GPIO.
For details, see: AT Command Set.
Secondary Development: LED Blinking
Refer to the official environment setup tutorial: <https://blog.csdn.net/Boantong_/article/details/128480919>
Open the Eclipse IDE, create a new RISC-V project, and import the target SDK folder;
Configure the Windows build tool and toolchain path;
Configure the SDK project's C/C++ build tool, toolchain path, target project path, etc.;
Clean the project, write code, and build the project.
Code
Click to expand full code
#include <stdio.h>
#include <string.h>
#include <FreeRTOS.h>
#include <task.h>
#include <bl_gpio.h>
#define GPIO_LED_PIN 3
void blink_test(void *param)
{
uint8_t value = 1;
while (1)
{
bl_gpio_enable_output(GPIO_LED_PIN, 0, 0);
printf("Turning the LED %s! \r\n", value == 1 ? "ON" : "OFF");
bl_gpio_output_set(GPIO_LED_PIN, value);
value = !value;
vTaskDelay(200);
}
}
void main(void)
{
xTaskCreate(blink_test, "blink", 1024, NULL, 15, NULL);
}Modify the GPIO_LED_PIN definition and the vTaskDelay function to adjust the target GPIO pin and the delay time.
Firmware Flashing Configuration

Load the target firmware, configure the serial port parameters, open the port, press the BOOT and RST buttons to enter flash mode, click the Create & Download button, and once the progress bar completes, press the RST button to reset.
Result
Delay set to vTaskDelay(1000);

Delay adjusted to vTaskDelay(200);

At the same time, the serial port outputs the LED state at that moment: ON or OFF.

