4.3. I2C

Synopsys Documentation

Synopsys Proprietary. Used with permission.

I2C is a commonly used 2-wire interface that can be used to connect devices for low speed data transfer using clock SCL and data SDA wires.

RP2040 has two identical instances of an I2C controller. The external pins of each controller are connected to GPIO pins as defined in the GPIO muxing table in Section 2.19.2 . The muxing options give some IO flexibility.

4.3.1. Features

Each I2C controller is based on a configuration of the Synopsys DW_apb_i2c (v2.01) IP. The following features are supported:

4.3.1.1. Standard

The I2C controller was designed for I2C Bus specification, version 6.0, dated April 2014.

4.3.1.2. Clocking

All clocks in the I2C controller are connected to clk_sys , including ic_clk which is mentioned in later sections. The I2C clock is generated by dividing down this clock, controlled by registers inside the block.

4.3.1.3. IOs

Each controller must connect its clock SCL and data SDA to one pair of GPIOs. The I2C standard requires that drivers drive a signal low, or when not driven the signal will be pulled high. This applies to SCL and SDA. The GPIO pads should be configured for:

i NOTE

There should also be external pull-ups on the board as the internal pad pull-ups may not be strong enough to pull up external circuits.

4.3.2. IP Configuration

I2C configuration details (each instance is fully independent):

4.3.3. I2C Overview

The I2C bus is a 2-wire serial interface, consisting of a serial data line SDA and a serial clock SCL . These wires carry information between the devices connected to the bus. Each device is recognized by a unique address and can operate as either a “transmitter” or “receiver”, depending on the function of the device. Devices can also be considered as masters or slaves when performing data transfers. A master is a device that initiates a data transfer on the bus and generates the clock signals to permit that transfer. At that time, any device addressed is considered a slave.

NOTE

The I2C block must only be programmed to operate in either master OR slave mode only. Operating as a master and slave simultaneously is not supported.

The I2C block can operate in these modes:

These modes are not supported:

NOTE

References to fast mode also apply to fast mode plus, unless specifically stated otherwise.

The I2C block can communicate with devices in one of these modes as long as they are attached to the bus. Additionally, fast mode devices are downward compatible. For instance, fast mode devices can communicate with standard mode devices in 0 to 100kbps I2C bus system. However standard mode devices are not upward compatible and should not be incorporated in a fast-mode I2C bus system as they cannot follow the higher transfer rate and unpredictable states would occur.

An example of high-speed mode devices are LCD displays, high-bit count ADCs, and high capacity EEPROMs. These devices typically need to transfer large amounts of data. Most maintenance and control applications, the common use for the I2C bus, typically operate at 100kHz (in standard and fast modes). Any DW_apb_i2c device can be attached to an I2C-bus and every device can talk with any master, passing information back and forth. There needs to be at least one master (such as a microcontroller or DSP) on the bus but there can be multiple masters, which require them to arbitrate for ownership. Multiple masters and arbitration are explained later in this chapter. The I2C block does not support SMBus and PMBus protocols (for System Management and Power management).

The DW_apb_i2c is made up of an AMBA APB slave interface, an I2C interface, and FIFO logic to maintain coherency between the two interfaces. The blocks of the component are illustrated in Figure 64 .

Figure 64. I2C Block diagram

Block diagram of the DW_apb_i2c component. The diagram shows a central blue box labeled 'DW_apb_i2c' containing several yellow blocks. The blocks are arranged in a grid: Row 1: AMBA Bus Interface Unit, Register File, Slave State Machine, Master State Machine; Row 2: Clock Generator, Rx Shift, Tx Shift, Rx Filter; Row 3: Toggle, Synchronizer, DMA Interface, Interrupt Controller; Row 4: RX FIFO, TX FIFO.
graph TD
    subgraph DW_apb_i2c
        direction TB
        subgraph Row1
            A[AMBA Bus Interface Unit]
            B[Register File]
            C[Slave State Machine]
            D[Master State Machine]
        end
        subgraph Row2
            E[Clock Generator]
            F[Rx Shift]
            G[Tx Shift]
            H[Rx Filter]
        end
        subgraph Row3
            I[Toggle]
            J[Synchronizer]
            K[DMA Interface]
            L[Interrupt Controller]
        end
        subgraph Row4
            M[RX FIFO]
            N[TX FIFO]
        end
    end
Block diagram of the DW_apb_i2c component. The diagram shows a central blue box labeled 'DW_apb_i2c' containing several yellow blocks. The blocks are arranged in a grid: Row 1: AMBA Bus Interface Unit, Register File, Slave State Machine, Master State Machine; Row 2: Clock Generator, Rx Shift, Tx Shift, Rx Filter; Row 3: Toggle, Synchronizer, DMA Interface, Interrupt Controller; Row 4: RX FIFO, TX FIFO.

The following define the functions of the blocks in Figure 64 :

4.3.4. I2C Terminology

The following terms are used and are defined as follows:

4.3.4.1. I2C Bus Terms

The following terms relate to how the role of the I2C device and how it interacts with other I2C devices on the bus.

4.3.4.2. Bus Transfer Terms

The following terms are specific to data transfers that occur to/from the I2C bus.

NOTE

START and RESTART conditions are functionally identical.

4.3.5. I2C Behaviour

The DW_apb_i2c can be controlled via software to be either:

The master is responsible for generating the clock and controlling the transfer of data. The slave is responsible for either transmitting or receiving data to/from the master. The acknowledgement of data is sent by the device that is receiving data, which can be either a master or a slave. As mentioned previously, the I2C protocol also allows multiple masters to reside on the I2C bus and uses an arbitration procedure to determine bus ownership.

Each slave has a unique address that is determined by the system designer. When a master wants to communicate with a slave, the master transmits a START/RESTART condition that is then followed by the slave’s address and a control bit (R/W) to determine if the master wants to transmit data or receive data from the slave. The slave then sends an acknowledge (ACK) pulse after the address.

If the master (master-transmitter) is writing to the slave (slave-receiver), the receiver gets one byte of data. This transaction continues until the master terminates the transmission with a STOP condition. If the master is reading from a slave (master-receiver), the slave transmits (slave-transmitter) a byte of data to the master, and the master then acknowledges the transaction with the ACK pulse. This transaction continues until the master terminates the transmission by not acknowledging (NACK) the transaction after the last byte is received, and then the master issues a STOP condition or addresses another slave after issuing a RESTART condition. This behaviour is illustrated in Figure 65.

Figure 65. Data transfer on the I2C Bus

Timing diagram for I2C data transfer showing SDA and SCL signals. The diagram illustrates a sequence of operations: START or RESTART Condition, data transmission (MSB to LSB), ACK from slave, SCL held low while servicing interrupts, data reception (1 to 3-8), ACK from receiver, and STOP AND RESTART Condition. The SDA line shows data bytes and ACK/NACK pulses, while the SCL line shows clock pulses and a low state during interrupts.

The diagram shows the SDA and SCL signals over time. The SDA line has a START or RESTART condition (low-to-high transition while SCL is high), followed by data transmission (MSB to LSB), an ACK from the slave (low-to-high transition while SCL is high), a period where SCL is held low while servicing interrupts, data reception (1 to 3-8), an ACK from the receiver (low-to-high transition while SCL is high), and finally a STOP AND RESTART condition (high-to-low transition while SCL is high). The SCL line shows clock pulses and a low state during interrupts.

Timing diagram for I2C data transfer showing SDA and SCL signals. The diagram illustrates a sequence of operations: START or RESTART Condition, data transmission (MSB to LSB), ACK from slave, SCL held low while servicing interrupts, data reception (1 to 3-8), ACK from receiver, and STOP AND RESTART Condition. The SDA line shows data bytes and ACK/NACK pulses, while the SCL line shows clock pulses and a low state during interrupts.

The DW_apb_i2c is a synchronous serial interface. The SDA line is a bidirectional signal and changes only while the SCL line is low, except for STOP, START, and RESTART conditions. The output drivers are open-drain or open-collector to perform wire-AND functions on the bus. The maximum number of devices on the bus is limited by only the maximum capacitance specification of 400 pF. Data is transmitted in byte packages.

The I2C protocols implemented in DW_apb_i2c are described in more details in Section 4.3.6.

4.3.5.1. START and STOP Generation

When operating as an I2C master, putting data into the transmit FIFO causes the DW_apb_i2c to generate a START condition on the I2C bus. Writing a 1 to IC_DATA_CMD.STOP causes the DW_apb_i2c to generate a STOP condition on

the I2C bus; a STOP condition is not issued if this bit is not set, even if the transmit FIFO is empty.

When operating as a slave, the DW_apb_i2c does not generate START and STOP conditions, as per the protocol. However, if a read request is made to the DW_apb_i2c, it holds the SCL line low until read data has been supplied to it. This stalls the I2C bus until read data is provided to the slave DW_apb_i2c, or the DW_apb_i2c slave is disabled by writing a 0 to IC_ENABLE.ENABLE .

4.3.5.2. Combined Formats

The DW_apb_i2c supports mixed read and write combined format transactions in both 7-bit and 10-bit addressing modes. The DW_apb_i2c does not support mixed address and mixed address format—that is, a 7-bit address transaction followed by a 10-bit address transaction or vice versa—combined format transactions. To initiate combined format transfers, IC_CON.IC_RESTART_EN should be set to 1. With this value set and operating as a master, when the DW_apb_i2c completes an I2C transfer, it checks the transmit FIFO and executes the next transfer. If the direction of this transfer differs from the previous transfer, the combined format is used to issue the transfer. If the transmit FIFO is empty when the current I2C transfer completes:

For more details, refer to Section 4.3.7 .

4.3.6. I2C Protocols

The DW_apb_i2c has the protocols discussed in this section.

4.3.6.1. START and STOP Conditions

When the bus is idle, both the SCL and SDA signals are pulled high through external pull-up resistors on the bus. When the master wants to start a transmission on the bus, the master issues a START condition. This is defined to be a high-to-low transition of the SDA signal while SCL is 1. When the master wants to terminate the transmission, the master issues a STOP condition. This is defined to be a low-to-high transition of the SDA line while SCL is 1. Figure 66 shows the timing of the START and STOP conditions. When data is being transmitted on the bus, the SDA line must be stable when SCL is 1.

Figure 66. I2C START and STOP Condition

Timing diagram for I2C START and STOP conditions. The diagram shows two signals: SDA (Serial Data Arbitration) and SCL (Serial Clock). SCL is a periodic square wave. SDA starts high. A dashed red box labeled 's' indicates the Start Condition: SDA transitions from high to low while SCL is high. After SCL goes low, a period labeled 'Change of Data Allowed' occurs. When SCL goes high again, the SDA line is stable at low, labeled 'Data line Stable Data Valid'. After SCL goes low, another 'Change of Data Allowed' period occurs. When SCL goes high again, a dashed red box labeled 'P' indicates the Stop Condition: SDA transitions from low to high while SCL is high.
Timing diagram for I2C START and STOP conditions. The diagram shows two signals: SDA (Serial Data Arbitration) and SCL (Serial Clock). SCL is a periodic square wave. SDA starts high. A dashed red box labeled 's' indicates the Start Condition: SDA transitions from high to low while SCL is high. After SCL goes low, a period labeled 'Change of Data Allowed' occurs. When SCL goes high again, the SDA line is stable at low, labeled 'Data line Stable Data Valid'. After SCL goes low, another 'Change of Data Allowed' period occurs. When SCL goes high again, a dashed red box labeled 'P' indicates the Stop Condition: SDA transitions from low to high while SCL is high.

i NOTE

The signal transitions for the START/STOP conditions, as depicted in Figure 66 , reflect those observed at the output signals of the Master driving the I2C bus. Care should be taken when observing the SDA/SCL signals at the input signals of the Slave(s), because unequal line delays may result in an incorrect SDA/SCL timing relationship.

4.3.6.2. Addressing Slave Protocol

There are two address formats: the 7-bit address format and the 10-bit address format.

4.3.6.2.1. 7-bit Address Format

During the 7-bit address format, the first seven bits (bits 7:1) of the first byte set the slave address and the LSB bit (bit 0) is the R/W bit as shown in Figure 67 . When bit 0 (R/W) is set to 0, the master writes to the slave. When bit 0 (R/W) is set to 1, the master reads from the slave.

Figure 67. I2C 7-bit Address Format

Diagram of the 7-bit I2C address format. It shows a sequence of bits: S (START), A6, A5, A4, A3, A2, A1, A0, R/W, and ACK. A bracket under A6 through A0 is labeled 'Slave Address'. A bracket under R/W and ACK is labeled 'sent by slave'. Below the diagram, it defines: S = START Condition, ACK = Acknowledge, and R/W = Read/Write Pulse.

S   A6   A5   A4   A3   A2   A1   A0   R/W \( \overline{\text{ACK}} \)

Slave Address

sent by slave

S = START Condition \( \overline{\text{ACK}} \) = Acknowledge   R/W = Read/Write Pulse

Diagram of the 7-bit I2C address format. It shows a sequence of bits: S (START), A6, A5, A4, A3, A2, A1, A0, R/W, and ACK. A bracket under A6 through A0 is labeled 'Slave Address'. A bracket under R/W and ACK is labeled 'sent by slave'. Below the diagram, it defines: S = START Condition, ACK = Acknowledge, and R/W = Read/Write Pulse.

4.3.6.2.2. 10-bit Address Format

During 10-bit addressing, two bytes are transferred to set the 10-bit address. The transfer of the first byte contains the following bit definition. The first five bits (bits 7:3) notify the slaves that this is a 10-bit transfer followed by the next two bits (bits 2:1), which set the slaves address bits 9:8, and the LSB bit (bit 0) is the R/W bit. The second byte transferred sets bits 7:0 of the slave address. Figure 68 shows the 10-bit address format.

Figure 68. 10-bit Address Format

Diagram of the first byte of the 10-bit I2C address format. It shows a sequence of bits: S, '1', '1', '1', '0', A9, A8, R/W, ACK, A7, A6, A5, A4, A3, A2, A1, A0, and ACK. A bracket under the five bits '1', '1', '1', '0', A9 is labeled 'Reserved for 10-bit Address'. A bracket under R/W, ACK, A7, A6, A5, A4, A3, A2, A1, A0 is labeled 'sent by slave'. A bracket under the final ACK is labeled 'sent by slave'. Below the diagram, it defines: S = START Condition, ACK = Acknowledge, and R/W = Read/Write Pulse.

S   '1'   '1'   '1'   '0'   A9   A8   R/W \( \overline{\text{ACK}} \) A7   A6   A5   A4   A3   A2   A1   A0 \( \overline{\text{ACK}} \)

Reserved for 10-bit Address

sent by slave

sent by slave

S = START Condition \( \overline{\text{ACK}} \) = Acknowledge   R/W = Read/Write Pulse

Diagram of the first byte of the 10-bit I2C address format. It shows a sequence of bits: S, '1', '1', '1', '0', A9, A8, R/W, ACK, A7, A6, A5, A4, A3, A2, A1, A0, and ACK. A bracket under the five bits '1', '1', '1', '0', A9 is labeled 'Reserved for 10-bit Address'. A bracket under R/W, ACK, A7, A6, A5, A4, A3, A2, A1, A0 is labeled 'sent by slave'. A bracket under the final ACK is labeled 'sent by slave'. Below the diagram, it defines: S = START Condition, ACK = Acknowledge, and R/W = Read/Write Pulse.

This table defines the special purpose and reserved first byte addresses.

Table 448. I2C/SMBus Definition of Bits in First Byte

Slave AddressR/W BitDescription
0000 0000General Call Address. DW_apb_i2c places the data in the receive buffer and issues a General Call interrupt.
0000 0001START byte. For more details, refer to Section 4.3.6.4 .
0000 001XCBUS address. DW_apb_i2c ignores these accesses.
0000 010XReserved.
0000 011XReserved.
0000 1XXXHigh-speed master code (for more information, refer to Section 4.3.8 ).
1111 1XXXReserved.
1111 0XXX10-bit slave addressing.
0001 000XSMBus Host (not supported)
0001 100XSMBus Alert Response Address (not supported)
1100 001XSMBus Device Default Address (not supported)

DW_apb_i2c does not restrict you from using these reserved addresses. However, if you use these reserved addresses,

you may run into incompatibilities with other I2C components.

4.3.6.3. Transmitting and Receiving Protocol

The master can initiate data transmission and reception to/from the bus, acting as either a master-transmitter or master-receiver. A slave responds to requests from the master to either transmit data or receive data to/from the bus, acting as either a slave-transmitter or slave-receiver, respectively.

4.3.6.3.1. Master-Transmitter and Slave-Receiver

All data is transmitted in byte format, with no limit on the number of bytes transferred per data transfer. After the master sends the address and R/W bit or the master transmits a byte of data to the slave, the slave-receiver must respond with the acknowledge signal (ACK). When a slave-receiver does not respond with an ACK pulse, the master aborts the transfer by issuing a STOP condition. The slave must leave the SDA line high so that the master can abort the transfer. If the master-transmitter is transmitting data as shown in Figure 69 , then the slave-receiver responds to the master-transmitter with an acknowledge pulse after every byte of data is received.

Figure 69. I2C Master-Transmitter Protocol

Diagram of I2C Master-Transmitter Protocol showing 7-bit and 10-bit address sequences.

The diagram illustrates the I2C Master-Transmitter Protocol for two address formats:

Legend:

Diagram of I2C Master-Transmitter Protocol showing 7-bit and 10-bit address sequences.

4.3.6.3.2. Master-Receiver and Slave-Transmitter

If the master is receiving data as shown in Figure 70 , then the master responds to the slave-transmitter with an acknowledge pulse after a byte of data has been received, except for the last byte. This is the way the master-receiver notifies the slave-transmitter that this is the last byte. The slave-transmitter relinquishes the SDA line after detecting the No Acknowledge (NACK) so that the master can issue a STOP condition.

