SlideShare a Scribd company logo
TinyML
for SparkFun Edge
May 15, 2020
• Sparkfun Edge board 介紹
• 準備好軟體開發環境
• 關於Ambiq Apollo3 SDK
• 編譯程式、產生韌體燒錄檔
• 將燒錄檔寫入至 Sparkfun Edge board
• 連接終端機
Outline
About Sparkfun Edge board
Sparkfun Edge board x1
Sparkfun USB-to-Serial Adapter x1 (CH340E chip)
microUSB wire x1
Himax CMOS Imaging Camera - HM01B0 x1
MCU (Apollo3 Blue)
• 32-bit ARM Cortex-M4F
• 48MHz CPU clock, 96MHz with TurboSPOT™
• 1MB Flash
• 384KB SRAM
• Extremely low-power usage: 6uA/MHz
Sensor
• two microphones
• 3-axis accelerometer
• camera connector
Connections
• Serial UART
• Qwiic connector (need Qwiic cables )
• Bluetooth Radio
• four LEDs and four GPIO connections
• JTAG Connector
Sparkfun Edge board
https://learn.sparkfun.com/tutorials/sparkfun-edge-hookup-
guide?_ga=2.52218401.900382962.1598838491-
96125856.1586318981#hardware-overview
Block Diagram of Apollo3 Blue MCU
Reset Button
UART connector
GPIO Button
MICx2
Qwiic connector
GPIO connections x4
Bluetooth Radio
LED x4
Camera connector
JTAG Connector
Accelerometer
MCU
Linux 系統
• 目的: Building the firmware for Sparkfun Edge Board
• OS: Ubuntu 18.04
**可參考本文章 ” Virtual Box建置Linux主機”
https://bit.ly/2RE0hK8
Windows 系統
• 目的: Training the Tensor flow model
• 所需軟體:
• Anaconda https://www.anaconda.com
• Python 3.7 and TensorFlow 2.0
• MobaXterm https://mobaxterm.mobatek.net/
• Serial to USB driver (CH340)
準備好軟體開發環境
Using SparkFun Edge Board with
Ambiq Apollo3 SDK
Layout of Ambiq Apollo3 SDK
BSP Layout of SparkFun_Edge
Setup Toolchain & build project
# Setup Toolchain
=====================
export
PATH=~/tinyML/tensorflow/lite/micro/tools/make/downloads/gcc_embedded/bin:$PATH
可以將此行加入到 ~/.bashrc內
#Build the Frist Example for test
==============
example1_edge_test/
├── gcc
│ ├── bin
│ ├── edge_test.ld
│ ├── Makefile
│ └── startup_gcc.c
├── Makefile
└── src
├── main.c
├── tf_accelerometer
└── tf_adc
>> cd SparkFun_Edge_SDK/AmbiqSuite-
Rel2.2.0/boards/SparkFun_Edge_BSP-
master/examples/example1_edge_test/gcc
>> make
==> it will output bin/example1_edge_test.bin
產生燒錄檔 & 寫入燒錄檔到板子
Genearte firmware 產生燒錄檔 xxx_wire.bin
====================
[on Linux]
cd apollo3_scripts
#copy xxx.bin to here
cp ../tensorflow/lite/micro/tools/make/gen/sparkfun_edge_cortex-m4/bin/
example1_edge_test.bin .
./build_fw.sh example1_edge_test.bin
==> example1_edge_test_wire.bin
Screenshot after ./build_fw.sh
將 binary 加上 header  signed binary
再將signed binary 加入燒錄資訊
1.) 先將Sparkfun 透過 USB 線連接 PC
2.) 再檢查所有USB-to-Serial裝置
• Linux : 在終端機輸入 ls /dev/ttyUSB0
• MacOS : 輸入 ls /dev/cu.usbserial*
• Windows : 在裝置管理員檢查COM (此處為COM14)
燒入前檢查
Windows 須先安裝CH340 Driver
遵循以下步驟
1. 確認 Sparkfun edge board已經連接到 PC (USB-to-Serial 轉板 )
2. 先持續按著Button 14, 再按 button RST (進入燒錄模式)
3. 接著在[Anaconda Prompt ],
要切換到 apollo3_scripts 目錄, 輸入下列指令
python uart_wired_update.py COM14 -f example1_edge_test_wire.bin
在windows上燒錄bin檔到edge board
*須先安裝pyserial 套件
pip install pyserial
COM14 不能被其他程式佔用!!
COM14 is your COM PORT NUMBER
ScreenShot
Done means Success
You can use TeraTerm or putty
Display the output message from Edge board
[Setup->Serial Port ]
baud rate: 115200 bps, 8 N 1
Code Architecture
• UART printing for info/debugging
• ADC operation to sample from a microphone
• I2C operation to control the accelerometer
• GPIO functions (an output that can drive up to 12 mA)
"hal/am_hal_adc.h"
"hal/am_hal_gpio.h"
"hal/am_hal_uart.h"
mcu/apollo3/am_mcu_apollo.h
……………
MCU
pin
Board (Sparkfun Edge)
./boards/SparkFun_Edge_BSP-
master/bsp/am_bsp_pins.h
Application
MCU register R/W
Hardware
Abstraction Layer
(HAL)
Code Study

