12.2. 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.

RP2350 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 9.4 . The muxing options give some IO flexibility.

12.2.1. Features

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

12.2.1.1. Standard

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

12.2.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.

12.2.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:

info icon 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.

12.2.2. IP configuration

I2C configuration details (each instance is fully independent):

12.2.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.

i 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:

i 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 at up to 100 kb/s over the 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; unpredictable states would occur.

The following devices commonly use high-speed mode:

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 100 kHz in standard and fast modes. Any DW_apb_i2c device can be attached to an I2C bus. 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:

The blocks of the component are illustrated in Figure 68 .

Figure 68. I2C Block diagram

Figure 68: I2C Block diagram. A block diagram of the DW_apb_i2c component. The component is represented by a large light blue rectangle labeled 'DW_apb_i2c' at the top center. Inside this rectangle, there are several smaller yellow rectangles representing functional blocks. The blocks are arranged in a grid-like fashion. The top row contains four blocks: 'AMBA Bus Interface Unit', 'Register File', 'Slave State Machine', and 'Master State Machine'. The second row contains four blocks: 'Clock Generator', 'Rx Shift', 'Tx Shift', and 'Rx Filter'. The third row contains four blocks: 'Toggle', 'Synchronizer', 'DMA Interface', and 'Interrupt Controller'. Below the third row, there are two blocks: 'RX FIFO' and 'TX FIFO'.
Figure 68: I2C Block diagram. A block diagram of the DW_apb_i2c component. The component is represented by a large light blue rectangle labeled 'DW_apb_i2c' at the top center. Inside this rectangle, there are several smaller yellow rectangles representing functional blocks. The blocks are arranged in a grid-like fashion. The top row contains four blocks: 'AMBA Bus Interface Unit', 'Register File', 'Slave State Machine', and 'Master State Machine'. The second row contains four blocks: 'Clock Generator', 'Rx Shift', 'Tx Shift', and 'Rx Filter'. The third row contains four blocks: 'Toggle', 'Synchronizer', 'DMA Interface', and 'Interrupt Controller'. Below the third row, there are two blocks: 'RX FIFO' and 'TX FIFO'.

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

12.2.4. I2C terminology

This section defines key terms used in various parts of the I2C.

12.2.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.

Transmitter

the device that sends data to the bus. A transmitter can either be a device that initiates the data transmission to the bus (a master-transmitter) or the device that responds to a request from the master to send data to the bus (a slave-transmitter).

Receiver

the device that receives data from the bus. A receiver can either be a device that receives data on its own request (a master-receiver) or a device that receives data in response to a request from the master (a slave-receiver).

Master

the component that initializes a transfer (START command), generates the clock SCL signal and terminates the transfer (STOP command). A master can be either a transmitter or a receiver.

Slave

the device addressed by the master. A slave can be either receiver or transmitter.

Multi-master

the ability for more than one master to co-exist on the bus at the same time without collision or data loss.

Arbitration

the predefined procedure that authorizes only one master at a time to take control of the bus. For more information about this behaviour, refer to Section 12.2.8 .

Synchronization

the predefined procedure that synchronizes the clock signals provided by two or more masters. For more information about this feature, refer to Section 12.2.9 .

SDA

the data signal line (Serial Data).

SCL

the clock signal line (Serial Clock).

12.2.4.2. Bus transfer terms

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

START (RESTART)

data transfer begins with a START or RESTART condition. The level of the SDA data line changes from high to low, while the SCL clock line remains high. When this occurs, the bus becomes busy.

NOTE

START and RESTART conditions are functionally identical.

STOP

data transfer is terminated by a STOP condition. This occurs when the level on the SDA data line passes from the low state to the high state, while the SCL clock line remains high. When the data transfer has been terminated, the bus is free or idle once again. The bus stays busy if a RESTART is generated instead of a STOP condition.

12.2.5. I2C behaviour

The DW_apb_i2c can be controlled with software to be one of the following:

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 and 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 determined by the system designer. When a master wants to communicate with a slave:

  1. 1. 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.
  2. 2. The slave then sends an acknowledge (ACK) pulse after the address.

When the master (master-transmitter) writes 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.

When the master reads from a slave (master-receiver), the slave transmits (slave-transmitter) a byte of data to the master. 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 69.

Figure 69. 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 transfer (MSB to LSB), ACK from slave, SCL held low while servicing interrupt, data transfer (1 to 9), ACK from receiver, and STOP AND RESTART Condition. Red dashed boxes highlight the START/RESTART and STOP/RESTART conditions.

The figure is a timing diagram for an I2C bus transfer. It shows two signals: SDA (Serial Data Arbitration) and SCL (Serial Clock Line). The SDA line is bidirectional, indicated by arrows. The SCL line is unidirectional, indicated by a single arrow. The diagram shows a sequence of operations: 1. START or RESTART Condition: SDA transitions from high to low while SCL is high. 2. Data Transfer: SDA carries data from MSB (Most Significant Bit) to LSB (Least Significant Bit). 3. ACK from slave: SDA transitions from low to high while SCL is high. 4. SCL held low while servicing interrupt: SCL transitions from high to low. 5. Data Transfer: SDA carries data from 1 to 9. 6. ACK from receiver: SDA transitions from low to high while SCL is high. 7. STOP AND RESTART Condition: SDA transitions from low to high while SCL is high. Red dashed boxes highlight the START/RESTART and STOP/RESTART conditions.