Figure 70. I2C Master-Receiver Protocol

Diagram of I2C Master-Receiver Protocol showing 7-bit and 10-bit address sequences.

The diagram illustrates the I2C Master-Receiver Protocol for two address formats:

Legend:

Diagram of I2C Master-Receiver Protocol showing 7-bit and 10-bit address sequences.

When a master does not want to relinquish the bus with a STOP condition, the master can issue a RESTART condition. This is identical to a START condition except it occurs after the ACK pulse. Operating in master mode, the DW_apb_i2c can then communicate with the same slave using a transfer of a different direction. For a description of the combined format transactions that the DW_apb_i2c supports, refer to Section 4.3.5.2 .

NOTE

The DW_apb_i2c must be completely disabled before the target slave address register ( IC_TAR ) can be reprogrammed.

4.3.6.4. START BYTE Transfer Protocol

The START BYTE transfer protocol is set up for systems that do not have an on-board dedicated I2C hardware module. When the DW_apb_i2c is addressed as a slave, it always samples the I2C bus at the highest speed supported so that it never requires a START BYTE transfer. However, when DW_apb_i2c is a master, it supports the generation of START BYTE transfers at the beginning of every transfer in case a slave device requires it.

This protocol consists of seven zeros being transmitted followed by a one, as illustrated in Figure 71 . This allows the processor that is polling the bus to under-sample the address phase until zero is detected. Once the microcontroller detects a zero, it switches from the under sampling rate to the correct rate of the master.

Figure 71. I2C Start Byte Transfer

Timing diagram for I2C Start Byte Transfer showing SDA and SCL signals. The SDA signal starts high, then transitions to low (labeled 'S' in a dashed box). The SCL signal shows clock pulses numbered 1 through 9. A red arrow indicates the 'start byte 00000001' spanning from the start of the SDA transition to the end of the 9th SCL pulse. After the 9th pulse, the SCL signal goes high (labeled '(HIGH)' and 'Ack'). The SDA signal then transitions back to high (labeled 'dummy acknowledge' and 'Sr' in a dashed box).
Timing diagram for I2C Start Byte Transfer showing SDA and SCL signals. The SDA signal starts high, then transitions to low (labeled 'S' in a dashed box). The SCL signal shows clock pulses numbered 1 through 9. A red arrow indicates the 'start byte 00000001' spanning from the start of the SDA transition to the end of the 9th SCL pulse. After the 9th pulse, the SCL signal goes high (labeled '(HIGH)' and 'Ack'). The SDA signal then transitions back to high (labeled 'dummy acknowledge' and 'Sr' in a dashed box).

The START BYTE procedure is as follows:

  1. 1. Master generates a START condition.
  2. 2. Master transmits the START byte (0000 0001).
  3. 3. Master transmits the ACK clock pulse. (Present only to conform with the byte handling format used on the bus)
  4. 4. No slave sets the ACK signal to zero.
  5. 5. Master generates a RESTART (R) condition.

A hardware receiver does not respond to the START BYTE because it is a reserved address and resets after the RESTART condition is generated.

4.3.7. Tx FIFO Management and START, STOP and RESTART Generation

When operating as a master, the DW_apb_i2c component supports the mode of Tx FIFO management illustrated in Figure 72

4.3.7.1. Tx FIFO Management

The component does not generate a STOP if the Tx FIFO becomes empty; in this situation the component holds the SCL line low, stalling the bus until a new entry is available in the Tx FIFO. A STOP condition is generated only when the user specifically requests it by setting bit nine (Stop bit) of the command written to IC_DATA_CMD register. Figure 72 shows the bits in the IC_DATA_CMD register.

Figure 72.
IC_DATA_CMD
Register

IC_DATA_CMD

RestartStopCMDDATA
9870

Data      Read/Write field; data retrieved from slave is read from this field; data to be sent to slave is written to this field
CMD      Write-only field; this bit determines whether transfer to be carried out is Read (CMD=1) or Write (CMD=0)
Stop      Write-only field; this bit determines whether STOP is generated after data byte is sent or received
Restart    Write-only field; this bit determines whether RESTART (or STOP followed by START in case or restart capability is not enabled) is generated before data is sent or received

Figure 73 illustrates the behaviour of the DW_apb_i2c when the Tx FIFO becomes empty while operating as a master transmitter, as well as showing the generation of a STOP condition.

Figure 73. Master Transmitter - Tx FIFO Empties/STOP Generation

SDA, SCL, FIFO EMPTY

Data availability triggers START condition on bus
Tx FIFO loaded with data (write data in this example)
Last byte popped from Tx FIFO, with STOP bit not set
Because STOP bit was not set on last byte popped from Tx FIFO, Master holds SCL low
Tx FIFO loaded with new data
Master releases SCL line and resumes transmission because new data became available
Last byte popped from Tx FIFO with STOP bit set
STOP bit enabled triggers STOP condition on bus

Figure 74 illustrates the behaviour of the DW_apb_i2c when the Tx FIFO becomes empty while operating as a master receiver, as well as showing the generation of a STOP condition.

Figure 74. Master Receiver - Tx FIFO Empties/STOP Generation

SDA, SCL, FIFO EMPTY

Command availability triggers START condition on bus
Tx FIFO loaded with command (read operation in this example)
Last command popped from Tx FIFO, with STOP bit not set
Because STOP bit was not set on last command popped from Tx FIFO, Master holds SCL low
Tx FIFO loaded with new command
Master releases SCL line and resumes transmission because new command became available
Last command popped from Tx FIFO with STOP bit set
STOP bit enabled triggers STOP condition on bus

Figure 75 and Figure 76 illustrate configurations where the user can control the generation of RESTART conditions on the I2C bus. If bit 10 (Restart) of the IC_DATA_CMD register is set and the restart capability is enabled (IC_RESTART_EN=1), a RESTART is generated before the data byte is written to or read from the slave. If the restart capability is not enabled a STOP followed by a START is generated in place of the RESTART. Figure 75 illustrates this situation during operation as a master transmitter.

Figure 75. Master Transmitter – Restart Bit of IC_DATA_CMD Is Set

SDA, SCL, FIFO EMPTY

Data availability triggers START condition on bus
Tx FIFO loaded with data (write data in this example)
Next byte in Tx FIFO has RESTART bit set
Because next byte on Tx FIFO has been tagged with RESTART bit, Master issues RESTART and initiates new transmission

Figure 76 illustrates the same situation, but during operation as a master receiver.

Figure 76. Master Receiver – Restart Bit of IC_DATA_CMD Is Set

SDA, SCL, FIFO EMPTY

Command availability triggers START condition on bus
Tx FIFO loaded with command (read operation in this example)
Next command in Tx FIFO has RESTART bit set
Master issues NOT ACK as required before RESTART when operating as receiver
Because next command on Tx FIFO has been tagged with RESTART bit, Master issues RESTART and initiates new transmission

Figure 77 illustrates operation as a master transmitter where the Stop bit of the IC_DATA_CMD register is set and the Tx FIFO is not empty

Figure 77. Master Transmitter – Stop Bit of IC_DATA_CMD Set/Tx FIFO Not Empty

Timing diagram for Figure 77 showing SDA, SCL, and FIFO_EMPTY signals. The SDA line shows a sequence of bytes (A0-A7) followed by a STOP condition (P). The SCL line shows a series of clock pulses. The FIFO_EMPTY signal transitions from HIGH to LOW when data is loaded and back to HIGH when the FIFO is empty. Annotations indicate that data availability triggers the START condition, the first byte is popped from the Tx FIFO, and because the STOP bit is set on the last byte, the master generates a STOP condition. A new transmission is initiated when more data is available.
Timing diagram for Figure 77 showing SDA, SCL, and FIFO_EMPTY signals. The SDA line shows a sequence of bytes (A0-A7) followed by a STOP condition (P). The SCL line shows a series of clock pulses. The FIFO_EMPTY signal transitions from HIGH to LOW when data is loaded and back to HIGH when the FIFO is empty. Annotations indicate that data availability triggers the START condition, the first byte is popped from the Tx FIFO, and because the STOP bit is set on the last byte, the master generates a STOP condition. A new transmission is initiated when more data is available.

Figure 78 illustrates operation as a master transmitter where the first byte loaded into the Tx FIFO is allowed to go empty with the Restart bit set

Figure 78. Master Transmitter – First Byte Loaded Into Tx FIFO Allowed to Empty, Restart Bit Set

Timing diagram for Figure 78 showing SDA, SCL, and FIFO_EMPTY signals. The SDA line shows a sequence of bytes (A0-A7) followed by a STOP condition (P). The SCL line shows a series of clock pulses. The FIFO_EMPTY signal transitions from HIGH to LOW when data is loaded and back to HIGH when the FIFO is empty. Annotations indicate that data availability triggers the START condition, the first byte is popped from the Tx FIFO, and because the STOP bit was not set on the last byte, the master holds SCL low. A new transmission is initiated when the Tx FIFO is loaded with a new command.
Timing diagram for Figure 78 showing SDA, SCL, and FIFO_EMPTY signals. The SDA line shows a sequence of bytes (A0-A7) followed by a STOP condition (P). The SCL line shows a series of clock pulses. The FIFO_EMPTY signal transitions from HIGH to LOW when data is loaded and back to HIGH when the FIFO is empty. Annotations indicate that data availability triggers the START condition, the first byte is popped from the Tx FIFO, and because the STOP bit was not set on the last byte, the master holds SCL low. A new transmission is initiated when the Tx FIFO is loaded with a new command.

Figure 79 illustrates operation as a master receiver where the Stop bit of the IC_DATA_CMD register is set and the Tx FIFO is not empty

Figure 79. Master Receiver – Stop Bit of IC_DATA_CMD Set/Tx FIFO Not Empty

Timing diagram for Figure 79 showing SDA, SCL, and FIFO_EMPTY signals. The SDA line shows a sequence of bytes (A0-A7) followed by a STOP condition (P). The SCL line shows a series of clock pulses. The FIFO_EMPTY signal transitions from HIGH to LOW when a command is loaded and back to HIGH when the FIFO is empty. Annotations indicate that command availability triggers the START condition, the first command is popped from the Tx FIFO, and because the STOP bit is set on the last command, the master generates a STOP condition. A new transmission is initiated when more commands are available.
Timing diagram for Figure 79 showing SDA, SCL, and FIFO_EMPTY signals. The SDA line shows a sequence of bytes (A0-A7) followed by a STOP condition (P). The SCL line shows a series of clock pulses. The FIFO_EMPTY signal transitions from HIGH to LOW when a command is loaded and back to HIGH when the FIFO is empty. Annotations indicate that command availability triggers the START condition, the first command is popped from the Tx FIFO, and because the STOP bit is set on the last command, the master generates a STOP condition. A new transmission is initiated when more commands are available.

Figure 80 illustrates operation as a master receiver where the first command loaded after the Tx FIFO is allowed to empty and the Restart bit is set

Figure 80. Master Receiver – First Command Loaded After Tx FIFO Allowed to Empty/Restart Bit Set

Timing diagram for Figure 80 showing SDA, SCL, and FIFO_EMPTY signals. The SDA line shows a sequence of bytes (A0-A7) followed by a STOP condition (P). The SCL line shows a series of clock pulses. The FIFO_EMPTY signal transitions from HIGH to LOW when a command is loaded and back to HIGH when the FIFO is empty. Annotations indicate that command availability triggers the START condition, the first command is popped from the Tx FIFO, and because the STOP bit was not set on the last command, the master holds SCL low. A new transmission is initiated when the Tx FIFO is loaded with a new command.
Timing diagram for Figure 80 showing SDA, SCL, and FIFO_EMPTY signals. The SDA line shows a sequence of bytes (A0-A7) followed by a STOP condition (P). The SCL line shows a series of clock pulses. The FIFO_EMPTY signal transitions from HIGH to LOW when a command is loaded and back to HIGH when the FIFO is empty. Annotations indicate that command availability triggers the START condition, the first command is popped from the Tx FIFO, and because the STOP bit was not set on the last command, the master holds SCL low. A new transmission is initiated when the Tx FIFO is loaded with a new command.

4.3.8. Multiple Master Arbitration

The DW_apb_i2c bus protocol allows multiple masters to reside on the same bus. If there are two masters on the same I2C-bus, there is an arbitration procedure if both try to take control of the bus at the same time by generating a START condition at the same time. Once a master (for example, a microcontroller) has control of the bus, no other master can take control until the first master sends a STOP condition and places the bus in an idle state.

Arbitration takes place on the SDA line, while the SCL line is one. The master, which transmits a one while the other master transmits zero, loses arbitration and turns off its data output stage. The master that lost arbitration can continue to generate clocks until the end of the byte transfer. If both masters are addressing the same slave device, the arbitration could go into the data phase.

Upon detecting that it has lost arbitration to another master, the DW_apb_i2c will stop generating SCL(will disable the output driver). Figure 81 illustrates the timing of when two masters are arbitrating on the bus.

Figure 81. Multiple Master Arbitration

Timing diagram for Multiple Master Arbitration showing CLK_A, DATA2, SDA, and SCL signals.

The diagram illustrates the arbitration process on the I2C bus. It shows four signals: CLK_A, DATA2, SDA, and SCL. CLK_A is a square wave. DATA2 and SDA are data lines. SCL is the clock line. A dashed red box highlights the start of the arbitration. SDA lines up with DATA1's START condition. DATA2 and SDA have matching data (MSB) for several clock cycles. At one point, DATA2 has a '1' while SDA has a '0', indicating DATA1 loses arbitration. SDA mirrors DATA2. The SCL signal is a square wave that is high during data transmission and low during arbitration.

Timing diagram for Multiple Master Arbitration showing CLK_A, DATA2, SDA, and SCL signals.

Control of the bus is determined by address or master code and data sent by competing masters, so there is no central master nor any order of priority on the bus.

Arbitration is not allowed between the following conditions:

NOTE

Slaves are not involved in the arbitration process.

4.3.9. Clock Synchronization

When two or more masters try to transfer information on the bus at the same time, they must arbitrate and synchronize the SCL clock. All masters generate their own clock to transfer messages. Data is valid only during the high period of SCL clock. Clock synchronization is performed using the wired-AND connection to the SCL signal. When the master transitions the SCL clock to zero, the master starts counting the low time of the SCL clock and transitions the SCL clock signal to one at the beginning of the next clock period. However, if another master is holding the SCL line to 0, then the master goes into a HIGH wait state until the SCL clock line transitions to one.

All masters then count off their high time, and the master with the shortest high time transitions the SCL line to zero. The masters then count out their low time and the one with the longest low time forces the other masters into a HIGH wait state. Therefore, a synchronized SCL clock is generated, which is illustrated in Figure 82. Optionally, slaves may hold the SCL line low to slow down the timing on the I2C bus.

Figure 82. Multi-Master Clock Synchronization

Timing diagram for Multi-Master Clock Synchronization showing CLK_A, CLK_B, and SCL signals.

The diagram illustrates the clock synchronization process. It shows three signals: CLK_A, CLK_B, and SCL. CLK_A and CLK_B are master clocks. SCL is the bus clock. A dashed red box highlights the start of the synchronization. SCL LOW transition Resets all CLKs to start counting their LOW periods. SCL transitions HIGH when all CLKs are in HIGH state. A Wait State is shown where one master is holding SCL low while others wait. Start counting HIGH period is indicated when SCL transitions high.

Timing diagram for Multi-Master Clock Synchronization showing CLK_A, CLK_B, and SCL signals.

4.3.10. Operation Modes

This section provides information on operation modes.

i NOTE

It is important to note that the DW_apb_i2c should only be set to operate as an I2C Master, or I2C Slave, but not both simultaneously. This is achieved by ensuring that IC_CON.IC_SLAVE_DISABLE and IC_CON.MASTER_MODE are never set to zero and one, respectively.

4.3.10.1. Slave Mode Operation

This section discusses slave mode procedures.

4.3.10.1.1. Initial Configuration

To use the DW_apb_i2c as a slave, perform the following steps:

  1. 1. Disable the DW_apb_i2c by writing a '0' to IC_ENABLE.ENABLE.
  2. 2. Write to the IC_SAR register (bits 9:0) to set the slave address. This is the address to which the DW_apb_i2c responds.
  3. 3. Write to the IC_CON register to specify which type of addressing is supported (7-bit or 10-bit by setting bit 3). Enable the DW_apb_i2c in slave-only mode by writing a '0' into bit six ( IC_SLAVE_DISABLE) and a '0' to bit zero ( MASTER_MODE).
i NOTE

Slaves and masters do not have to be programmed with the same type of addressing 7-bit or 10-bit address. For instance, a slave can be programmed with 7-bit addressing and a master with 10-bit addressing, and vice versa.

  1. 1. Enable the DW_apb_i2c by writing a '1' to IC_ENABLE.ENABLE.
i NOTE

Depending on the reset values chosen, steps two and three may not be necessary because the reset values can be configured. For instance, if the device is only going to be a master, there would be no need to set the slave address because you can configure DW_apb_i2c to have the slave disabled after reset and to enable the master after reset. The values stored are static and do not need to be reprogrammed if the DW_apb_i2c is disabled.

⚠ WARNING

It is recommended that the DW_apb_i2c Slave be brought out of reset only when the I2C bus is IDLE. De-asserting the reset when a transfer is ongoing on the bus causes internal synchronization flip-flops used to synchronize SDA and SCL to toggle from a reset value of one to the actual value on the bus. This can result in SDA toggling from one to zero while SCL is one, thereby causing a false START condition to be detected by the DW_apb_i2c Slave. This scenario can also be avoided by configuring the DW_apb_i2c with IC_SLAVE_DISABLE= 1 and MASTER_MODE= 1 so that the Slave interface is disabled after reset. It can then be enabled by programming IC_CON[0]= 0 and IC_CON[6]= 0 after the internal SDA and SCL have synchronized to the value on the bus; this takes approximately six ic_clk cycles after reset de-assertion.

