Part 8: I/O Communication Protocol

I^{_{2}}C (Inter-Integrated Circuit 内置集成电路): a multi-master, multi-slave, single-ended, serial computer bus.

For attaching low-speed peripherals (外围设备) to computer motherboards and embedded systems.

Characteristics: open-drain(open collector)

Protocol(协议): Serial, Half Duplex

SMBus:A subset ofI^{_{2}}C but the protocols are defined more strictly.

Purpose: promote robustness and interoperability(互用性)

Modern I^{_{2}}C systems incorporate policies and rules from SMBus.

I^{_{2}}C architecture:uses only two bidirectional open-drain lines: Serial Data Line (SDA) and Serial Clock Line (SCL), pulled up with resistors.

Typical voltages used are +5 V or +3.3 V, although systems with other voltages are permitted

The I²C reference designs:

  • address space: 7-bit or 10-bit (depending on the device used).
  • speeds: 
    • standard mode (100 Kbit/s) and low-speed mode (10 kbit/s); but arbitrarily low clock frequencies are also allowed.
    • Recent revisions of I²C can host more nodes and run at faster speeds: fast mode (400 kbit/s), fast mode plus or Fm+ (1 Mbit/s), and high-speed mode (3.4 Mbit/s). These speeds are more widely used on embedded systems than on PCs.
  • There are also other features, such as 16-bit addressing.

问题:address space 和 addressing关系是什么?

  • The reference design is a bus with a clock (SCL) and data (SDA) lines with 7-bit (or 10-bit) addressing. The bus has two roles for nodes:

    • Master node — a node that generates the clock (SCL) and initiates communication with slaves
    • a node that receives the clock and responds when addressed by the master
  • I2C is a multi-master bus, i.e., any number of master nodes can be present.
  • The master and slave roles may be changed between messages (after a STOP is sent)
  • Four potential modes of operation for a given bus device, although most devices only use a single role (master/slave):
    • master transmit — master node is sending data to a slave
    • master receive — master node is receiving data from a slave
    • slave transmit — slave node is sending data to the master
    • slave receive — slave node is receiving data from the master

General Timing diagram

Start: Data transfer is initiated with a START bit (S) that is signaled by SDA being pulled low while SCL stays high

Data transition: SDA sets the 1st data bit level while keeping SCL low (during the blue-bar time.)

Data sampling: The data is sampled (received) when SCL rises (green) for the first bit (B1)

This process repeats: SDA transitioning while SCL is low, and the data being read(receive) while SCL is high (B2, …, BN)

Stop: A STOP bit (P) is signaled when SDA is pulled high while SCL is high

Master-Node Read/Write

The I2C’s start and stop signals are different from the start bits and stop bits used in asynchronous serial communication, which are distinguished from data bits only by their timing

The master is initially in master transmit mode by sending (i) a START; then (ii) the 7-bit address of the slave it wishes to communicate with; and then (iii) a single bit representing whether it wishes to transmit (0: write) or receive (1: read)

If the addressed slave exists on the bus, it will respond with an ACK bit (active low for acknowledged) for that address. The master then continues in either transmit or receive mode (according to the read/write bit it sent), and the slave continues in the complementary mode (receive or transmit, respectively)

The address and the data bytes are sent most significant bit first

STM32F103’s I^{_{2}}C

I2C bus Interface:

  • serves as an interface between the microcontroller and the serial I2C bus
  • provides Multimaster capability, and controls all I2C bus-specific sequencing, protocol, arbitration, and timing
  • supports the standard mode (Sm; up to 100 kHz) and Fm mode (Fm; up to 400 kHz)

It is used for a variety of purposes:

CRC generation and verification, SMBus (system management bus), and PMBus (power management bus)

Depending on specific device implementation, DMA capability may be available for reducing CPU overload

I^{_{2}}C Message protocols(协议)

The basic transaction(交易) begins with a START and ends with a STOP

  • Single message where a master writes data to a slave
  • Single message where a master reads data from a slave
  • Combined format, where a master issues at least two reads or writes to one or more slaves

In a combined transaction

  • Each read or write begins with a START and the slave address.
  • The START conditions after the first one are also called repeated START bits.
  • Repeated STARTs are not preceded(先于) by STOP conditions, which is how slaves know that the next message is part of the same transaction.

STM32F103 use two-level data registers (data register + data shift register).

SMBus introduction

a two-wire interface that is based on I2C principles of operation.

Provides a control bus for system and power management related tasks.

Designed for communication with low-bandwidth (低带宽) devices on a motherboard(母板), especially power-related chips such as:

  • a laptop's rechargeable battery subsystem
  • sensors for temperature, fan, or voltage; and
  • lid switches (限位开关) and clock chips

A system may use SMBus to pass messages to and from devices instead of toggling individual control lines.

SMBus types

The System Management Bus Specification refers to three types of devices:

  • Slave: a device that is receiving or responding to a command.
  • Master: a device that issues commands, generates the clocks, and terminates the transfer
  • Host: a specialized master (特殊master) that provides the main interface to the system's CPU