Timing diagram for I2C data transfer showing SDA and SCL signals. The diagram illustrates a sequence of operations: START or RESTART Condition, data transfer (MSB to LSB), ACK from slave, SCL held low while servicing interrupt, data transfer (1 to 9), ACK from receiver, and STOP AND RESTART Condition. Red dashed boxes highlight the START/RESTART and STOP/RESTART conditions.

The DW_apb_i2c is a synchronous serial interface. The SDA line is a bidirectional signal that 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 12.2.6.

12.2.5.1. START and STOP generation

When operating as an I2C master, putting data into the TX 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 TX 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.

12.2.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 TX 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 TX FIFO is empty when the current I2C transfer completes:

For more details, refer to Section 12.2.7 .

12.2.6. I2C protocols

This section defines protocols used in the DW_apb_i2c.

12.2.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 : 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 : a low-to-high transition of the SDA signal while SCL is 1. Figure 70 shows the timing of the START and STOP conditions. When data is being transmitted on the bus, the SDA signal must be stable when SCL is set to 1.

Figure 70. I2C START and STOP Condition

Timing diagram for I2C START and STOP conditions showing SDA and SCL signals.

The diagram illustrates the timing of START and STOP conditions on an I2C bus. It shows two signals: SDA (Serial Data Arbitration) and SCL (Serial Clock). The SCL signal is a periodic square wave. The SDA signal is high when the bus is idle and transitions to low during data transmission. The diagram is divided into five regions by vertical dashed lines: 1. Start Condition: SDA transitions from high to low while SCL is high. 2. Change of Data Allowed: SDA is low and SCL is low. 3. Data line Stable Data Valid: SDA is low and SCL is high. 4. Change of Data Allowed: SDA is low and SCL is low. 5. Stop Condition: SDA transitions from low to high while SCL is high. The SDA signal is labeled 'S' at the start and 'P' at the stop.

Timing diagram for I2C START and STOP conditions showing SDA and SCL signals.

NOTE

The signal transitions for the START/STOP conditions, as depicted in Figure 70 , 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 slaves, because unequal line delays may result in an incorrect SDA/SCL timing relationship.

12.2.6.2. Addressing slave protocol

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

12.2.6.2.1. 7-bit address format

In 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) defines the R/W status, as shown in Figure 71 . When bit 0 is set to 0, the master writes to the slave. When bit 0 is set to 1, the master reads from the slave.

Figure 71. 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'. The R/W and ACK bits are 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'. The R/W and ACK bits are labeled 'sent by slave'. Below the diagram, it defines: S = START Condition, ACK = Acknowledge, and R/W = Read/Write Pulse.

12.2.6.2.2. 10-bit address format

The 10-bit address format transfers two bytes for each 10-bit address.

Figure 72 shows the 10-bit address format:

Figure 72. 10-bit Address Format

Diagram 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 first five bits (S, '1', '1', '1', '0') is labeled 'Reserved for 10-bit Address'. Brackets under A9-A8, A7-A0, and the final ACK are 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 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 first five bits (S, '1', '1', '1', '0') is labeled 'Reserved for 10-bit Address'. Brackets under A9-A8, A7-A0, and the final ACK are 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 1051.
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 12.2.6.4 .
0000 001XCBUS address. DW_apb_i2c ignores these accesses.
0000 010XReserved.
Slave AddressR/W BitDescription
0000 011XReserved.
0000 1XXXHigh-speed master code (for more
information, refer to Section 12.2.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)
issuing a STOP condition. The slave must leave theSDAline high so that the master can abort the transfer. If the master-
transmitter is transmitting data as shown in acknowledge pulse after every byte of data is received.Figure 73, the slave-receiver responds to the master-transmitter with an
For 7-bit Address Transmitter Protocol S Slave Address R/W A ‘0’ (read)DATA A DAT A A/A P
For 10-bit Address S Slave Address First 7 bits R/W A ‘11110xxx’ ‘0’ (write)Slave Address Second Byte A DATA A/A P
From Master to SlaveA = Acknowledge (SDA low) S = START Condition
From Slave to MasterA = No Acknowledge (SDA high) P = STOP Condition
12.2.6.3.2. Master-receiver and slave-transmitter If the master is receiving data as shown in Figure 74the master responds to the slave-transmitter with an acknowledge
transmitter that this is the last byte. The slave-transmitter relinquishes theSDA line after detecting No Acknowledge

DW_apb_i2c does not restrict you from using reserved addresses. However, if you use these reserved addresses, you may experience incompatibilities with I2C components.

12.2.6.3. Transmitting and receiving protocol

The master can initiate data transmission and reception to and 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.

