MENU

Fun & Interesting

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

Phil’s Lab 260,222 4 years ago
Video Not Working? Fix It Now

⏵Hardware and PCB design course: https://www.phils-lab.net/courses 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, initialisation, setting registers, reading registers, configuring the sensor, reading data, and finally testing the driver. Free trial of Altium Designer: https://www.altium.com/yt/philslab Visit https://jlcpcb.com/RHS for $2 for five 2-layer PCBs and $5 for five 4-layer PCBs. Patreon: https://www.patreon.com/phils94 Git: https://github.com/pms67 [TIMESTAMPS] 00:00 Introduction 00:28 Sensor (ADXL355, JLCPCB) 01:22 Altium Designer 01:42 Sensor Board Schematic and PCB (KiCad) 03:38 STM32F4 Schematic (LittleBrain) 04:16 STM32CubeIDE Setup 06:40 Basic Project Structure 07:55 Driver Header File 16:11 Driver Source File (Low-Level Functions) 18:41 Driver Source File (Sensor Initialisation and Setup) 26:18 Driver Source File (Temperature Measurement) 30:21 Driver Source File (Acceleration Measurements) 34:10 Testing the Driver ID: QIBvbJtYjWuHiTG0uCoK

Comment