RISC-V BL706 Audio Video Board

📝 14 Jul 2021

The BL706 Audio Video Board by Bouffalo Lab has a delightful mix of features for Embedded Developers: Multimedia, Bluetooth LE / Zigbee Networking and USB Device Interface.

And it runs on 32-bit RISC-V!

Today we look inside the BL706 Audio Video Board and learn why it’s great for creating Multimedia, RF Networking and USB Firmware.

(The board is not available for purchase yet… But soon, according to Bouffalo Lab)

Many thanks to Bouffalo Lab for providing the BL706 Audio Video Board! (BTW I’m not paid to write this article)

Dev Kit for Bouffalo Lab BL706 Audio Video Board

Dev Kit for Bouffalo Lab BL706 Audio Video Board

Top to bottom: ILI9341 SPI Display, BL706 AVB, Camera, JTAG Adapter

1 BL706 Audio Video Board

What is BL706?

BL706 is the new RISC-V + 2.4 GHz RF SoC by Bouffalo Lab

BL706 Datasheet

The BL706 docs are located here…

BL702 and BL704 have fewer features than BL706…

(How does BL706 compare with BL602? We’ll discuss in a while)

What is BL706 Audio Video Board?

Bouffalo Lab has created 2 Development Boards for BL706

  1. BL706 IoT Development Board

    This is the Smaller Board, with GPIO Pins and USB Port exposed. (It looks like the BL602 Evaluation Board)

    The BL706 IoT Dev Board is useful for running Bluetooth LE and Zigbee Firmware.

    (See this)

  2. BL706 Audio Video Board (AVB)

    This is the Bigger Board, with connectors for SPI Display, Camera and Audio Codec. Plus GPIO Pins and USB Port.

    The BL706 AVB is great for Mulimedia Firmware. And it works with Bluetooth LE and Zigbee too.

    (We’re using this today)

(Trivia: Both BL706 boards were used in a hackathon at Nanjing University of Information Science & Technology)

Here’s the Pinout for BL706 AVB

BL706 AVB Pinout

(Source)

Here’s the Front View of BL706 AVB

Front of BL706 Audio Video Board

(ILI9341 SPI Display is connected at left. The PEN Pin must be disconnected)

And here’s the Back View of BL706 AVB

Back of BL706 Audio Video Board

(The Camera Connector is at top left. FUNC1 and FUNC2 refer to the two jumpers at the bottom of the Front View)

What kinds of Multimedia Firmware can we create with BL706 AVB?

Plenty! Today we shall run the LVGL Graphics Demo Firmware and draw some cool animation on the ILI9341 Display.

With the onboard USB 2.0 Device Interface we can create lots of fun firmware…

Check out the USB Demo Firmware

See also the TensorFlow Lite Firmware

More Demo Firmware

2 Install SDK and Toolchain

UPDATE: BL706 is now supported by Bouffalo Lab IoT SDK (the same one for BL602)

To build firmware for BL706, we need the Bouffalo Lab MCU SDK

(The version on Gitee is probably more recent than GitHub)

Today we shall build BL706 Firmware on Windows Subsystem for Linux (WSL) + Ubuntu.

The instructions are in Chinese (apologies)…

To install the SDK and RISC-V Toolchain on WSL (Ubuntu), we follow these steps in the above doc…

  1. Section 2.3.2: Install RISC-V Toolchain

    wget” the toolchain from dev.bouffalolab.com

    Do this at the WSL bash command prompt.

  2. Section 2.3.3: Install cmake and make

    I used “sudo apt install cmake” and it worked OK.

    Also do this at the WSL bash command prompt.

  3. Section 2.3.5: Download bl_mcu_sdk

    git clone --recursive” the BL MCU SDK link above.

    Note: Do this at the Windows cmd command prompt, because we will be flashing the generated firmware under Windows.

The instructions will also work on Ubuntu x64. (But not Ubuntu Arm64)

2.1 Windows CDK and Eclipse

If we prefer plain old Windows CMD (instead of WSL), follow these instructions to install Windows CDK or Windows Eclipse (apologies again)…

What about macOS?

Sadly BL MCU SDK doesn’t support macOS.

BL706 LVGL Demo

3 Build Firmware

Let’s build some firmware for BL706!

The pic above shows the LVGL Graphics Demo Firmware that we shall build. The source code is at…

According to the instructions for the LVGL Demo Firmware, we build the firmware like so…