12.2.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 no slave-receiver responds 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 73 , the slave-receiver responds to the master-transmitter with an acknowledge pulse after every byte of data is received.

Figure 73. 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 types: 7-bit and 10-bit.

For 7-bit Address: The sequence of bytes is S (START), Slave Address (7 bits), R/W bit (0 for read), A (Acknowledge), DATA, A (Acknowledge), DATA, A/A̅ (Acknowledge/No Acknowledge), and P (STOP). A label '0' (read)' points to the R/W bit.

For 10-bit Address: The sequence of bytes is S (START), Slave Address First 7 bits, R/W bit (0 for write), A (Acknowledge), Slave Address Second Byte, A (Acknowledge), DATA, A/A̅ (Acknowledge/No Acknowledge), and P (STOP). A label '11110xxx' '0' (write)' points to the R/W bit.

Legend:

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

12.2.6.3.2. Master-receiver and slave-transmitter

If the master is receiving data as shown in Figure 74 the master responds to the slave-transmitter with an acknowledge pulse after receiving each byte of data, 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 No Acknowledge (NACK) so that the master can issue a STOP condition.

Figure 74. I2C Master-Receiver Protocol

Diagram of I2C Master-Receiver Protocol for 7-bit and 10-bit addresses.

The diagram illustrates the I2C Master-Receiver Protocol for two address formats: 7-bit and 10-bit.

For 7-bit Address:

For 10-bit Address:

Legend:

Diagram of I2C Master-Receiver Protocol for 7-bit and 10-bit addresses.

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, see Section 12.2.5.2 .

NOTE

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

12.2.6.4. START BYTE Transfer Protocol

The START BYTE transfer protocol is designed 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 the transmission of seven zeros, followed by a one, as illustrated in Figure 75 . This allows the processor 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 75. I2C Start Byte Transfer

Timing diagram for I2C Start Byte Transfer showing SDA and SCL signals.

The diagram shows the timing of the I2C Start Byte Transfer. The SDA (Serial Data) line is pulled up to a high state. The SCL (Serial Clock) line is shown with a series of pulses. The start byte is transmitted as a sequence of seven zeros followed by a one (00000001). The SCL line is labeled with 'S' for the start condition, '1' for the first bit, '2' for the second bit, '7' for the seventh bit, '8' for the eighth bit, '9' for the ninth bit, and 'Ack' for the acknowledgment pulse. The SDA line is labeled with 'dummy acknowledge (HIGH)' during the acknowledgment phase. The SCL line is labeled with 'Sr' for the restart condition. A red dashed box highlights the start byte sequence on the SCL line.

Timing diagram for I2C Start Byte Transfer showing SDA and SCL signals.

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.

Hardware receivers do not respond to the START BYTE procedure because it uses a reserved address and resets after the RESTART condition generates.

12.2.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 (transmit) FIFO management illustrated in Figure 76.

12.2.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 76 shows the bits in the IC_DATA_CMD register.

Figure 76.
IC_DATA_CMD
Register

Diagram of the IC_DATA_CMD register structure and bit definitions.

The diagram shows the IC_DATA_CMD register structure. It is a 10-bit register with the following fields:

Diagram of the IC_DATA_CMD register structure and bit definitions.

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

Figure 77. Master
Transmitter - TX FIFO
Empties/STOP
Generation

Timing diagram for Master Transmitter TX FIFO Empty/STOP generation.

The diagram shows the SDA and SCL lines over time. It illustrates the sequence of events when the TX FIFO becomes empty during a master transmitter operation. Key events include:

Timing diagram for Master Transmitter TX FIFO Empty/STOP generation.

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

Figure 78. Master
Receiver - TX FIFO
Empties/STOP
Generation

Timing diagram for Master Receiver TX FIFO Empty/STOP generation.

The diagram shows the SDA and SCL lines over time. It illustrates the sequence of events when the TX FIFO becomes empty during a master receiver operation. Key events include:

Timing diagram for Master Receiver TX FIFO Empty/STOP generation.

Figure 79 and Figure 80 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 79 illustrates this situation during operation as a master transmitter.

Figure 79. Master Transmitter - Restart Bit of IC_DATA_CMD Is Set

Figure 84. Master Receiver - First Command Loaded After TX FIFO Allowed to Empty/Restart Bit Set

Timing diagram for I2C Master Receiver showing SDA, SCL, and FIFO status. It illustrates the sequence of events from command loading to a restart.

The diagram shows the interaction between the SDA and SCL lines and the TX FIFO. Key events include: a START condition on SDA; the TX FIFO being loaded with a command; the master popping the command from the FIFO; the master holding SCL low; the master issuing a RESTART; and the master issuing a NOT ACK as required before the RESTART. The TX FIFO is then loaded with a new command.

Timing diagram for I2C Master Receiver showing SDA, SCL, and FIFO status. It illustrates the sequence of events from command loading to a restart.

12.2.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 set to 1. 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 address 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 stops generating SCL by disabling the output driver. Figure 85 illustrates the timing of two masters arbitrating on the bus.

Figure 85. Multiple Master Arbitration

