STM32CubeMX Sensor Configuration

This page documents the current STM32CubeMX configuration for the Sensor Board firmware and explains how to extend it for the remaining sensor interfaces (ADC, EXTI, I2C device setup) in a way that is safe for code generation.

Current CubeMX Snapshot

Item

Value

MCU

STM32H753ZITx (NUCLEO-H753ZI)

CubeMX Version

6.15.0

STM32Cube FW Package

STM32Cube FW_H7 V1.12.1

Build system

PlatformIO (env:sensor_board), stm32cube framework

Enabled CubeMX Components

Clock and Core Setup

Clock Configuration (from IOC)

Parameter

Value

HSE crystal value

8 MHz

SYSCLK

64 MHz

APB1

64 MHz

Note: the STM32H753 is capable of 480 MHz, but the current IOC runs the core at 64 MHz. Raising the clock requires PLL configuration in the Clock Configuration tab and re-validation of the Ethernet and FreeRTOS timing.

Cortex-M7 / MPU

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

PB12

ETH_TXD1

PB13

Sensor and Actuator Pins (labeled in IOC)

Label

Pin

Mode

Used by

FLOW_SENSOR

PA4

GPIO Input (EXTI4 not yet enabled)

Flow sensor pulse counting

WEIGHT_INPUT_1

PA5

GPIO Input

HX711 unit 0 DOUT

WEIGHT_INPUT_2

PA6

GPIO Input

HX711 unit 1 DOUT

WEIGHT_CLOCK_1

PC7

GPIO Output

HX711 unit 0 SCK

WEIGHT_CLOCK_2

PB5

GPIO Output

HX711 unit 1 SCK

IMU_I2C_Clock

PB8

I2C1_SCL (pull-up)

IMU

IMU_I2C_Data

PB9

I2C1_SDA (pull-up)

IMU

WATER_PUMP_PWM

PC8

TIM3_CH3 (PWM)

Pump MOSFET gate

PH_ANALOG_DATA

PD14

GPIO_Analog

pH sensor (see warning below)

FORCE_ANALOG_DATA_1

PD15

GPIO_Analog

Pressure/FSR sensor 0 (see warning below)

FORCE_ANALOG_DATA_2

PF3

GPIO_Analog

Pressure/FSR sensor 1 (PF3 = ADC3_INP5)

STEPPER_MOTOR_1..4

PD7, PD6, PD5, PD4

GPIO Output

Reserved for the sampling stepper

Warning: on the STM32H753, PD14 and PD15 have NO ADC function. The pH analog input and FORCE_ANALOG_DATA_1 must be moved to ADC-capable pins (for example PA0, PC0, or PF3-class pins) before the analog drivers can be enabled. PF3 maps to ADC3_INP5 and can be used as is.

Serial / COM

Signal

Pin

Note

USART1_TX / USART1_RX

PA9 / PA10

Spare asynchronous UART

USART3_TX / USART3_RX

PD8 / PD9

NUCLEO ST-Link VCP path, used by the logging system (hcom_uart[COM1])

RTOS Tasks and Interrupts

FreeRTOS Tasks (CMSIS V2)

Task

Priority

Stack (words)

Entry

defaultTask

24

128

StartDefaultTask (generated)

mainTask

39

2048

MainTask, "As external" (defined in src/sensor_board/main.c)

FreeRTOS heap: configTOTAL_HEAP_SIZE = 65536 (64 KB).

Interrupt Priorities (key entries)

IRQ

Priority

Notes

ETH_IRQn

5

Ethernet / LwIP path

DMA1_Stream0_IRQn

5

DMA

USART1_IRQn

5

Spare UART

EXTI15_10_IRQn

5

External interrupt group (user button)

TIM6_DAC_IRQn

15

HAL tick timebase (TIM6)

SysTick / PendSV

15

FreeRTOS kernel

Sensor Interface Status

What Is Already Configured in CubeMX

What Is Not Yet Modeled in CubeMX (TO DO once sensors are retrieved and assembled)

Important: the analog sensor drivers are compile gated (PH_SENSOR_USE_ADC, PRESSURE_USE_ADC) so the firmware links without hardware. When bringing up physical sensors, add the corresponding CubeMX peripherals first, then enable the build flags and bind the generated handles.

  1. Open components/sensor_board/firmware/firmware.ioc in STM32CubeMX.
  2. Add the required peripheral for the target sensor (ADC channel, EXTI line, or I2C settings).
  3. Assign and lock pins in the Pinout view; avoid overlap with RMII and COM pins.
  4. Configure clocks for new peripherals in Clock Configuration.
  5. Set NVIC priorities for new ISR sources so Ethernet and RTOS timing remain stable.
  6. Generate code with Keep User Code enabled.
  7. Rebuild using PlatformIO and validate startup and sensor polling.

Conflicts To Check Before Saving the .ioc File


Revision #4
Created 2026-04-18 12:23:40 UTC by Shishir Nambiar
Updated 2026-07-20 17:58:22 UTC by Shishir Nambiar