2026-02-09 1:14 AM - edited 2026-02-09 2:33 AM
Hello everyone,
I am currently working on a project to develop drivers for STM32F4 microcontrollers, based on Reference Manual RM0090 (without HAL, only CMSIS and register access).
The goal of the project is to design reusable low-level drivers for the following peripherals:
USART / UART
SPI
I2C
I am now in the code implementation phase.
I would like the community's help with the following:
Examples of source code or references (preferably bare-metal / register level) for:
SPI : transmission et réception
I2C : master transmit / master receive
UART : transmission et réception
Recommendations on API structure and function naming, for example:
SPI_Init(), SPI_Transmit(), SPI_Receive()
I2C_MasterTransmit(), I2C_MasterReceive()
USART_Transmit(), USART_Receive()
Any help, code snippets, links to reference implementations, or feedback would be greatly appreciated.
Thank you in advance for your help.
Best regards,
*This post has been translated from French to comply with the ST Community guidelines.
2026-02-09 6:31 AM
There are lots of LL library examples. Maybe those will give you some inspiration. HAL library is also perfectly usable. You can re-implement as register access if desired.
2026-02-09 6:49 AM
The "legacy" SPL is still available for download at ST for the F4 devices, which provides a relatively thin abstraction layer.
Although it contains some bloated code as well that tries to be too generic.
I often take SPL code as a template in my projects, and strip it down to the functionality required.
Which usually means copying the "register access" code from the SPL functions, and adapting it.
We’re moving the ST Community to a new platform to give you a better and more reliable community experience.