| KNOWLEDGE BASE

A rich source of expert knowledge

Learn from experts in the world of embedded systems

USE DISCOUNT CODE
LEARN30
TO SAVE $30 USD

How To Write A Driver (STM32, I2C, Datasheet) - Phil's Lab #30

How to write an I2C driver from scratch in C for an STM32F4 microcontroller interfacing with an accelerometer (Analog Devices ADXL355) using the datasheet and ST´s HAL (hardware abstraction layer).

Going through schematic, STM32CubeIDE setup, low-level functions, initialization, setting registers, reading registers, configuring the sensor, reading data, and finally testing the driver.
Chapters:
  • 00:00Introduction
  • 00:28Sensor (ADXL355, JLCPCB)
  • 01:22Altium Designer
  • 01:42Sensor Board Schematic and PCB (KiCad)
  • 03:38STM32F4 Schematic (LittleBrain)
  • 04:16STM32CubeIDE Setup
  • 06:40Basic Project Structure
  • 07:55Driver Header File
  • 16:11Driver Source File (Low-Level Functions)
  • 18:41Driver Source File (Sensor Initialisation and Setup)
  • 26:18Driver Source File (Temperature Measurement)
  • 30:21Driver Source File (Acceleration Measurements)
  • 34:10Testing the Driver