
I2C
文章平均质量分 78
imx6ull i2c学习
习惯就好zz
一个无趣的人
展开
-
具体芯片的I2C_Adapter驱动分析
参考资料Linux内核真正的I2C驱动控制器驱动程序。drivers\i2c\busses\i2c-imx.c芯片手册:IMX6ULL:Chapter 31: I2C Controller (I2C)一、I2C控制器内部结构I2C单独控制的话,占用CPU的时间非常高,这样不利于系统高效运转,所以一般的芯片里面都会有I2C控制器。1.1 通用的简化结构I2C控制器里面一般会有很多的寄存器。比如:controller_register可以设置I2C控制器的频率tx_register、rx原创 2021-09-12 20:28:39 · 619 阅读 · 0 评论 -
使用GPIO操作I2C设备
参考资料硬件连接修改设备树上机实验测试结果原创 2021-09-11 10:54:08 · 2336 阅读 · 0 评论 -
使用GPIO模拟I2C的驱动程序分析
参考资料i2c_spec.pdfLinux文档:Documentation\devicetree\bindings\i2c\i2c-gpio.txtLinux驱动源码:drivers\i2c\busses\i2c-gpio.c一、I2C协议结构一般SCL和SDA上都会借一个上拉电阻。如果要去使用GPIO模拟I2C,必须对GPIO的时序了解比较清楚1.1 I2C信号I2C协议中数据传输的单位是字节,也就是8位。但是要用到9个时钟:前面8个使用用来传输8个数据,第9个时钟用来传输ACK信号原创 2021-09-09 21:57:09 · 3288 阅读 · 0 评论 -
I2C_Adapter驱动创建讲解与编写
参考资料Linux内核文档:Documentation\devicetree\bindings\i2c\i2c-gpio.txtLinux内核驱动程序:使用GPIO模拟I2Cdrivers\i2c\busses\i2c-gpio.cLinux内核真正的I2C控制器驱动程序drivers\i2c\busses\i2c-imx.c一、回顾1.1 I2C驱动程序的层次App:应用程序,想做某些事情。I2C device driver:内核中的i2c驱动和i2c设备,驱动原创 2021-09-04 14:32:24 · 1365 阅读 · 0 评论 -
编写设备驱动之i2c_client
参考资料Linux内核文档Docuemntation\i2c\instantiating-devices.rstDocumentation\i2c\writing-client.rstLinux内核驱动程序示例drivers/eeprom/at24.c一、I2C总线 - 设备 - 驱动模型写过很多次了,左边client右边driver,必须配对Linux才能使用。二、编译i2c_driverMakefile:KERN_DIR = /home/book/imx6ull/linux-4.原创 2021-08-26 21:31:28 · 1597 阅读 · 0 评论 -
编写设备驱动之i2c_driver
参考资料Linux内核文档Documentation\i2c\instantiating-devices.rstDocumentation\i2c\writing-clients.rstLinux内核驱动程序示例drivers/eeprom/at24.c一、套路1.1 I2C总线-设备-驱动模型1.2 示例分配、设置、注册一个i2c_driver结构体,类似drivers/eeprom/at24.c:在probe_new函数中,分配、设置、注册file_operations结构体。原创 2021-08-19 20:41:50 · 784 阅读 · 3 评论 -
i2c系统驱动程序模型
I2C系统驱动模型参考资料Linux内核文档:Documentation\i2c\instantiating-devices.rstDocumentation\i2c\writing-clients.rstLinux内核驱动程序示例:drivers/eeprom/at24.c1.I2C驱动程序的层次I2C Core就是I2c核心层,它的作用:提供统一的访问函数,比如i2c_transfer、i2c_smbus_xfer等实现I2C总线-设备-驱动模型,管理:I2C设备原创 2021-08-14 21:32:04 · 481 阅读 · 0 评论 -
通用i2c-dev分析
通用驱动i2c-dev分析参考资料Linux驱动程序:drivers/i2c/i2c-dev.cI2C-Tools-4.2:https//mirrors.edge.kernel.org/pub/software/utils/i2c-tools/AT24cxx.pdf1. 回顾字符设备驱动程序![在这里插入图片描述](https://img-blog.csdnimg.cn/3c96d5ce81854277b5e3b79f9765ef39.png?x-oss-process=image/wate原创 2021-08-10 21:38:37 · 542 阅读 · 0 评论 -
I2C系统中的重要结构
/* * i2c_adapter is the structure used to identify a physical i2c bus along * with the access algorithms necessary to access it. */struct i2c_adapter { struct module *owner; unsigned int class; /* classes to allow probing for */ cons原创 2021-04-30 09:04:27 · 392 阅读 · 0 评论 -
rk3288 I2C-原理学习
I2C介绍I2C硬件框架一个Soc一般有多个I2C接口,一条I2C总线上,可以挂载一个或多个I2C设备,I2C设备用地址区分。I2C总线上,有两条线,一条是SCL时钟线,一条是SDA线,这两条线上都有上拉电阻I2C软件框架App:不关心底层实现细节,只需要调用设备驱动程序提供的接口。芯片驱动:知道芯片要求的地址、数据格式;知道怎么发出信号才能让芯片工作,一些芯片特定的工作状态;构造好数据结构给I2C控制器。I2C控制器驱动:根据I2C协议发出各类信号,I2C设备地址、I2C存储地址、原创 2021-04-24 12:40:13 · 1908 阅读 · 0 评论 -
rk3288 i2c-tools使用
i2c-tools源码下载Linux驱动程序: drivers/i2c/i2c-dev.cI2C-Tools-4.2: https://mirrors.edge.kernel.org/pub/software/utils/i2c-tools/AP3216C:在git clone https://e.coding.net/weidongshan/01_all_series_quickstart.git,在10.1篇,第十六章,I2C编程。APP访问硬件肯定是需要驱动程序的, 对于I2C设备,内核提原创 2021-04-29 14:00:24 · 845 阅读 · 0 评论