Timing diagram for Multiple Master Arbitration showing CLK_A, DATA2, SDA, and SCL. It illustrates the arbitration process where DATA1 loses arbitration.

The diagram shows the arbitration process between two masters. It includes signals for CLK_A, DATA2, SDA, and SCL. Key events include: SDA lines up with DATA1 START condition; matching data; DATA1 loses arbitration; SDA mirrors DATA2; and SCL is set to 1.

Timing diagram for Multiple Master Arbitration showing CLK_A, DATA2, SDA, and SCL. It illustrates the arbitration process where DATA1 loses arbitration.

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:

i NOTE

Slaves do not participate in the arbitration process.

12.2.9. Clock synchronisation

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 synchronisation 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 86. Optionally, slaves may hold the SCL line low to slow down the timing on the I2C bus.

Figure 86. Multi-Master Clock Synchronisation

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

The diagram illustrates the clock synchronisation process on an I2C bus. It shows three signals: CLK_A, CLK_B, and SCL. CLK_A and CLK_B represent the individual clock signals from two different masters. SCL is the resulting synchronized clock signal. The process starts with SCL being low. When SCL transitions low, it resets all CLKs to start counting their LOW periods. As CLK_A and CLK_B transition high, SCL remains low. When CLK_A transitions low, SCL transitions high, starting the counting of the HIGH period. If CLK_B transitions low while SCL is high, SCL remains high, forcing CLK_B into a HIGH wait state. This process repeats until all masters have completed their high time, and SCL transitions low again, forcing all masters into a LOW wait state. The diagram includes labels for 'Wait State' and 'Start counting HIGH period'.

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

12.2.10. Operation modes

This section provides information about operation modes.

i NOTE

Only set the DW_apb_i2c to operate as an I2C Master or an I2C Slave. Never set the DW_apb_i2c to operate as both simultaneously. To avoid this, never simultaneously set IC_CON.IC_SLAVE_DISABLE and IC_CON.MASTER_MODE to zero and one, respectively.

12.2.10.1. Slave mode operation

This section discusses slave mode procedures.

12.2.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_CON.IC_SLAVE_DISABLE ) and a 0 to bit zero ( IC_CON.MASTER_MODE ).
NOTE

Slaves and masters can use different addressing settings. For instance, a slave can be programmed with 7-bit addressing and a master with 10-bit addressing, and vice versa.

  1. 4. Enable the DW_apb_i2c by writing a 1 to IC_ENABLE.ENABLE.
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

Only bring the DW_apb_i2c Slave out of reset 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.

12.2.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. 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 remains 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, use a hardware and/or software timing routine to instruct the CPU to perform periodic reads of the IC_RAW_INTR_STAT register.
    • ◦ 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.
    • ◦ Software must then act to satisfy the I2C transfer.
    • ◦ 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 400 kb/s, the timing interval is 25µs.
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. 4. If there is any data remaining in the TX FIFO before receiving the read request, 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, re-use the timing routine described in the previous step to read the IC_RAW_INTR_STAT register.
NOTE

Because the DW_apb_i2c's TX FIFO is forced into a flushed/reset state whenever a TX_ABORT event occurs, software must release the DW_apb_i2c from this state by reading the IC_CLR_TX_ABORT register before attempting to write into the TX FIFO. See register IC_RAW_INTR_STAT for more details.

    • ◦ Reads that indicate bit six ( R_TX_ABORT) being set to one must be treated as the equivalent of the TX_ABORT interrupt being asserted.
    • ◦ There is no further action required from software.
    • ◦ The timing interval used should be similar to that described in the previous step for the IC_RAW_INTR_STAT.RD_REQ register.
    1. 5. Software writes to the IC_DATA_CMD register with the data to be written (by writing a 0 in bit 8).
    2. 6. Software must clear the RD_REQ and TX_ABORT interrupts (bits five and six, respectively) of the IC_RAW_INTR_STAT register before proceeding. If the RD_REQ or TX_ABORT 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_ABORT bit has been read as one.
    3. 7. The DW_apb_i2c releases the SCL and transmits the byte.
    4. 8. 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, since this mode does not support read transfers.

12.2.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 (receive) 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. 4. 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 to zero or setting IC_TX_TL to a value larger than zero, you should implement a timing routine (described in Section 12.2.10.1.2) for periodic reads of the IC_STATUS register. This timing routine should treat reads of the IC_STATUS register, with bit 3 ( RFNE) set at one as the equivalent of an RX_FULL interrupt.
  2. 5. Software may read the byte from the IC_DATA_CMD register (bits 7:0).
  3. 6. The other master device may hold the I2C bus by issuing a RESTART condition, or release the bus by issuing a STOP condition.

12.2.10.1.4. Slave-transfer operation for bulk transfers

In the standard I2C protocol, all transactions are single byte transactions; the programmer responds to a remote master read request by writing one byte into the slave's TX FIFO. When a slave (slave-transmitter) receives 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 handles more data in the TX FIFO. This enables subsequent read requests to take data without raising an interrupt. This eliminates latencies incurred between interrupts. This mode only occurs when DW_apb_i2c acts 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 a data write into the TX FIFO.

