1 Getting to Know SMBus
Figure 1 shows some simple examples of generic SMBus transactions. These transactions are read/write words with and without packet error checking (PEC). Although a user's scope traces may not look exactly like these examples, it is easier to look at these theoretical examples and understand their content rather than considering actual scope traces. Examples of actual scope trace are given later in this document. Note that more detailed information can be gathered from these pictures than is discussed in this document. Simplified information is given in order to present only the basics of SMBus information. For most troubleshooting issues, the basics are all that users need to solve SMBus problems.
First, entire packets for read and write are examined. Only word communications are considered because they are common and relevant for most troubleshooting.
The following components make up the packet along with some of the relevant issues to consider.
- Start bit: Each packet of data must start with a start bit denoted with an S. The clock must wait at least 4 µs after the data line goes low before it goes low.
- Device address 1: The device address is sent by the host telling all slaves on the bus which slave acknowledges this particular communication packet.
- SMBus can have multiple slaves, so all other slaves that do not have this address ignore the packet. Smart batteries have device address 0x16. Thus, this packet is acknowledged by any fuel gauge.
- Only one device on the bus can have the same device address.
- The last bit of the device address is the read/write bit. A 0 for this bit denotes a write, and a 1 denotes a read. The read/write bit in the first device address for a read is a 0 because a command code is being written to the slave first. A write packet has only one device address because the direction (read/write) does not change.
- Acknowledge: Denoted by an A. The slave must acknowledge that the device address was received.
- Command code: This is the command or slave data address that is written to in a write packet or read from in a read packet.
- Repeated start (read): Denoted by an S. A second start bit embedded within the packet is used to shift the bus to a read.
- Device address 2 (read): The second device address in a read packet is a legacy component. Because a read operation is two packets combined with a repeated start, it is not required because the slave responsible for this packet has already been established. The SMBus specification still requires this as part of the specification, so it is mandatory for communicating to all devices including TI fuel gauges. However, important information is in this byte such as the read/write bit, which is set to a 1. This setting tells the slave that this packet is a read, so it is prepared to clock out data.
- Data LSB: The first byte of data is the least-significant byte of the data word. The reason why SMBus sends the LSB first is because SMBus sends data in little-endian format. This means that data is sent in increasing numeric significance. Most modern computers store data in memory in this order.
- Data MSB: This is the second byte of data for the word sent and is the most-significant byte. Again, it is sent this way to conform to the little-endian format.
- PEC: The PEC byte is a checksum of the entire packet used to protect against data corruption.
- Stop bit: This is the end of the packet. It tells the slave device that the bus is done, so the slave can get ready for more communications. It is an important part of the packet. Users can experience trouble by leaving this stop bit off if they get all the data. Although TI fuel gauges will time out and reset eventually without this, it is important to keep all devices on the bus in a known state at the end of each packet sent. Even if the host has to stop the communication in the middle of the packet for some reason, the host always sends the stop bit to reset everything on the bus.