More Related Content

PDF
TinyML - 4 speech recognition
PDF
Linux kernel debugging
PDF
Yoctoで綺麗なkernel configを作る
PDF
Kernel Module Programming
PDF
VMworld 2013: ESXi Native Networking Driver Model - Delivering on Simplicity ...
PDF
The ideal and reality of NVDIMM RAS
PDF
Jagan Teki - U-boot from scratch
PPTX
RISC-V Boot Process: One Step at a Time
TinyML - 4 speech recognition
Linux kernel debugging
Yoctoで綺麗なkernel configを作る
Kernel Module Programming
VMworld 2013: ESXi Native Networking Driver Model - Delivering on Simplicity ...
The ideal and reality of NVDIMM RAS
Jagan Teki - U-boot from scratch
RISC-V Boot Process: One Step at a Time

What's hot (20)

PDF
Kdump and the kernel crash dump analysis
PDF
Tensorflow lite for microcontroller
PDF
Linux Linux Traffic Control
PDF
Arm device tree and linux device drivers
PPTX
Linux Kernel Booting Process (1) - For NLKB
PPT
Bootstrap process of u boot (NDS32 RISC CPU)
PPTX
JAVA_HOME/binにあるコマンド、いくつ使っていますか?[JVM関連ツール編](JJUGナイトセミナー「Java解析ツール特集」 発表資料)
PPTX
Linux Device Tree
PDF
Bootloaders
PDF
Architecture Of The Linux Kernel
PDF
Faster packet processing in Linux: XDP
PDF
【EX/QFX】JUNOS ハンズオントレーニング資料 EX/QFX シリーズ サービス ゲートウェイ コース
PDF
FreeBSD and Drivers
PDF
한컴MDS_Virtual Target Debugging with TRACE32
PDF
Embedded Linux Kernel - Build your custom kernel
PDF
FC SAN Fabric環境におけるパフォーマンストラブルの対処法
PDF
AndroidとSELinux
PPT
Linux Audio Drivers. ALSA
PDF
I2c drivers
PDF
Building Embedded Linux Full Tutorial for ARM
Kdump and the kernel crash dump analysis
Tensorflow lite for microcontroller
Linux Linux Traffic Control
Arm device tree and linux device drivers
Linux Kernel Booting Process (1) - For NLKB
Bootstrap process of u boot (NDS32 RISC CPU)
JAVA_HOME/binにあるコマンド、いくつ使っていますか?[JVM関連ツール編](JJUGナイトセミナー「Java解析ツール特集」 発表資料)
Linux Device Tree
Bootloaders
Architecture Of The Linux Kernel
Faster packet processing in Linux: XDP
【EX/QFX】JUNOS ハンズオントレーニング資料 EX/QFX シリーズ サービス ゲートウェイ コース
FreeBSD and Drivers
한컴MDS_Virtual Target Debugging with TRACE32
Embedded Linux Kernel - Build your custom kernel
FC SAN Fabric環境におけるパフォーマンストラブルの対処法
AndroidとSELinux
Linux Audio Drivers. ALSA
I2c drivers
Building Embedded Linux Full Tutorial for ARM
Ad

More from 艾鍗科技 (20)