If the RD_REQ interrupt is masked by setting IC_INTR_STAT.R_RD_REQ to zero, use a timing routine 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 RD_REQ . This timing routine is similar to that described in Section 12.2.10.1.2 .

The RD_REQ interrupt is raised upon a read request. Always clear this interrupt 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. The master can request additional data at the end of a transmission by acknowledging the last byte. In this scenario, the slave must raise RD_REQ again.

If you know in advance that the remote master requests a packet of n bytes, you can write n byte to the TX FIFO. Then, when another master addresses DW_apb_i2c and requests data, the remote master will receive a continuous stream of data. This happens because the DW_apb_i2c slave continues to send data to the remote master as long as the remote master acknowledges 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 doesn't read all of the bytes from the TX FIFO, the DW_apb_i2c ignores the excess bytes with the following procedure:

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.

12.2.10.2. Master mode operation

This section discusses master mode procedures.

12.2.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 can use different addressing settings. For instance, a slave can be programmed with 7-bit addressing and a master with 10-bit addressing, and vice versa.

  1. 3. Write the address of the I2C device to be addressed to bits 9:0 of the IC_TAR register. This register also determines whether the I2C will perform a General Call or a START BYTE command.
  2. 4. Enable the DW_apb_i2c by writing a one to IC_ENABLE.ENABLE .
  3. 5. Write the transfer direction and the data to be sent to the IC_DATA_CMD register. 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.
NOTE

If you write to the IC_DATA_CMD register before enabling the DW_apb_i2c , the data and commands are lost: the buffers are kept cleared when DW_apb_i2c is disabled.

The values stored are static and do not need to be reprogrammed when the DW_apb_i2c is disabled except for transfer direction and data. As a result, you may not need to perform steps two, three, four, and five if you already configured the reset values.

12.2.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 data to the lower byte of the I2C RX/TX Data Buffer and Command Register ( IC_DATA_CMD ). For I2C write operations, write zero to the CMD bit [8]. Subsequently, to issue a read command, write a one to the CMD bit and write don't care to the lower byte of the IC_DATA_CMD register. The DW_apb_i2c master continues to initiate transfers as long as there are commands present in the TX FIFO. If the TX FIFO becomes empty, the master performs one of the following actions based on the value of IC_DATA_CMD :

For more details, refer to Section 12.2.7 .

12.2.10.3. Disabling DW_apb_i2c

The IC_ENABLE_STATUS register allows software to unambiguously determine when the I2C hardware has completely shut down.

NOTE

Earlier versions of DW_apb_i2c required the programmer to monitor two registers: ( IC_STATUS and IC_RAW_INTR_STAT ). RP2350 only requires the programmer to monitor IC_ENABLE_STATUS .

To shut down I2C hardware, write a zero to IC_ENABLE.ENABLE . The DW_apb_i2c master can be disabled only if the command currently processing when the de-assertion occurs has the STOP bit set to one. If you attempt 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.

To relinquish the I2C bus and disable DW_apb_i2c while the DW_apb_i2c master is processing a command without the STOP bit set, issue an ABORT request .

12.2.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 400 kb/s, \( t_{i2c\_poll} \) is 25µ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, or function that prevents any further I2C master transactions from starting from software, but allows any pending transfers to be completed.
i 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, sleep for \( t_{i2c\_poll} \) and proceed to the previous step. Otherwise, exit with a relevant success code.

12.2.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 a TX FIFO flush. Aborting the transfer is allowed only in master mode of operation.

12.2.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_ABRT interrupt.
  5. 5. Read the IC_TX_ABRT_SOURCE register to identify the source as ABRT_USER_ABRT.

12.2.11. Spike suppression

The DW_apb_i2c contains programmable spike suppression logic that matches 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. The value should account for the frequency of ic_clk and the relevant spike length specification. Each counter starts whenever its input signal changes value. Depending on the behaviour of the input signal, one of the following scenarios occurs:

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

Figure 87. Spike
Suppression Example

Timing diagram for spike suppression example. It shows four signals: Recovery Clocks (a regular square wave), SCL (a square wave with a long low pulse), Spike length counter (a sequence of values: 0, 1, 2, 3, 0, 1, 2, 3, 4, 5, 0), and Internal filtered SCL (a square wave that is low during the spike and returns to high after the counter reaches 5).

The diagram illustrates the spike suppression logic. The Recovery Clocks are shown as a regular square wave. The SCL signal is a square wave that transitions from high to low, then back to high, and then to low again. The Spike length counter is a sequence of values: 0, 1, 2, 3, 0, 1, 2, 3, 4, 5, 0. The Internal filtered SCL is a square wave that is low during the spike and returns to high after the counter reaches 5.

Timing diagram for spike suppression example. It shows four signals: Recovery Clocks (a regular square wave), SCL (a square wave with a long low pulse), Spike length counter (a sequence of values: 0, 1, 2, 3, 0, 1, 2, 3, 4, 5, 0), and Internal filtered SCL (a square wave that is low during the spike and returns to high after the counter reaches 5).

