lupyuen.org/articles/bl706.html

557 lines
No EOL
31 KiB
HTML
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="generator" content="rustdoc">
<title>RISC-V BL706 Audio Video Board</title>
<!-- Begin scripts/articles/*-header.html: Article Header for Custom Markdown files processed by rustdoc, like chip8.md -->
<meta property="og:title"
content="RISC-V BL706 Audio Video Board"
data-rh="true">
<meta property="og:description"
content="What's inside the Bouffalo Lab RISC-V BL706 Audio Video Board... And how it differs from BL602"
data-rh="true">
<meta property="og:image"
content="https://lupyuen.github.io/images/bl706-title.jpg">
<meta property="og:type"
content="article" data-rh="true">
<link rel="canonical" href="https://lupyuen.org/articles/bl706.html" />
<!-- End scripts/articles/*-header.html -->
<!-- Begin scripts/rustdoc-header.html: Header for Custom Markdown files processed by rustdoc, like chip8.md -->
<link rel="alternate" type="application/rss+xml" title="RSS Feed for lupyuen" href="/rss.xml" />
<link rel="stylesheet" type="text/css" href="../normalize.css">
<link rel="stylesheet" type="text/css" href="../rustdoc.css" id="mainThemeStyle">
<link rel="stylesheet" type="text/css" href="../dark.css">
<link rel="stylesheet" type="text/css" href="../light.css" id="themeStyle">
<link rel="stylesheet" type="text/css" href="../prism.css">
<script src="../storage.js"></script><noscript>
<link rel="stylesheet" href="../noscript.css"></noscript>
<link rel="shortcut icon" href="../favicon.ico">
<style type="text/css">
#crate-search {
background-image: url("../down-arrow.svg");
}
</style>
<!-- End scripts/rustdoc-header.html -->
</head>
<body class="rustdoc">
<!--[if lte IE 8]>
<div class="warning">
This old browser is unsupported and will most likely display funky
things.
</div>
<![endif]-->
<!-- Begin scripts/rustdoc-before.html: Pre-HTML for Custom Markdown files processed by rustdoc, like chip8.md -->
<!-- Begin Theme Picker -->
<div class="theme-picker" style="left: 0"><button id="theme-picker" aria-label="Pick another theme!"><img src="../brush.svg"
width="18" alt="Pick another theme!"></button>
<div id="theme-choices"></div>
</div>
<!-- Theme Picker -->
<!-- End scripts/rustdoc-before.html -->
<h1 class="title">RISC-V BL706 Audio Video Board</h1>
<nav id="rustdoc"><ul>
<li><a href="#bl706-audio-video-board" title="BL706 Audio Video Board">1 BL706 Audio Video Board</a><ul></ul></li>
<li><a href="#install-sdk-and-toolchain" title="Install SDK and Toolchain">2 Install SDK and Toolchain</a><ul>
<li><a href="#windows-cdk-and-eclipse" title="Windows CDK and Eclipse">2.1 Windows CDK and Eclipse</a><ul></ul></li></ul></li>
<li><a href="#build-firmware" title="Build Firmware">3 Build Firmware</a><ul></ul></li>
<li><a href="#flash-firmware" title="Flash Firmware">4 Flash Firmware</a><ul>
<li><a href="#enter-flashing-mode" title="Enter Flashing Mode">4.1 Enter Flashing Mode</a><ul></ul></li>
<li><a href="#run-bl-dev-cube" title="Run BL Dev Cube">4.2 Run BL Dev Cube</a><ul></ul></li>
<li><a href="#jtag-and-j-link" title="JTAG and J-Link">4.3 JTAG and J-Link</a><ul></ul></li>
<li><a href="#flashing-without-bl-dev-cube" title="Flashing without BL Dev Cube">4.4 Flashing without BL Dev Cube</a><ul></ul></li></ul></li>
<li><a href="#run-lvgl-firmware" title="Run LVGL Firmware">5 Run LVGL Firmware</a><ul></ul></li>
<li><a href="#bl706-vs-bl602" title="BL706 vs BL602">6 BL706 vs BL602</a><ul>
<li><a href="#mcu-sdk-vs-iot-sdk" title="MCU SDK vs IoT SDK">6.1 MCU SDK vs IoT SDK</a><ul></ul></li></ul></li>
<li><a href="#whats-next" title="Whats Next">7 Whats Next</a><ul></ul></li>
<li><a href="#notes" title="Notes">8 Notes</a><ul></ul></li></ul></nav><p>📝 <em>14 Jul 2021</em></p>
<p>The <strong>BL706 Audio Video Board</strong> by <a href="https://www.bouffalolab.com/"><strong>Bouffalo Lab</strong></a> has a delightful mix of features for Embedded Developers: <strong>Multimedia, Bluetooth LE / Zigbee Networking and USB Device Interface</strong>.</p>
<p>And it runs on <strong>32-bit RISC-V</strong>!</p>
<p>Today we look inside the BL706 Audio Video Board and learn why its great for creating <strong>Multimedia, RF Networking and USB Firmware</strong>.</p>
<p>(The board is not available for purchase yet… But soon, according to Bouffalo Lab)</p>
<p>Many thanks to <strong>Bouffalo Lab</strong> for providing the BL706 Audio Video Board! (BTW Im not paid to write this article)</p>
<p><img src="https://lupyuen.github.io/images/bl706-title.jpg" alt="Dev Kit for Bouffalo Lab BL706 Audio Video Board" /></p>
<p><em>Dev Kit for Bouffalo Lab BL706 Audio Video Board</em></p>
<p><em>Top to bottom: ILI9341 SPI Display, BL706 AVB, Camera, JTAG Adapter</em></p>
<h1 id="bl706-audio-video-board"><a class="doc-anchor" href="#bl706-audio-video-board">§</a>1 BL706 Audio Video Board</h1>
<p><em>What is BL706?</em></p>
<p>BL706 is the new <strong>RISC-V + 2.4 GHz RF SoC by Bouffalo Lab</strong></p>
<ul>
<li>
<p><strong>32-bit RISC-V CPU with Hardware Floating-Point</strong> (RV32IMAFC)</p>
<p>CPU Frequency configurable from <strong>1 MHz to 144 MHz</strong></p>
<p>Based on <a href="https://www.sifive.com/cores/e24"><strong>SiFive E24 Core</strong></a></p>
</li>
<li>
<p><strong>132 KB RAM, 192 KB ROM</strong></p>
<p><strong>XIP QSPI Flash / pSRAM</strong> with hardware encryption support</p>
</li>
<li>
<p><strong>2.4 GHz Radio Frequency Transceiver</strong></p>
<p>Supports <strong>Bluetooth LE 5.0 and Zigbee 3.0</strong></p>
<p>(Note that BL706 does NOT support WiFi)</p>
</li>
<li>
<p><strong>Camera</strong> Interface</p>
</li>
<li>
<p><strong>I2S</strong> Audio Interface</p>
</li>
<li>
<p><strong>Ethernet</strong> RMII Interface</p>
</li>
<li>
<p><strong>USB 2.0</strong> Full-Speed Device Interface</p>
</li>
<li>
<p><strong>Infrared</strong> Remote Control Interface</p>
<p>Passive Infrared Detection</p>
</li>
<li>
<p><strong>Other Peripherals</strong></p>
<p>UART x 2, SPI x 1, I2C x 1</p>
<p>PWM x 5, ADC 12-bit, DAC 10-bit</p>
<p>GPIO x 31</p>
</li>
</ul>
<p><img src="https://lupyuen.github.io/images/bl706-datasheet.jpg" alt="BL706 Datasheet" /></p>
<p>The <strong>BL706 docs</strong> are located here…</p>
<ul>
<li>
<p><a href="https://github.com/bouffalolab/bl_mcu_sdk/blob/master/docs/chipSpecification/bl70x_docs"><strong>BL702 / BL704 / BL706 Datasheet</strong></a></p>
<p>(Click on <strong>BL702_BL704_BL706_DS_EN</strong>)</p>
</li>
<li>
<p><a href="https://github.com/bouffalolab/bl_mcu_sdk/blob/master/docs/chipSpecification/bl70x_docs"><strong>BL702 / BL704 / BL706 Reference Manual</strong></a></p>
<p>(Click on <strong>BL702_BL704_706_RM_EN</strong>)</p>
</li>
<li>
<p><a href="https://github.com/bouffalolab/bl_mcu_sdk/blob/master/docs"><strong>Other Docs</strong></a></p>
</li>
</ul>
<p><strong>BL702 and BL704</strong> have fewer features than BL706…</p>
<ul>
<li>
<p><strong>GPIO:</strong> 15 on BL702, 23 on BL704 (31 on BL706)</p>
</li>
<li>
<p><strong>Camera Interface:</strong> Only available on BL706</p>
</li>
<li>
<p><strong>Ethernet Interface:</strong> Only available on BL704 and BL706</p>
</li>
</ul>
<p>(How does BL706 compare with BL602? Well discuss in a while)</p>
<p><em>What is BL706 Audio Video Board?</em></p>
<p>Bouffalo Lab has created <strong>2 Development Boards for BL706</strong></p>
<ol>
<li>
<p><strong>BL706 IoT Development Board</strong></p>
<p>This is the Smaller Board, with <strong>GPIO Pins and USB Port</strong> exposed. (It looks like the BL602 Evaluation Board)</p>
<p>The BL706 IoT Dev Board is useful for running <strong>Bluetooth LE and Zigbee Firmware</strong>.</p>
<p><a href="https://github.com/bouffalolab/bl_mcu_sdk#hardware-resources">(See this)</a></p>
</li>
<li>
<p><strong>BL706 Audio Video Board (AVB)</strong></p>
<p>This is the Bigger Board, with connectors for <strong>SPI Display, Camera and Audio Codec</strong>. Plus GPIO Pins and USB Port.</p>
<p>The BL706 AVB is great for <strong>Mulimedia Firmware</strong>. And it works with Bluetooth LE and Zigbee too.</p>
<p>(Were using this today)</p>
</li>
</ol>
<p><a href="http://www.bjxy.cn/info/1039/9445.htm">(Trivia: Both BL706 boards were used in a hackathon at Nanjing University of Information Science &amp; Technology)</a></p>
<p>Heres the <strong>Pinout for BL706 AVB</strong></p>
<p><img src="https://lupyuen.github.io/images/bl706-pinout.jpg" alt="BL706 AVB Pinout" /></p>
<p><a href="https://github.com/bouffalolab/bl_mcu_sdk">(Source)</a></p>
<p>Heres the <strong>Front View of BL706 AVB</strong></p>
<p><img src="https://lupyuen.github.io/images/bl706-front1.jpg" alt="Front of BL706 Audio Video Board" /></p>
<p>(ILI9341 SPI Display is connected at left. The <code>PEN</code> Pin must be disconnected)</p>
<p>And heres the <strong>Back View of BL706 AVB</strong></p>
<p><img src="https://lupyuen.github.io/images/bl706-back1.jpg" alt="Back of BL706 Audio Video Board" /></p>
<p>(The Camera Connector is at top left. <code>FUNC1</code> and <code>FUNC2</code> refer to the two jumpers at the bottom of the Front View)</p>
<p><em>What kinds of Multimedia Firmware can we create with BL706 AVB?</em></p>
<p>Plenty! Today we shall run the <strong>LVGL Graphics Demo Firmware</strong> and draw some cool animation on the <strong>ILI9341 Display</strong>.</p>
<p>With the onboard <strong>USB 2.0 Device Interface</strong> we can create lots of fun firmware…</p>
<ul>
<li>
<p><a href="https://en.wikipedia.org/wiki/USB_communications_device_class"><strong>CDC</strong></a>: USB Serial Port (Command-Line Interface)</p>
</li>
<li>
<p><a href="https://en.wikipedia.org/wiki/USB_mass_storage_device_class"><strong>MSC</strong></a>: USB Storage (BL706 becomes a USB Drive)</p>
</li>
<li>
<p><a href="https://en.wikipedia.org/wiki/USB_human_interface_device_class"><strong>HID</strong></a>: USB Mouse and Keyboard</p>
</li>
<li>
<p><strong>Video</strong>: USB Cam</p>
</li>
<li>
<p><strong>Audio</strong>: USB Microphone</p>
</li>
</ul>
<p><a href="https://github.com/bouffalolab/bl_mcu_sdk/tree/master/examples/usb">Check out the USB Demo Firmware</a></p>
<p><a href="https://github.com/bouffalolab/bl_mcu_sdk/tree/master/examples/tensorflow">See also the TensorFlow Lite Firmware</a></p>
<p><a href="https://github.com/bouffalolab/bl_mcu_sdk/tree/master/examples">More Demo Firmware</a></p>
<h1 id="install-sdk-and-toolchain"><a class="doc-anchor" href="#install-sdk-and-toolchain">§</a>2 Install SDK and Toolchain</h1>
<p><a href="https://htmlpreview.github.io/?https://raw.githubusercontent.com/bouffalolab/bl_iot_sdk/master/docs/BL702/html/index.html"><strong>UPDATE</strong>: BL706 is now supported by <strong>Bouffalo Lab IoT SDK</strong> (the same one for BL602)</a></p>
<p>To build firmware for BL706, we need the <strong>Bouffalo Lab MCU SDK</strong></p>
<ul>
<li>
<p><a href="https://github.com/bouffalolab/bl_mcu_sdk"><strong>BL MCU SDK on GitHub</strong></a></p>
</li>
<li>
<p><a href="https://gitee.com/bouffalolab/bl_mcu_sdk"><strong>BL MCU SDK on Gitee</strong></a></p>
</li>
</ul>
<p>(The version on Gitee is probably more recent than GitHub)</p>
<p>Today we shall build BL706 Firmware on <strong>Windows Subsystem for Linux (WSL) + Ubuntu</strong>.</p>
<p>The instructions are in Chinese (apologies)…</p>
<ul>
<li>
<p><a href="https://bouffalolab.gitee.io/bl_mcu_sdk/get_started/Linux_quick_start_ubuntu.html"><strong>Linux Quick Start for Ubuntu (Chinese)</strong></a></p>
<p><a href="https://htmlpreview.github.io/?https://github.com/bouffalolab/bl_mcu_sdk/blob/master/docs/development_guide/build/html/get_started/Linux_quick_start_ubuntu.html">(Alternative Link)</a></p>
</li>
</ul>
<p>To install the SDK and RISC-V Toolchain on WSL (Ubuntu), we follow these steps in the above doc…</p>
<ol>
<li>
<p><a href="https://bouffalolab.gitee.io/bl_mcu_sdk/get_started/Linux_quick_start_ubuntu.html#risc-v"><strong>Section 2.3.2: Install RISC-V Toolchain</strong></a></p>
<p><code>wget</code>” the toolchain from <code>dev.bouffalolab.com</code></p>
<p>Do this at the <strong>WSL <code>bash</code></strong> command prompt.</p>
</li>
<li>
<p><a href="https://bouffalolab.gitee.io/bl_mcu_sdk/get_started/Linux_quick_start_ubuntu.html#cmake-make"><strong>Section 2.3.3: Install <code>cmake</code> and <code>make</code></strong></a></p>
<p>I used “<code>sudo apt install cmake</code>” and it worked OK.</p>
<p>Also do this at the <strong>WSL <code>bash</code></strong> command prompt.</p>
</li>
<li>
<p><a href="https://bouffalolab.gitee.io/bl_mcu_sdk/get_started/Linux_quick_start_ubuntu.html#bl-mcu-sdk"><strong>Section 2.3.5: Download <code>bl_mcu_sdk</code></strong></a></p>
<p><code>git clone --recursive</code>” the BL MCU SDK link above.</p>
<p><strong>Note:</strong> Do this at the <strong>Windows <code>cmd</code></strong> command prompt, because we will be flashing the generated firmware under Windows.</p>
</li>
</ol>
<p>The instructions will also work on <strong>Ubuntu x64</strong>. (But not Ubuntu Arm64)</p>
<h2 id="windows-cdk-and-eclipse"><a class="doc-anchor" href="#windows-cdk-and-eclipse">§</a>2.1 Windows CDK and Eclipse</h2>
<p>If we prefer plain old Windows CMD (instead of WSL), follow these instructions to install <strong>Windows CDK</strong> or <strong>Windows Eclipse</strong> (apologies again)…</p>
<ul>
<li>
<p><a href="https://bouffalolab.gitee.io/bl_mcu_sdk/get_started/Windows_quick_start_cdk.html"><strong>Windows Quick Start for CDK (Chinese)</strong></a></p>
<p><a href="https://htmlpreview.github.io/?https://github.com/bouffalolab/bl_mcu_sdk/blob/master/docs/development_guide/build/html/get_started/Windows_quick_start_cdk.html">(Alternative Link)</a></p>
<p>Jianchi CDK is the IoT IDE by T-Head.</p>
</li>
<li>
<p><a href="https://bouffalolab.gitee.io/bl_mcu_sdk/get_started/Windows_quick_start_eclipse.html"><strong>Windows Quick Start for Eclipse (Chinese)</strong></a></p>
<p><a href="https://htmlpreview.github.io/?https://github.com/bouffalolab/bl_mcu_sdk/blob/master/docs/development_guide/build/html/get_started/Windows_quick_start_eclipse.html">(Alternative Link)</a></p>
</li>
</ul>
<p><em>What about macOS?</em></p>
<p>Sadly BL MCU SDK doesnt support macOS.</p>
<p><img src="https://lupyuen.github.io/images/bl706-lvgl.png" alt="BL706 LVGL Demo" /></p>
<h1 id="build-firmware"><a class="doc-anchor" href="#build-firmware">§</a>3 Build Firmware</h1>
<p>Lets <strong>build some firmware</strong> for BL706!</p>
<p>The pic above shows the <strong>LVGL Graphics Demo Firmware</strong> that we shall build. The source code is at…</p>
<ul>
<li><a href="https://github.com/bouffalolab/bl_mcu_sdk/tree/master/examples/lvgl"><strong>LVGL Demo Firmware for BL706</strong></a></li>
</ul>
<p>According to the <a href="https://github.com/bouffalolab/bl_mcu_sdk/tree/master/examples/lvgl">instructions for the LVGL Demo Firmware</a>, we build the firmware like so…</p>
<div class="example-wrap"><pre class="language-bash"><code>## 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</code></pre></div>
<p>(Note that weve downloaded the MCU SDK to <code>C:\bl_mcu_sdk</code> in Windows <code>cmd</code>, so the WSL path becomes <code>/mnt/c/bl_mcu_sdk</code>)</p>
<p>The firmware build begins…</p>
<div class="example-wrap"><pre class="language-text"><code>make[1]: Entering directory &#39;/mnt/c/bl_mcu_sdk/build&#39;
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</code></pre></div>
<p><img src="https://lupyuen.github.io/images/bl706-build.png" alt="BL706 Firmware Build" /></p>
<p>And succeeds with…</p>
<div class="example-wrap"><pre class="language-text"><code>[100%] Linking C executable ../../../out/examples/lvgl/lvgl_main.elf
Generate /mnt/c/bl_mcu_sdk/out/examples/lvgl/lvgl_main.bin</code></pre></div>
<p><a href="https://gist.github.com/lupyuen/226cb7dc629b47daa8435339fcb17a1c">(See the complete log)</a></p>
<p>The build is done! This is the <strong>BL706 Firmware File</strong> that we shall flash to BL706 AVB…</p>
<div class="example-wrap"><pre class="language-text"><code>C:\bl_mcu_sdk\out\examples\lvgl\lvgl_main.bin</code></pre></div><h1 id="flash-firmware"><a class="doc-anchor" href="#flash-firmware">§</a>4 Flash Firmware</h1>
<p>Were ready to <strong>flash our LVGL Demo Firmware</strong> to BL706 AVB! We shall…</p>
<ol>
<li>
<p>Enter <strong>Flashing Mode</strong> on BL706 AVB</p>
</li>
<li>
<p>Run <strong>Bouffalo Lab Dev Cube</strong> to flash our firmware to BL706 AVB</p>
</li>
</ol>
<h2 id="enter-flashing-mode"><a class="doc-anchor" href="#enter-flashing-mode">§</a>4.1 Enter Flashing Mode</h2>
<p>Connect BL706 AVB to our computers USB port.</p>
<p>To enter <strong>Flashing Mode</strong> on BL706 AVB, we do the <strong>“Two Finger Salute”</strong></p>
<ol>
<li>
<p>Press and Hold <strong><code>BOOT</code></strong></p>
</li>
<li>
<p>Press <strong><code>RST</code></strong></p>
</li>
<li>
<p>Release <strong><code>RST</code></strong></p>
</li>
<li>
<p>Release <strong><code>BOOT</code></strong></p>
</li>
</ol>
<p><img src="https://lupyuen.github.io/images/bl706-boot2.jpg" alt="BOOT and RST Buttons" /></p>
<p>BL706 AVB needs to be in Flashing Mode so that it will appear on Windows as a <strong>USB Serial Device</strong></p>
<p><img src="https://lupyuen.github.io/images/bl706-usb.png" alt="BL706 USB" /></p>
<h2 id="run-bl-dev-cube"><a class="doc-anchor" href="#run-bl-dev-cube">§</a>4.2 Run BL Dev Cube</h2>
<p>To flash our firmware on Windows, we download the Windows version of <strong>Bouffalo Lab Dev Cube</strong> software…</p>
<ul>
<li>
<p><a href="https://dev.bouffalolab.com/download"><strong>Download BL Dev Cube</strong></a></p>
<p>BL Dev Cube is available for Windows, macOS and Ubuntu x64.</p>
<p>(But the macOS version doesnt seem to work. <a href="https://twitter.com/MisterTechBlog/status/1415093180844843009">See this</a>)</p>
</li>
</ul>
<p>Start <strong>BL Dev Cube</strong>, select <strong><code>BL706</code></strong> and click <strong><code>View → MCU</code></strong>.</p>
<p>(If we see the <strong>Windows Defender</strong> warning, click <strong><code>More Info → Run Anyway</code></strong>)</p>
<p>Enter these settings…</p>
<ol>
<li>
<p><strong>Interface:</strong> <code>UART</code></p>
</li>
<li>
<p><strong>COM Port:</strong> (Select the COM Port for BL706 AVB)</p>
</li>
<li>
<p><strong>UART Speed:</strong> <code>2000000</code></p>
</li>
<li>
<p><strong>Chip Erase:</strong> <code>False</code></p>
</li>
<li>
<p><strong>Xtal:</strong> <code>32M</code></p>
</li>
<li>
<p><strong>Boot Source:</strong> <code>Flash</code></p>
</li>
<li>
<p><strong>Image Type:</strong> <code>Single CPU</code></p>
</li>
<li>
<p><strong>BootInfo Addr:</strong> <code>0x0</code></p>
</li>
<li>
<p><strong>Image Addr:</strong> <code>0x2000</code></p>
</li>
<li>
<p><strong>Image File:</strong></p>
<div class="example-wrap"><pre class="language-text"><code>C:\bl_mcu_sdk\out\examples\lvgl\lvgl_main.bin</code></pre></div>
<p>(Change this to the location of the <strong>BL706 Firmware File</strong> <code>lvgl_main.bin</code>)</p>
</li>
</ol>
<p><img src="https://lupyuen.github.io/images/bl706-flash.png" alt="Flashing BL706 with BL Dev Cube" /></p>
<p>Click <strong><code>Create &amp; Program</code></strong></p>
<p>We should see…</p>
<div class="example-wrap"><pre class="language-text"><code>{&#39;xtal_type&#39;: &#39;XTAL_32M&#39;, &#39;pll_clk&#39;: &#39;144M&#39;, &#39;encrypt_type&#39;: &#39;None&#39;, &#39;key_sel&#39;: &#39;0&#39;, &#39;cache_way_disable&#39;: &#39;None&#39;, &#39;sign_type&#39;: &#39;None&#39;, &#39;crc_ignore&#39;: &#39;False&#39;, &#39;hash_ignore&#39;: &#39;False&#39;, &#39;encrypt_key&#39;: &#39;&#39;, &#39;aes_iv&#39;: &#39;&#39;, &#39;public_key_cfg&#39;: &#39;&#39;, &#39;private_key_cfg&#39;: &#39;&#39;, &#39;device_tree&#39;: &#39;&#39;, &#39;page_type&#39;: &#39;mcu&#39;, &#39;flash_clk_type&#39;: &#39;72M&#39;, &#39;boot_src&#39;: &#39;Flash&#39;, &#39;img_type&#39;: &#39;SingleCPU&#39;, &#39;img_addr&#39;: &#39;0x2000&#39;, &#39;bootinfo_addr&#39;: &#39;0x0&#39;, &#39;img_file&#39;: &#39;C:\\bl_mcu_sdk\\out\\examples\\lvgl\\lvgl_main.bin&#39;, &#39;dl_device&#39;: &#39;Uart&#39;, &#39;dl_comport&#39;: &#39;COM6&#39;, &#39;dl_comspeed&#39;: &#39;2000000&#39;, &#39;dl_jlinkspeed&#39;: &#39;1000&#39;, &#39;dl_chiperase&#39;: &#39;False&#39;, &#39;dl_xtal&#39;: &#39;32M&#39;}
...
========= programming chips\bl702\img_create_mcu\img.bin to 0x2000
...
Verify success
Program Finished
[All Success]</code></pre></div>
<p><a href="https://gist.github.com/lupyuen/4a77baac69962ff3d65624b8c33608c0">(See the complete log)</a></p>
<p>Our firmware has been flashed to BL706 AVB!</p>
<p>To learn more about BL Dev Cube…</p>
<ul>
<li>
<p><a href="https://bouffalolab.gitee.io/bl_mcu_sdk/get_started/bl_dev_cube.html"><strong>Flashing with BL Dev Cube (Chinese)</strong></a></p>
<p><a href="https://htmlpreview.github.io/?https://github.com/bouffalolab/bl_mcu_sdk/blob/master/docs/development_guide/build/html/get_started/bl_dev_cube.html">(Alternative Link)</a></p>
</li>
</ul>
<h2 id="jtag-and-j-link"><a class="doc-anchor" href="#jtag-and-j-link">§</a>4.3 JTAG and J-Link</h2>
<p><em>Is there another way to flash our firmware to BL706?</em></p>
<p>We may flash BL706 with <strong>BL Dev Cube, OpenOCD and a JTAG or J-Link Adapter</strong>.</p>
<p>The <strong><code>FUNC1</code> Jumper</strong> should be connected, to <strong>enable the JTAG Port</strong>.</p>
<p>Here are the instructions…</p>
<ul>
<li>
<p><a href="https://bouffalolab.gitee.io/bl_mcu_sdk/get_started/bl_dev_cube.html#openocd"><strong>Flashing with OpenOCD (Chinese)</strong></a></p>
<p><a href="https://htmlpreview.github.io/?https://github.com/bouffalolab/bl_mcu_sdk/blob/master/docs/development_guide/build/html/get_started/bl_dev_cube.html#openocd">(Alternative Link)</a></p>
</li>
<li>
<p><a href="https://bouffalolab.gitee.io/bl_mcu_sdk/get_started/connecting_hardware.html"><strong>Connecting BL706 Hardware (Chinese)</strong></a></p>
<p><a href="https://htmlpreview.github.io/?https://github.com/bouffalolab/bl_mcu_sdk/blob/master/docs/development_guide/build/html/get_started/connecting_hardware.html">(Alternative Link)</a></p>
</li>
</ul>
<blockquote>
<p><img src="https://lupyuen.github.io/images/bl706-openocd.png" alt="BL706 OpenOCD" /></p>
</blockquote>
<h2 id="flashing-without-bl-dev-cube"><a class="doc-anchor" href="#flashing-without-bl-dev-cube">§</a>4.4 Flashing without BL Dev Cube</h2>
<p><em>Is it possible to flash BL706 with OpenOCD and JTAG… Without BLDevCube?</em></p>
<p>Check out the findings here…</p>
<ul>
<li><a href="https://github.com/lupyuen/lupyuen.github.io/releases/tag/v1.0.3"><strong>Flashing BL706 with OpenOCD without BLDevCube</strong></a></li>
</ul>
<h1 id="run-lvgl-firmware"><a class="doc-anchor" href="#run-lvgl-firmware">§</a>5 Run LVGL Firmware</h1>
<p>Watch what happens when we <strong>run our LVGL Firmware</strong> on BL706 AVB!</p>
<p>Connect the <strong><code>FUNC1</code> and <code>FUNC2</code> Jumpers</strong>. (Because were using the SPI Port)</p>
<p><img src="https://lupyuen.github.io/images/bl706-jumpers.jpg" alt="BL706 Jumpers" /></p>
<p>Attach the <strong>ILI9341 SPI Display</strong> to the left edge of the BL706 AVB…</p>
<p><img src="https://lupyuen.github.io/images/bl706-front2b.jpg" alt="Front of BL706 Audio Video Board" /></p>
<p>(Yep it looks like a Game Boy!)</p>
<p>The <strong><code>PEN</code> Pin</strong> (leftmost pin on the display) must be <strong>disconnected</strong></p>
<p><img src="https://lupyuen.github.io/images/bl706-display.jpg" alt="PEN Pin must be disconnected" /></p>
<p>Heres the back view…</p>
<p><img src="https://lupyuen.github.io/images/bl706-back2b.jpg" alt="Back of BL706 Audio Video Board" /></p>
<p>Connect BL706 AVB to our computers USB port.</p>
<p>Press the <strong><code>RST</code> Button</strong>.</p>
<p>The display comes to life with some <strong>cool animation!</strong></p>
<p>BL706 AVB is actually running an <strong>LVGL Graphics Display Benchmark</strong></p>
<ul>
<li><a href="https://youtu.be/q7mjNy6GSHo"><strong>Watch the demo on YouTube</strong></a></li>
</ul>
<p>Here are the results…</p>
<p><img src="https://lupyuen.github.io/images/bl706-lvgl2a.jpg" alt="BL706 LVGL Demo Firmware" /></p>
<p>We have successfully <strong>built, flashed and executed the LVGL Demo Firmware</strong> on BL706 AVB!</p>
<h1 id="bl706-vs-bl602"><a class="doc-anchor" href="#bl706-vs-bl602">§</a>6 BL706 vs BL602</h1>
<p><em>How does BL706 differ from BL602?</em></p>
<p>From the datasheets we can see…</p>
<ol>
<li>
<p>BL706 has <strong>Zigbee</strong>, while BL602 has <strong>WiFi</strong>.</p>
<p>(Both have Bluetooth LE)</p>
</li>
<li>
<p>BL706 has interfaces for <strong>USB, I2S (Audio), Camera and Ethernet</strong>.</p>
<p>BL602 has an <strong>SDIO Interface</strong> (for SD Card).</p>
</li>
<li>
<p>BL706 has <strong>less RAM</strong> than BL602, but <strong>more ROM</strong>.</p>
</li>
<li>
<p>BL706s CPU (144 MHz) also <strong>runs slower</strong> than BL602 (192 MHz).</p>
</li>
</ol>
<p><img src="https://lupyuen.github.io/images/bl706-vs-bl602a.jpg" alt="BL706 vs BL602 Datasheet" /></p>
<h2 id="mcu-sdk-vs-iot-sdk"><a class="doc-anchor" href="#mcu-sdk-vs-iot-sdk">§</a>6.1 MCU SDK vs IoT SDK</h2>
<p><a href="https://htmlpreview.github.io/?https://raw.githubusercontent.com/bouffalolab/bl_iot_sdk/master/docs/BL702/html/index.html"><strong>UPDATE</strong>: BL706 is now supported by <strong>Bouffalo Lab IoT SDK</strong> (the same one for BL602)</a></p>
<p>The <strong>BL IoT SDK</strong> for BL602 was released months before the <strong>BL MCU SDK</strong> for BL706.</p>
<p>Bouffalo Lab explains how the <strong>MCU SDK differs from IoT SDK</strong></p>
<p><img src="https://lupyuen.github.io/images/bl706-mcusdk.jpg" alt="BL706 MCU SDK vs BL602 IoT SDK" /></p>
<p><a href="https://bbs.bouffalolab.com/d/30-bl-mcu-sdk-v10">(Auto-translated from this post)</a></p>
<p><strong>BL602 is not supported</strong> today on BL MCU SDK, but it will be supported in future according to Bouffalo Lab.</p>
<p>We spotted some <strong>differences between the SDKs</strong></p>
<ol>
<li>
<p><strong>Hardware Adaptation Layer</strong> has been revamped.</p>
<p>With BL602 IoT SDK we call this to set a GPIO Output…</p>
<div class="example-wrap"><pre class="language-text"><code>bl_gpio_output_set(pin, value);</code></pre></div>
<p>Now with BL706 MCU SDK we do this…</p>
<div class="example-wrap"><pre class="language-text"><code>gpio_write(pin, value);</code></pre></div></li>
<li>
<p><strong>FreeRTOS</strong> is no longer included for firmware builds by default.</p>
<p>To include FreeRTOS, we specify <code>SUPPORT_FREERTOS</code> like so…</p>
<div class="example-wrap"><pre class="language-bash"><code>make APP=freertos_semaphore \
BOARD=bl706_iot \
SUPPORT_FREERTOS=y</code></pre></div>
<p><a href="https://github.com/bouffalolab/bl_mcu_sdk/tree/master/examples/freertos/freertos_semaphore">(Source)</a></p>
</li>
<li>
<p><strong>AliOS Functions</strong> (<code>aos_*</code>) for Multitasking and Device Tree are no longer in BL706 MCU SDK.</p>
<p>Now we configure peripherals directly from our Firmware Code: GPIO, SPI, UART, …</p>
<p><a href="https://bouffalolab.gitee.io/bl_mcu_sdk/samples/basic%20samples/uart/uart_loopback_demo.html">Sample code for UART Configuration</a></p>
<p><a href="https://htmlpreview.github.io/?https://raw.githubusercontent.com/bouffalolab/bl_mcu_sdk/master/docs/development_guide/build/html/samples/basic%20samples/uart/uart_loopback_demo.html">(Alternative Link)</a></p>
</li>
<li>
<p><strong>OpenOCD, JTAG and J-Link</strong> are now supported for flashing BL706.</p>
<p>(But not BL602)</p>
<p><a href="https://github.com/lupyuen/lupyuen.github.io/releases/tag/v1.0.3">Flashing BL706 with OpenOCD</a></p>
</li>
<li>
<p><strong>LVGL (Graphics) and TensorFlow Lite (Machine Learning)</strong> are now bundled with BL706 MCU SDK</p>
<p><a href="https://github.com/bouffalolab/bl_mcu_sdk/tree/master/examples/tensorflow">Demo Firmware for TensorFlow Lite</a></p>
</li>
<li>
<p><strong>BL706 requires <code>cmake</code></strong> for building firmware.</p>
<p>(BL602 builds with <code>make</code> only)</p>
<p><img src="https://lupyuen.github.io/images/bl706-cmake.png" alt="BL706 uses cmake" /></p>
</li>
<li>
<p><strong>GCC RISC-V Toolchain</strong> is no longer bundled with BL706 MCU SDK.</p>
<p>(Now we need to download the toolchain from <code>dev.bouffalolab.com</code>)</p>
<p><img src="https://lupyuen.github.io/images/bl706-gcc.png" alt="GCC Toolchain not bundled" /></p>
</li>
<li>
<p><strong>macOS</strong> is no longer supported for building firmware with BL706 MCU SDK.</p>
<p>(But BL Dev Cube is still available on macOS for flashing firmware)</p>
<p><img src="https://lupyuen.github.io/images/bl706-macos.png" alt="BL706 doesnt support macOS" /></p>
</li>
</ol>
<h1 id="whats-next"><a class="doc-anchor" href="#whats-next">§</a>7 Whats Next</h1>
<p>I had lots of fun using the <strong>BL706 Audio Video Board</strong>.</p>
<p>It feels simpler than BL602… But yet it has so many <strong>cool new features</strong>: Camera, Audio, USB, Zigbee Networking, LVGL Graphics, TensorFlow Machine Learning, …</p>
<p>I look forward to seeing your <strong>Multimedia Creations on BL706!</strong></p>
<ul>
<li>
<p><a href="https://lupyuen.github.io/articles/sponsor">Sponsor me a coffee</a></p>
</li>
<li>
<p><a href="https://www.reddit.com/r/RISCV/comments/ojspp3/riscv_bl706_audio_video_board/">Discuss this article on Reddit</a></p>
</li>
<li>
<p><a href="https://lupyuen.github.io/articles/book">Read “The RISC-V BL602 Book”</a></p>
</li>
<li>
<p><a href="https://lupyuen.github.io">Check out my articles</a></p>
</li>
<li>
<p><a href="https://lupyuen.github.io/rss.xml">RSS Feed</a></p>
</li>
</ul>
<p><em>Got a question, comment or suggestion? Create an Issue or submit a Pull Request here…</em></p>
<p><a href="https://github.com/lupyuen/lupyuen.github.io/blob/master/src/bl706.md"><code>lupyuen.github.io/src/bl706.md</code></a></p>
<h1 id="notes"><a class="doc-anchor" href="#notes">§</a>8 Notes</h1>
<ol>
<li>
<p>This article is the expanded version of <a href="https://twitter.com/MisterTechBlog/status/1407845438787489794">this Twitter Thread</a></p>
</li>
<li>
<p>Got a question for Bouffalo Lab? Check out their <strong>Developer Forum</strong></p>
<p><a href="https://bbs.bouffalolab.com/"><strong>“Bouffalo Lab Developer Forum”</strong></a></p>
</li>
<li>
<p>Here are the steps for debugging BL702 / BL704 / BL706…</p>
<p><a href="https://simplycreate.online/bl702/2022/03/17/debug-bl702.html"><strong>“Debugging BL702”</strong></a></p>
</li>
<li>
<p><strong>UPDATE:</strong> There is a new <strong>Combo BL706 + BL602</strong> board. <a href="https://twitter.com/MisterTechBlog/status/1442682697311088649">(See this)</a></p>
</li>
<li>
<p><strong>UPDATE:</strong> BL706 is now supported by <strong>Bouffalo Lab IoT SDK</strong> (the same one for BL602)</p>
<p><a href="https://twitter.com/MisterTechBlog/status/1456259223323508748"><strong>See this Twitter Thread</strong></a></p>
</li>
</ol>
<p><img src="https://lupyuen.github.io/images/bl706-front2a.jpg" alt="Front of BL706 Audio Video Board" /></p>
<p><em>BL706 Audio Video Board</em></p>
<!-- Begin scripts/rustdoc-after.html: Post-HTML for Custom Markdown files processed by rustdoc, like chip8.md -->
<!-- Begin Theme Picker and Prism Theme -->
<script src="../theme.js"></script>
<script src="../prism.js"></script>
<!-- Theme Picker and Prism Theme -->
<!-- End scripts/rustdoc-after.html -->
</body>
</html>