What This Section Covers
“System Control” is a category in the Ai-M6x (BL616/BL618) development tutorials that gathers the basic abilities for making the chip behave as you want, storing data, and debugging problems. Unlike lighting an LED or driving a UART, these features control the chip itself: how logs are printed, how data is stored, how to sleep for low power, how to reboot, and how to locate a crash.
Each feature has its own page with a uniform structure: Concepts First → Example Overview → Operation Steps → Code Execution Flow → APIs Used → Complete Code → FAQ. If you are new to this category, read this overview first, then open the page you need.
Feature List
| Feature | Page | What it does (one line) | SDK example |
|---|---|---|---|
| blog Log | blog Log | Prints runtime status to the serial port with F/E/W/I/D/T levels and tag filtering — the foundation of debugging | examples/bflog/barebone_sync |
| Flash Operations | Flash Operations | Erases, writes, and read-back verifies internal Flash data areas for non-volatile data | examples/peripherals/flash/flash_read_write |
| Sleep Mode | Sleep Mode | Enters PDS deep sleep and wakes every 1 second via the RTC timer — the core of low-power designs | examples/pmu/bl616/pds_rtc |
| Software Timer | Software Timer | Uses FreeRTOS software timers as “alarm clocks” that run a callback on expiry, without occupying a hardware timer | Self-authored (FreeRTOS xTimerCreate) |
| Software Reboot | Software Reboot | Actively resets the system via reset APIs for config-reload or post-OTA restart | Self-authored (bl_sys_reset_system() etc.) |
| Power-Off Saving | Power-Off Saving | Stores key-value pairs (Wi-Fi credentials, device config, etc.) in Flash with EasyFlash — survives power loss | examples/easyflash |
| Partition Table | Partition Table | Reads and prints the Flash partition table to see which address each region (FW, PSM, OTA, ...) uses | examples/partition |
| Log Debug & Assert | Log Debug & Assert | Prints variables/arrays/hexdumps with DBG macros and checks “this must hold” with asserts to catch logic errors fast | examples/log_dbg_assert |
| Crash Debugging | Crash Debugging | Forces a crash, saves the coredump to Flash, and reconstructs the call stack offline to locate the crash | examples/crash |
How to Choose
- Make the program “talk”: start with blog Log; log levels and filtering are the basis of every later debugging session.
- Save power: see Sleep Mode; PDS/HBN and wake-up sources are the key to low-power design.
- Save config or data: prefer Power-Off Saving (key-value pairs are simplest); if you manage Flash regions yourself, combine Flash Operations and Partition Table.
- Do something periodically: see Software Timer.
- Abnormal behavior, hangs, resets: add asserts with Log Debug & Assert first; for real crashes analyze the coredump with Crash Debugging; use Software Reboot when you need an active restart.
Environment Setup
All pages share the same build/flash flow; the prerequisite is a working SDK environment:
Build with make CHIP=bl616 BOARD=bl616dk (the Ai-M62's BL616 and Ai-M61's BL618 are the same series, so both use bl616), flash with make flash CHIP=bl616 COMX=/dev/ttyUSB0 (use COMx on Windows), and set the serial baud rate to 2000000.
Have questions?
For any other questions, visit the unified Q&A and discussion board: Ai-Thinker Discussions

