對應教材《STM32 × FreeRTOS × 智慧語音控制》。應用層只放在本目錄; STM32Cube 產生的啟動檔、HAL、FreeRTOS 核心請用 CubeMX/CubeIDE 產生。

建議 MCU

  • 主線:NUCLEO-F429ZI(路徑 A,外部語音模組或 VCP 模擬)
  • 替代:STM32F407G-DISC1
  • 路徑 B(X-CUBE-AI):STM32H747I-DISCO / STM32F746-DISCO

腳位預設見 common/include/pin_map.h 與教材附錄 A2。

加入 CubeIDE 專案

  1. 依該週章節用 CubeMX 打開對應週邊(GPIO、USART、TIM、DMA、FREERTOS、IWDG…)。
  2. 把 common/include 加到 Include Path。
  3. 把 common/src/*.c 與該 lab 的 app_main.c(及該週額外 .c)加入編譯。
  4. 在 main.c 週邊初始化之後呼叫 app_main();。
  5. 只寫 USER CODE 區塊,避免重新產生時被覆寫。

lab09/lab10/lab12/final 需一併編譯 lab08_asr_module/asr_map.c。

智慧助理(第 13 章)

lab12_assistant_gateway/ 讓 Siri、Alexa 與 OK Google 控制同一台裝置:

  • STM32 側:app_main.c + gw_proto.c(GW_UART 預設 USART6)
  • ESP32 側:esp32/homespan_siri(HomeKit)、esp32/fauxmo_alexa(Alexa)、 esp32/mqtt_uart_bridge(配 Home Assistant,YAML 在 homeassistant/)
  • Matter(三家統一標準)導讀:esp32/matter_bridge.md

目錄

目錄 章節
lab01_blinky 2
lab02_gpio_devices 3
lab03_pwm_fan_motor 4
lab04_freertos_blinky 5
lab05_queue_semaphore 6
lab06_event_group 7
lab07_audio_capture 8
lab08_asr_module 9 路徑 A
lab08_asr_edgeai 9 路徑 B
lab09_voice_controller 10
lab10_comms 11
lab11_watchdog_lpm_ota 12
lab12_assistant_gateway 13(Siri/Alexa/Google)
voice_home_final 總成

無硬體時

  • 路徑 A 全程可用 USB 虛擬 COM 輸入拼音(xiao-ke、kai-deng…)。
  • 風扇可用 LED PWM 代替。
  • lab09/host_test 可在 PC 驗證狀態機:
cd lab09_voice_controller/host_test
gcc -I../../common/include test_fsm.c ../../common/src/device_fsm.c -o test_fsm
./test_fsm

序列埠監看

python3 tools/serial_plot.py /dev/cu.usbmodem1103 115200