4.3.10.1.2. Slave-Transmitter Operation for a Single Byte

When another I2C master device on the bus addresses the DW_apb_i2c and requests data, the DW_apb_i2c acts as a slave-transmitter and the following steps occur:

  1. 1. The other I2C master device initiates an I2C transfer with an address that matches the slave address in the IC_SAR register of the DW_apb_i2c.
  2. 2. The DW_apb_i2c acknowledges the sent address and recognizes the direction of the transfer to indicate that it is acting as a slave-transmitter.
  3. 3. The DW_apb_i2c asserts the RD_REQ interrupt (bit five of the IC_RAW_INTR_STAT register) and holds the SCL line low. It is in a wait state until software responds. If the RD_REQ interrupt has been masked, due to IC_INTR_MASK.M_RD_REQ being set to zero, then it is recommended that a hardware and/or software timing routine be used to instruct the CPU to perform periodic reads of the IC_RAW_INTR_STAT register.
    1. a. Reads that indicate IC_RAW_INTR_STAT.RD_REQ being set to one must be treated as the equivalent of the RD_REQ interrupt being asserted.
    2. b. Software must then act to satisfy the I2C transfer.
    3. c. The timing interval used should be in the order of 10 times the fastest SCL clock period the DW_apb_i2c can handle. For example, for 400kbps, the timing interval is 25µs.

Note icon NOTE

The value of 10 is recommended here because this is approximately the amount of time required for a single byte of data transferred on the I2C bus.

  1. 1. If there is any data remaining in the Tx FIFO before receiving the read request, then the DW_apb_i2c asserts a TX_ABRT interrupt (bit six of the IC_RAW_INTR_STAT register) to flush the old data from the TX FIFO. If the TX_ABRT interrupt has been masked, due to IC_INTR_MASK.M_TX_ABRT being set to zero, then it is recommended that re-using the timing routine (described in the previous step), or a similar one, be used to read the IC_RAW_INTR_STAT register.

Note icon NOTE

Because the DW_apb_i2c's Tx FIFO is forced into a flushed/reset state whenever a TX_ABRT event occurs, it is necessary for software to release the DW_apb_i2c from this state by reading the IC_CLR_TX_ABRT register before attempting to write into the Tx FIFO. See register IC_RAW_INTR_STAT for more details.

  1. a. Reads that indicate bit six ( R_TX_ABRT ) being set to one must be treated as the equivalent of the TX_ABRT interrupt being asserted.
  2. b. There is no further action required from software.
  3. c. The timing interval used should be similar to that described in the previous step for the IC_RAW_INTR_STAT.RD_REQ register.
    1. 1. Software writes to the IC_DATA_CMD register with the data to be written (by writing a '0' in bit 8).
    2. 2. Software must clear the RD_REQ and TX_ABRT interrupts (bits five and six, respectively) of the IC_RAW_INTR_STAT register before proceeding. If the RD_REQ and/or TX_ABRT interrupts have been masked, then clearing of the IC_RAW_INTR_STAT register will have already been performed when either the R_RD_REQ or R_TX_ABRT bit has been read as one.
    3. 3. The DW_apb_i2c releases the SCL and transmits the byte.
    4. 4. The master may hold the I2C bus by issuing a RESTART condition or release the bus by issuing a STOP condition.
NOTE

Slave-Transmitter Operation for a Single Byte is not applicable in Ultra-Fast Mode as Read transfers are not supported.

4.3.10.1.3. Slave-Receiver Operation for a Single Byte

When another I2C master device on the bus addresses the DW_apb_i2c and is sending data, the DW_apb_i2c acts as a slave-receiver and the following steps occur:

  1. 1. The other I2C master device initiates an I2C transfer with an address that matches the DW_apb_i2c's slave address in the IC_SAR register.
  2. 2. The DW_apb_i2c acknowledges the sent address and recognizes the direction of the transfer to indicate that the DW_apb_i2c is acting as a slave-receiver.
  3. 3. DW_apb_i2c receives the transmitted byte and places it in the receive buffer.
NOTE

If the Rx FIFO is completely filled with data when a byte is pushed, then the DW_apb_i2c slave holds the I2C SCL line low until the Rx FIFO has some space, and then continues with the next read request.

  1. 1. DW_apb_i2c asserts the RX_FULL interrupt IC_RAW_INTR_STAT.RX_FULL . If the RX_FULL interrupt has been masked, due to setting IC_INTR_MASK.M_RX_FULL register to zero or setting IC_TX_TL to a value larger than zero, then it is recommended that a timing routine (described in Section 4.3.10.1.2 ) be implemented for periodic reads of the IC_STATUS register. Reads of the IC_STATUS register, with bit 3 (RFNE) set at one, must then be treated by software as the equivalent of the RX_FULL interrupt being asserted.
  2. 2. Software may read the byte from the IC_DATA_CMD register (bits 7:0).
  3. 3. The other master device may hold the I2C bus by issuing a RESTART condition, or release the bus by issuing a STOP condition.
4.3.10.1.4. Slave-Transfer Operation For Bulk Transfers

In the standard I2C protocol, all transactions are single byte transactions and the programmer responds to a remote master read request by writing one byte into the slave's TX FIFO. When a slave (slave-transmitter) is issued with a read request (RD_REQ) from the remote master (master-receiver), at a minimum there should be at least one entry placed into the slave-transmitter's TX FIFO. DW_apb_i2c is designed to handle more data in the TX FIFO so that subsequent read requests can take that data without raising an interrupt to get more data. Ultimately, this eliminates the possibility of significant latencies being incurred between raising the interrupt for data each time had there been a restriction of having only one entry placed in the TX FIFO. This mode only occurs when DW_apb_i2c is acting as a slave-transmitter. If the remote master acknowledges the data sent by the slave-transmitter and there is no data in the slave's TX FIFO, the DW_apb_i2c holds the I2C SCL line low while it raises the read request interrupt (RD_REQ) and waits for data to be written into the TX FIFO before it can be sent to the remote master.

If the RD_REQ interrupt is masked, due to IC_INTR_STAT.R_RD_REQ set to zero, then it is recommended that a timing routine be used to activate periodic reads of the IC_RAW_INTR_STAT register. Reads of IC_RAW_INTR_STAT that return bit five (RD_REQ) set to one must be treated as the equivalent of the RD_REQ interrupt referred to in this section. This timing routine is similar to that described in Section 4.3.10.1.2 .

The RD_REQ interrupt is raised upon a read request, and like interrupts, must be cleared when exiting the interrupt service handling routine (ISR). The ISR allows you to either write one byte or more than one byte into the Tx FIFO. During the transmission of these bytes to the master, if the master acknowledges the last byte, then the slave must raise the RD_REQ again because the master is requesting for more data. If the programmer knows in advance that the remote master is requesting a packet of 'n' bytes, then when another master addresses DW_apb_i2c and requests data, the Tx FIFO could be written with 'n' bytes and the remote master receives it as a continuous stream of data. For example, the

DW_apb_i2c slave continues to send data to the remote master as long as the remote master is acknowledging the data sent and there is data available in the Tx FIFO. There is no need to hold the SCL line low or to issue RD_REQ again.

If the remote master is to receive 'n' bytes from the DW_apb_i2c but the programmer wrote a number of bytes larger than 'n' to the Tx FIFO, then when the slave finishes sending the requested 'n' bytes, it clears the Tx FIFO and ignores any excess bytes.

The DW_apb_i2c generates a transmit abort (TX_ABRT) event to indicate the clearing of the Tx FIFO in this example. At the time an ACK/NACK is expected, if a NACK is received, then the remote master has all the data it wants. At this time, a flag is raised within the slave's state machine to clear the leftover data in the Tx FIFO. This flag is transferred to the processor bus clock domain where the FIFO exists and the contents of the Tx FIFO is cleared at that time.

4.3.10.2. Master Mode Operation

This section discusses master mode procedures.

4.3.10.2.1. Initial Configuration

To use the DW_apb_i2c as a master perform the following steps:

  1. 1. Disable the DW_apb_i2c by writing zero to IC_ENABLE.ENABLE .
  2. 2. Write to the IC_CON register to set the maximum speed mode supported (bits 2:1) and the desired speed of the DW_apb_i2c master-initiated transfers, either 7-bit or 10-bit addressing (bit 4). Ensure that bit six ( IC_SLAVE_DISABLE ) is written with a '1' and bit zero ( MASTER_MODE ) is written with a '1'.

Note: Slaves and masters do not have to be programmed with the same type of 7-bit or 10-bit address. For instance, a slave can be programmed with 7-bit addressing and a master with 10-bit addressing, and vice versa.

  1. 1. Write to the IC_TAR register the address of the I2C device to be addressed (bits 9:0). This register also indicates whether a General Call or a START BYTE command is going to be performed by I2C.
  2. 2. Enable the DW_apb_i2c by writing a one to IC_ENABLE.ENABLE .
  3. 3. Now write transfer direction and data to be sent to the IC_DATA_CMD register. If the IC_DATA_CMD register is written before the DW_apb_i2c is enabled, the data and commands are lost as the buffers are kept cleared when DW_apb_i2c is disabled. This step generates the START condition and the address byte on the DW_apb_i2c. Once DW_apb_i2c is enabled and there is data in the TX FIFO, DW_apb_i2c starts reading the data.
i NOTE

Depending on the reset values chosen, steps two, three, four, and five may not be necessary because the reset values can be configured. The values stored are static and do not need to be reprogrammed if the DW_apb_i2c is disabled, with the exception of the transfer direction and data.

4.3.10.2.2. Master Transmit and Master Receive

The DW_apb_i2c supports switching back and forth between reading and writing dynamically. To transmit data, write the data to be written to the lower byte of the I2C Rx/Tx Data Buffer and Command Register ( IC_DATA_CMD ). The CMD bit [8] should be written to zero for I2C write operations. Subsequently, a read command may be issued by writing "don't cares" to the lower byte of the IC_DATA_CMD register, and a one should be written to the CMD bit. The DW_apb_i2c master continues to initiate transfers as long as there are commands present in the transmit FIFO. If the transmit FIFO becomes empty the master either inserts a STOP condition after completing the current transfers.

For more details, refer to Section 4.3.7 .

4.3.10.3. Disabling DW_apb_i2c

The register IC_ENABLE_STATUS is added to allow software to unambiguously determine when the hardware has completely shutdown in response to IC_ENABLE.ENABLE being set from one to zero.

Only one register is required to be monitored, as opposed to monitoring two registers ( IC_STATUS and IC_RAW_INTR_STAT) which was a requirement for earlier versions of DW_apb_i2c.

Image: info icon

NOTE

The DW_apb_i2c Master can be disabled only if the current command being processed—when the ic_enable de-assertion occurs—has the STOP bit set to one. When an attempt is made to disable the DW_apb_i2c Master while processing a command without the STOP bit set, the DW_apb_i2c Master continues to remain active, holding the SCL line low until a new command is received in the Tx FIFO. When the DW_apb_i2c Master is processing a command without the STOP bit set, you can issue the ABORT ( IC_ENABLE.ABORT) to relinquish the I2C bus and then disable DW_apb_i2c.

4.3.10.3.1. Procedure

  1. 1. Define a timer interval ( \( t_{i2c\_poll} \) ) equal to the 10 times the signalling period for the highest I2C transfer speed used in the system and supported by DW_apb_i2c. For example, if the highest I2C transfer mode is 400kbps, then this \( t_{i2c\_poll} \) is 25 \( \mu s \) .
  2. 2. Define a maximum time-out parameter, MAX_T_POLL_COUNT, such that if any repeated polling operation exceeds this maximum value, an error is reported.
  3. 3. Execute a blocking thread/process/function that prevents any further I2C master transactions to be started by software, but allows any pending transfers to be completed.

Image: info icon

NOTE

This step can be ignored if DW_apb_i2c is programmed to operate as an I2C slave only.

  1. 1. The variable POLL_COUNT is initialized to zero.
  2. 2. Set bit zero of the IC_ENABLE register to zero.
  3. 3. Read the IC_ENABLE_STATUS register and test the IC_EN bit (bit 0). Increment POLL_COUNT by one. If POLL_COUNT >= MAX_T_POLL_COUNT, exit with the relevant error code.
  4. 4. If IC_ENABLE_STATUS[0] is one, then sleep for \( t_{i2c\_poll} \) and proceed to the previous step. Otherwise, exit with a relevant success code.

4.3.10.4. Aborting I2C Transfers

The ABORT control bit of the IC_ENABLE register allows the software to relinquish the I2C bus before completing the issued transfer commands from the Tx FIFO. In response to an ABORT request, the controller issues the STOP condition over the I2C bus, followed by Tx FIFO flush. Aborting the transfer is allowed only in master mode of operation.

4.3.10.4.1. Procedure

  1. 1. Stop filling the Tx FIFO ( IC_DATA_CMD) with new commands.
  2. 2. When operating in DMA mode, disable the transmit DMA by setting TDMAE to zero.
  3. 3. Set IC_ENABLE.ABORT to one.
  4. 4. Wait for the M_TX_ABORT interrupt.

4.3.11. Spike Suppression

The DW_apb_i2c contains programmable spike suppression logic that match requirements imposed by the I2C Bus Specification for SS/FS modes. This logic is based on counters that monitor the input signals ( SCL and SDA), checking if they remain stable for a predetermined amount of ic_clk cycles before they are sampled internally. There is one separate counter for each signal ( SCL and SDA). The number of ic_clk cycles can be programmed by the user and should be calculated taking into account the frequency of ic_clk and the relevant spike length specification. Each counter is started whenever its input signal changes its value. Depending on the behaviour of the input signal, one of the following scenarios occurs:

The timing diagram in Figure 83 illustrates the behaviour described above.

Figure 83. Spike Suppression Example

Timing diagram for Spike Suppression Example showing Recovery Clocks, SCL, Spike length counter, and Internal filtered SCL.

The diagram shows four signals over time:

Timing diagram for Spike Suppression Example showing Recovery Clocks, SCL, Spike length counter, and Internal filtered SCL.

NOTE

There is a 2-stage synchronizer on the SCL input, but for the sake of simplicity this synchronization delay was not included in the timing diagram in Figure 83 .

The I2C Bus Specification calls for different maximum spike lengths according to the operating mode – 50ns for SS and FS, so this register is required to store the values needed:

This register is 8 bits wide and accessible through the APB interface for read and write purposes; however, they can be written to only when the DW_apb_i2c is disabled. The minimum value that can be programmed into these registers is one; attempting to program a value smaller than one results in the value one being written.

The default value for these registers is based on the value of 100ns for ic_clk period, so should be updated for the clk_sys period in use on RP2040.

NOTE

4.3.12. Fast Mode Plus Operation

In fast mode plus, the DW_apb_i2c allows the fast mode operation to be extended to support speeds up to 1000kbps. To enable the DW_apb_i2c for fast mode plus operation, perform the following steps before initiating any data transfer:

  1. 1. Set ic_clk frequency greater than or equal to 32MHz (refer to Section 4.3.14.2.1 ).
  2. 2. Program the IC_CON register [2:1] = 2'b10 for fast mode or fast mode plus.
  3. 3. Program IC_FS_SCL_LCNT and IC_FS_SCL_HCNT registers to meet the fast mode plus SCL(refer to Section 4.3.14 ).
  4. 4. Program the IC_FS_SPKLEN register to suppress the maximum spike of 50ns.
  5. 5. Program the IC_SDA_SETUP register to meet the minimum data setup time (tSU; DAT).

4.3.13. Bus Clear Feature

DW_apb_i2c supports the bus clear feature that provides graceful recovery of data SDA and clock SCL lines during unlikely events in which either the clock or data line is stuck at LOW.

4.3.13.1. SDA Line Stuck at LOW Recovery

In case of SDA line stuck at LOW, the master performs the following actions to recover as shown in Figure 84 and Figure 85 :

  1. 1. Master sends a maximum of nine clock pulses to recover the bus LOW within those nine clocks.
    • ◦ The number of clock pulses will vary with the number of bits that remain to be sent by the slave. As the maximum number of bits is nine, master sends up to nine clock pulses and allows the slave to recover it.
    • ◦ The master attempts to assert a Logic 1 on the SDA line and check whether SDA is recovered. If the SDA is not recovered, it will continue to send a maximum of nine SCL clocks.
  2. 2. If SDA line is recovered within nine clock pulses then the master will send the STOP to release the bus.
  3. 3. If SDA line is not recovered even after the ninth clock pulse then system needs a hardware reset.

Figure 84. SDA Recovery with 9 SCL Clocks

Timing diagram for SDA recovery with 9 SCL clocks. The diagram shows three signals: Recovery Clocks (0-10), SCL, and SDA. SCL is a periodic square wave. SDA is initially low and then transitions to high. MST_SDA is a signal that drives SCL for 9 clocks to recover SDA stuck at low. A label indicates 'Master drives 9 clocks to recover SDA stuck at low'.

Recovery Clocks 0 1 2 3 4 5 6 7 8 9 10

SCL

SDA

MST_SDA

Master drives 9 clocks to recover SDA stuck at low

Timing diagram for SDA recovery with 9 SCL clocks. The diagram shows three signals: Recovery Clocks (0-10), SCL, and SDA. SCL is a periodic square wave. SDA is initially low and then transitions to high. MST_SDA is a signal that drives SCL for 9 clocks to recover SDA stuck at low. A label indicates 'Master drives 9 clocks to recover SDA stuck at low'.

Figure 85. SDA Recovery with 6 SCL Clocks

