🛠 Advanced First Boot for XIAO STM32C5
Objectives
This tutorial aims to master the low-level initialization of the STM32C5A3CG microcontroller. Unlike classic Arduino boards, this step requires understanding the Arm Cortex-M33 architecture and clock management. You will learn to verify the integrity of internal (1 MB) and external (16 MB) flash, as well as configure the CAN FD bus via the TCAN3403-Q1 transceiver.
Required Hardware
- Seeed Studio XIAO STM32C5 board
- USB-C data cable
- PC with STM32CubeIDE or Zephyr SDK
- Logic analyzer or oscilloscope (recommended for verification)
Steps
- Hardware Check: Connect the XIAO via USB-C. The Li-Po charging circuit must show a stable state. Ensure the external 48 MHz crystal is properly soldered.
- Environment Setup: Launch STM32CubeIDE. Select the
STM32C5A3CGdevice. In the configurator, enable the 144 MHz clock system using the HSE (48 MHz) as the main source. - CAN FD Initialization: In the code, configure the FDCAN2 peripheral. Note that the TCAN3403-Q1 transceiver is already wired with a 120 Ω termination resistor. Enable FD mode to support high bitrates.
- LSM6DS3TR-C Sensor Test: Initialize the SPI or I2C interface. Activate the PWM output linked to the heating circuit to stabilize the sensor temperature before reading inertial data.
- Flashing: Compile the firmware and flash it via SWD or USB DFU interface. Verify that the bootloader accepts the image on internal flash.
Verification
Use a logic analyzer to confirm signals on CAN_H and CAN_L pins. You must observe valid CAN FD frames if the code emits periodic messages. On the serial port, check initialization logs confirming the Cortex-M33 startup at 144 MHz and LSM6DS3TR-C detection. The onboard LED should blink if the example code is used.
Going Further
Explore DMA memory management to transfer sensor data to the 256 KB SRAM without overloading the CPU. Also study the use of FDCAN1 with an external transceiver to create a redundant CAN network.