Development Environment Setup
Prerequisites
Before you begin, ensure you have the following hardware and software ready:
- Hardware:
- Snake-V1 device (or the STM32WB35CEU6A development board).
- ST-LINK V2 or V3 debugger/programmer.
- USB-C cable for power and data.
- Software:
- STM32CubeIDE: The recommended integrated development environment (IDE) for compiling and debugging.
- STM32CubeProgrammer: Required for flashing the wireless stack and device firmware.
1. Install the STM32CubeWB MCU Package
The Snake-V1 relies on the STM32WB series firmware package for HAL drivers and wireless middleware (BLE/Sub-GHz).
- Open STM32CubeIDE.
- Navigate to Help > Manage Embedded Software Packages.
- Select the STM32WB tab.
- Install the latest version of the
STM32Cube MCU Package for STM32WB Series.
2. Setting Up the Wireless Stack (Crucial)
Because the STM32WB35CEU6A is a dual-core MCU, you must flash the Coprocessor Wireless Stack (CPU2) before the main application code will run.
- Connect your Snake-V1 via the ST-LINK.
- Open STM32CubeProgrammer.
- Connect to the device.
- Navigate to the Firmware Upgrade Services (FUS) or Firmware Upgrade section.
- Flash the appropriate stack (e.g.,
stm32wb5x_BLE_Stack_full_fw.bin) provided in the ST firmware package directory (typically found inSTM32Cube/Repository/STM32Cube_FW_WB_V1.x.x/Projects/STM32WB_Copro_Wireless_Binaries).
3. Importing and Compiling the Project
- Clone the repository to your local machine:
git clone https://github.com/yovinc420/Snake-V1.git - In STM32CubeIDE, go to File > Import....
- Select General > Existing Projects into Workspace.
- Browse to the cloned
Snake-V1folder and click Finish. - Right-click on the project in the Project Explorer and select Build Project.
4. Flashing the Firmware
Once the build is successful (generating a .elf or .bin file), follow these steps to load it onto the Snake-V1:
- Connect the ST-LINK to the SWD headers on the Snake-V1.
- In STM32CubeIDE, click the Run icon (green play button) or go to Run > Debug.
- If prompted, create a new
STM32 Cortex-M C/C++ Applicationlaunch configuration. - The IDE will flash the code to CPU1 and automatically start the application.
5. Verification
After flashing, you can verify the setup via the following:
- Console/UART: Connect a logic analyzer or USB-to-TTL adapter to the designated GPIO pins to view debug output.
- Peripheral Test: Point an IR remote at the TSOP38238 receiver to check if the device registers signals, or use the CC1101 module to scan for Sub-GHz frequencies.