PPTX
AI 技術浪潮, 什麼是機器學習? 什麼是深度學習, 什麼是生成式AI, AI 能力認證
PPTX
Appendix 1 Goolge colab
PPTX
Project-IOT於餐館系統的應用
PPTX
02 IoT implementation
PDF
Openvino ncs2
PDF
Step motor
PDF
2. 機器學習簡介
PDF
5.MLP(Multi-Layer Perceptron)
PDF
3. data features
PPTX
心率血氧檢測與運動促進
PPTX
利用音樂&情境燈幫助放鬆
PPTX
IoT感測器驅動程式 在樹莓派上實作
PPTX
無線聲控遙控車
PPT
最佳光源的研究和實作
PPTX
無線監控網路攝影機與控制自走車
PPTX
Reinforcement Learning
PPTX
人臉辨識考勤系統
PPTX
智慧家庭Smart Home
PPT
智能健身
PPTX
雲端智能盆栽
AI 技術浪潮, 什麼是機器學習? 什麼是深度學習, 什麼是生成式AI, AI 能力認證
Appendix 1 Goolge colab
Project-IOT於餐館系統的應用
02 IoT implementation
Openvino ncs2
Step motor
2. 機器學習簡介
5.MLP(Multi-Layer Perceptron)
3. data features
心率血氧檢測與運動促進
利用音樂&情境燈幫助放鬆
IoT感測器驅動程式 在樹莓派上實作
無線聲控遙控車
最佳光源的研究和實作
無線監控網路攝影機與控制自走車
Reinforcement Learning
人臉辨識考勤系統
智慧家庭Smart Home
智能健身
雲端智能盆栽
Ad

Recently uploaded (20)

PPTX
Geodesy 1.pptx...............................................
PPTX
Sustainable Sites - Green Building Construction
DOCX
ASol_English-Language-Literature-Set-1-27-02-2023-converted.docx
PDF
Evaluating the Democratization of the Turkish Armed Forces from a Normative P...
PDF
PPT on Performance Review to get promotions
PDF
composite construction of structures.pdf
PPTX
web development for engineering and engineering
PPTX
M Tech Sem 1 Civil Engineering Environmental Sciences.pptx
PPTX
IOT PPTs Week 10 Lecture Material.pptx of NPTEL Smart Cities contd
PPTX
Lesson 3_Tessellation.pptx finite Mathematics
PPTX
Internet of Things (IOT) - A guide to understanding
PPTX
UNIT 4 Total Quality Management .pptx
PPT
Mechanical Engineering MATERIALS Selection
PDF
Embodied AI: Ushering in the Next Era of Intelligent Systems
PDF
PRIZ Academy - 9 Windows Thinking Where to Invest Today to Win Tomorrow.pdf
PPTX
Foundation to blockchain - A guide to Blockchain Tech
PDF
The CXO Playbook 2025 – Future-Ready Strategies for C-Suite Leaders Cerebrai...
PPTX
Infosys Presentation by1.Riyan Bagwan 2.Samadhan Naiknavare 3.Gaurav Shinde 4...
PDF
Operating System & Kernel Study Guide-1 - converted.pdf
PPTX
OOP with Java - Java Introduction (Basics)
Geodesy 1.pptx...............................................
Sustainable Sites - Green Building Construction
ASol_English-Language-Literature-Set-1-27-02-2023-converted.docx
Evaluating the Democratization of the Turkish Armed Forces from a Normative P...
PPT on Performance Review to get promotions
composite construction of structures.pdf
web development for engineering and engineering
M Tech Sem 1 Civil Engineering Environmental Sciences.pptx
IOT PPTs Week 10 Lecture Material.pptx of NPTEL Smart Cities contd
Lesson 3_Tessellation.pptx finite Mathematics
Internet of Things (IOT) - A guide to understanding
UNIT 4 Total Quality Management .pptx
Mechanical Engineering MATERIALS Selection
Embodied AI: Ushering in the Next Era of Intelligent Systems
PRIZ Academy - 9 Windows Thinking Where to Invest Today to Win Tomorrow.pdf
Foundation to blockchain - A guide to Blockchain Tech
The CXO Playbook 2025 – Future-Ready Strategies for C-Suite Leaders Cerebrai...
Infosys Presentation by1.Riyan Bagwan 2.Samadhan Naiknavare 3.Gaurav Shinde 4...
Operating System & Kernel Study Guide-1 - converted.pdf
OOP with Java - Java Introduction (Basics)

