STM32 I2C communication protocol and temperature and humidity sensor module

Learn the I2C bus communication protocol, use STM32F103 to complete the data collection of the AHT20 temperature and humidity sensor based on the I2C protocol, and output the collected temperature-humidity values through the serial port Article directory 1. Preliminary knowledge (1) I2C communication protocol (2) I2C physical layer (3) I2C timing (4) Hardware I2C and […]

STM32 development practice-data collection of AHT20 temperature and humidity sensor based on I2C protocol

STM32 development practice-data collection of AHT20 temperature and humidity sensor based on I2C protocol Preface “Software I2C” and “Hardware I2C” SoftwareI2C HardwareI2C AHT20 temperature and humidity sensor AHT20 main features AHT20 parameters Application areas STM32 data collection of AHT20 temperature and humidity sensor based on I2C protocol Ideas code Experimental effect Summarize Foreword In the […]

Data collection of AHT20 temperature and humidity sensor based on I2C protocol

Data collection of AHT20 temperature and humidity sensor based on I2C protocol 1. Basic introduction 1. What is “software I2C” and “hardware I2C” 2.AHT20 temperature and humidity sensor 2. Project establishment 3. Code part 4. Results display and summary 1. Basic introduction 1. What is “software I2C” and “hardware I2C” Software and protocol layers, hardware […]

C language code for temperature sensor related to I2C

#include <stdio.h> //Introduce the standard input and output library for input and output data #include <windows.h> //Introduce Windows API header files for operating Windows systems #include <winioctl.h> //Introduce Windows I/O control function header file #define I2C_ADDRESS 0x48 //Define the I2C address as 0x48, which is the address of the LM75 sensor #define I2C_REG_READ 0x00 //Define […]

I2c controller data transceiver function example

1. Example of calling device driver data sending and receiving functions Pay attention to I2C_M_RD. This flag must be assigned when reading. The data sending and receiving functions implemented by the controller must be used. static int ap3216c_read_regs(struct ap3216c_dev *dev,u8 reg, void *val, int len) { int ret; struct i2c_msg msg[2]; struct i2c_client *client = […]

9. DMA&USART&I2C&SPI (STM32)

1. DMA direct memory access-DMA transfer data/DMA + AD multi-channel http://t.csdnimg.cn/fauUzhttp://t.csdnimg.cn/fauUz The following is my own learning version code, read more comments, they are all the essence. Understand the DMA library functions Understanding DMA library functions void DMA_DeInit(DMA_Channel_TypeDef* DMAy_Channelx);//Restore default configuration void DMA_Init(DMA_Channel_TypeDef* DMAy_Channelx, DMA_InitTypeDef* DMA_InitStruct);//Initialization void DMA_StructInit(DMA_InitTypeDef* DMA_InitStruct);//Structure initialization void DMA_Cmd(DMA_Channel_TypeDef* DMAy_Channelx, FunctionalState NewState);//Enable […]

[linux/driver]I2C client driver implementation

Linux device platform driver I2C driver i2c hardware features and reading and writing processes protocol Two-wire bidirectional serial transmission, data line SDA, clock line SCL; SDA big-endian transmission, each time transmitting one byte (8bit) The read and write register address addr is divided into a fixed part and a programmable part. You need to query […]

Linux driver i2c subsystem 0.96 inch oled

Foreword: There is no preface. For relevant knowledge, please refer to my other blog. This one is for practice. The general idea is still to write the i2c device address in the device tree, register the i2c driver in the driver code, write the “hard operation of entering the number and note section” in the […]

STM32MP157 I2C and SPI bus experiment

I2C.h #ifndef I2C_DRIVER_H #define I2C_DRIVER_H #include “gpio.h” #define NACK 1 #defineACK 0 #define SCL_PIN 14 #define SCL_PORT GPIOF #define SCL_PIN_CLK_EN() do{<!– –>RCC->MP_AHB4ENSETR |= (0x1 << 5);}while(0) #define SDA_PIN 15 #define SDA_PORT GPIOF #define SDA_PIN_CLK_EN() do{<!– –>RCC->MP_AHB4ENSETR |= (0x1 << 5);}while(0) #define SCL_H() do{<!– –>GPIOF->BSRR |= (0x1 << 14);}while(0) #define SCL_L() do{<!– –>GPIOF->BRR |= (0x1 << […]

Linux driver i2c subsystem mpu6050

Foreword: In fact, there is nothing new, because the Linux kernel implements the principle of separation of devices and drivers, and the process of i2c driver development is not much different from that of platform bus device driver development. This i2c subsystem is also the system that helps us prepare the bus. In terms of […]