• Menu
  • Product
  • Email
  • PDF
  • Order now
  • SMBus Made Simple

    • SLUA475 November   2016 BQ2060A , BQ20Z80 , BQ40Z50-R1 , BQ40Z50-R2 , BQ40Z60 , BQ78350-R1 , BQ78350-R1A

       

  • CONTENTS
  • SEARCH
  • SMBus Made Simple
  1.   SMBus Made Simple
    1.     Trademarks
    2. 1 Getting to Know SMBus
      1. 1.1 Closer Inspection
      2. 1.2 Final Considerations
        1. 1.2.1 Clock Stretching
        2. 1.2.2 Broadcasting (Master Mode Messages)
        3. 1.2.3 PEC
          1. 1.2.3.1 How to Calculate PEC
        4. 1.2.4 Examples
          1. 1.2.4.1 Example 1
          2. 1.2.4.2 Example 2
          3. 1.2.4.3 Example 3
          4. 1.2.4.4 Example 4
    3. 2 Most Common Problems
    4. 3 Glossary
    5. 4 References
  2.   A SMBus Reference Sheet
    1.     19
  3. IMPORTANT NOTICE
search No matches found.
  • Full reading width
    • Full reading width
    • Comfortable reading width
    • Expanded reading width
  • Card for each section
  • Card with all content

 

APPLICATION NOTE

SMBus Made Simple

SMBus Made Simple

The System Management Bus (SMBus) is the most common form of communication for Texas Instruments advanced fuel gauges. Many customers want to design SMBus engines to communicate with TI advanced fuel gauges. Though this is possible, these designs sometime lead to confusion and frustration. Investigating SMBus errors or transaction failures can seem to be a difficult or daunting task. The purpose of this application report is to reduce the complexity and make learning SMBus easier. This report assumes some knowledge of I²C.

Trademarks

All trademarks are the property of their respective owners.

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.

read_wrt_pec_lua475.gifFigure 1. SMBus Transaction Examples

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.

1.1 Closer Inspection

To consider SMBus communication in more detail, Figure 2 shows an SMBus read word and zooms into one byte of a data packet and the NACK/Stop bit. This diagram gives examples of most of the important bits of a total packet.

rdwd_lua475.gifFigure 2. SMBus Read Word – Without PEC

Each byte is 8 bits long. Several things of interest can be derived by looking closely at this diagram:

  1. Data processing: Each bit of data is processed by the SMBus engine on the rising clock edge. This is where the data is shifted into the engine. Note that the data must never change levels while the clock is high during an SMBus transaction except to create a start, restart, or stop bit.
  2. Clock timing: The most common cause of difficulty with the SMBus is when host systems fail to follow the SMBus High clock timeout specification. If the clock is high at any time during a transaction for more than 50 µs, the SMBus engine interprets this as a bus idle condition and resets. This SMBus specification requirement can be more problematic than any other.
  3. Repeated start: The repeated start bit is unique in that it shifts the focus of the current transaction from a write to a read. Prior to the repeated start is a write to a command code with the read/write cleared in the device address, and after the repeated start, the bus shifts to a read of data with the read/write bit set.
  4. Read/write bit: This bit is appended to the end of the device address. The device address is usually thought of as being 8 bits long, but it is actually 7 bits. So, the device address in an 8-bit format is a 0x16 in a write and a 0x17 after the repeated start in an SMBus read packet.
  5. Acknowledge: All bytes are followed by an acknowledge (ACK) except for the last byte of a read packet when the host is responsible for NACK-ing the last byte. The slave expects a NACK of this byte even if it is a PEC byte (PEC is explained later in this document). Whoever receives the byte prior to the ACK is who is responsible for sending the ACK.
  6. No acknowledge: A no acknowledge follows any byte that is not understood by the device receiving the previous data byte. The exception to this rule is the NACK required from the host after the last byte of data in a read packet (see number 5), which indicates to the slave that the host has received all bytes that it expected.
  7. Start and stop bit: The stop bit is the final bit in the packet. Once this bit is sent by the host, the slave ignores anything on the bus until a start is detected and then only acknowledges its own device. By the SMBus specification, the fuel gauge must always acknowledge its device address.
  8. Bit order versus byte order: This is important because the orders are opposite, which can be confusing. Each byte starts with the most-significant bit first and ends with the least-significant bit. However, the word of data is sent with the least-significant byte first and the most-significant byte last, which the SMBus specification requires. The bitwise order is normal; however, the bytewise order is in little-endian format as previously explained.

1.2 Final Considerations

The following are final considerations when examining all the points of a total packet.

1.2.1 Clock Stretching

clk_str_lua475.gifFigure 3. SMBus Clock Stretch

Clock stretching is a simple way for the slave to indicate to the host that it is busy (see Figure 3). Any time the clock is low in the packet, the slave has the right to grab the clock and hold it low as long as required; however, the bit must not cause a packet timeout (25 ms).

The entire packet must not be longer than 25 ms, which includes the clock stretch. TI fuel gauges usually only clock stretch before or after the ACK or NACK bits.

 

Texas Instruments

© Copyright 1995-2025 Texas Instruments Incorporated. All rights reserved.
Submit documentation feedback | IMPORTANT NOTICE | Trademarks | Privacy policy | Cookie policy | Terms of use | Terms of sale