How pierremergon/pleiades-sensor-integration works
Project type and purpose
• This is an embedded‐firmware project for an STM32H5 series microcontroller, generated by STM32CubeIDE. Its purpose is to integrate an SHT40 temperature/humidity sensor (over I²C) with the Pleiades hardware platform, using STM32 HAL drivers plus a custom sensor library.
File structure
• Top‐level:
• Pleiades-Sensor-Integration.ioc — CubeMX configuration defining clocks, pins, I²C, NVIC, middleware.
• Core/Inc & Core/Src — application entry point (main.c), system & interrupt handlers, HAL MSP init, timebase, syscalls, sysmem, sensor‐library header/.c.
• Core/Startup — MCU startup assembly for STM32H503RBTx.
• Drivers/STM32H5xx_HAL_Driver — STM32Cube HAL source code (I²C, GPIO, timers, NVIC, etc.).
• STM32H503RBTX_FLASH.ld — linker script.
• Debug folder is auto‐generated build artifacts.
README
• Minimal: project title indicates “Sensor Integration for Pleiades.” No further architecture details.
Main components
a. Hardware layer
• STM32H503RBTx MCU (core, registers, NVIC)
• SHT40 Sensor (I²C peripheral on MCU)
• Optional: USB/UART connector for debug/PC comms
b. Firmware layers
• Startup code (assembly, vector table)
• System initialization (system_stm32h5xx.c, HAL_Init, clock config)
• HAL drivers (I²C, GPIO, TIM, NVIC)
• Sensor library (sht40_lib.c/.h)
• Application logic (main.c)
• Syscalls/sysmem for newlib retarget (syscalls.c, sysmem.c)
c. Toolchain and build
• STM32CubeIDE/CubeMX (ioc, .mxproject) generating code + Makefile
• Linker script, output ELF
Relationships and interactions
• MCU startup → system init → HAL_Init
• HAL I²C driver ↔ SHT40 sensor on I²C bus
• Application (main.c) calls sensor API → returns temperature/humidity
• TIM2 timebase → HAL tick interrupt → systick for delays/timeouts
• NVIC dispatches I²C/TIM interrupts to HAL callbacks
• Syscalls layer provides read/write for printf over UART (if used)
Architectural patterns & principles
• Layered architecture: hardware abstraction (HAL) below sensor driver, below application.
• Initialization flow: Reset handler → SystemClock_Config → peripheral init → main loop.
• ISR‐driven events and polling coexist: HAL_I2C_Master_Receive() or interrupt callbacks.
What to include for maximum detail
• Vector table startup → Reset_Handler
• SystemClock_Config block
• HAL_Init and peripheral init sequence
• I²C peripheral instance (e.g. I2C1) mapped to GPIO pins
• Timer used for HAL tick (TIM2)
• Sensor library API functions (e.g. SHT40_Read)
• main() infinite loop or RTOS hook if used
• Linker script region assignments (FLASH, SRAM) if relevant for memory map
• Debug interface (UART or SWD)