NOTE

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

The I2C Bus Specification calls for different maximum spike lengths according to the operating mode (50 ns for SS and FS). Register IC_FS_SPKLEN holds the maximum spike length for SS and FS modes.

This register is 8 bits wide and accessible through the APB interface for reads and writes. However, you can only write to this register 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 100 ns for ic_clk period, so should be updated for the clk_sys period in use on RP2350.

NOTE

12.2.12. Fast mode plus operation

In fast mode plus, the DW_apb_i2c extends fast mode operation to be support speeds up to 1000 kb/s. 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 32 MHz (refer to Section 12.2.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 12.2.14 ).
  4. 4. Program the IC_FS_SPKLEN register to suppress the maximum spike of 50 ns.
  5. 5. Program the IC_SDA_SETUP register to meet the minimum data setup time (tSU; DAT).

12.2.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.

12.2.13.1. SDA line is stuck at LOW

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

Figure 88. SDA Recovery with 9 SCL Clocks

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

Figure 88 is a timing diagram illustrating the recovery of the SDA line when it is stuck at LOW. The diagram shows four signals over 11 clock cycles (0 to 10). The SCL signal is a periodic square wave. The SDA signal is initially low and then transitions high at clock 9. The MST_SDA signal is low until clock 9, then transitions high. A label indicates 'Master drives 9 clocks to recover SDA stuck at low'.

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

Figure 89. SDA Recovery with 6 SCL Clocks

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

Figure 89 is a timing diagram illustrating the recovery of the SDA line when it is stuck at LOW. The diagram shows four signals over 8 clock cycles (0 to 7). The SCL signal is a periodic square wave. The SDA signal is initially low and then transitions high at clock 6. The MST_SDA signal is low until clock 6, then transitions high. A label indicates 'Master drives 9 clocks to recover SDA stuck at low'.

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

12.2.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. Instead, reset the bus using the hardware reset signal.

12.2.14. IC_CLK frequency configuration

When the DW_apb_i2c is configured as a Standard (SS), Fast (FS), or 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:

NOTE

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

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 1052 lists the derivation of I2C timing parameters from the *CNT programming registers.

Table 1052. 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 conditiontHD;STAIC_SS_SCL_HCNTIC_FS_SCL_HCNT
Setup time for STOP conditiontSU;STOIC_SS_SCL_HCNTIC_FS_SCL_HCNT
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

12.2.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:

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 90 . 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 90. 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 with rounded edges. The high time of the SCL signal is labeled as HCNT + IC_*_SPKLEN + 7, and the low time is labeled as LCNT + 1. The SCL rise time and fall time are indicated by red arrows. The equations for SCL_High_time and SCL_Low_time are provided below the diagram.

