finds.dev← search

// the find

alejoseb/Modbus-STM32-HAL-FreeRTOS

★ 789 · C · LGPL-2.1 · updated May 2026

Modbus TCP and RTU, Master and Slave for STM32 using Cube HAL and FreeRTOS

A Modbus RTU/TCP master and slave library for STM32 microcontrollers, built on top of ST's Cube HAL and FreeRTOS. It's a port of the Arduino Modbus library, covering USART, DMA, USB-CDC, and TCP transports across a wide range of STM32 boards. Aimed at embedded developers who need Modbus in an industrial or PLC context without building from scratch.

Multiple concurrent instances per MCU — one UART per instance, limited only by hardware. DMA mode with idle-line detection handles up to 2 Mbps without burning CPU on every byte. The newer separate memory regions model maps coils/DI/HR/IR to independent arrays with configurable Modbus start addresses, which finally makes standard address space partitioning (0x, 1x, 3x, 4x) actually feasible. Pymodbus Jupyter notebooks for testing are a genuine timesaver — no need to stand up a separate test rig just to validate register reads.

Modbus.c is over 1200 lines and the author calls it out as a known mess in the TODO list — it's been that way for a while with no sign of a split happening soon. USB-CDC support is locked to the F103 Bluepill and explicitly not validated on anything else, which is an odd limitation to leave unfixed for a mature library. TCP relies on lwIP via CubeMX, and there's a known bug where the stack stops working if the Ethernet cable isn't connected at boot — requiring manual patches to generated code, which means your port is fragile across CubeMX regenerations. No unit tests anywhere in the repo; correctness is validated entirely through hardware examples, which makes it risky to adopt without your own validation harness.

View on GitHub →

// want more like this?

We dig through GitHub every week and send a few repos picked for what you actually care about — each with an honest take like this one.

Get finds in your inbox → Search again →