Hackaday 在三月份的時候介紹了一款最小的MCU, 華大的 HC32L110B6YA-CSP16TR, CSP16封裝, 尺寸有隻1.6mm x 1.4mm, 還不及一粒米大. HC32L110 (以及其他的Cortex M0華大MCU) 在 Windows 下可以選擇的燒錄選項比較多, 以下... ...
HC32L110 系列 Cortex M0 MCU
Hackaday 在三月份的時候介紹了一款最小的MCU NEW PART DAY: SMALLEST ARM MCU UPROOTS COMPETITION, NEEDS RESEARCH, 華大的 HC32L110B6YA-CSP16TR, CSP16封裝, 尺寸有隻1.6mm x 1.4mm, 還不及一粒米大, 從這幾張圖可以對比看看實物大小
硬體大佬Jeroen Domburg的手工焊接嘗試油管視頻鏈接地址 和晶元介紹
- Using a tiny HC32L110 ARM chip - Intro
- Using a tiny HC32L110 ARM chip - Soldering a WCSP package
- Using a tiny HC32L110 ARM chip - Programming the chip
有沒有點賽博朋克的感覺?
HC32L110 參數
HC32L110 雖然小, 但是參數並不差, 32位Cortex M0內核, 16K Flash, 2K RAM, 外設也很齊全, 還是相當能打的.
- Arm Cortex-M0+ 32-bit core, 32 MHz
- 2KB to 4KB RAM
- 16K to 32KB flash
- 外設
- 16x GPIOs with 20-pin packages, 12x GPIOs with 16-pin packages
- PWM output
- 2x UART, 1x SPI, 1x I2C
- Up to 9-channel 12-bit SARADC with up to 1Msps sampling
- Buzzer frequency generator
- Timer/Counter
- 3x general-purpose 16-bit timers/counters
- 3x high-performance 16-bit timer/counter
- 1x low power 16-bit timer/counter
- 1x programmable 16-bit timer/counter with comparison support
- RTC
- 2-way voltage comparator VC with integrated 6-bit DAC and programmable reference input
- 時鐘
- External high-speed crystal oscillator 4 ~ 32MHz
- External low-speed crystal oscillator 32.768KHz
- Internal high-speed clock 4/8/16/22.12/24MHz
- Internal low-speed clock 32.8/38.4KHz
- Watchdog timer
- Hardware supports internal and external clock calibration and monitoring
- Security – CRC-16 module, unique 10-byte ID number
- Debugging – Embedded debugging solution providing a full-featured real-time debugger
- Power Management
- Operating voltage – 1.8 to 5.5V
- Integrated low voltage detector LVD, configurable 16-level comparison level
- Power consumption
- 0.5μA @ 3V in deep sleep mode (all clocks off, power-on reset valid, IO status maintained, IO interrupt valid)
- 1.0μA @ 3V in deep sleep mode + RTC operation
- 6μA in 32.768KHz low-speed active mode (CPU and peripheral modules run, run programs from flash)
- 20μA/MHz @ 3V @ 16MHz in sleep mode (CPU stops working, peripheral modules run, main clock runs)
- 120μA/MHz @ 3V @ 16MHz while active (CPU and peripheral modules run, run programs from flash)
- Wake-up time – 4μS ultra-low-power wake-up time
- Temperature range – -40 ~ 85C
- Packages
- QFN20 – 3 x 3 mm
- TSSOP20 – 6.5 x 4.4 mm
- TSSOP16 – 5 x 4.4 mm
- CSP16 – 1.59 x 1.436 mm
型號參數表
Win10 環境
HC32L110 (以及其他的Cortex M0華大MCU) 在 Windows 下可以選擇的燒錄選項比較多, 以下說明 DAP-Link, ST-Link, J-Link 這幾種燒錄方式的配置步驟.
硬體準備
- 開發板, 可以用
- LilyGo 的 T-HC32 開發板, 這個開發板用的就是 CSP16封裝的 HC32L110B6
- 或者用澤耀的2.4G模塊套件底板AS06-VTB07H. 套件9.9還送一片Si24R1. 這個底板最早使用的是STM8S, 現在改成 QFN20 的 HC32L110C4UA
- 以上在某寶上都能買到
- 燒錄卡可以用 CMSIS DAP-Link 或 J-Link 或 ST-Link V2, 在Win10下都已經驗證可以使用
軟體
- HC32L110_DDL_Rev1.1.4.zip 這個是帶項目模板和例子的程式包
- HC32L110_IDE_Rev1.0.3.zip IDE開發的型號支持, 帶flash演算法文件.
- JLink安裝包(如果需要單獨的 J-Flash), 需要單獨安裝, 從 Segger官網下載
安裝環境支持包
將 HC32L110_IDE_Rev1.0.3.zip 解壓, MDK_IDE下的 HDSC.HC32L110.1.0.3.pack 就是給 Keil MDK 用的晶元型號庫, 雙擊導入, 或者通過 Keil MDK 的 Package Installer 導入. 導入之後, 在 Keil MDK 中新建項目選擇晶元時, 就能看到 HC32L110 系列晶元, 選擇晶元型號後, 在Debug Download下麵就有對應的演算法文件. 演算法文件的預設路徑是 C:\Keil_v5\ARM\PACK\HDSC\HC32L110\1.0.3\Flash
使用 DAP-Link
- 在項目中點開編譯選項, 選擇正確的晶元型號, 例如 HC32L110C4UA
- 到Debug標簽頁選擇下載設備為CMSIS-DAP Debugger,
- 打開 Settings, 應該能看到識別出的設備為 0x0BC11477 Arm Core Sight SW-DP
- Max Clock 選擇10MHz (初始化時經常會自動選擇1MHz, 這樣下載時最後一步會出錯).
- 到Flash Download 標簽頁, 勾選 Reset and Run, 並且確認下方的Programming Algorithm中已經設置了演算法.
之後F7編譯, F8下載, 設置正確的話就能看到燒錄校驗完成的信息
使用 ST-Link V2
如果DAP-Link已經設置正確, ST-Link可以直接使用,
- 在Debug中切換設備為ST-Link Debugger
- 打開 Settings, 能看到識別出的設備 0x0BC11477 Arm Core Sight SW-DP. Port 如果設成了JTAG需要改為SW, Clock設為4MHz
- Flash Download 勾選 Reset and Run
也是 F8 下載. 輸出記錄:
Build started: Project: x
*** Using Compiler 'V5.06 update 6 (build 750)', folder: 'C:\Keil_v5\ARM\ARMCC\Bin'
Build target 'x'
".\Objects\1101_tx.axf" - 0 Error(s), 0 Warning(s).
Build Time Elapsed: 00:00:00
Load "D:\\WorkMDK\\WorkHC32\\hc32l110_prj\\Objects\\1101_tx.axf"
Erase Done.
Programming Done.
Verify OK.
Application running ...
Flash Load finished at 20:46:34
使用J-Link
J-Link 使用方式和 DAP-Link 基本一致, 如果DAP-Link已經設置正確, J-Link可以直接使用, 在Debug中切換設備為J-Link, 打開 Settings 能看到識別出的設備 0x0BC11477 Arm Core Sight SW-DP. Port 如果設成了JTAG需要改為SW, Clock設為5MHz
Flash Download 勾選 Reset and Run, F8燒錄, 輸出記錄為
Build started: Project: x
*** Using Compiler 'V5.06 update 6 (build 750)', folder: 'C:\Keil_v5\ARM\ARMCC\Bin'
Build target 'x'
".\Objects\1101_tx.axf" - 0 Error(s), 0 Warning(s).
Build Time Elapsed: 00:00:00
Load "D:\\WorkMDK\\WorkHC32\\hc32l110_prj\\Objects\\1101_tx.axf"
* JLink Info: Device "CORTEX-M3" selected.
* JLink Info: Device "CORTEX-M3" selected.
Set JLink Project File to "D:\WorkMDK\WorkHC32\hc32l110_prj\JLinkSettings.ini"
* JLink Info: Device "CORTEX-M3" selected.
JLink info:
------------
DLL: V6.30h, compiled Mar 16 2018 18:02:51
Firmware: J-Link ARM-OB STM32 compiled Aug 22 2012 19:52:04
Hardware: V7.00
S/N : 20090928
Feature(s) : RDI,FlashDL,FlashBP,JFlash,GDB
* JLink Info: Found SW-DP with ID 0x0BC11477
* JLink Info: Scanning AP map to find all available APs
* JLink Info: AP[1]: Stopped AP scan as end of AP map has been reached
* JLink Info: AP[0]: AHB-AP (IDR: 0x04770031)
* JLink Info: Iterating through AP map to find AHB-AP to use
* JLink Info: AP[0]: Core found
* JLink Info: AP[0]: AHB-AP ROM base: 0xE00FF000
* JLink Info: CPUID register: 0x410CC601. Implementer code: 0x41 (ARM)
* JLink Info: Found Cortex-M0 r0p1, Little endian.
**JLink Warning: Identified core does not match configuration. (Found: Cortex-M0, Configured: Cortex-M3)
* JLink Info: FPUnit: 4 code (BP) slots and 0 literal slots
* JLink Info: CoreSight components:
* JLink Info: ROMTbl[0] @ E00FF000
* JLink Info: ROMTbl[0][0]: E000E000, CID: B105E00D, PID: 000BB008 SCS
* JLink Info: ROMTbl[0][1]: E0001000, CID: B105E00D, PID: 000BB00A DWT
* JLink Info: ROMTbl[0][2]: E0002000, CID: B105E00D, PID: 000BB00B FPB
ROMTableAddr = 0xE00FF000
* JLink Info: Reset: Halt core after reset via DEMCR.VC_CORERESET.
* JLink Info: Reset: Reset device via AIRCR.SYSRESETREQ.
Target info:
------------
Device: HC32L110C4UA
VTarget = 3.300V
State of Pins:
TCK: 0, TDI: 0, TDO: 1, TMS: 0, TRES: 1, TRST: 0
Hardware-Breakpoints: 4
Software-Breakpoints: 8192
Watchpoints: 2
JTAG speed: 4000 kHz
Erase Done.
Programming Done.
Verify OK.
* JLink Info: Reset: Halt core after reset via DEMCR.VC_CORERESET.
* JLink Info: Reset: Reset device via AIRCR.SYSRESETREQ.
Application running ...
Flash Load finished at 19:21:41
單獨使用 J-Flash
從 segger 官網 https://www.segger.com/downloads/jlink/ 下載 JLink 整合安裝包, 安裝完是不帶 HC32L110 系列型號的, 需要單獨添加
添加設備
將 C:\Keil_v5\ARM\PACK\HDSC\HC32L110\1.0.3\Flash 下麵的兩個演算法文件, HC32L110B4_C4.FLM 和 HC32L110B6_C6.FLM 複製到
C:\Program Files\SEGGER\JLink\Devices\HDSC ,
修改 JLinkDevices.xml
修改 C:\Program Files\SEGGER\JLink\JLinkDevices.xml 在結尾的</DataBase>
之前增加這幾行
<!-- -->
<!-- Huada (HDSC) -->
<!-- -->
<Device>
<ChipInfo Vendor="HDSC" Name="HC32L110x4" WorkRAMAddr="0x20000000" WorkRAMSize="0x800" Core="JLINK_CORE_CORTEX_M0"/>
<FlashBankInfo Name="Flash_16K" BaseAddr="0x0" MaxSize="0x4000" Loader="Devices/HDSC/HC32L110B4_C4.FLM" LoaderType="FLASH_ALGO_TYPE_OPEN" AlwaysPresent="1"/>
</Device>
<Device>
<ChipInfo Vendor="HDSC" Name="HC32L110x6" WorkRAMAddr="0x20000000" WorkRAMSize="0x1000" Core="JLINK_CORE_CORTEX_M0"/>
<FlashBankInfo Name="Flash_32K" BaseAddr="0x0" MaxSize="0x8000" Loader="Devices/HDSC/HC32L110B6_C6.FLM" LoaderType="FLASH_ALGO_TYPE_OPEN" AlwaysPresent="1"/>
</Device>
然後打開J-Flash, 在設備列表裡就能找到 HC32L110了, 連接後打開要燒錄的hex, F7就可以燒錄了