\[ \text{SCL\_High\_time} = [(\text{HCNT} + \text{IC\_}\ast\text{SPKLEN} + 7) * \text{ic\_clk}] + \text{SCL\_Fall\_time} \]
\[ \text{SCL\_Low\_time} = [(\text{LCNT} + 1) * \text{ic\_clk}] - \text{SCL\_Fall\_time} + \text{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 with rounded edges. The high time of the SCL signal is labeled as HCNT + IC_*_SPKLEN + 7, and the low time is labeled as LCNT + 1. The SCL rise time and fall time are indicated by red arrows. The equations for SCL_High_time and SCL_Low_time are provided below the diagram.

12.2.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.

12.2.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 :

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

The previous equation gives:

\[ \text{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\text{s} / (16 + 14) = 83.3\text{ns} = 12 \text{ MHz} \]

Testing these results shows that protocol requirements are satisfied.

Table 1053 lists the minimum ic_clk values for all modes with high and low count values.

Table 1053. ic_clk in Relation to High and Low Counts

Speed Modeic_clkfreq (MHz)Minimum Value of IC_*_SPKLENSCL 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μs1465.2μs
FS12.0116151.33μs1461.16μs
FM+3221615500 ns167500 ns

12.2.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 1053 .

The default ic_clk period value is set to 100 ns, 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 = (ROUNDUP(MIN_SCL_xxxtime*OSCFREQ,0))
MIN_SCL_HIGHtime = Minimum High Period
MIN_SCL_HIGHtime = 400ns for 100kb/s,
600ns for 400kb/s,
260ns for 1000kb/s,
MIN_SCL_LOWtime = Minimum Low Period
MIN_SCL_LOWtime = 470ns for 100kb/s,
1300ns for 400kb/s,
500ns for 1000kb/s,
OSCFREQ = ic_clk Clock Frequency (Hz).

For example:

OSCFREQ = 100MHz
I2Cmode = fast, 400kb/s
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

12.2.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 data transfers to and from the DMA. DMA transfers use single accesses, since the data rate is relatively low.

12.2.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.

12.2.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.

12.2.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. Because the DMA controller normally has the highest priority on the system bus, transfers complete quickly.

12.2.16. Operation of interrupt registers

Table 1054 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 1054. 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

12.2.17. List of registers

The I2C0 and I2C1 registers start at base addresses of 0x40090000 and 0x40098000 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 i2c.h in the pico-sdk GitHub repository .

Table 1055. 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
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
OffsetNameInfo
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 1056. 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
BitsDescriptionTypeReset
7

STOP_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
6

IC_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
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
BitsDescriptionTypeReset
3IC_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
2:1SPEED: 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
0MASTER_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 1057. IC_TAR Register

BitsDescriptionTypeReset
31:12Reserved.--
11SPECIAL: 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: 0x0RW0x0
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_ABRT) 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 1058. IC_SAR Register

BitsDescriptionTypeReset
31:10Reserved.--
BitsDescriptionTypeReset
9:0

IC_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 1051 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 1059.
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
BitsDescriptionTypeReset
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
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
BitsDescriptionTypeReset
0x1 → READ: Master Read Command
7:0DAT : 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 1060.
IC_SS_SCL_HCNT
Register

BitsDescriptionTypeReset
31:16Reserved.--
15:0IC_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 1061.
IC_SS_SCL_LCNT
Register

BitsDescriptionTypeReset
31:16Reserved.--
BitsDescriptionTypeReset
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 1064.
IC_INTR_STAT
Register

BitsDescriptionTypeReset
31:13Reserved.--
12

R_RESTART_DET: See IC_RAW_INTR_STAT for a detailed description of R_RESTART_DET bit.

Reset value: 0x0

Enumerated values:

0x0 → INACTIVE: R_RESTART_DET interrupt is inactive

0x1 → ACTIVE: R_RESTART_DET interrupt is active

RO0x0
11

R_GEN_CALL: See IC_RAW_INTR_STAT for a detailed description of R_GEN_CALL bit.

Reset value: 0x0

Enumerated values:

0x0 → INACTIVE: R_GEN_CALL interrupt is inactive

0x1 → ACTIVE: R_GEN_CALL interrupt is active

RO0x0
BitsDescriptionTypeReset
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:
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
BitsDescriptionTypeReset
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:
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 unmasks the interrupt.

Table 1065.
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
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
BitsDescriptionTypeReset
0x1 → DISABLED: RX_DONE interrupt is unmasked
6M_TX_ABORT : This bit masks the R_TX_ABORT 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
3M_TX_OVER : This bit masks the R_TX_OVER interrupt in IC_INTR_STAT register.

Reset value: 0x1
RW0x1
Enumerated values:
0x0 → ENABLED: TX_OVER interrupt is masked
0x1 → DISABLED: TX_OVER interrupt is unmasked
2M_RX_FULL : This bit masks the R_RX_FULL interrupt in IC_INTR_STAT register.

Reset value: 0x1
RW0x1
Enumerated values:
0x0 → ENABLED: RX_FULL interrupt is masked
0x1 → DISABLED: RX_FULL interrupt is unmasked
1M_RX_OVER : This bit masks the R_RX_OVER interrupt in IC_INTR_STAT register.

Reset value: 0x1
RW0x1
Enumerated values:
0x0 → ENABLED: RX_OVER interrupt is masked
0x1 → DISABLED: RX_OVER interrupt is unmasked
BitsDescriptionTypeReset
0M_RX_UNDER : This bit masks the R_RX_UNDER interrupt in IC_INTR_STAT register.

Reset value: 0x1
RW0x1
Enumerated values:
0x0 → ENABLED: RX_UNDER interrupt is masked
0x1 → DISABLED: RX_UNDER interrupt is unmasked

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 1066.
IC_RAW_INTR_STAT
Register

BitsDescriptionTypeReset
31:13Reserved.--
12RESTART_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
11GEN_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
10START_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:
BitsDescriptionTypeReset
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:
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
BitsDescriptionTypeReset
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
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

I2C: IC_RX_TL Register

Offset: 0x38

Description

I2C Receive FIFO Threshold Register

Table 1067. IC_RX_TL Register

BitsDescriptionTypeReset
31:8Reserved.--
7:0RX_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 1068. 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 1069.
IC_CLR_INTR Register

Bits 31:0 Bits 31:0 Bits 31:28column_2Description Description Input value for GPIO0…31. Description QSPI_SD : Input value on QSPI SD0 (MOSI), SD1 (MISO), SD2 and SD3 pinsType RO Type RO Type ROReset - Reset 0x00000000 Reset 0x0
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 clearRO0x0
Table 1070. Bits IC_CLR_RX_UNDERDescriptionTypeReset
Register 31:1Reserved.--
0CLR_RX_UNDER: Read this register to clear the RX_UNDER interrupt (bit 0) of the IC_RAW_INTR_STAT register.RO0x0
Table 1071. Bits IC_CLR_RX_OVERDescriptionTypeReset
Register 31:1Reserved.--
0CLR_RX_OVER: Read this register to clear the RX_OVER interrupt (bit 1) of the IC_RAW_INTR_STAT register.RO0x0

I2C: IC_CLR_RX_UNDER Register

Offset: 0x44

Description

Clear RX_UNDER Interrupt Register

Table 1070.
IC_CLR_RX_UNDER
Register

I2C: IC_CLR_RX_OVER Register

Offset: 0x48

Description

Clear RX_OVER Interrupt Register

Table 1071.
IC_CLR_RX_OVER
Register

I2C: IC_CLR_TX_OVER Register

Offset: 0x4c

Description

Clear TX_OVER Interrupt Register

Table 1072.
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 1073.
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 1074.
IC_CLR_TX_ABRT
Register

BitsDescriptionTypeReset
31:1Reserved.--
0CLR_TX_ABRT : Read this register to clear the TX_ABRT interrupt (bit 6) of the IC_RAW_INTR_STAT register, and the IC_TX_ABRT_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_ABRT_SOURCE register for an exception to clearing IC_TX_ABRT_SOURCE.

Reset value: 0x0
RO0x0

I2C: IC_CLR_RX_DONE Register

Offset: 0x58

Description

Clear RX_DONE Interrupt Register

Table 1075.
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 1076.
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 1077.
IC_CLR_STOP_DET
Register

BitsDescriptionTypeReset
31:1Reserved.--
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 1078.
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 1079.
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 1080.
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
0x1 → BLOCKED: Tx Command execution blocked
BitsDescriptionTypeReset
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 1081.
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
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:
BitsDescriptionTypeReset
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 1082. 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 1083. 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 1084.
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 1085.
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.--
16ABRT_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:
BitsDescriptionTypeReset
0x0 → ABRT_USER_ABRT_VOID: Transfer abort detected by master- scenario not present
0x1 → ABRT_USER_ABRT_GENERATED: Transfer abort detected by master
15ABRT_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
14ABRT_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
13ABRT_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:
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
BitsDescriptionTypeReset
12

ARB_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
11

ABRT_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
10

ABRT_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
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
BitsDescriptionTypeReset
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
8ABRT_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
7ABRT_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
6ABRT_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
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:
BitsDescriptionTypeReset
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
Enumerated values:
0x0 → INACTIVE: This abort is not generated
0x1 → ACTIVE: Byte 2 of 10Bit Address not ACKed by any slave
1ABRT_10ADDR1_NOACK: This field indicates that the Master is in 10-bit address mode and the first 10-bit address byte was not acknowledged by any slave.

Reset value: 0x0

Role of DW_apb_i2c: Master-Transmitter or Master-Receiver
RO0x0
Enumerated values:
0x0 → INACTIVE: This abort is not generated
BitsDescriptionTypeReset
0x1 → ACTIVE: Byte 1 of 10Bit Address not ACKed by any slave
0ABRT_7B_ADDR_NOACK: This field indicates that the Master is in 7-bit addressing mode and the address sent was not acknowledged by any slave.

Reset value: 0x0

Role of DW_apb_i2c: Master-Transmitter or Master-Receiver
RO0x0
Enumerated values:
0x0 → INACTIVE: This abort is not generated
0x1 → ACTIVE: This abort is generated because of NOACK for 7-bit address

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 1086.
IC_SLV_DATA_NACK_ONLY Register

BitsDescriptionTypeReset
31:1Reserved.--
0NACK: Generate NACK. This NACK generation only occurs when DW_apb_i2c is a slave-receiver. If this register is set to a value of 1, it can only generate a NACK after a data byte is received; hence, the data transfer is aborted and the data received is not pushed to the receive buffer.

When the register is set to a value of 0, it generates NACK/ACK, depending on normal criteria. - 1: generate NACK after data byte received - 0: generate NACK/ACK normally Reset value: 0x0
RW0x0
Enumerated values:
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 1087.
IC_DMA_CR Register

BitsDescriptionTypeReset
31:2Reserved.--
BitsDescriptionTypeReset
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 1088.
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 1089.
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 1090.
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 1091.
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 1092.
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
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:
BitsDescriptionTypeReset
0x0 → INACTIVE: Slave is disabled when it is idle
0x1 → ACTIVE: Slave is disabled when it is active
0IC_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 1093.
IC_FS_SPKLEN
Register

BitsDescriptionTypeReset
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, measured in ic_clk cycles, of the longest spike in the SCL or SDA lines that will be filtered out by the spike suppression logic. 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 1; hardware prevents values less than this being written, and if attempted results in 1 being set. or more information, refer to 'Spike Suppression'.RW0x07

I2C: IC_CLR_RESTART_DET Register

Offset: 0xa8

Description

Clear RESTART_DET Interrupt Register

Table 1094.
IC_CLR_RESTART_DET
Register

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

Reset value: 0x0
RO0x0

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 1095.
IC_COMP_PARAM_1
Register

BitsDescriptionTypeReset
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_COMP_VERSION Register

Offset: 0xf8

Description

I2C Component Version Register

Table 1096.
IC_COMP_VERSION
Register

BitsDescriptionTypeReset
31:0IC_COMP_VERSIONRO0x3230312a

I2C: IC_COMP_TYPE Register

Offset: 0xfc

Description

I2C Component Type Register

Table 1097.
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