Tiny ML for spark Fun Edge

  • 2. • Sparkfun Edge board 介紹 • 準備好軟體開發環境 • 關於Ambiq Apollo3 SDK • 編譯程式、產生韌體燒錄檔 • 將燒錄檔寫入至 Sparkfun Edge board • 連接終端機 Outline
  • 3. About Sparkfun Edge board Sparkfun Edge board x1 Sparkfun USB-to-Serial Adapter x1 (CH340E chip) microUSB wire x1 Himax CMOS Imaging Camera - HM01B0 x1
  • 4. MCU (Apollo3 Blue) • 32-bit ARM Cortex-M4F • 48MHz CPU clock, 96MHz with TurboSPOT™ • 1MB Flash • 384KB SRAM • Extremely low-power usage: 6uA/MHz Sensor • two microphones • 3-axis accelerometer • camera connector Connections • Serial UART • Qwiic connector (need Qwiic cables ) • Bluetooth Radio • four LEDs and four GPIO connections • JTAG Connector Sparkfun Edge board https://learn.sparkfun.com/tutorials/sparkfun-edge-hookup- guide?_ga=2.52218401.900382962.1598838491- 96125856.1586318981#hardware-overview
  • 5. Block Diagram of Apollo3 Blue MCU
  • 6. Reset Button UART connector GPIO Button MICx2 Qwiic connector GPIO connections x4 Bluetooth Radio LED x4 Camera connector JTAG Connector Accelerometer MCU
  • 7. Linux 系統 • 目的: Building the firmware for Sparkfun Edge Board • OS: Ubuntu 18.04 **可參考本文章 ” Virtual Box建置Linux主機” https://bit.ly/2RE0hK8 Windows 系統 • 目的: Training the Tensor flow model • 所需軟體: • Anaconda https://www.anaconda.com • Python 3.7 and TensorFlow 2.0 • MobaXterm https://mobaxterm.mobatek.net/ • Serial to USB driver (CH340) 準備好軟體開發環境
  • 8. Using SparkFun Edge Board with Ambiq Apollo3 SDK
  • 9. Layout of Ambiq Apollo3 SDK
  • 10. BSP Layout of SparkFun_Edge
  • 11. Setup Toolchain & build project # Setup Toolchain ===================== export PATH=~/tinyML/tensorflow/lite/micro/tools/make/downloads/gcc_embedded/bin:$PATH 可以將此行加入到 ~/.bashrc內 #Build the Frist Example for test ============== example1_edge_test/ ├── gcc │ ├── bin │ ├── edge_test.ld │ ├── Makefile │ └── startup_gcc.c ├── Makefile └── src ├── main.c ├── tf_accelerometer └── tf_adc >> cd SparkFun_Edge_SDK/AmbiqSuite- Rel2.2.0/boards/SparkFun_Edge_BSP- master/examples/example1_edge_test/gcc >> make ==> it will output bin/example1_edge_test.bin
  • 12. 產生燒錄檔 & 寫入燒錄檔到板子 Genearte firmware 產生燒錄檔 xxx_wire.bin ==================== [on Linux] cd apollo3_scripts #copy xxx.bin to here cp ../tensorflow/lite/micro/tools/make/gen/sparkfun_edge_cortex-m4/bin/ example1_edge_test.bin . ./build_fw.sh example1_edge_test.bin ==> example1_edge_test_wire.bin
  • 13. Screenshot after ./build_fw.sh 將 binary 加上 header  signed binary 再將signed binary 加入燒錄資訊
  • 14. 1.) 先將Sparkfun 透過 USB 線連接 PC 2.) 再檢查所有USB-to-Serial裝置 • Linux : 在終端機輸入 ls /dev/ttyUSB0 • MacOS : 輸入 ls /dev/cu.usbserial* • Windows : 在裝置管理員檢查COM (此處為COM14) 燒入前檢查 Windows 須先安裝CH340 Driver
  • 15. 遵循以下步驟 1. 確認 Sparkfun edge board已經連接到 PC (USB-to-Serial 轉板 ) 2. 先持續按著Button 14, 再按 button RST (進入燒錄模式) 3. 接著在[Anaconda Prompt ], 要切換到 apollo3_scripts 目錄, 輸入下列指令 python uart_wired_update.py COM14 -f example1_edge_test_wire.bin 在windows上燒錄bin檔到edge board *須先安裝pyserial 套件 pip install pyserial COM14 不能被其他程式佔用!! COM14 is your COM PORT NUMBER
  • 17. You can use TeraTerm or putty Display the output message from Edge board [Setup->Serial Port ] baud rate: 115200 bps, 8 N 1
  • 18. Code Architecture • UART printing for info/debugging • ADC operation to sample from a microphone • I2C operation to control the accelerometer • GPIO functions (an output that can drive up to 12 mA) "hal/am_hal_adc.h" "hal/am_hal_gpio.h" "hal/am_hal_uart.h" mcu/apollo3/am_mcu_apollo.h …………… MCU pin Board (Sparkfun Edge) ./boards/SparkFun_Edge_BSP- master/bsp/am_bsp_pins.h Application MCU register R/W Hardware Abstraction Layer (HAL)