# In WSL bash: Go to the Windows directory for MCU SDK
cd /mnt/c/bl_mcu_sdk

# Build the LVGL Firmware
make APP=lvgl \
     BOARD=bl706_avb \
     SUPPORT_LVGL=y

(Note that we’ve downloaded the MCU SDK to C:\bl_mcu_sdk in Windows cmd, so the WSL path becomes /mnt/c/bl_mcu_sdk)

The firmware build begins…

make[1]: Entering directory '/mnt/c/bl_mcu_sdk/build'
cmake -DCHIP=bl702 -DCPU_ID=m0 -DBOARD=bl706_avb -DSUPPORT_FLOAT=n -DSUPPORT_SHELL=n -DSUPPORT_FREERTOS=n -DSSUPPORT_LVGL=y -DSUPPORT_BLE=n -DSUPPORT_XZ=n -DSUPPORT_LWIP=n -DSUPPORT_TFLITE=n -DAPP_DIR=examples -DAPP=lv

BL706 Firmware Build

And succeeds with…

[100%] Linking C executable ../../../out/examples/lvgl/lvgl_main.elf
Generate /mnt/c/bl_mcu_sdk/out/examples/lvgl/lvgl_main.bin

(See the complete log)

The build is done! This is the BL706 Firmware File that we shall flash to BL706 AVB…

C:\bl_mcu_sdk\out\examples\lvgl\lvgl_main.bin

4 Flash Firmware

We’re ready to flash our LVGL Demo Firmware to BL706 AVB! We shall…

  1. Enter Flashing Mode on BL706 AVB

  2. Run Bouffalo Lab Dev Cube to flash our firmware to BL706 AVB

4.1 Enter Flashing Mode

Connect BL706 AVB to our computer’s USB port.

To enter Flashing Mode on BL706 AVB, we do the “Two Finger Salute”

  1. Press and Hold BOOT

  2. Press RST

  3. Release RST

  4. Release BOOT

BOOT and RST Buttons

BL706 AVB needs to be in Flashing Mode so that it will appear on Windows as a USB Serial Device

BL706 USB

4.2 Run BL Dev Cube

To flash our firmware on Windows, we download the Windows version of Bouffalo Lab Dev Cube software…

Start BL Dev Cube, select BL706 and click View → MCU.

(If we see the Windows Defender warning, click More Info → Run Anyway)

Enter these settings…

  1. Interface: UART

  2. COM Port: (Select the COM Port for BL706 AVB)

  3. UART Speed: 2000000

  4. Chip Erase: False

  5. Xtal: 32M

  6. Boot Source: Flash

  7. Image Type: Single CPU

  8. BootInfo Addr: 0x0

  9. Image Addr: 0x2000

  10. Image File:

    C:\bl_mcu_sdk\out\examples\lvgl\lvgl_main.bin

    (Change this to the location of the BL706 Firmware File lvgl_main.bin)

Flashing BL706 with BL Dev Cube

Click Create & Program

We should see…

{'xtal_type': 'XTAL_32M', 'pll_clk': '144M', 'encrypt_type': 'None', 'key_sel': '0', 'cache_way_disable': 'None', 'sign_type': 'None', 'crc_ignore': 'False', 'hash_ignore': 'False', 'encrypt_key': '', 'aes_iv': '', 'public_key_cfg': '', 'private_key_cfg': '', 'device_tree': '', 'page_type': 'mcu', 'flash_clk_type': '72M', 'boot_src': 'Flash', 'img_type': 'SingleCPU', 'img_addr': '0x2000', 'bootinfo_addr': '0x0', 'img_file': 'C:\\bl_mcu_sdk\\out\\examples\\lvgl\\lvgl_main.bin', 'dl_device': 'Uart', 'dl_comport': 'COM6', 'dl_comspeed': '2000000', 'dl_jlinkspeed': '1000', 'dl_chiperase': 'False', 'dl_xtal': '32M'}
...
========= programming chips\bl702\img_create_mcu\img.bin to 0x2000
...
Verify success
Program Finished
[All Success]

(See the complete log)

Our firmware has been flashed to BL706 AVB!

To learn more about BL Dev Cube…

Is there another way to flash our firmware to BL706?

We may flash BL706 with BL Dev Cube, OpenOCD and a JTAG or J-Link Adapter.

The FUNC1 Jumper should be connected, to enable the JTAG Port.

Here are the instructions…

BL706 OpenOCD

4.4 Flashing without BL Dev Cube