Timing diagram for SDA recovery with 6 SCL clocks. The diagram shows three signals: Recovery Clocks (0-7), SCL, and SDA. SCL is a periodic square wave. SDA is initially low and then transitions to high. MST_SDA is a signal that drives SCL for 6 clocks to recover SDA stuck at low. A label indicates 'Master drives 6 clocks to recover SDA stuck at low'.

Recovery Clocks 0 1 2 3 4 5 6 7

SCL

SDA

MST_SDA

Master drives 6 clocks to recover SDA stuck at low

Timing diagram for SDA recovery with 6 SCL clocks. The diagram shows three signals: Recovery Clocks (0-7), SCL, and SDA. SCL is a periodic square wave. SDA is initially low and then transitions to high. MST_SDA is a signal that drives SCL for 6 clocks to recover SDA stuck at low. A label indicates 'Master drives 6 clocks to recover SDA stuck at low'.

4.3.13.2. SCL Line is Stuck at LOW

In the unlikely event (due to an electric failure of a circuit) where the clock (SCL) is stuck to LOW, there is no effective method to overcome this problem but to reset the bus using the hardware reset signal.

4.3.14. IC_CLK Frequency Configuration

When the DW_apb_i2c is configured as a Standard (SS), Fast (FS)/Fast-Mode Plus (FM+), the *CNT registers must be set before any I2C bus transaction can take place in order to ensure proper I/O timing. The *CNT registers are:

i NOTE

