STM32CubeMX Sensor Configuration
This page documents the current STM32CubeMX configuration for the Sensor Board firmware and explains how to extend it for sensor interfaces (UART/I2C/SPI/ADC) in a way that is safe for code generation.
- IOC File:
components/sensor_board/firmware/firmware.ioc - Generated HAL Init Files:
components/sensor_board/firmware/Core/Src/ - Application Entry:
src/sensor_board/main.c
Current CubeMX Snapshot
Item | Value |
|---|---|
MCU | STM32H753ZIT6 (NUCLEO-H753ZI) |
CubeMX Version | 6.15.0 |
STM32Cube FW Package | STM32Cube FW_H7 v1.12.1 |
Toolchain | Makefile + GCC |
Post-generation Script |
|
Enabled CubeMX Components
- CORTEX_M7 (I-Cache/D-Cache enabled, MPU configured)
- ETH (RMII mode)
- LWIP (Static IP, DHCP disabled)
- FREERTOS (CMSIS-RTOS v2, default task generated)
- TIM1 (base timer)
- SYS/NVIC/RCC base platform configuration
Clock and Core Setup
Clock Configuration (from IOC)
Parameter | Value |
|---|---|
Clock Source | HSE 8 MHz -> PLL |
SYSCLK | 72 MHz |
APB1 | 36 MHz (DIV2) |
APB2/APB3/APB4 | 72 MHz |
TIM1 Clock | 72 MHz |
Cortex-M7 / MPU
- Instruction cache: enabled
- Data cache: enabled
- MPU region at
0x30000000, size32KB, shareable, non-cacheable
Pinout and Peripheral Mapping
Ethernet (RMII)
Signal | Pin |
|---|---|
ETH_REF_CLK | PA1 |
ETH_MDIO | PA2 |
ETH_CRS_DV | PA7 |
ETH_MDC | PC1 |
ETH_RXD0 | PC4 |
ETH_RXD1 | PC5 |
ETH_TX_EN | PG11 |
ETH_TXD0 | PG13 |
ETH_TXD1 | PB13 |
Serial / COM
Signal | Pin | Note |
|---|---|---|
USART1_TX | PA9 | Configured in generated
|
USART1_RX | PA10 | Configured in generated
|
USART3_TX | PD8 | Used by NUCLEO COM path (
in app init) |
USART3_RX | PD9 | Used by NUCLEO COM path (
in app init) |
Board IO / Misc
Pin | Mode | Typical Use |
|---|---|---|
PC13 | GPIO Input | User button |
PB0 | GPIO Output | Board output line |
PB7 | GPIO Output | Board output line |
PB14 | GPIO Output | Board output line |
PH0 / PH1 | HSE oscillator | System clock source |
PC14 / PC15 | LSE oscillator | Low-speed oscillator |
Timer, RTOS, and Interrupts
TIM1 Base Timer
htim1.Init.Prescaler = 6400 - 1;
htim1.Init.Period = 10000;
With a 72 MHz timer clock, this gives an update period near 0.89 s.
Interrupt Priorities (Key Entries)
IRQ | Priority | Notes |
|---|---|---|
ETH_IRQn | 15 | Ethernet/LwIP path |
TIM1_UP_IRQn | 12 | TIM1 update interrupt |
TIM2_IRQn | 7 | HAL tick time base |
EXTI15_10_IRQn | 6 | External interrupt group |
Sensor Interface Status
What Is Already Configured in CubeMX
- Networking stack and RMII pinout
- Base timer and RTOS scaffolding
- Basic UART-capable pins and NUCLEO COM integration path
What Is Not Yet Fully Modeled in CubeMX (TO-DO ONCE sensors retrieved and assembled)
- Dedicated ADC channels for analog sensors (pH, load cell, pressure)
- Dedicated I2C/SPI buses for IMU and pressure variants
- Explicit sensor-specific pin labels and alternate-function assignments
Important: Current sensor drivers include placeholders for hardware access in multiple modules. When bringing up physical sensors, add the corresponding CubeMX peripherals first, then update the sensor drivers to use generated handles.
Recommended Workflow
- Open
components/sensor_board/firmware/firmware.iocin STM32CubeMX. - Add required peripherals for the target sensor like this:
GPS -> USARTx (baud/parity/stop bits to match module)
IMU -> I2Cx or SPIx (+ optional DRDY INT GPIO)
pH -> ADCx channel (sampling time, resolution)
Load Cell -> ADCx channel(s) or external ADC interface
Pressure -> ADCx or I2Cx/SPIx (depends on sensor part)
- Assign and lock pins in Pinout view; avoid overlap with RMII and COM pins.
- Configure clocks for new peripherals in Clock Configuration.
- Set NVIC priorities for new ISR sources so Ethernet/RTOS timing remains stable.
- Generate code with Keep User Code enabled.
- Rebuild using PlatformIO and validate startup + sensor polling.
Conflict To Look Out for Before Saving .ioc file
- No conflict with ETH RMII pins (PA1, PA2, PA7, PC1, PC4, PC5, PG11, PG13, PB13)
- No conflict with debug/COM path (PA9/PA10 and PD8/PD9)
- No conflict with oscillator pins (PH0, PH1, PC14, PC15)