Is it possible to flash BL706 with OpenOCD and JTAG… Without BLDevCube?

Check out the findings here…

5 Run LVGL Firmware

Watch what happens when we run our LVGL Firmware on BL706 AVB!

Connect the FUNC1 and FUNC2 Jumpers. (Because we’re using the SPI Port)

BL706 Jumpers

Attach the ILI9341 SPI Display to the left edge of the BL706 AVB…

Front of BL706 Audio Video Board

(Yep it looks like a Game Boy!)

The PEN Pin (leftmost pin on the display) must be disconnected

PEN Pin must be disconnected

Here’s the back view…

Back of BL706 Audio Video Board

Connect BL706 AVB to our computer’s USB port.

Press the RST Button.

The display comes to life with some cool animation!

BL706 AVB is actually running an LVGL Graphics Display Benchmark

Here are the results…

BL706 LVGL Demo Firmware

We have successfully built, flashed and executed the LVGL Demo Firmware on BL706 AVB!

6 BL706 vs BL602

How does BL706 differ from BL602?

From the datasheets we can see…

  1. BL706 has Zigbee, while BL602 has WiFi.

    (Both have Bluetooth LE)

  2. BL706 has interfaces for USB, I2S (Audio), Camera and Ethernet.

    BL602 has an SDIO Interface (for SD Card).

  3. BL706 has less RAM than BL602, but more ROM.

  4. BL706’s CPU (144 MHz) also runs slower than BL602 (192 MHz).

BL706 vs BL602 Datasheet

6.1 MCU SDK vs IoT SDK

UPDATE: BL706 is now supported by Bouffalo Lab IoT SDK (the same one for BL602)

The BL IoT SDK for BL602 was released months before the BL MCU SDK for BL706.

Bouffalo Lab explains how the MCU SDK differs from IoT SDK

BL706 MCU SDK vs BL602 IoT SDK

(Auto-translated from this post)

BL602 is not supported today on BL MCU SDK, but it will be supported in future according to Bouffalo Lab.

We spotted some differences between the SDKs

  1. Hardware Adaptation Layer has been revamped.

    With BL602 IoT SDK we call this to set a GPIO Output…

    bl_gpio_output_set(pin, value);

    Now with BL706 MCU SDK we do this…

    gpio_write(pin, value);
  2. FreeRTOS is no longer included for firmware builds by default.

    To include FreeRTOS, we specify SUPPORT_FREERTOS like so…

    make APP=freertos_semaphore \
         BOARD=bl706_iot \
         SUPPORT_FREERTOS=y

    (Source)

  3. AliOS Functions (aos_*) for Multitasking and Device Tree are no longer in BL706 MCU SDK.

    Now we configure peripherals directly from our Firmware Code: GPIO, SPI, UART, …

    Sample code for UART Configuration

    (Alternative Link)

  4. OpenOCD, JTAG and J-Link are now supported for flashing BL706.

    (But not BL602)

    Flashing BL706 with OpenOCD

  5. LVGL (Graphics) and TensorFlow Lite (Machine Learning) are now bundled with BL706 MCU SDK

    Demo Firmware for TensorFlow Lite

  6. BL706 requires cmake for building firmware.

    (BL602 builds with make only)

    BL706 uses cmake

  7. GCC RISC-V Toolchain is no longer bundled with BL706 MCU SDK.

    (Now we need to download the toolchain from dev.bouffalolab.com)

    GCC Toolchain not bundled

  8. macOS is no longer supported for building firmware with BL706 MCU SDK.

    (But BL Dev Cube is still available on macOS for flashing firmware)

    BL706 doesn’t support macOS

7 What’s Next

I had lots of fun using the BL706 Audio Video Board.

It feels simpler than BL602… But yet it has so many cool new features: Camera, Audio, USB, Zigbee Networking, LVGL Graphics, TensorFlow Machine Learning, …

I look forward to seeing your Multimedia Creations on BL706!

Got a question, comment or suggestion? Create an Issue or submit a Pull Request here…

lupyuen.github.io/src/bl706.md

8 Notes

  1. This article is the expanded version of this Twitter Thread

  2. Here are the steps for debugging BL702 / BL704 / BL706…

    “Debugging BL702”

  3. UPDATE: There is a new Combo BL706 + BL602 board. (See this)

  4. UPDATE: BL706 is now supported by Bouffalo Lab IoT SDK (the same one for BL602)

    See this Twitter Thread

Front of BL706 Audio Video Board

BL706 Audio Video Board