The tBUF timing and setup/hold time of START, STOP and RESTART registers uses *HCNT/*LCNT register settings for the corresponding speed mode.

i NOTE

It is not necessary to program any of the *CNT registers if the DW_apb_i2c is enabled to operate only as an I2C slave, since these registers are used only to determine the SCL timing requirements for operation as an I2C master.

Table 449 lists the derivation of I2C timing parameters from the *CNT programming registers.

Table 449. Derivation of I2C Timing Parameters from *CNT Registers

Timing ParameterSymbolStandard SpeedFast Speed / Fast Speed Plus
LOW period of the SCL clocktLOWIC_SS_SCL_LCNTIC_FS_SCL_LCNT
HIGH period of the SCL clocktHIGHIC_SS_SCL_HCNTIC_FS_SCL_HCNT
Setup time for a repeated START conditiontSU;STAIC_SS_SCL_LCNTIC_FS_SCL_HCNT
Hold time (repeated) START condition*tHD;STAIC_SS_SCL_HCNTIC_FS_SCL_HCNT
Setup time for STOP conditiontSU;STOIC_SS_SCL_HCNTIC_FS_SCL_HCNT
Timing ParameterSymbolStandard SpeedFast Speed / Fast Speed Plus
Bus free time between a STOP and a START conditiontBUFIC_SS_SCL_LCNTIC_FS_SCL_LCNT
Spike lengthtSPIC_FS_SPKLENIC_FS_SPKLEN
Data hold timetHD;DATIC_SDA_HOLDIC_SDA_HOLD
Data setup timetSU;DATIC_SDA_SETUPIC_SDA_SETUP

4.3.14.1. Minimum High and Low Counts in SS, FS, and FM+ Modes.

When the DW_apb_i2c operates as an I2C master, in both transmit and receive transfers:

Details regarding the DW_apb_i2c high and low counts are as follows:

i NOTE

The total high time and low time of SCL generated by the DW_apb_i2c master is also influenced by the rise time and fall time of the SCL line, as shown in the illustration and equations in Figure 86. It should be noted that the SCL rise and fall time parameters vary, depending on external factors such as:

These characteristics are beyond the control of the DW_apb_i2c.

Figure 86. Impact of SCL Rise Time and Fall Time on Generated SCL

Timing diagram showing the impact of SCL rise and fall times on the generated SCL signal. The diagram shows two waveforms: ic_clk (clock) and ic_clk_in_a/SCL (SCL signal). The SCL signal is a square wave that is delayed and distorted by the rise and fall times of the ic_clk signal. The diagram labels the SCL rise time, SCL fall time, and the high and low pulse widths. The high pulse width is labeled as HCNT + IC_*_SPKLEN + 7, and the low pulse width is labeled as LCNT + 1. The diagram also includes the following equations: SCL_High_time = [(HCNT + IC_*_SPKLEN + 7) * ic_clk] + SCL_Fall_time and SCL_Low_time = [(LCNT + 1) * ic_clk] - SCL_Fall_time + SCL_Rise_time.

ic_clk

ic_clk_in_a/SCL

SCL rise time

HCNT + IC_*_SPKLEN + 7

SCL fall time

LCNT + 1

SCL rise time

SCL_High_time = [(HCNT + IC_*_SPKLEN + 7) * ic_clk] + SCL_Fall_time

SCL_Low_time = [(LCNT + 1) * ic_clk] - SCL_Fall_time + SCL_Rise_time

Timing diagram showing the impact of SCL rise and fall times on the generated SCL signal. The diagram shows two waveforms: ic_clk (clock) and ic_clk_in_a/SCL (SCL signal). The SCL signal is a square wave that is delayed and distorted by the rise and fall times of the ic_clk signal. The diagram labels the SCL rise time, SCL fall time, and the high and low pulse widths. The high pulse width is labeled as HCNT + IC_*_SPKLEN + 7, and the low pulse width is labeled as LCNT + 1. The diagram also includes the following equations: SCL_High_time = [(HCNT + IC_*_SPKLEN + 7) * ic_clk] + SCL_Fall_time and SCL_Low_time = [(LCNT + 1) * ic_clk] - SCL_Fall_time + SCL_Rise_time.

4.3.14.2. Minimum IC_CLK Frequency

This section describes the minimum ic_clk frequencies that the DW_apb_i2c supports for each speed mode, and the associated high and low count values. In Slave mode, IC_SDA_HOLD (Thd;dat) and IC_SDA_SETUP (Tsu;dat) need to be programmed to satisfy the I2C protocol timing requirements. The following examples are for the case where IC_FS_SPKLEN is programmed to two.

4.3.14.2.1. Standard Mode (SM), Fast Mode (FM), and Fast Mode Plus (FM+)

This section details how to derive a minimum ic_clk value for standard and fast modes of the DW_apb_i2c. Although the following method shows how to do fast mode calculations, you can also use the same method in order to do calculations for standard mode and fast mode plus.

NOTE

The following computations do not consider the SCL_Rise_time and SCL_Fall_time.

Given conditions and calculations for the minimum DW_apb_i2c ic_clk value in fast mode:

Derived equations:

\[ \text{SCL\_PERIOD\_FS} / (\text{IC\_HCNT\_FS} + \text{IC\_LCNT\_FS}) = \text{IC\_CLK\_PERIOD} \]

\[ \text{IC\_LCNT\_FS} \times \text{IC\_CLK\_PERIOD} = \text{MIN\_SCL\_LOWtime\_FS} \]

Combined, the previous equations produce the following:

\[ \text{IC\_LCNT\_FS} \times (\text{SCL\_PERIOD\_FS} / (\text{IC\_LCNT\_FS} + \text{IC\_HCNT\_FS})) = \text{MIN\_SCL\_LOWtime\_FS} \]

Solving for IC_LCNT_FS:

\[ IC\_LCNT\_FS \times (2.5\mu s / (IC\_LCNT\_FS + 14)) = 1.3\mu s \]

The previous equation gives:

\[ IC\_LCNT\_FS = \text{roundup}(15.166) = 16 \]

These calculations produce \( IC\_LCNT\_FS = 16 \) and \( IC\_HCNT\_FS = 14 \) , giving an \( ic\_clk \) value of:

\[ 2.5\mu s / (16 + 14) = 83.3ns = 12MHz \]

Testing these results shows that protocol requirements are satisfied.

Table 450 lists the minimum \( ic\_clk \) values for all modes with high and low count values.

Table 450. \( ic\_clk \) in Relation to High and Low Counts

Speed Mode\( ic\_clk \) freq (MHz)Minimum Value of \( IC\_*_SPKLEN \)SCL Low Time in ' \( ic\_clk \) 'sSCL Low Program ValueSCL Low TimeSCL High Time in ' \( ic\_clk \) 'sSCL High Program ValueSCL High Time
SS2.7113124.7 \( \mu s \)1465.2 \( \mu s \)
FS12.0116151.33 \( \mu s \)1461.16 \( \mu s \)
FM+3221615500ns167500ns

4.3.14.3. Calculating High and Low Counts

The calculations below show how to calculate SCL high and low counts for each speed mode in the DW_apb_i2c. For the calculations to work, the \( ic\_clk \) frequencies used must not be less than the minimum \( ic\_clk \) frequencies specified in Table 450.

The default \( ic\_clk \) period value is set to 100ns, so default SCL high and low count values are calculated for each speed mode based on this clock. These values need updating according to the guidelines below.

The equation to calculate the proper number of \( ic\_clk \) signals required for setting the proper SCL clocks high and low times is as follows:

\[ IC\_xCNT = (\text{ROUNDUP}(\text{MIN\_SCL\_xxxtime} * \text{OSCFREQ}, 0)) \]

MIN_SCL_HIGHTime = Minimum High Period
MIN_SCL_HIGHTime = 4000ns for 100kbps,
600ns for 400kbps,
260ns for 1000kbps,

MIN_SCL_LOWtime = Minimum Low Period
MIN_SCL_LOWtime = 4700ns for 100kbps,

1300ns for 400kbps,
500ns for 1000kbps,

OSCFREQ = ic_clk Clock Frequency (Hz).

For example:

OSCFREQ = 100MHz
I2Cmode = fast, 400kbps
MIN_SCL_HIGHTime = 600ns.
MIN_SCL_LOWtime = 1300ns.

IC_xCNT = (ROUNDUP(MIN_SCL_HIGH_LOWtime*OSCFREQ,0))

IC_HCNT = (ROUNDUP(600ns * 100MHz,0))
IC_HCNTSCL PERIOD = 60
IC_LCNT = (ROUNDUP(1300ns * 100MHz,0))
IC_LCNTSCL PERIOD = 130
Actual MIN_SCL_HIGHTime = 60*(1/100MHz) = 600ns
Actual MIN_SCL_LOWtime = 130*(1/100MHz) = 1300ns

4.3.15. DMA Controller Interface

The DW_apb_i2c has built-in DMA capability; it has a handshaking interface to the DMA Controller to request and control transfers. The APB bus is used to perform the data transfer to or from the DMA. DMA transfers are transferred as single accesses as data rate is relatively low.

4.3.15.1. Enabling the DMA Controller Interface

To enable the DMA Controller interface on the DW_apb_i2c, you must write the DMA Control Register ( IC_DMA_CR ). Writing a one into the TDMAE bit field of IC_DMA_CR register enables the DW_apb_i2c transmit handshaking interface. Writing a one into the RDMAE bit field of the IC_DMA_CR register enables the DW_apb_i2c receive handshaking interface.

4.3.15.2. Overview of Operation

The DMA Controller is programmed with the number of data items (transfer count) that are to be transmitted or received by DW_apb_i2c.

The transfer is broken into single transfers on the bus, each initiated by a request from the DW_apb_i2c.

For example, where the transfer count programmed into the DMA Controller is four. The DMA transfer consists of a series of four single transactions. If the DW_apb_i2c makes a transmit request to this channel, a single data item is written to the DW_apb_i2c TX FIFO. Similarly, if the DW_apb_i2c makes a receive request to this channel, a single data item is read from the DW_apb_i2c RX FIFO. Four separate requests must be made to this DMA channel before all four data items are written or read.

4.3.15.3. Watermark Levels

In DW_apb_i2c the registers for setting watermarks to allow DMA bursts do not need be set to anything other than their reset value. Specifically IC_DMA_TDLR and IC_DMA_RDLR can be left at reset values of zero. This is because only single transfers are needed due to the low bandwidth of I2C relative to system bandwidth, and also the DMA controller

normally has highest priority on the system bus so will generally complete very quickly.

4.3.16. Operation of Interrupt Registers

Table 451 lists the operation of the DW_apb_i2c interrupt registers and how they are set and cleared. Some bits are set by hardware and cleared by software, whereas other bits are set and cleared by hardware.

Table 451. Clearing and Setting of Interrupt Registers

Interrupt Bit FieldsSet by Hardware/Cleared by SoftwareSet and Cleared by Hardware
RESTART_DETYN
GEN_CALLYN
START_DETYN
STOP_DETYN
ACTIVITYYN
RX_DONEYN
TX_ABRTYN
RD_REQYN
TX_EMPTYNY
TX_OVERYN
RX_FULLNY
RX_OVERYN
RX_UNDERYN

4.3.17. List of Registers

The I2C0 and I2C1 registers start at base addresses of 0x40044000 and 0x40048000 respectively (defined as I2C0_BASE and I2C1_BASE in SDK).

NOTE

You may see references to configuration constants in the I2C register descriptions; these are fixed values, set at hardware design time. A full list of their values can be found in https://github.com/raspberrypi/pico-sdk/blob/master/src/rp2040/hardware_regs/include/hardware/regs/i2c.h

Table 452. List of I2C registers

OffsetNameInfo
0x00IC_CONI2C Control Register
0x04IC_TARI2C Target Address Register
0x08IC_SARI2C Slave Address Register
0x10IC_DATA_CMDI2C Rx/Tx Data Buffer and Command Register
0x14IC_SS_SCL_HCNTStandard Speed I2C Clock SCL High Count Register
0x18IC_SS_SCL_LCNTStandard Speed I2C Clock SCL Low Count Register
0x1cIC_FS_SCL_HCNTFast Mode or Fast Mode Plus I2C Clock SCL High Count Register
0x20IC_FS_SCL_LCNTFast Mode or Fast Mode Plus I2C Clock SCL Low Count Register
OffsetNameInfo
0x2cIC_INTR_STATI2C Interrupt Status Register
0x30IC_INTR_MASKI2C Interrupt Mask Register
0x34IC_RAW_INTR_STATI2C Raw Interrupt Status Register
0x38IC_RX_TLI2C Receive FIFO Threshold Register
0x3cIC_TX_TLI2C Transmit FIFO Threshold Register
0x40IC_CLR_INTRClear Combined and Individual Interrupt Register
0x44IC_CLR_RX_UNDERClear RX_UNDER Interrupt Register
0x48IC_CLR_RX_OVERClear RX_OVER Interrupt Register
0x4cIC_CLR_TX_OVERClear TX_OVER Interrupt Register
0x50IC_CLR_RD_REQClear RD_REQ Interrupt Register
0x54IC_CLR_TX_ABRTClear TX_ABRT Interrupt Register
0x58IC_CLR_RX_DONEClear RX_DONE Interrupt Register
0x5cIC_CLR_ACTIVITYClear ACTIVITY Interrupt Register
0x60IC_CLR_STOP_DETClear STOP_DET Interrupt Register
0x64IC_CLR_START_DETClear START_DET Interrupt Register
0x68IC_CLR_GEN_CALLClear GEN_CALL Interrupt Register
0x6cIC_ENABLEI2C ENABLE Register
0x70IC_STATUSI2C STATUS Register
0x74IC_TXFLRI2C Transmit FIFO Level Register
0x78IC_RXFLRI2C Receive FIFO Level Register
0x7cIC_SDA_HOLDI2C SDA Hold Time Length Register
0x80IC_TX_ABRT_SOURCEI2C Transmit Abort Source Register
0x84IC_SLV_DATA_NACK_ONLYGenerate Slave Data NACK Register
0x88IC_DMA_CRDMA Control Register
0x8cIC_DMA_TDLRDMA Transmit Data Level Register
0x90IC_DMA_RDLRDMA Transmit Data Level Register
0x94IC_SDA_SETUPI2C SDA Setup Register
0x98IC_ACK_GENERAL_CALLI2C ACK General Call Register
0x9cIC_ENABLE_STATUSI2C Enable Status Register
0xa0IC_FS_SPKLENI2C SS, FS or FM+ spike suppression limit
0xa8IC_CLR_RESTART_DETClear RESTART_DET Interrupt Register
0xf4IC_COMP_PARAM_1Component Parameter Register 1
0xf8IC_COMP_VERSIONI2C Component Version Register
0xfcIC_COMP_TYPEI2C Component Type Register

I2C: IC_CON Register

Offset: 0x00

Description

I2C Control Register. This register can be written only when the DW_apb_i2c is disabled, which corresponds to the IC_ENABLE[0] register being set to 0. Writes at other times have no effect.

Read/Write Access: - bit 10 is read only. - bit 11 is read only - bit 16 is read only - bit 17 is read only - bits 18 and 19 are read only.

Table 453. IC_CON Register

BitsDescriptionTypeReset
31:11Reserved.--
10STOP_DET_IF_MASTER_ACTIVE : Master issues the STOP_DET interrupt irrespective of whether master is active or notRO0x0
9RX_FIFO_FULL_HLD_CTRL : This bit controls whether DW_apb_i2c should hold the bus when the Rx FIFO is physically full to its RX_BUFFER_DEPTH, as described in the IC_RX_FULL_HLD_BUS_EN parameter.

Reset value: 0x0.
RW0x0
Enumerated values:
0x0 → DISABLED: Overflow when RX_FIFO is full
0x1 → ENABLED: Hold bus when RX_FIFO is full
8TX_EMPTY_CTRL : This bit controls the generation of the TX_EMPTY interrupt, as described in the IC_RAW_INTR_STAT register.

Reset value: 0x0.
RW0x0
Enumerated values:
0x0 → DISABLED: Default behaviour of TX_EMPTY interrupt
0x1 → ENABLED: Controlled generation of TX_EMPTY interrupt
7STOP_DET_IFADDRESSED : In slave mode: - 1'b1: issues the STOP_DET interrupt only when it is addressed. - 1'b0: issues the STOP_DET irrespective of whether it's addressed or not. Reset value: 0x0

NOTE: During a general call address, this slave does not issue the STOP_DET interrupt if STOP_DET_IF_ADDRESSED = 1'b1, even if the slave responds to the general call address by generating ACK. The STOP_DET interrupt is generated only when the transmitted address matches the slave address (SAR).
RW0x0
Enumerated values:
0x0 → DISABLED: slave issues STOP_DET intr always
0x1 → ENABLED: slave issues STOP_DET intr only if addressed
6IC_SLAVE_DISABLE : This bit controls whether I2C has its slave disabled, which means once the preseln signal is applied, then this bit is set and the slave is disabled.

If this bit is set (slave is disabled), DW_apb_i2c functions only as a master and does not perform any action that requires a slave.

NOTE: Software should ensure that if this bit is written with 0, then bit 0 should also be written with a 0.
RW0x1
BitsDescriptionTypeReset
Enumerated values:
0x0 → SLAVE_ENABLED: Slave mode is enabled
0x1 → SLAVE_DISABLED: Slave mode is disabled
5

IC_RESTART_EN: Determines whether RESTART conditions may be sent when acting as a master. Some older slaves do not support handling RESTART conditions; however, RESTART conditions are used in several DW_apb_i2c operations. When RESTART is disabled, the master is prohibited from performing the following functions: - Sending a START BYTE - Performing any high-speed mode operation - High-speed mode operation - Performing direction changes in combined format mode - Performing a read operation with a 10-bit address By replacing RESTART condition followed by a STOP and a subsequent START condition, split operations are broken down into multiple DW_apb_i2c transfers. If the above operations are performed, it will result in setting bit 6 (TX_ABRT) of the IC_RAW_INTR_STAT register.

Reset value: ENABLED

RW0x1
Enumerated values:
0x0 → DISABLED: Master restart disabled
0x1 → ENABLED: Master restart enabled
4

IC_10BITADDR_MASTER: Controls whether the DW_apb_i2c starts its transfers in 7- or 10-bit addressing mode when acting as a master. - 0: 7-bit addressing - 1: 10-bit addressing

RW0x0
Enumerated values:
0x0 → ADDR_7BITS: Master 7Bit addressing mode
0x1 → ADDR_10BITS: Master 10Bit addressing mode
3

IC_10BITADDR_SLAVE: When acting as a slave, this bit controls whether the DW_apb_i2c responds to 7- or 10-bit addresses. - 0: 7-bit addressing. The DW_apb_i2c ignores transactions that involve 10-bit addressing; for 7-bit addressing, only the lower 7 bits of the IC_SAR register are compared. - 1: 10-bit addressing. The DW_apb_i2c responds to only 10-bit addressing transfers that match the full 10 bits of the IC_SAR register.

RW0x0
Enumerated values:
0x0 → ADDR_7BITS: Slave 7Bit addressing
0x1 → ADDR_10BITS: Slave 10Bit addressing
BitsDescriptionTypeReset
2:1

SPEED: These bits control at which speed the DW_apb_i2c operates; its setting is relevant only if one is operating the DW_apb_i2c in master mode. Hardware protects against illegal values being programmed by software. These bits must be programmed appropriately for slave mode also, as it is used to capture correct value of spike filter as per the speed mode.

This register should be programmed only with a value in the range of 1 to IC_MAX_SPEED_MODE; otherwise, hardware updates this register with the value of IC_MAX_SPEED_MODE.

1: standard mode (100 kbit/s)

2: fast mode (<=400 kbit/s) or fast mode plus (<=1000Kbit/s)

3: high speed mode (3.4 Mbit/s)

Note: This field is not applicable when IC_ULTRA_FAST_MODE=1

RW0x2
Enumerated values:
0x1 → STANDARD: Standard Speed mode of operation
0x2 → FAST: Fast or Fast Plus mode of operation
0x3 → HIGH: High Speed mode of operation
0

MASTER_MODE: This bit controls whether the DW_apb_i2c master is enabled.

NOTE: Software should ensure that if this bit is written with '1' then bit 6 should also be written with a '1'.

RW0x1
Enumerated values:
0x0 → DISABLED: Master mode is disabled
0x1 → ENABLED: Master mode is enabled

I2C: IC_TAR Register

Offset: 0x04

Description

I2C Target Address Register

This register is 12 bits wide, and bits 31:12 are reserved. This register can be written to only when IC_ENABLE[0] is set to 0.

Note: If the software or application is aware that the DW_apb_i2c is not using the TAR address for the pending commands in the Tx FIFO, then it is possible to update the TAR address even while the Tx FIFO has entries (IC_STATUS[2]= 0). - It is not necessary to perform any write to this register if DW_apb_i2c is enabled as an I2C slave only.

Table 454. IC_TAR Register

BitsDescriptionTypeReset
31:12Reserved.--
11

SPECIAL: This bit indicates whether software performs a Device-ID or General Call or START BYTE command. - 0: ignore bit 10 GC_OR_START and use IC_TAR normally - 1: perform special I2C command as specified in Device_ID or GC_OR_START bit Reset value: 0x0

RW0x0
BitsDescriptionTypeReset
Enumerated values:
0x0 → DISABLED: Disables programming of GENERAL_CALL or START_BYTE transmission
0x1 → ENABLED: Enables programming of GENERAL_CALL or START_BYTE transmission
10GC_OR_START: If bit 11 (SPECIAL) is set to 1 and bit 13(Device-ID) is set to 0, then this bit indicates whether a General Call or START byte command is to be performed by the DW_apb_i2c. - 0: General Call Address - after issuing a General Call, only writes may be performed. Attempting to issue a read command results in setting bit 6 (TX_ABORT) of the IC_RAW_INTR_STAT register. The DW_apb_i2c remains in General Call mode until the SPECIAL bit value (bit 11) is cleared. - 1: START BYTE Reset value: 0x0RW0x0
Enumerated values:
0x0 → GENERAL_CALL: GENERAL_CALL byte transmission
0x1 → START_BYTE: START byte transmission
9:0IC_TAR: This is the target address for any master transaction. When transmitting a General Call, these bits are ignored. To generate a START BYTE, the CPU needs to write only once into these bits.

If the IC_TAR and IC_SAR are the same, loopback exists but the FIFOs are shared between master and slave, so full loopback is not feasible. Only one direction loopback mode is supported (simplex), not duplex. A master cannot transmit to itself; it can transmit to only a slave.
RW0x055

I2C: IC_SAR Register

Offset: 0x08

Description

I2C Slave Address Register

Table 455. IC_SAR Register

BitsDescriptionTypeReset
31:10Reserved.--
9:0IC_SAR: The IC_SAR holds the slave address when the I2C is operating as a slave. For 7-bit addressing, only IC_SAR[6:0] is used.

This register can be written only when the I2C interface is disabled, which corresponds to the IC_ENABLE[0] register being set to 0. Writes at other times have no effect.

Note: The default values cannot be any of the reserved address locations: that is, 0x00 to 0x07, or 0x78 to 0x7f. The correct operation of the device is not guaranteed if you program the IC_SAR or IC_TAR to a reserved value. Refer to Table 448 for a complete list of these reserved values.
RW0x055

I2C: IC_DATA_CMD Register

Offset: 0x10

Description

I2C Rx/Tx Data Buffer and Command Register; this is the register the CPU writes to when filling the TX FIFO and the CPU reads from when retrieving bytes from RX FIFO.

The size of the register changes as follows:

Write: - 11 bits when IC_EMPTYFIFO_HOLD_MASTER_EN=1 - 9 bits when IC_EMPTYFIFO_HOLD_MASTER_EN=0 Read: - 12 bits when IC_FIRST_DATA_BYTE_STATUS = 1 - 8 bits when IC_FIRST_DATA_BYTE_STATUS = 0 Note: In order for the DW_apb_i2c to continue acknowledging reads, a read command should be written for every byte that is to be received; otherwise the DW_apb_i2c will stop acknowledging.

Table 456.
IC_DATA_CMD
Register

BitsDescriptionTypeReset
31:12Reserved.--
11

FIRST_DATA_BYTE: Indicates the first data byte received after the address phase for receive transfer in Master receiver or Slave receiver mode.

Reset value : 0x0

NOTE: In case of APB_DATA_WIDTH=8,

1. The user has to perform two APB Reads to IC_DATA_CMD in order to get status on 11 bit.

2. In order to read the 11 bit, the user has to perform the first data byte read [7:0] (offset 0x10) and then perform the second read [15:8] (offset 0x11) in order to know the status of 11 bit (whether the data received in previous read is a first data byte or not).

3. The 11th bit is an optional read field, user can ignore 2nd byte read [15:8] (offset 0x11) if not interested in FIRST_DATA_BYTE status.

RO0x0
Enumerated values:
0x0 → INACTIVE: Sequential data byte received
0x1 → ACTIVE: Non sequential data byte received
10

RESTART: This bit controls whether a RESTART is issued before the byte is sent or received.

1 - If IC_RESTART_EN is 1, a RESTART is issued before the data is sent/received (according to the value of CMD), regardless of whether or not the transfer direction is changing from the previous command; if IC_RESTART_EN is 0, a STOP followed by a START is issued instead.

0 - If IC_RESTART_EN is 1, a RESTART is issued only if the transfer direction is changing from the previous command; if IC_RESTART_EN is 0, a STOP followed by a START is issued instead.

Reset value: 0x0

SC0x0
Enumerated values:
0x0 → DISABLE: Don't Issue RESTART before this command
0x1 → ENABLE: Issue RESTART before this command
BitsDescriptionTypeReset
9

STOP: This bit controls whether a STOP is issued after the byte is sent or received.

- 1 - STOP is issued after this byte, regardless of whether or not the Tx FIFO is empty. If the Tx FIFO is not empty, the master immediately tries to start a new transfer by issuing a START and arbitrating for the bus. - 0 - STOP is not issued after this byte, regardless of whether or not the Tx FIFO is empty. If the Tx FIFO is not empty, the master continues the current transfer by sending/receiving data bytes according to the value of the CMD bit. If the Tx FIFO is empty, the master holds the SCL line low and stalls the bus until a new command is available in the Tx FIFO. Reset value: 0x0

SC0x0
Enumerated values:
0x0 → DISABLE: Don't Issue STOP after this command
0x1 → ENABLE: Issue STOP after this command
8

CMD: This bit controls whether a read or a write is performed. This bit does not control the direction when the DW_apb_i2con acts as a slave. It controls only the direction when it acts as a master.

When a command is entered in the TX FIFO, this bit distinguishes the write and read commands. In slave-receiver mode, this bit is a 'don't care' because writes to this register are not required. In slave-transmitter mode, a '0' indicates that the data in IC_DATA_CMD is to be transmitted.

When programming this bit, you should remember the following: attempting to perform a read operation after a General Call command has been sent results in a TX_ABRT interrupt (bit 6 of the IC_RAW_INTR_STAT register), unless bit 11 (SPECIAL) in the IC_TAR register has been cleared. If a '1' is written to this bit after receiving a RD_REQ interrupt, then a TX_ABRT interrupt occurs.

Reset value: 0x0

SC0x0
Enumerated values:
0x0 → WRITE: Master Write Command
0x1 → READ: Master Read Command
7:0

DAT: This register contains the data to be transmitted or received on the I2C bus. If you are writing to this register and want to perform a read, bits 7:0 (DAT) are ignored by the DW_apb_i2c. However, when you read this register, these bits return the value of data received on the DW_apb_i2c interface.

Reset value: 0x0

RW0x00

I2C: IC_SS_SCL_HCNT Register

Offset: 0x14

Description

Standard Speed I2C Clock SCL High Count Register

Table 457.
IC_SS_SCL_HCNT
Register

BitsDescriptionTypeReset
31:16Reserved.--
BitsDescriptionTypeReset
15:0

IC_SS_SCL_HCNT: This register must be set before any I2C bus transaction can take place to ensure proper I/O timing. This register sets the SCL clock high-period count for standard speed. For more information, refer to 'IC_CLK Frequency Configuration'.

This register can be written only when the I2C interface is disabled which corresponds to the IC_ENABLE[0] register being set to 0. Writes at other times have no effect.

The minimum valid value is 6; hardware prevents values less than this being written, and if attempted results in 6 being set. For designs with APB_DATA_WIDTH = 8, the order of programming is important to ensure the correct operation of the DW_apb_i2c. The lower byte must be programmed first. Then the upper byte is programmed.

NOTE: This register must not be programmed to a value higher than 65525, because DW_apb_i2c uses a 16-bit counter to flag an I2C bus idle condition when this counter reaches a value of IC_SS_SCL_HCNT + 10.

RW0x0028

I2C: IC_SS_SCL_LCNT Register

Offset: 0x18

Description

Standard Speed I2C Clock SCL Low Count Register

Table 458.
IC_SS_SCL_LCNT
Register

BitsDescriptionTypeReset
31:16Reserved.--
15:0

IC_SS_SCL_LCNT: This register must be set before any I2C bus transaction can take place to ensure proper I/O timing. This register sets the SCL clock low period count for standard speed. For more information, refer to 'IC_CLK Frequency Configuration'.

This register can be written only when the I2C interface is disabled which corresponds to the IC_ENABLE[0] register being set to 0. Writes at other times have no effect.

The minimum valid value is 8; hardware prevents values less than this being written, and if attempted, results in 8 being set. For designs with APB_DATA_WIDTH = 8, the order of programming is important to ensure the correct operation of DW_apb_i2c. The lower byte must be programmed first, and then the upper byte is programmed.

RW0x002f

I2C: IC_FS_SCL_HCNT Register

Offset: 0x1c

Description

Fast Mode or Fast Mode Plus I2C Clock SCL High Count Register

Table 459.
IC_FS_SCL_HCNT
Register

BitsDescriptionTypeReset
31:16Reserved.--
BitsDescriptionTypeReset
15:0

IC_FS_SCL_HCNT: This register must be set before any I2C bus transaction can take place to ensure proper I/O timing. This register sets the SCL clock high-period count for fast mode or fast mode plus. It is used in high-speed mode to send the Master Code and START BYTE or General CALL. For more information, refer to 'IC_CLK Frequency Configuration'.

This register goes away and becomes read-only returning 0s if IC_MAX_SPEED_MODE = standard. This register can be written only when the I2C interface is disabled, which corresponds to the IC_ENABLE[0] register being set to 0. Writes at other times have no effect.

The minimum valid value is 6; hardware prevents values less than this being written, and if attempted results in 6 being set. For designs with APB_DATA_WIDTH == 8 the order of programming is important to ensure the correct operation of the DW_apb_i2c. The lower byte must be programmed first. Then the upper byte is programmed.

RW0x0006

I2C: IC_FS_SCL_LCNT Register

Offset: 0x20

Description

Fast Mode or Fast Mode Plus I2C Clock SCL Low Count Register

Table 460.
IC_FS_SCL_LCNT
Register

BitsDescriptionTypeReset
31:16Reserved.--
15:0

IC_FS_SCL_LCNT: This register must be set before any I2C bus transaction can take place to ensure proper I/O timing. This register sets the SCL clock low period count for fast speed. It is used in high-speed mode to send the Master Code and START BYTE or General CALL. For more information, refer to 'IC_CLK Frequency Configuration'.

This register goes away and becomes read-only returning 0s if IC_MAX_SPEED_MODE = standard.

This register can be written only when the I2C interface is disabled, which corresponds to the IC_ENABLE[0] register being set to 0. Writes at other times have no effect.

The minimum valid value is 8; hardware prevents values less than this being written, and if attempted results in 8 being set. For designs with APB_DATA_WIDTH = 8 the order of programming is important to ensure the correct operation of the DW_apb_i2c. The lower byte must be programmed first. Then the upper byte is programmed. If the value is less than 8 then the count value gets changed to 8.

RW0x000d

I2C: IC_INTR_STAT Register

Offset: 0x2c

Description

I2C Interrupt Status Register

Each bit in this register has a corresponding mask bit in the IC_INTR_MASK register. These bits are cleared by reading the matching interrupt clear register. The unmasked raw versions of these bits are available in the IC_RAW_INTR_STAT

register.

Table 461.
IC_INTR_STAT
Register

BitsDescriptionTypeReset
31:13Reserved.--
12R_RESTART_DET : See IC_RAW_INTR_STAT for a detailed description of R_RESTART_DET bit.

Reset value: 0x0
RO0x0
Enumerated values:
0x0 → INACTIVE: R_RESTART_DET interrupt is inactive
0x1 → ACTIVE: R_RESTART_DET interrupt is active
11R_GEN_CALL : See IC_RAW_INTR_STAT for a detailed description of R_GEN_CALL bit.

Reset value: 0x0
RO0x0
Enumerated values:
0x0 → INACTIVE: R_GEN_CALL interrupt is inactive
0x1 → ACTIVE: R_GEN_CALL interrupt is active
10R_START_DET : See IC_RAW_INTR_STAT for a detailed description of R_START_DET bit.

Reset value: 0x0
RO0x0
Enumerated values:
0x0 → INACTIVE: R_START_DET interrupt is inactive
0x1 → ACTIVE: R_START_DET interrupt is active
9R_STOP_DET : See IC_RAW_INTR_STAT for a detailed description of R_STOP_DET bit.

Reset value: 0x0
RO0x0
Enumerated values:
0x0 → INACTIVE: R_STOP_DET interrupt is inactive
0x1 → ACTIVE: R_STOP_DET interrupt is active
8R_ACTIVITY : See IC_RAW_INTR_STAT for a detailed description of R_ACTIVITY bit.

Reset value: 0x0
RO0x0
Enumerated values:
0x0 → INACTIVE: R_ACTIVITY interrupt is inactive
0x1 → ACTIVE: R_ACTIVITY interrupt is active
7R_RX_DONE : See IC_RAW_INTR_STAT for a detailed description of R_RX_DONE bit.

Reset value: 0x0
RO0x0
Enumerated values:
BitsDescriptionTypeReset
0x0 → INACTIVE: R_RX_DONE interrupt is inactive
0x1 → ACTIVE: R_RX_DONE interrupt is active
6R_TX_ABRT : See IC_RAW_INTR_STAT for a detailed description of R_TX_ABRT bit.

Reset value: 0x0
RO0x0
Enumerated values:
0x0 → INACTIVE: R_TX_ABRT interrupt is inactive
0x1 → ACTIVE: R_TX_ABRT interrupt is active
5R_RD_REQ : See IC_RAW_INTR_STAT for a detailed description of R_RD_REQ bit.

Reset value: 0x0
RO0x0
Enumerated values:
0x0 → INACTIVE: R_RD_REQ interrupt is inactive
0x1 → ACTIVE: R_RD_REQ interrupt is active
4R_TX_EMPTY : See IC_RAW_INTR_STAT for a detailed description of R_TX_EMPTY bit.

Reset value: 0x0
RO0x0
Enumerated values:
0x0 → INACTIVE: R_TX_EMPTY interrupt is inactive
0x1 → ACTIVE: R_TX_EMPTY interrupt is active
3R_TX_OVER : See IC_RAW_INTR_STAT for a detailed description of R_TX_OVER bit.

Reset value: 0x0
RO0x0
Enumerated values:
0x0 → INACTIVE: R_TX_OVER interrupt is inactive
0x1 → ACTIVE: R_TX_OVER interrupt is active
2R_RX_FULL : See IC_RAW_INTR_STAT for a detailed description of R_RX_FULL bit.

Reset value: 0x0
RO0x0
Enumerated values:
0x0 → INACTIVE: R_RX_FULL interrupt is inactive
0x1 → ACTIVE: R_RX_FULL interrupt is active
1R_RX_OVER : See IC_RAW_INTR_STAT for a detailed description of R_RX_OVER bit.

Reset value: 0x0
RO0x0
Enumerated values:
BitsDescriptionTypeReset
0x0 → INACTIVE: R_RX_OVER interrupt is inactive
0x1 → ACTIVE: R_RX_OVER interrupt is active
0R_RX_UNDER : See IC_RAW_INTR_STAT for a detailed description of R_RX_UNDER bit.

Reset value: 0x0
RO0x0
Enumerated values:
0x0 → INACTIVE: RX_UNDER interrupt is inactive
0x1 → ACTIVE: RX_UNDER interrupt is active

I2C: IC_INTR_MASK Register

Offset: 0x30

Description

I2C Interrupt Mask Register.

These bits mask their corresponding interrupt status bits. This register is active low; a value of 0 masks the interrupt, whereas a value of 1 unmask the interrupt.

Table 462.
IC_INTR_MASK
Register

BitsDescriptionTypeReset
31:13Reserved.--
12M_RESTART_DET : This bit masks the R_RESTART_DET interrupt in IC_INTR_STAT register.

Reset value: 0x0
RW0x0
Enumerated values:
0x0 → ENABLED: RESTART_DET interrupt is masked
0x1 → DISABLED: RESTART_DET interrupt is unmasked
11M_GEN_CALL : This bit masks the R_GEN_CALL interrupt in IC_INTR_STAT register.

Reset value: 0x1
RW0x1
Enumerated values:
0x0 → ENABLED: GEN_CALL interrupt is masked
0x1 → DISABLED: GEN_CALL interrupt is unmasked
10M_START_DET : This bit masks the R_START_DET interrupt in IC_INTR_STAT register.

Reset value: 0x0
RW0x0
Enumerated values:
0x0 → ENABLED: START_DET interrupt is masked
0x1 → DISABLED: START_DET interrupt is unmasked
BitsDescriptionTypeReset
9M_STOP_DET: This bit masks the R_STOP_DET interrupt in IC_INTR_STAT register.

Reset value: 0x0
RW0x0
Enumerated values:
0x0 → ENABLED: STOP_DET interrupt is masked
0x1 → DISABLED: STOP_DET interrupt is unmasked
8M_ACTIVITY: This bit masks the R_ACTIVITY interrupt in IC_INTR_STAT register.

Reset value: 0x0
RW0x0
Enumerated values:
0x0 → ENABLED: ACTIVITY interrupt is masked
0x1 → DISABLED: ACTIVITY interrupt is unmasked
7M_RX_DONE: This bit masks the R_RX_DONE interrupt in IC_INTR_STAT register.

Reset value: 0x1
RW0x1
Enumerated values:
0x0 → ENABLED: RX_DONE interrupt is masked
0x1 → DISABLED: RX_DONE interrupt is unmasked
6M_TX_ABRT: This bit masks the R_TX_ABRT interrupt in IC_INTR_STAT register.

Reset value: 0x1
RW0x1
Enumerated values:
0x0 → ENABLED: TX_ABORT interrupt is masked
0x1 → DISABLED: TX_ABORT interrupt is unmasked
5M_RD_REQ: This bit masks the R_RD_REQ interrupt in IC_INTR_STAT register.

Reset value: 0x1
RW0x1
Enumerated values:
0x0 → ENABLED: RD_REQ interrupt is masked
0x1 → DISABLED: RD_REQ interrupt is unmasked
4M_TX_EMPTY: This bit masks the R_TX_EMPTY interrupt in IC_INTR_STAT register.

Reset value: 0x1
RW0x1
Enumerated values:
0x0 → ENABLED: TX_EMPTY interrupt is masked
0x1 → DISABLED: TX_EMPTY interrupt is unmasked
BitsDescriptionTypeReset
3M_TX_OVER : This bit masks the R_TX_OVER interrupt in IC_INTR_STAT register.

Reset value: 0x1

Enumerated values:

0x0 → ENABLED: TX_OVER interrupt is masked

0x1 → DISABLED: TX_OVER interrupt is unmasked
RW0x1
2M_RX_FULL : This bit masks the R_RX_FULL interrupt in IC_INTR_STAT register.

Reset value: 0x1

Enumerated values:

0x0 → ENABLED: RX_FULL interrupt is masked

0x1 → DISABLED: RX_FULL interrupt is unmasked
RW0x1
1M_RX_OVER : This bit masks the R_RX_OVER interrupt in IC_INTR_STAT register.

Reset value: 0x1

Enumerated values:

0x0 → ENABLED: RX_OVER interrupt is masked

0x1 → DISABLED: RX_OVER interrupt is unmasked
RW0x1
0M_RX_UNDER : This bit masks the R_RX_UNDER interrupt in IC_INTR_STAT register.

Reset value: 0x1

Enumerated values:

0x0 → ENABLED: RX_UNDER interrupt is masked

0x1 → DISABLED: RX_UNDER interrupt is unmasked
RW0x1

I2C: IC_RAW_INTR_STAT Register

Offset: 0x34

Description

I2C Raw Interrupt Status Register

Unlike the IC_INTR_STAT register, these bits are not masked so they always show the true status of the DW_apb_i2c.

Table 463.
IC_RAW_INTR_STAT
Register

BitsDescriptionTypeReset
31:13Reserved.--
BitsDescriptionTypeReset
12

RESTART_DET: Indicates whether a RESTART condition has occurred on the I2C interface when DW_apb_i2c is operating in Slave mode and the slave is being addressed. Enabled only when IC_SLV_RESTART_DET_EN=1.

Note: However, in high-speed mode or during a START BYTE transfer, the RESTART comes before the address field as per the I2C protocol. In this case, the slave is not the addressed slave when the RESTART is issued, therefore DW_apb_i2c does not generate the RESTART_DET interrupt.

Reset value: 0x0

RO0x0
Enumerated values:
0x0 → INACTIVE: RESTART_DET interrupt is inactive
0x1 → ACTIVE: RESTART_DET interrupt is active
11

GEN_CALL: Set only when a General Call address is received and it is acknowledged. It stays set until it is cleared either by disabling DW_apb_i2c or when the CPU reads bit 0 of the IC_CLR_GEN_CALL register. DW_apb_i2c stores the received data in the Rx buffer.

Reset value: 0x0

RO0x0
Enumerated values:
0x0 → INACTIVE: GEN_CALL interrupt is inactive
0x1 → ACTIVE: GEN_CALL interrupt is active
10

START_DET: Indicates whether a START or RESTART condition has occurred on the I2C interface regardless of whether DW_apb_i2c is operating in slave or master mode.

Reset value: 0x0

RO0x0
Enumerated values:
0x0 → INACTIVE: START_DET interrupt is inactive
0x1 → ACTIVE: START_DET interrupt is active
9

STOP_DET: Indicates whether a STOP condition has occurred on the I2C interface regardless of whether DW_apb_i2c is operating in slave or master mode.

In Slave Mode: - If IC_CON[7]=1'b1 (STOP_DET_IFADDRESSED), the STOP_DET interrupt will be issued only if slave is addressed. Note: During a general call address, this slave does not issue a STOP_DET interrupt if STOP_DET_IF_ADDRESSED=1'b1, even if the slave responds to the general call address by generating ACK. The STOP_DET interrupt is generated only when the transmitted address matches the slave address (SAR). - If IC_CON[7]=1'b0 (STOP_DET_IFADDRESSED), the STOP_DET interrupt is issued irrespective of whether it is being addressed. In Master Mode: - If IC_CON[10]=1'b1 (STOP_DET_IF_MASTER_ACTIVE), the STOP_DET interrupt will be issued only if Master is active. - If IC_CON[10]=1'b0 (STOP_DET_IFADDRESSED), the STOP_DET interrupt will be issued irrespective of whether master is active or not. Reset value: 0x0

RO0x0
Enumerated values:
BitsDescriptionTypeReset
0x0 → INACTIVE: STOP_DET interrupt is inactive
0x1 → ACTIVE: STOP_DET interrupt is active
8

ACTIVITY: This bit captures DW_apb_i2c activity and stays set until it is cleared. There are four ways to clear it: - Disabling the DW_apb_i2c - Reading the IC_CLR_ACTIVITY register - Reading the IC_CLR_INTR register - System reset Once this bit is set, it stays set unless one of the four methods is used to clear it. Even if the DW_apb_i2c module is idle, this bit remains set until cleared, indicating that there was activity on the bus.

Reset value: 0x0

RO0x0
Enumerated values:
0x0 → INACTIVE: RAW_INTR_ACTIVITY interrupt is inactive
0x1 → ACTIVE: RAW_INTR_ACTIVITY interrupt is active
7

RX_DONE: When the DW_apb_i2c is acting as a slave-transmitter, this bit is set to 1 if the master does not acknowledge a transmitted byte. This occurs on the last byte of the transmission, indicating that the transmission is done.

Reset value: 0x0

RO0x0
Enumerated values:
0x0 → INACTIVE: RX_DONE interrupt is inactive
0x1 → ACTIVE: RX_DONE interrupt is active
6

TX_ABRT: This bit indicates if DW_apb_i2c, as an I2C transmitter, is unable to complete the intended actions on the contents of the transmit FIFO. This situation can occur both as an I2C master or an I2C slave, and is referred to as a 'transmit abort'. When this bit is set to 1, the IC_TX_ABRT_SOURCE register indicates the reason why the transmit abort takes places.

Note: The DW_apb_i2c flushes/resets/empties the TX_FIFO and RX_FIFO whenever there is a transmit abort caused by any of the events tracked by the IC_TX_ABRT_SOURCE register. The FIFOs remains in this flushed state until the register IC_CLR_TX_ABRT is read. Once this read is performed, the Tx FIFO is then ready to accept more data bytes from the APB interface.

Reset value: 0x0

RO0x0
Enumerated values:
0x0 → INACTIVE: TX_ABRT interrupt is inactive
0x1 → ACTIVE: TX_ABRT interrupt is active
5

RD_REQ: This bit is set to 1 when DW_apb_i2c is acting as a slave and another I2C master is attempting to read data from DW_apb_i2c. The DW_apb_i2c holds the I2C bus in a wait state (SCL=0) until this interrupt is serviced, which means that the slave has been addressed by a remote master that is asking for data to be transferred. The processor must respond to this interrupt and then write the requested data to the IC_DATA_CMD register. This bit is set to 0 just after the processor reads the IC_CLR_RD_REQ register.

Reset value: 0x0

RO0x0
BitsDescriptionTypeReset
Enumerated values:
0x0 → INACTIVE: RD_REQ interrupt is inactive
0x1 → ACTIVE: RD_REQ interrupt is active
4

TX_EMPTY: The behavior of the TX_EMPTY interrupt status differs based on the TX_EMPTY_CTRL selection in the IC_CON register. - When TX_EMPTY_CTRL = 0: This bit is set to 1 when the transmit buffer is at or below the threshold value set in the IC_TX_TL register. - When TX_EMPTY_CTRL = 1: This bit is set to 1 when the transmit buffer is at or below the threshold value set in the IC_TX_TL register and the transmission of the address/data from the internal shift register for the most recently popped command is completed. It is automatically cleared by hardware when the buffer level goes above the threshold. When IC_ENABLE[0] is set to 0, the TX FIFO is flushed and held in reset. There the TX FIFO looks like it has no data within it, so this bit is set to 1, provided there is activity in the master or slave state machines. When there is no longer any activity, then with ic_en=0, this bit is set to 0.

Reset value: 0x0.

RO0x0
Enumerated values:
0x0 → INACTIVE: TX_EMPTY interrupt is inactive
0x1 → ACTIVE: TX_EMPTY interrupt is active
3

TX_OVER: Set during transmit if the transmit buffer is filled to IC_TX_BUFFER_DEPTH and the processor attempts to issue another I2C command by writing to the IC_DATA_CMD register. When the module is disabled, this bit keeps its level until the master or slave state machines go into idle, and when ic_en goes to 0, this interrupt is cleared.

Reset value: 0x0

RO0x0
Enumerated values:
0x0 → INACTIVE: TX_OVER interrupt is inactive
0x1 → ACTIVE: TX_OVER interrupt is active
2

RX_FULL: Set when the receive buffer reaches or goes above the RX_TL threshold in the IC_RX_TL register. It is automatically cleared by hardware when buffer level goes below the threshold. If the module is disabled (IC_ENABLE[0]=0), the RX FIFO is flushed and held in reset; therefore the RX FIFO is not full. So this bit is cleared once the IC_ENABLE bit 0 is programmed with a 0, regardless of the activity that continues.

Reset value: 0x0

RO0x0
Enumerated values:
0x0 → INACTIVE: RX_FULL interrupt is inactive
0x1 → ACTIVE: RX_FULL interrupt is active
BitsDescriptionTypeReset
1

RX_OVER: Set if the receive buffer is completely filled to IC_RX_BUFFER_DEPTH and an additional byte is received from an external I2C device. The DW_apb_i2c acknowledges this, but any data bytes received after the FIFO is full are lost. If the module is disabled (IC_ENABLE[0]=0), this bit keeps its level until the master or slave state machines go into idle, and when ic_en goes to 0, this interrupt is cleared.

Note: If bit 9 of the IC_CON register (RX_FIFO_FULL_HLD_CTRL) is programmed to HIGH, then the RX_OVER interrupt never occurs, because the Rx FIFO never overflows.

Reset value: 0x0

RO0x0
Enumerated values:
0x0 → INACTIVE: RX_OVER interrupt is inactive
0x1 → ACTIVE: RX_OVER interrupt is active
0

RX_UNDER: Set if the processor attempts to read the receive buffer when it is empty by reading from the IC_DATA_CMD register. If the module is disabled (IC_ENABLE[0]=0), this bit keeps its level until the master or slave state machines go into idle, and when ic_en goes to 0, this interrupt is cleared.

Reset value: 0x0

RO0x0
Enumerated values:
0x0 → INACTIVE: RX_UNDER interrupt is inactive
0x1 → ACTIVE: RX_UNDER interrupt is active

I2C: IC_RX_TL Register

Offset: 0x38

Description

I2C Receive FIFO Threshold Register

Table 464. IC_RX_TL Register

BitsDescriptionTypeReset
31:8Reserved.--
7:0

RX_TL: Receive FIFO Threshold Level.

Controls the level of entries (or above) that triggers the RX_FULL interrupt (bit 2 in IC_RAW_INTR_STAT register). The valid range is 0-255, with the additional restriction that hardware does not allow this value to be set to a value larger than the depth of the buffer. If an attempt is made to do that, the actual value set will be the maximum depth of the buffer. A value of 0 sets the threshold for 1 entry, and a value of 255 sets the threshold for 256 entries.

RW0x00

I2C: IC_TX_TL Register

Offset: 0x3c

Description

I2C Transmit FIFO Threshold Register

Table 465. IC_TX_TL Register

BitsDescriptionTypeReset
31:8Reserved.--
7:0TX_TL : Transmit FIFO Threshold Level.

Controls the level of entries (or below) that trigger the TX_EMPTY interrupt (bit 4 in IC_RAW_INTR_STAT register). The valid range is 0-255, with the additional restriction that it may not be set to value larger than the depth of the buffer. If an attempt is made to do that, the actual value set will be the maximum depth of the buffer. A value of 0 sets the threshold for 0 entries, and a value of 255 sets the threshold for 255 entries.
RW0x00

I2C: IC_CLR_INTR Register

Offset: 0x40

Description

Clear Combined and Individual Interrupt Register

Table 466. IC_CLR_INTR Register

BitsDescriptionTypeReset
31:1Reserved.--
0CLR_INTR : Read this register to clear the combined interrupt, all individual interrupts, and the IC_TX_ABRT_SOURCE register. This bit does not clear hardware clearable interrupts but software clearable interrupts. Refer to Bit 9 of the IC_TX_ABRT_SOURCE register for an exception to clearing IC_TX_ABRT_SOURCE.

Reset value: 0x0
RO0x0

I2C: IC_CLR_RX_UNDER Register

Offset: 0x44

Description

Clear RX_UNDER Interrupt Register

Table 467. IC_CLR_RX_UNDER Register

BitsDescriptionTypeReset
31:1Reserved.--
0CLR_RX_UNDER : Read this register to clear the RX_UNDER interrupt (bit 0) of the IC_RAW_INTR_STAT register.

Reset value: 0x0
RO0x0

I2C: IC_CLR_RX_OVER Register

Offset: 0x48

Description

Clear RX_OVER Interrupt Register

Table 468. IC_CLR_RX_OVER Register

BitsDescriptionTypeReset
31:1Reserved.--
BitsDescriptionTypeReset
0CLR_RX_OVER : Read this register to clear the RX_OVER interrupt (bit 1) of the IC_RAW_INTR_STAT register.

Reset value: 0x0
RO0x0

I2C: IC_CLR_TX_OVER Register

Offset: 0x4c

Description

Clear TX_OVER Interrupt Register

Table 469.
IC_CLR_TX_OVER
Register

BitsDescriptionTypeReset
31:1Reserved.--
0CLR_TX_OVER : Read this register to clear the TX_OVER interrupt (bit 3) of the IC_RAW_INTR_STAT register.

Reset value: 0x0
RO0x0

I2C: IC_CLR_RD_REQ Register

Offset: 0x50

Description

Clear RD_REQ Interrupt Register

Table 470.
IC_CLR_RD_REQ
Register

BitsDescriptionTypeReset
31:1Reserved.--
0CLR_RD_REQ : Read this register to clear the RD_REQ interrupt (bit 5) of the IC_RAW_INTR_STAT register.

Reset value: 0x0
RO0x0

I2C: IC_CLR_TX_ABRT Register

Offset: 0x54

Description

Clear TX_ABRT Interrupt Register

Table 471.
IC_CLR_TX_ABORT
Register

BitsDescriptionTypeReset
31:1Reserved.--
0CLR_TX_ABORT : Read this register to clear the TX_ABORT interrupt (bit 6) of the IC_RAW_INTR_STAT register, and the IC_TX_ABORT_SOURCE register. This also releases the TX FIFO from the flushed/reset state, allowing more writes to the TX FIFO. Refer to Bit 9 of the IC_TX_ABORT_SOURCE register for an exception to clearing IC_TX_ABORT_SOURCE.

Reset value: 0x0
RO0x0

I2C: IC_CLR_RX_DONE Register

Offset: 0x58

Description

Clear RX_DONE Interrupt Register

Table 472.
IC_CLR_RX_DONE
Register

BitsDescriptionTypeReset
31:1Reserved.--
0CLR_RX_DONE : Read this register to clear the RX_DONE interrupt (bit 7) of the IC_RAW_INTR_STAT register.

Reset value: 0x0
RO0x0

I2C: IC_CLR_ACTIVITY Register

Offset: 0x5c

Description

Clear ACTIVITY Interrupt Register

Table 473.
IC_CLR_ACTIVITY
Register

BitsDescriptionTypeReset
31:1Reserved.--
0CLR_ACTIVITY : Reading this register clears the ACTIVITY interrupt if the I2C is not active anymore. If the I2C module is still active on the bus, the ACTIVITY interrupt bit continues to be set. It is automatically cleared by hardware if the module is disabled and if there is no further activity on the bus. The value read from this register to get status of the ACTIVITY interrupt (bit 8) of the IC_RAW_INTR_STAT register.

Reset value: 0x0
RO0x0

I2C: IC_CLR_STOP_DET Register

Offset: 0x60

Description

Clear STOP_DET Interrupt Register

Table 474.
IC_CLR_STOP_DET
Register

BitsDescriptionTypeReset
31:1Reserved.--
BitsDescriptionTypeReset
0CLR_STOP_DET : Read this register to clear the STOP_DET interrupt (bit 9) of the IC_RAW_INTR_STAT register.

Reset value: 0x0
RO0x0

I2C: IC_CLR_START_DET Register

Offset: 0x64

Description

Clear START_DET Interrupt Register

Table 475.
IC_CLR_START_DET
Register

BitsDescriptionTypeReset
31:1Reserved.--
0CLR_START_DET : Read this register to clear the START_DET interrupt (bit 10) of the IC_RAW_INTR_STAT register.

Reset value: 0x0
RO0x0

I2C: IC_CLR_GEN_CALL Register

Offset: 0x68

Description

Clear GEN_CALL Interrupt Register

Table 476.
IC_CLR_GEN_CALL
Register

BitsDescriptionTypeReset
31:1Reserved.--
0CLR_GEN_CALL : Read this register to clear the GEN_CALL interrupt (bit 11) of IC_RAW_INTR_STAT register.

Reset value: 0x0
RO0x0

I2C: IC_ENABLE Register

Offset: 0x6c

Description

I2C Enable Register

Table 477. IC_ENABLE
Register

BitsDescriptionTypeReset
31:3Reserved.--
2TX_CMD_BLOCK : In Master mode: - 1'b1: Blocks the transmission of data on I2C bus even if Tx FIFO has data to transmit. - 1'b0: The transmission of data starts on I2C bus automatically, as soon as the first data is available in the Tx FIFO. Note: To block the execution of Master commands, set the TX_CMD_BLOCK bit only when Tx FIFO is empty (IC_STATUS[2]==1) and Master is in Idle state (IC_STATUS[5] == 0). Any further commands put in the Tx FIFO are not executed until TX_CMD_BLOCK bit is unset. Reset value: IC_TX_CMD_BLOCK_DEFAULTRW0x0
Enumerated values:
0x0 → NOT_BLOCKED: Tx Command execution not blocked
BitsDescriptionTypeReset
0x1 → BLOCKED: Tx Command execution blocked
1

ABORT: When set, the controller initiates the transfer abort. - 0: ABORT not initiated or ABORT done - 1: ABORT operation in progress The software can abort the I2C transfer in master mode by setting this bit. The software can set this bit only when ENABLE is already set; otherwise, the controller ignores any write to ABORT bit. The software cannot clear the ABORT bit once set. In response to an ABORT, the controller issues a STOP and flushes the Tx FIFO after completing the current transfer, then sets the TX_ABORT interrupt after the abort operation. The ABORT bit is cleared automatically after the abort operation.

For a detailed description on how to abort I2C transfers, refer to 'Aborting I2C Transfers'.

Reset value: 0x0

RW0x0
Enumerated values:
0x0 → DISABLE: ABORT operation not in progress
0x1 → ENABLED: ABORT operation in progress
0

ENABLE: Controls whether the DW_apb_i2c is enabled. - 0: Disables DW_apb_i2c (TX and RX FIFOs are held in an erased state) - 1: Enables DW_apb_i2c Software can disable DW_apb_i2c while it is active. However, it is important that care be taken to ensure that DW_apb_i2c is disabled properly. A recommended procedure is described in 'Disabling DW_apb_i2c'.

When DW_apb_i2c is disabled, the following occurs: - The TX FIFO and RX FIFO get flushed. - Status bits in the IC_INTR_STAT register are still active until DW_apb_i2c goes into IDLE state. If the module is transmitting, it stops as well as deletes the contents of the transmit buffer after the current transfer is complete. If the module is receiving, the DW_apb_i2c stops the current transfer at the end of the current byte and does not acknowledge the transfer.

In systems with asynchronous pclk and ic_clk when IC_CLK_TYPE parameter set to asynchronous (1), there is a two ic_clk delay when enabling or disabling the DW_apb_i2c. For a detailed description on how to disable DW_apb_i2c, refer to 'Disabling DW_apb_i2c'

Reset value: 0x0

RW0x0
Enumerated values:
0x0 → DISABLED: I2C is disabled
0x1 → ENABLED: I2C is enabled

I2C: IC_STATUS Register

Offset: 0x70

Description

I2C Status Register

This is a read-only register used to indicate the current transfer status and FIFO status. The status register may be read at any time. None of the bits in this register request an interrupt.

When the I2C is disabled by writing 0 in bit 0 of the IC_ENABLE register: - Bits 1 and 2 are set to 1 - Bits 3 and 10 are set to 0 When the master or slave state machines goes to idle and ic_en=0: - Bits 5 and 6 are set to 0

Table 478. IC_STATUS Register

BitsDescriptionTypeReset
31:7Reserved.--
6SLV_ACTIVITY : Slave FSM Activity Status. When the Slave Finite State Machine (FSM) is not in the IDLE state, this bit is set. - 0: Slave FSM is in IDLE state so the Slave part of DW_apb_i2c is not Active - 1: Slave FSM is not in IDLE state so the Slave part of DW_apb_i2c is Active Reset value: 0x0RO0x0
Enumerated values:
0x0 → IDLE: Slave is idle
0x1 → ACTIVE: Slave not idle
5MST_ACTIVITY : Master FSM Activity Status. When the Master Finite State Machine (FSM) is not in the IDLE state, this bit is set. - 0: Master FSM is in IDLE state so the Master part of DW_apb_i2c is not Active - 1: Master FSM is not in IDLE state so the Master part of DW_apb_i2c is Active Note: IC_STATUS[0]-that is, ACTIVITY bit-is the OR of SLV_ACTIVITY and MST_ACTIVITY bits.

Reset value: 0x0
RO0x0
Enumerated values:
0x0 → IDLE: Master is idle
0x1 → ACTIVE: Master not idle
4RFF : Receive FIFO Completely Full. When the receive FIFO is completely full, this bit is set. When the receive FIFO contains one or more empty location, this bit is cleared. - 0: Receive FIFO is not full - 1: Receive FIFO is full Reset value: 0x0RO0x0
Enumerated values:
0x0 → NOT_FULL: Rx FIFO not full
0x1 → FULL: Rx FIFO is full
3RFNE : Receive FIFO Not Empty. This bit is set when the receive FIFO contains one or more entries; it is cleared when the receive FIFO is empty. - 0: Receive FIFO is empty - 1: Receive FIFO is not empty Reset value: 0x0RO0x0
Enumerated values:
0x0 → EMPTY: Rx FIFO is empty
0x1 → NOT_EMPTY: Rx FIFO not empty
2TFE : Transmit FIFO Completely Empty. When the transmit FIFO is completely empty, this bit is set. When it contains one or more valid entries, this bit is cleared. This bit field does not request an interrupt. - 0: Transmit FIFO is not empty - 1: Transmit FIFO is empty Reset value: 0x1RO0x1
Enumerated values:
0x0 → NON_EMPTY: Tx FIFO not empty
0x1 → EMPTY: Tx FIFO is empty
BitsDescriptionTypeReset
1TFNF : Transmit FIFO Not Full. Set when the transmit FIFO contains one or more empty locations, and is cleared when the FIFO is full. - 0: Transmit FIFO is full - 1: Transmit FIFO is not full Reset value: 0x1RO0x1
Enumerated values:
0x0 → FULL: Tx FIFO is full
0x1 → NOT_FULL: Tx FIFO not full
0ACTIVITY : I2C Activity Status. Reset value: 0x0RO0x0
Enumerated values:
0x0 → INACTIVE: I2C is idle
0x1 → ACTIVE: I2C is active

I2C: IC_TXFLR Register

Offset: 0x74

Description

I2C Transmit FIFO Level Register This register contains the number of valid data entries in the transmit FIFO buffer. It is cleared whenever: - The I2C is disabled - There is a transmit abort - that is, TX_ABRT bit is set in the IC_RAW_INTR_STAT register - The slave bulk transmit mode is aborted The register increments whenever data is placed into the transmit FIFO and decrements when data is taken from the transmit FIFO.

Table 479. IC_TXFLR Register

BitsDescriptionTypeReset
31:5Reserved.--
4:0TXFLR : Transmit FIFO Level. Contains the number of valid data entries in the transmit FIFO.

Reset value: 0x0
RO0x00

I2C: IC_RXFLR Register

Offset: 0x78

Description

I2C Receive FIFO Level Register This register contains the number of valid data entries in the receive FIFO buffer. It is cleared whenever: - The I2C is disabled - Whenever there is a transmit abort caused by any of the events tracked in IC_TX_ABRT_SOURCE The register increments whenever data is placed into the receive FIFO and decrements when data is taken from the receive FIFO.

Table 480. IC_RXFLR Register

BitsDescriptionTypeReset
31:5Reserved.--
4:0RXFLR : Receive FIFO Level. Contains the number of valid data entries in the receive FIFO.

Reset value: 0x0
RO0x00

I2C: IC_SDA_HOLD Register

Offset: 0x7c

Description

I2C SDA Hold Time Length Register

The bits [15:0] of this register are used to control the hold time of SDA during transmit in both slave and master mode (after SCL goes from HIGH to LOW).

The bits [23:16] of this register are used to extend the SDA transition (if any) whenever SCL is HIGH in the receiver in either master or slave mode.

Writes to this register succeed only when IC_ENABLE[0]=0.

The values in this register are in units of ic_clk period. The value programmed in IC_SDA_TX_HOLD must be greater than the minimum hold time in each mode (one cycle in master mode, seven cycles in slave mode) for the value to be implemented.

The programmed SDA hold time during transmit (IC_SDA_TX_HOLD) cannot exceed at any time the duration of the low part of scl. Therefore the programmed value cannot be larger than N_SCL_LOW-2, where N_SCL_LOW is the duration of the low part of the scl period measured in ic_clk cycles.

Table 481.
IC_SDA_HOLD
Register

BitsDescriptionTypeReset
31:24Reserved.--
23:16IC_SDA_RX_HOLD: Sets the required SDA hold time in units of ic_clk period, when DW_apb_i2c acts as a receiver.

Reset value: IC_DEFAULT_SDA_HOLD[23:16].
RW0x00
15:0IC_SDA_TX_HOLD: Sets the required SDA hold time in units of ic_clk period, when DW_apb_i2c acts as a transmitter.

Reset value: IC_DEFAULT_SDA_HOLD[15:0].
RW0x0001

I2C: IC_TX_ABRT_SOURCE Register

Offset: 0x80

Description

I2C Transmit Abort Source Register

This register has 32 bits that indicate the source of the TX_ABRT bit. Except for Bit 9, this register is cleared whenever the IC_CLR_TX_ABRT register or the IC_CLR_INTR register is read. To clear Bit 9, the source of the ABRT_SBYTE_NORSTRT must be fixed first; RESTART must be enabled (IC_CON[5]=1), the SPECIAL bit must be cleared (IC_TAR[11]), or the GC_OR_START bit must be cleared (IC_TAR[10]).

Once the source of the ABRT_SBYTE_NORSTRT is fixed, then this bit can be cleared in the same manner as other bits in this register. If the source of the ABRT_SBYTE_NORSTRT is not fixed before attempting to clear this bit, Bit 9 clears for one cycle and is then re-asserted.

Table 482.
IC_TX_ABRT_SOURCE
Register

BitsDescriptionTypeReset
31:23TX_FLUSH_CNT: This field indicates the number of Tx FIFO Data Commands which are flushed due to TX_ABRT interrupt. It is cleared whenever I2C is disabled.

Reset value: 0x0

Role of DW_apb_i2c: Master-Transmitter or Slave-Transmitter
RO0x000
22:17Reserved.--
BitsDescriptionTypeReset
16

ABRT_USER_ABRT: This is a master-mode-only bit. Master has detected the transfer abort (IC_ENABLE[1])

Reset value: 0x0

Role of DW_apb_i2c: Master-Transmitter

RO0x0
Enumerated values:
0x0 → ABRT_USER_ABRT_VOID: Transfer abort detected by master- scenario not present
0x1 → ABRT_USER_ABRT_GENERATED: Transfer abort detected by master
15

ABRT_SLVRD_INTX: 1: When the processor side responds to a slave mode request for data to be transmitted to a remote master and user writes a 1 in CMD (bit 8) of IC_DATA_CMD register.

Reset value: 0x0

Role of DW_apb_i2c: Slave-Transmitter

RO0x0
Enumerated values:
0x0 → ABRT_SLVRD_INTX_VOID: Slave trying to transmit to remote master in read mode- scenario not present
0x1 → ABRT_SLVRD_INTX_GENERATED: Slave trying to transmit to remote master in read mode
14

ABRT_SLV_ARBLOST: This field indicates that a Slave has lost the bus while transmitting data to a remote master. IC_TX_ABRT_SOURCE[12] is set at the same time. Note: Even though the slave never 'owns' the bus, something could go wrong on the bus. This is a fail safe check. For instance, during a data transmission at the low-to-high transition of SCL, if what is on the data bus is not what is supposed to be transmitted, then DW_apb_i2c no longer own the bus.

Reset value: 0x0

Role of DW_apb_i2c: Slave-Transmitter

RO0x0
Enumerated values:
0x0 → ABRT_SLV_ARBLOST_VOID: Slave lost arbitration to remote master- scenario not present
0x1 → ABRT_SLV_ARBLOST_GENERATED: Slave lost arbitration to remote master
13

ABRT_SLVFLUSH_TXFIFO: This field specifies that the Slave has received a read command and some data exists in the TX FIFO, so the slave issues a TX_ABRT interrupt to flush old data in TX FIFO.

Reset value: 0x0

Role of DW_apb_i2c: Slave-Transmitter

RO0x0
Enumerated values:
BitsDescriptionTypeReset
0x0 → ABRT_SLVFLUSH_TXFIFO_VOID: Slave flushes existing data in TX-FIFO upon getting read command- scenario not present
0x1 → ABRT_SLVFLUSH_TXFIFO_GENERATED: Slave flushes existing data in TX-FIFO upon getting read command
12ARB_LOST : This field specifies that the Master has lost arbitration, or if IC_TX_ABRT_SOURCE[14] is also set, then the slave transmitter has lost arbitration.

Reset value: 0x0

Role of DW_apb_i2c: Master-Transmitter or Slave-Transmitter
RO0x0
Enumerated values:
0x0 → ABRT_LOST_VOID: Master or Slave-Transmitter lost arbitration- scenario not present
0x1 → ABRT_LOST_GENERATED: Master or Slave-Transmitter lost arbitration
11ABRT_MASTER_DIS : This field indicates that the User tries to initiate a Master operation with the Master mode disabled.

Reset value: 0x0

Role of DW_apb_i2c: Master-Transmitter or Master-Receiver
RO0x0
Enumerated values:
0x0 → ABRT_MASTER_DIS_VOID: User initiating master operation when MASTER disabled- scenario not present
0x1 → ABRT_MASTER_DIS_GENERATED: User initiating master operation when MASTER disabled
10ABRT_10B_RD_NORSTRT : This field indicates that the restart is disabled (IC_RESTART_EN bit (IC_CON[5]) =0) and the master sends a read command in 10-bit addressing mode.

Reset value: 0x0

Role of DW_apb_i2c: Master-Receiver
RO0x0
Enumerated values:
0x0 → ABRT_10B_RD_VOID: Master not trying to read in 10Bit addressing mode when RESTART disabled
0x1 → ABRT_10B_RD_GENERATED: Master trying to read in 10Bit addressing mode when RESTART disabled
BitsDescriptionTypeReset
9

ABRT_SBYTE_NORSTRT: To clear Bit 9, the source of the ABRT_SBYTE_NORSTRT must be fixed first; restart must be enabled (IC_CON[5]=1), the SPECIAL bit must be cleared (IC_TAR[11]), or the GC_OR_START bit must be cleared (IC_TAR[10]). Once the source of the ABRT_SBYTE_NORSTRT is fixed, then this bit can be cleared in the same manner as other bits in this register. If the source of the ABRT_SBYTE_NORSTRT is not fixed before attempting to clear this bit, bit 9 clears for one cycle and then gets reasserted. When this field is set to 1, the restart is disabled (IC_RESTART_EN bit (IC_CON[5]) =0) and the user is trying to send a START Byte.

Reset value: 0x0

Role of DW_apb_i2c: Master

RO0x0
Enumerated values:
0x0 → ABRT_SBYTE_NORSTRT_VOID: User trying to send START byte when RESTART disabled- scenario not present
0x1 → ABRT_SBYTE_NORSTRT_GENERATED: User trying to send START byte when RESTART disabled
8

ABRT_HS_NORSTRT: This field indicates that the restart is disabled (IC_RESTART_EN bit (IC_CON[5]) =0) and the user is trying to use the master to transfer data in High Speed mode.

Reset value: 0x0

Role of DW_apb_i2c: Master-Transmitter or Master-Receiver

RO0x0
Enumerated values:
0x0 → ABRT_HS_NORSTRT_VOID: User trying to switch Master to HS mode when RESTART disabled- scenario not present
0x1 → ABRT_HS_NORSTRT_GENERATED: User trying to switch Master to HS mode when RESTART disabled
7

ABRT_SBYTE_ACKDET: This field indicates that the Master has sent a START Byte and the START Byte was acknowledged (wrong behavior).

Reset value: 0x0

Role of DW_apb_i2c: Master

RO0x0
Enumerated values:
0x0 → ABRT_SBYTE_ACKDET_VOID: ACK detected for START byte- scenario not present
0x1 → ABRT_SBYTE_ACKDET_GENERATED: ACK detected for START byte
6

ABRT_HS_ACKDET: This field indicates that the Master is in High Speed mode and the High Speed Master code was acknowledged (wrong behavior).

Reset value: 0x0

Role of DW_apb_i2c: Master

RO0x0
BitsDescriptionTypeReset
Enumerated values:
0x0 → ABRT_HS_ACK_VOID: HS Master code ACKed in HS Mode- scenario not present
0x1 → ABRT_HS_ACK_GENERATED: HS Master code ACKed in HS Mode
5ABRT_GCALL_READ: This field indicates that DW_apb_i2c in the master mode has sent a General Call but the user programmed the byte following the General Call to be a read from the bus (IC_DATA_CMD[9] is set to 1).

Reset value: 0x0

Role of DW_apb_i2c: Master-Transmitter
RO0x0
Enumerated values:
0x0 → ABRT_GCALL_READ_VOID: GCALL is followed by read from bus- scenario not present
0x1 → ABRT_GCALL_READ_GENERATED: GCALL is followed by read from bus
4ABRT_GCALL_NOACK: This field indicates that DW_apb_i2c in master mode has sent a General Call and no slave on the bus acknowledged the General Call.

Reset value: 0x0

Role of DW_apb_i2c: Master-Transmitter
RO0x0
Enumerated values:
0x0 → ABRT_GCALL_NOACK_VOID: GCALL not ACKed by any slave-scenario not present
0x1 → ABRT_GCALL_NOACK_GENERATED: GCALL not ACKed by any slave
3ABRT_TXDATA_NOACK: This field indicates the master-mode only bit. When the master receives an acknowledgement for the address, but when it sends data byte(s) following the address, it did not receive an acknowledge from the remote slave(s).

Reset value: 0x0

Role of DW_apb_i2c: Master-Transmitter
RO0x0
Enumerated values:
0x0 → ABRT_TXDATA_NOACK_VOID: Transmitted data non-ACKed by addressed slave-scenario not present
0x1 → ABRT_TXDATA_NOACK_GENERATED: Transmitted data not ACKed by addressed slave
2ABRT_10ADDR2_NOACK: This field indicates that the Master is in 10-bit address mode and that the second address byte of the 10-bit address was not acknowledged by any slave.

Reset value: 0x0

Role of DW_apb_i2c: Master-Transmitter or Master-Receiver
RO0x0
Bits Register 31:0 Bitscolumn_2Description DescriptionType RO TypeReset 0x00000001 Reset
0ABRT_7B_ADDR_NOACK: This field indicates that the Master is in 7-bitRO0x0
0x0Enumerated values: → INACTIVE: This abort is not generated
0x1→ ACTIVE: This abort is generated because of NOACK for 7-bit address
Table 483. Bits IC_SLV_DATA_NACK_DescriptionTypeReset
ONLY Register 31:1Reserved.--
0NACK: Generate NACK. This NACK generation only occurs when DW_apb_i2cRW0x0

I2C: IC_SLV_DATA_NACK_ONLY Register

Offset: 0x84

Description

Generate Slave Data NACK Register

The register is used to generate a NACK for the data part of a transfer when DW_apb_i2c is acting as a slave-receiver. This register only exists when the IC_SLV_DATA_NACK_ONLY parameter is set to 1. When this parameter disabled, this register does not exist and writing to the register's address has no effect.

A write can occur on this register if both of the following conditions are met: - DW_apb_i2c is disabled (IC_ENABLE[0] = 0) - Slave part is inactive (IC_STATUS[6] = 0) Note: The IC_STATUS[6] is a register read-back location for the internal slv_activity signal; the user should poll this before writing the ic_slv_data_nack_only bit.

Table 483.
IC_SLV_DATA_NACK_ONLY Register

BitsDescriptionTypeReset
0x0 → DISABLED: Slave receiver generates NACK normally
0x1 → ENABLED: Slave receiver generates NACK upon data reception only

I2C: IC_DMA_CR Register

Offset: 0x88

Description

DMA Control Register

The register is used to enable the DMA Controller interface operation. There is a separate bit for transmit and receive. This can be programmed regardless of the state of IC_ENABLE.

Table 484.
IC_DMA_CR Register

BitsDescriptionTypeReset
31:2Reserved.--
1TDMAE : Transmit DMA Enable. This bit enables/disables the transmit FIFO DMA channel. Reset value: 0x0RW0x0
Enumerated values:
0x0 → DISABLED: transmit FIFO DMA channel disabled
0x1 → ENABLED: Transmit FIFO DMA channel enabled
0RDMAE : Receive DMA Enable. This bit enables/disables the receive FIFO DMA channel. Reset value: 0x0RW0x0
Enumerated values:
0x0 → DISABLED: Receive FIFO DMA channel disabled
0x1 → ENABLED: Receive FIFO DMA channel enabled

I2C: IC_DMA_TDLR Register

Offset: 0x8c

Description

DMA Transmit Data Level Register

Table 485.
IC_DMA_TDLR
Register

BitsDescriptionTypeReset
31:4Reserved.--
3:0DMATDL : Transmit Data Level. This bit field controls the level at which a DMA request is made by the transmit logic. It is equal to the watermark level; that is, the dma_tx_req signal is generated when the number of valid data entries in the transmit FIFO is equal to or below this field value, and TDMAE = 1.

Reset value: 0x0
RW0x0

I2C: IC_DMA_RDLR Register

Offset: 0x90

Description

I2C Receive Data Level Register

Table 486.
IC_DMA_RDLR
Register

BitsDescriptionTypeReset
31:4Reserved.--
3:0DMARDL : Receive Data Level. This bit field controls the level at which a DMA request is made by the receive logic. The watermark level = DMARDL+1; that is, dma_rx_req is generated when the number of valid data entries in the receive FIFO is equal to or more than this field value + 1, and RDMAE =1. For instance, when DMARDL is 0, then dma_rx_req is asserted when 1 or more data entries are present in the receive FIFO.

Reset value: 0x0
RW0x0

I2C: IC_SDA_SETUP Register

Offset: 0x94

Description

I2C SDA Setup Register

This register controls the amount of time delay (in terms of number of ic_clk clock periods) introduced in the rising edge of SCL - relative to SDA changing - when DW_apb_i2c services a read request in a slave-transmitter operation. The relevant I2C requirement is tSU:DAT (note 4) as detailed in the I2C Bus Specification. This register must be programmed with a value equal to or greater than 2.

Writes to this register succeed only when IC_ENABLE[0] = 0.

Note: The length of setup time is calculated using \( [(IC\_SDA\_SETUP - 1) * (ic\_clk\_period)] \) , so if the user requires 10 ic_clk periods of setup time, they should program a value of 11. The IC_SDA_SETUP register is only used by the DW_apb_i2c when operating as a slave transmitter.

Table 487.
IC_SDA_SETUP
Register

BitsDescriptionTypeReset
31:8Reserved.--
7:0SDA_SETUP : SDA Setup. It is recommended that if the required delay is 1000ns, then for an ic_clk frequency of 10 MHz, IC_SDA_SETUP should be programmed to a value of 11. IC_SDA_SETUP must be programmed with a minimum value of 2.RW0x64

I2C: IC_ACK_GENERAL_CALL Register

Offset: 0x98

Description

I2C ACK General Call Register

The register controls whether DW_apb_i2c responds with a ACK or NACK when it receives an I2C General Call address.

This register is applicable only when the DW_apb_i2c is in slave mode.

Table 488.
IC_ACK_GENERAL_CALL
Register

BitsDescriptionTypeReset
31:1Reserved.--
0ACK_GEN_CALL : ACK General Call. When set to 1, DW_apb_i2c responds with a ACK (by asserting ic_data_oe) when it receives a General Call. Otherwise, DW_apb_i2c responds with a NACK (by negating ic_data_oe).RW0x1
Enumerated values:
0x0 → DISABLED: Generate NACK for a General Call
0x1 → ENABLED: Generate ACK for a General Call

I2C: IC_ENABLE_STATUS Register

Offset: 0x9c

Description

I2C Enable Status Register

The register is used to report the DW_apb_i2c hardware status when the IC_ENABLE[0] register is set from 1 to 0; that is, when DW_apb_i2c is disabled.

If IC_ENABLE[0] has been set to 1, bits 2:1 are forced to 0, and bit 0 is forced to 1.

If IC_ENABLE[0] has been set to 0, bits 2:1 is only be valid as soon as bit 0 is read as '0'.

Note: When IC_ENABLE[0] has been set to 0, a delay occurs for bit 0 to be read as 0 because disabling the DW_apb_i2c depends on I2C bus activities.

Table 489.
IC_ENABLE_STATUS
Register

BitsDescriptionTypeReset
31:3Reserved.--
2

SLV_RX_DATA_LOST : Slave Received Data Lost. This bit indicates if a Slave-Receiver operation has been aborted with at least one data byte received from an I2C transfer due to the setting bit 0 of IC_ENABLE from 1 to 0. When read as 1, DW_apb_i2c is deemed to have been actively engaged in an aborted I2C transfer (with matching address) and the data phase of the I2C transfer has been entered, even though a data byte has been responded with a NACK.

Note: If the remote I2C master terminates the transfer with a STOP condition before the DW_apb_i2c has a chance to NACK a transfer, and IC_ENABLE[0] has been set to 0, then this bit is also set to 1.

When read as 0, DW_apb_i2c is deemed to have been disabled without being actively involved in the data phase of a Slave-Receiver transfer.

Note: The CPU can safely read this bit when IC_EN (bit 0) is read as 0.

Reset value: 0x0

RO0x0
Enumerated values:
0x0 → INACTIVE: Slave RX Data is not lost
0x1 → ACTIVE: Slave RX Data is lost
BitsDescriptionTypeReset
1

SLV_DISABLED_WHILE_BUSY: Slave Disabled While Busy (Transmit, Receive). This bit indicates if a potential or active Slave operation has been aborted due to the setting bit 0 of the IC_ENABLE register from 1 to 0. This bit is set when the CPU writes a 0 to the IC_ENABLE register while:

(a) DW_apb_i2c is receiving the address byte of the Slave-Transmitter operation from a remote master;

OR,

(b) address and data bytes of the Slave-Receiver operation from a remote master.

When read as 1, DW_apb_i2c is deemed to have forced a NACK during any part of an I2C transfer, irrespective of whether the I2C address matches the slave address set in DW_apb_i2c (IC_SAR register) OR if the transfer is completed before IC_ENABLE is set to 0 but has not taken effect.

Note: If the remote I2C master terminates the transfer with a STOP condition before the DW_apb_i2c has a chance to NACK a transfer, and IC_ENABLE[0] has been set to 0, then this bit will also be set to 1.

When read as 0, DW_apb_i2c is deemed to have been disabled when there is master activity, or when the I2C bus is idle.

Note: The CPU can safely read this bit when IC_EN (bit 0) is read as 0.

Reset value: 0x0

RO0x0
Enumerated values:
0x0 → INACTIVE: Slave is disabled when it is idle
0x1 → ACTIVE: Slave is disabled when it is active
0

IC_EN: ic_en Status. This bit always reflects the value driven on the output port ic_en. - When read as 1, DW_apb_i2c is deemed to be in an enabled state. - When read as 0, DW_apb_i2c is deemed completely inactive. Note: The CPU can safely read this bit anytime. When this bit is read as 0, the CPU can safely read SLV_RX_DATA_LOST (bit 2) and SLV_DISABLED_WHILE_BUSY (bit 1).

Reset value: 0x0

RO0x0
Enumerated values:
0x0 → DISABLED: I2C disabled
0x1 → ENABLED: I2C enabled

I2C: IC_FS_SPKLEN Register

Offset: 0xa0

Description

I2C SS, FS or FM+ spike suppression limit

This register is used to store the duration, measured in ic_clk cycles, of the longest spike that is filtered out by the spike suppression logic when the component is operating in SS, FS or FM+ modes. The relevant I2C requirement is tSP (table

4) as detailed in the I2C Bus Specification. This register must be programmed with a minimum value of 1.

Table 490.
IC_FS_SPKLEN
Register

BitsDescriptioncolumn_3TypeReset
Register 31:8Reserved.--
7:0IC_FS_SPKLEN: This register must be set before any I2C bus transaction can take place to ensure stable operation. This register sets the duration,RW0x07
Table 491. BitsDescriptionTypeReset
IC_CLR_RESTART_DET Register 31:1Reserved.--
0CLR_RESTART_DET: Read this register to clear the RESTART_DET interrupt (bit 12) of IC_RAW_INTR_STAT register.RO0x0
Table 492. Bitssettings for those parameters DescriptionTypeReset
IC_COMP_PARAM_1 Register 31:24Reserved.--
23:16TX_BUFFER_DEPTH: TX Buffer Depth = 16RO0x00
15:8RX_BUFFER_DEPTH: RX Buffer Depth = 16RO0x00
7ADD_ENCODED_PARAMS: Encoded parameters not visibleRO0x0
6HAS_DMA: DMA handshaking signals are enabledRO0x0
5INTR_IO : COMBINED Interrupt outputsRO0x0
4HC_COUNT_VALUES: Programmable count values for each mode.RO0x0
3:2MAX_SPEED_MODE: MAX SPEED MODE = FAST MODERO0x0
1:0APB_DATA_WIDTH: APB data bus width is 32 bitsRO0x0

I2C: IC_CLR_RESTART_DET Register

Offset: 0xa8

Description

Clear RESTART_DET Interrupt Register

Table 491.
IC_CLR_RESTART_DET
Register

I2C: IC_COMP_PARAM_1 Register

Offset: 0xf4

Description

Component Parameter Register 1

Note This register is not implemented and therefore reads as 0. If it was implemented it would be a constant read-only register that contains encoded information about the component's parameter settings. Fields shown below are the settings for those parameters

Table 492.
IC_COMP_PARAM_1
Register

I2C: IC_COMP_VERSION Register

Offset: 0xf8

Description

I2C Component Version Register

Table 493.
IC_COMP_VERSION
Register

BitsDescriptionTypeReset
31:0IC_COMP_VERSIONRO0x3230312a

I2C: IC_COMP_TYPE Register

Offset: 0xfc

Description

I2C Component Type Register

Table 494.
IC_COMP_TYPE
Register

BitsDescriptionTypeReset
31:0IC_COMP_TYPE: Designware Component Type number = 0x44_57_01_40. This assigned unique hex value is constant and is derived from the two ASCII letters 'DW' followed by a 16-bit unsigned number.RO0x44570140