A host must be a master-slave and must support the SMBus host notify(通知) protocol.

Only one host is allowed in a system.

Microcontrollers and Embedded Systems相关推荐

  1. Important Programming Concepts (Even on Embedded Systems) Part V: State Machines

    Earlier articles in this series: Part I: Idempotence Part II: Immutability Part III: Volatility Part ...

  2. 架构与设计 之一 C 嵌入式设计模式(Design Patterns for Embedded Systems in C)的学习记录

    唉   时至今日,已经不知道在嵌入式的道路上到底挣扎了多少个岁月,总感觉要"病入膏肓"了.此间总是不时出现一些疑惑:人家搞 Java.搞 C# 的动不动就是什么架构 / 框架的,搞 ...

  3. 架构设计 之一 C 嵌入式设计模式(Design Patterns for Embedded Systems in C)学习笔记

    前言   时至今日,已经不知道在嵌入式的道路上到底挣扎了多少个岁月,总感觉要"病入膏肓"了.此间总是不时出现一些疑惑:人家搞 Java.搞 C# 的动不动就是什么架构 / 框架的, ...

  4. 什么是Deeply Embedded Systems?

    什么是深嵌系统(Deeply Embedded Systems)呢?一般意义下,它是物联网领域的感知设备,能对检测到的环境数据进行处理.并做出响应. Deeply embedded systems a ...

  5. LCDet Low-Complexity Fully-Convolutional Neural Networks for Object Detection in Embedded Systems

    Subarna Tripathi UC San Diego∗ stripathi@ucsd.edu Byeongkeun Kang UC San Diego bkkang@ucsd.edu V asu ...

  6. ZPiE: Zero-knowledge Proofs in Embedded systems

    1. 引言 Salleras和Daza 2021年论文< ZPiE: Zero-Knowledge Proofs in Embedded Systems>. 代码实现: https://g ...

  7. SysML-Sec: A Model-Driven Environment for Developing Secure Embedded Systems

    SysML-Sec:用于开发安全嵌入式系统的模型驱动环境 摘要 我们介绍SysML-Sec,这是一个新的SysML环境,旨在使安全专家在嵌入式系统设计和开发的所有方法阶段与系统设计人员合作. SysM ...

  8. 【FastDepth】《FastDepth:Fast Monocular Depth Estimation on Embedded Systems》

    ICRA-2019 文章目录 1 Background and Motivation 2 Related Work 3 Advantages / Contributions 4 Method 5 Ex ...

  9. 嵌入式系统词汇表(Embedded System Vocabulary List)

    A ASIC(专用集成电路) Application-Specific Integrated Circuit. A piece of custom-designed hardware in a chi ...

最新文章

  1. 过滤字符串中的html标签
  2. 渗透知识-SQL注入
  3. Zabbix配置详解
  4. 内置h5 调用safari系统浏览器打开_开发教我做设计:移动端H5页面中的橡皮筋效果...
  5. ALV标准范例Demo汇总
  6. (转)Android中尺寸单位杂谈
  7. Pytorch的C++接口实践
  8. 开源软件 许可证密钥_自由和开源软件-1中的重要许可证
  9. mysql时间戳计算_mysql根据时间戳计算
  10. c# mysql 封装_C#简单通用的数据库连接封装
  11. CentOS 5.5搭建Apache+PHP5.2x+MySQL5+Zend3(yum安装)
  12. 金蝶云星空销售合同变更单表名
  13. 【项目实战一】基于人工神经网络ANN的车牌识别
  14. 安卓计算机切换用户,电脑模拟器小米游戏怎么切换账号
  15. 2016--MatConvNet Convolutional Neural Networks for MATLAB
  16. 上海电力学院计算机软件技术大作业,计算机硬件技术大作业报告2.doc
  17. Urllib2库+正则爬取内涵段子
  18. deepstream-测试发送kafka
  19. sketch导出html可以跳转,Sketch导入、导出功能说明及技巧
  20. 换个姿势做运维!GOPS 2022 · 深圳站精彩内容抢先看

热门文章

  1. 云闪付小程序吃坑,太坑了,整个人都要烧了,找遍全网都找不到这么详细的开发资料了
  2. mysql会话和事务_MySQL事务熟练使用就够?和腾讯大佬的一席对话,原来考点都在这些方面!...
  3. 以安装 WordPress为例介绍在Xampp中安装Bitnami XAMPP modules
  4. volte遇上VOWIFI
  5. 2023深圳留学生落户材料清单
  6. C语言查课系统的报告,河南工业大学C语言库管理系统课程报告
  7. BLDC应用兴起,MCU厂家如何应对技术挑战?
  8. Jackson科普:为基于抗体的研究选择荧光团
  9. WPA WPA2 区别
  10. 解决 docker exec 报错 Error response from daemon: Container XXXXX is not running