PDF(1680 KB)
PDF(1680 KB)
PDF(1680 KB)
GPIO引脚模拟I2C通信的驱动设计
Driver design for simulating I2C communication based on GPIO pins
I2C总线多用于嵌入式系统中多个芯片及模块间的数据通信,针对芯片的I2C总线专用引脚被占用或I2C总线功能需移植到其他平台等需求,现有的I2C总线专用引脚使用方式存在一定的局限性。本文基于I2C总线的通信机理开发了一套驱动程序,通过控制常规GPIO引脚电平模拟I2C时序,实现I2C总线通信功能。以STM32F103C8T6芯片为I2C总线主控制器、PCF8591T A/D转换模块为I2C总线从器件,对开发的I2C驱动程序进行验证,试验结果表明,该驱动方式可靠、稳定。
The I2C bus is widely employed for exchanging data between multiple chips and modules in embedded systems.However,the utilization of dedicated I2C bus pins has limitations when these pins are already occupied or when the I2C bus function needs to be migrated to other platforms.In the study,a driver program is developed that leverages the communication mechanism of the I2C bus.It achieves I2C bus communication functionality by simulating I2C timing through the control of electrical levels on conventional GPIO pins.The STM32F103C8T6 chip serves as the primary controller of the I2C bus,while the PCF8591T A/D conversion module operates as the slave device.This article verifies the developed I2C driver program,and the experimental results show that the driving method is reliable and stable.
I2C总线 / GPIO引脚 / 驱动 / STM32 / PCF8591T
| [1] |
何立民. I2C总线应用系统设计[M]. 北京: 北京航空航天大学出版社, 1995.
|
| [2] |
邓忠华, 李霞, 陈浩. I2C总线技术在单片机串行扩展中的应用[J]. 武汉理工大学学报(交通科学与工程版), 2005, 29(2):227-229,247.DOI:10.3963/j.issn.2095-3844.2005.02.018.
|
| [3] |
|
| [4] |
|
| [5] |
|
| [6] |
赵国栋, 郭锋, 周洋. 国产嵌入式操作系统的I2C驱动设计与实现[J]. 电脑编程技巧与维护, 2023(1):56-58.DOI:10.16184/j.cnki.comprg.2023.01.009.
|
| [7] |
李耀川. I2C控制器及加速度传感器的驱动设计和实现[D]. 西安: 西安电子科技大学, 2013.
|
| [8] |
|
| [9] |
|
| [10] |
STMicroelectronics. STM32F103xx advanced Arm-based 32-bit MCUs Reference Manual, 2021.
|
| [11] |
南山府嵌入式. 玩转STM32之IIC通信(软件模拟篇)[EB/OL].(2022-11-02)[2023-10-16]. https://zhuanlan.zhihu.com/p/579536577.
Embedded in Nanshan Prefecture. Playing STM32 with I2C Communication (Software Simulation Chapter)[EB/OL].(2022-11-02)[2023-10-16]. https://zhuanlan.zhihu.com/p/579536577. (in Chinese)
|
| [12] |
赵道新, 李炳辰. 基于PCF8591的I2C总线多路温度测量系统[J]. 制造业自动化, 2013, 35(5):3.DOI: 10.3969/j.issn.1009-0134.2013.03(s).11.
|
| [13] |
周剑利, 郭建波, 崔涛. 具有I2C总线接口的A/D芯片PCF8591及其应用[J]. 微计算机信息, 2005(7):150-151.
|
| [14] |
陈柱峰, 沈治国. 基于PCF8591的I2C总线A/D、D/A转换[J]. 企业技术开发, 2009, 28(5):24-27.
|
| [15] |
郝结来, 王子权, 林华. 基于STM32的多通道温湿度测量仪设计[J]. 电子设计工程, 2021, 29(11):74-79.DOI: 10.14022/j.issn1674-6236.2021.11.016.
|
| [16] |
杨日容, 林木峰, 陆泉森. 一种基于I2C总线驱动的锅炉温度测量系统设计[J]. 微型机与应用, 2011, 30(19):73-75.DOI:10.3969/J.ISSN.1674-7720.2011.19.026.
|
/
| 〈 |
|
〉 |