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:
- • Master or Slave (Default to Master mode)
- • Standard mode, Fast mode or Fast mode plus
- • Default slave address
0x055 - • Supports 10-bit addressing in Master mode
- • 16-element transmit buffer
- • 16-element receive buffer
- • Can be driven from DMA
- • Can generate interrupts
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:
- • pull-up enabled
- • slew rate limited
- • schmitt trigger enabled
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):
- • 32-bit APB access
- • Supports Standard mode, Fast mode or Fast mode plus (not High speed)
- • Default slave address of
0x055 - • Master or Slave mode
- • Master by default (Slave mode disabled at reset)
- • 10-bit addressing supported in master mode (7-bit by default)
- • 16 entry transmit buffer
- • 16 entry receive buffer
- • Allows restart conditions when a master (can be disabled for legacy device support)
- • Configurable timing to adjust \( T_{suDAT}/T_{hDAT} \)
- • General calls responded to on reset
- • Interface to DMA
- • Single interrupt output
- • Configurable timing to adjust clock frequency
- • Spike suppression (default 7 \( clk_{sys} \) cycles)
- • Can NACK after data received by Slave
- • Hold transfer when TX FIFO empty
- • Hold bus until space available in RX FIFO
- • Restart detect interrupt in Slave mode
- • Optional blocking Master commands (not enabled by default)
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:
- • standard mode (with data rates from 0 to 100 kb/s),
- • fast mode (with data rates up to 400 kb/s),
- • fast mode plus (with data rates up to 1000 kb/s).
These modes are not supported:
- • High-speed mode (with data rates up to 3.4Mb/s),
- • Ultra-Fast Speed Mode (with data rates up to 5Mb/s).
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:
- • LCD displays
- • high-bit count ADCs
- • high capacity EEPROMs
These devices typically need to transfer large amounts of data.
Most maintenance and control applications, the common use for the I2C bus, typically operate at 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:
- • an AMBA APB slave interface
- • an I2C interface
- • FIFO logic to maintain coherency between the two interfaces
The blocks of the component are illustrated in Figure 68 .
Figure 68. I2C Block diagram

The following define the functions of the blocks in Figure 68 :
- • AMBA Bus Interface Unit: Takes the APB interface signals and translates them into a common generic interface that allows the register file to be bus protocol-agnostic.
- • Register File: Contains configuration registers and is the interface with software.
- • Slave State Machine: Follows the protocol for a slave and monitors bus for address match.
- • Master State Machine: Generates the I2C protocol for the master transfers.
- •
Clock Generator:
Calculates the required timing to do the following:
- ◦ Generate the
SCLclock when configured as a master - ◦ Check for bus idle
- ◦ Generate a START and a STOP
- ◦ Setup the data and hold the data
- ◦ Generate the
- • RX Shift: Takes data into the design and extracts it in byte format.
- • TX Shift: Presents data supplied by CPU for transfer on the I2C bus.
- • RX Filter: Detects the events in the bus; for example, start, stop and arbitration lost.
- • Toggle: Generates pulses on both sides and toggles to transfer signals across clock domains.
- • Synchronizer: Transfers signals from one clock domain to another.
- • DMA Interface: Generates the handshaking signals to the central DMA controller in order to automate the data transfer without CPU intervention.
- • Interrupt Controller: Generates the raw interrupt and interrupt flags, allowing them to be set and cleared.
- • RX FIFO/TX FIFO: Holds the RX FIFO and TX FIFO register banks and controllers, along with their status levels.
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:
- • An I2C master only, communicating with other I2C slaves
- • An I2C slave only, communicating with one or more I2C masters.
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. 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. 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

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.
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:
- •
IC_DATA_CMD.STOPis checked and:- ◦ If set to 1, a STOP bit is issued.
- ◦ If set to 0, the
SCLis held low until the next command is written to the TX FIFO.
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

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

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
12.2.6.2.2. 10-bit address format
The 10-bit address format transfers two bytes for each 10-bit address.
- • In the first byte, the first five bits (bits 7:3) indicate a 10-bit transfer. The next two bits (bits 2:1) contain bits 9:8 of the slave address. The LSB bit (bit 0) defines the R/W status.
- • The second byte contains bits 7:0 of the slave address.
Figure 72 shows the 10-bit address format:
Figure 72. 10-bit Address Format

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
This table defines the special purpose and reserved first byte addresses.
Table 1051.
I2C/SMBus Definition
of Bits in First Byte
| Slave Address | R/W Bit | Description |
|---|---|---|
| 0000 000 | 0 | General Call Address. DW_apb_i2c places the data in the receive buffer and issues a General Call interrupt. |
| 0000 000 | 1 | START byte. For more details, refer to Section 12.2.6.4 . |
| 0000 001 | X | CBUS address. DW_apb_i2c ignores these accesses. |
| 0000 010 | X | Reserved. |
| Slave Address | R/W Bit | Description |
|---|---|---|
| 0000 011 | X | Reserved. |
| 0000 1XX | X | High-speed master code (for more |
| information, refer to Section 12.2.8 ). | ||
| 1111 1XX | X | Reserved. |
| 1111 0XX | X | 10-bit slave addressing. |
| 0001 000 | X | SMbus Host. (not supported) |
| 0001 100 | X | SMBus Alert Response Address. (not supported) |
| 1100 001 | X | SMBus Device Default Address. (not supported) |
| 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 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 Slave | A = Acknowledge (SDA low) S = START Condition | |
| From Slave to Master | A = 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 i | n Figure 74 | the master responds to the slave-transmitter with an acknowledge |
| transmitter that this is the last byte. The slave-transmitter relinquishes the | SDA 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

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:
- Blue box: From Master to Slave
- White box: From Slave to Master
- A = Acknowledge (SDA low)
- A̅ = No Acknowledge (SDA high)
- S = START Condition
- P = STOP Condition
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

The diagram illustrates the I2C Master-Receiver Protocol for two address formats: 7-bit and 10-bit.
For 7-bit Address:
- Sequence: S (Start) → Slave Address (7 bits) → R/W (Read/Write) → A (Acknowledge) → DATA → A (Acknowledge) → \( \bar{A} \) (No Acknowledge) → P (Stop).
- Direction: Slave Address and DATA are transmitted from Master to Slave. R/W, A, and \( \bar{A} \) are signals on the bus.
- Read/Write: R/W = '1' (read) for the 7-bit address format.
For 10-bit Address:
- Sequence: S (Start) → Slave Address First 7 bits → R/W (Read/Write) → A (Acknowledge) → Slave Address Second Byte → A (Acknowledge) → Sr (Restart) → Slave Address First 7 bits → R/W (Read/Write) → A (Acknowledge) → DATA → \( \bar{A} \) (No Acknowledge) → P (Stop).
- Direction: Slave Address First 7 bits, Slave Address Second Byte, and DATA are transmitted from Master to Slave. R/W, A, and \( \bar{A} \) are signals on the bus.
- Read/Write: R/W = '0' (write) for the first 7 bits and '1' (read) for the second 7 bits.
Legend:
- Blue box: From Master to Slave
- White box: From Slave to Master
- A = Acknowledge (SDA low)
- \( \bar{A} \) = No Acknowledge (SDA high)
- S = START Condition
- R = RESTART Condition
- P = STOP Condition
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

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.
The START BYTE procedure is as follows:
- 1. Master generates a START condition.
- 2. Master transmits the START byte (0000 0001).
- 3. Master transmits the ACK clock pulse. (Present only to conform with the byte handling format used on the bus)
- 4. No slave sets the ACK signal to zero.
- 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

The diagram shows the
IC_DATA_CMD register structure. It is a 10-bit register with the following fields:
- Restart : Bit 9. Write-only field; this bit determines whether RESTART (or STOP followed by START in case or restart capability is not enabled) is generated before data is sent or received.
- Stop : Bit 8. Write-only field; this bit determines whether STOP is generated after data byte is sent or received.
- CMD : Bit 7. Write-only field; this bit determines whether transfer to be carried out is Read (CMD=1) or Write (CMD=0).
- DATA : Bits 6-0. Read/Write field; data retrieved from slave is read from this field; data to be sent to slave is written to this field.
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

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:
- SDA line starts with a START condition (S).
- Data is written to the TX FIFO (Tx FIFO loaded with data).
- Data is transferred from the TX FIFO to the SDA line (Data availability triggers START condition on bus).
- The TX FIFO becomes empty (FIFO EMPTY).
- The last byte is popped from the TX FIFO with the STOP bit not set.
- Because the STOP bit was not set on the last command popped from the TX FIFO, the Master holds the SCL line low.
- The TX FIFO is loaded with new data.
- The Master releases the SCL line and resumes transmission because new data became available.
- The last byte is popped from the TX FIFO with the STOP bit set.
- The STOP bit enabled triggers a STOP condition on the bus.
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

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:
- SDA line starts with a START condition (S).
- A command is written to the TX FIFO (Tx FIFO loaded with command).
- The command is transferred from the TX FIFO to the SDA line (Command availability triggers START condition on bus).
- The TX FIFO becomes empty (FIFO EMPTY).
- The last command is popped from the TX FIFO with the STOP bit not set.
- Because the STOP bit was not set on the last command popped from the TX FIFO, the Master holds the SCL line low.
- The TX FIFO is loaded with new command.
- The Master releases the SCL line and resumes transmission because new command became available.
- The last command is popped from the TX FIFO with the STOP bit set.
- The STOP bit enabled triggers a STOP condition on the bus.
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

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

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.
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:
- • A RESTART condition and a data bit
- • A STOP condition and a data bit
- • A RESTART condition and a STOP condition
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

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'.
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. Disable the DW_apb_i2c by writing a 0 to IC_ENABLE.ENABLE .
- 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. 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 ).
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.
- 4. Enable the
DW_apb_i2cby writing a 1 toIC_ENABLE.ENABLE.
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.
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.
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. The other I2C master device initiates an I2C transfer with an address that matches the slave address in the
IC_SARregister of theDW_apb_i2c. - 2. The
DW_apb_i2cacknowledges the sent address and recognizes the direction of the transfer to indicate that it is acting as a slave-transmitter. - 3. The
DW_apb_i2casserts theRD_REQinterrupt (bit five of theIC_RAW_INTR_STATregister) and holds theSCLline low. It remains in a wait state until software responds. If theRD_REQinterrupt has been masked, due toIC_INTR_MASK.M_RD_REQbeing set to zero, use a hardware and/or software timing routine to instruct the CPU to perform periodic reads of theIC_RAW_INTR_STATregister.- ◦ Reads that indicate
IC_RAW_INTR_STAT.RD_REQbeing set to one must be treated as the equivalent of theRD_REQinterrupt 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
SCLclock period theDW_apb_i2ccan handle. For example, for 400 kb/s, the timing interval is 25µs.
- ◦ Reads that indicate
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.
- 4. If there is any data remaining in the TX FIFO before receiving the read request, the
DW_apb_i2casserts aTX_ABRTinterrupt (bit six of theIC_RAW_INTR_STATregister) to flush the old data from the TX FIFO. If theTX_ABRTinterrupt has been masked, due toIC_INTR_MASK.M_TX_ABRTbeing set to zero, re-use the timing routine described in the previous step to read theIC_RAW_INTR_STATregister.
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 theTX_ABORTinterrupt 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_REQregister.
- ◦ Reads that indicate bit six (
- 5. Software writes to the
IC_DATA_CMDregister with the data to be written (by writing a 0 in bit 8). - 6. Software must clear the
RD_REQandTX_ABORTinterrupts (bits five and six, respectively) of theIC_RAW_INTR_STATregister before proceeding. If theRD_REQorTX_ABORTinterrupts have been masked, then clearing of theIC_RAW_INTR_STATregister will have already been performed when either theR_RD_REQorR_TX_ABORTbit has been read as one. - 7. The
DW_apb_i2creleases theSCLand transmits the byte. - 8. The master may hold the I2C bus by issuing a RESTART condition or release the bus by issuing a STOP condition.
- 5. Software writes to the
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 byteWhen 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. The other I2C master device initiates an I2C transfer with an address that matches the
DW_apb_i2c's slave address in theIC_SARregister. - 2. The
DW_apb_i2cacknowledges the sent address and recognizes the direction of the transfer to indicate that theDW_apb_i2cis acting as a slave-receiver. - 3.
DW_apb_i2creceives the transmitted byte and places it in the receive buffer.
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.
- 4.
DW_apb_i2casserts theRX_FULLinterruptIC_RAW_INTR_STAT.RX_FULL. If theRX_FULLinterrupt has been masked, due to settingIC_INTR_MASK.M_RX_FULLto zero or settingIC_TX_TLto a value larger than zero, you should implement a timing routine (described in Section 12.2.10.1.2) for periodic reads of theIC_STATUSregister. This timing routine should treat reads of theIC_STATUSregister, with bit 3 (RFNE) set at one as the equivalent of anRX_FULLinterrupt. - 5. Software may read the byte from the
IC_DATA_CMDregister (bits 7:0). - 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:
- • The DW_apb_i2c clears the TX FIFO.
- • The DW_apb_i2c generates a transmit abort ( TX_ABORT ) event.
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. Disable the DW_apb_i2c by writing zero to IC_ENABLE.ENABLE .
- 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.
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.
- 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.
- 4. Enable the DW_apb_i2c by writing a one to IC_ENABLE.ENABLE .
- 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.
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 receiveThe 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 :
- • If set to one, it issues a STOP condition after completing the current transfer.
- • If set to zero, it holds SCL low until next command is written to the TX FIFO.
For more details, refer to Section 12.2.7 .
12.2.10.3. Disabling DW_apb_i2cThe IC_ENABLE_STATUS register allows software to unambiguously determine when the I2C hardware has completely shut down.
NOTEEarlier 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. 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. 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. 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. The variable
POLL_COUNTis initialized to zero. - 2. Set bit zero of the
IC_ENABLEregister to zero. - 3. Read the
IC_ENABLE_STATUSregister and test theIC_ENbit (bit 0). IncrementPOLL_COUNTby one. IfPOLL_COUNT >= MAX_T_POLL_COUNT, exit with the relevant error code. - 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. Stop filling the TX FIFO (
IC_DATA_CMD) with new commands. - 2. When operating in DMA mode, disable the transmit DMA by setting
TDMAEto zero. - 3. Set
IC_ENABLE.ABORTto one. - 4. Wait for the
M_TX_ABRTinterrupt. - 5. Read the
IC_TX_ABRT_SOURCEregister to identify the source asABRT_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 input signal remains unchanged until the counter reaches its count limit value. When this happens, the counter resets and stops, and the internal version of the signal updates to the input value.
- • The input signal changes again before the counter reaches its count limit value. When this happens, the counter resets and stops, but the internal version of the signal does not update.
The timing diagram in Figure 87 illustrates the behaviour described above.
Figure 87. Spike
Suppression Example

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.
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
- • Because the minimum value that can be programmed into the IC_FS_SPKLEN register is one, the spike length specification can be exceeded for low frequencies of ic_clk . Consider the simple example of a 10 MHz (100 ns period) ic_clk ; in this case, the minimum spike length that can be programmed is 100 ns, which means that spikes up to this length are suppressed.
- • Standard synchronization logic (two flip-flops in series) is implemented upstream of the spike suppression logic and is not affected in any way by the contents of the spike length registers or the operation of the spike suppression logic; the two operations (synchronization and spike suppression) are completely independent. Because the SCL and SDA inputs are asynchronous to ic_clk , there is one ic_clk cycle uncertainty in the sampling of these signals. Depending on when they occur relative to the rising edge of ic_clk , spikes of the same original length might show a difference of one ic_clk cycle after being sampled.
- • Spike suppression is symmetrical; the behaviour is exactly the same for transitions from zero to one and from one to zero.
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. Set ic_clk frequency greater than or equal to 32 MHz (refer to Section 12.2.14.2.1 ).
- 2. Program the IC_CON register [2:1] = 2'b10 for fast mode or fast mode plus.
- 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. Program the IC_FS_SPKLEN register to suppress the maximum spike of 50 ns.
- 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:
- 1. Master sends a maximum of nine clock pulses to recover the bus LOW within those nine clocks.
- ◦ The number of clock pulses will vary with the number of bits that remain to be sent by the slave. As the maximum number of bits is nine, master sends up to nine clock pluses and allows the slave to recover.
- ◦ The master attempts to assert a Logic 1 on the SDA line and check whether SDA is recovered. If the SDA is not recovered, it will continue to send a maximum of nine SCL clocks.
- 2. If SDA line is recovered within nine clock pulses, the master will send STOP to release the bus.
- 3. If SDA line is not recovered even after the ninth clock pulse, you must hardware reset the system.
Figure 88. SDA Recovery with 9 SCL Clocks

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'.
Figure 89. SDA Recovery with 6 SCL Clocks

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'.
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:
- • IC_SS_SCL_HCNT
- • IC_SS_SCL_LCNT
- • IC_FS_SCL_HCNT
- • IC_FS_SCL_LCNT
NOTE
The tBUF timing and setup/hold time of START, STOP and RESTART registers uses *HCNT/*LCNT register settings for the corresponding speed mode.
NOTEIt 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 Parameter | Symbol | Standard Speed | Fast Speed / Fast Speed Plus |
|---|---|---|---|
LOW period of the
SCL clock | tLOW | IC_SS_SCL_LCNT | IC_FS_SCL_LCNT |
HIGH period of the
SCL clock | tHIGH | IC_SS_SCL_HCNT | IC_FS_SCL_HCNT |
| Setup time for a repeated START condition | tSU;STA | IC_SS_SCL_LCNT | IC_FS_SCL_HCNT |
| Hold time (repeated) START condition | tHD;STA | IC_SS_SCL_HCNT | IC_FS_SCL_HCNT |
| Setup time for STOP condition | tSU;STO | IC_SS_SCL_HCNT | IC_FS_SCL_HCNT |
| Bus free time between a STOP and a START condition | tBUF | IC_SS_SCL_LCNT | IC_FS_SCL_LCNT |
| Spike length | tSP | IC_FS_SPKLEN | IC_FS_SPKLEN |
| Data hold time | tHD;DAT | IC_SDA_HOLD | IC_SDA_HOLD |
| Data setup time | tSU;DAT | IC_SDA_SETUP | IC_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:
- •
IC_SS_SCL_LCNTandIC_FS_SCL_LCNTregister values must be larger thanIC_FS_SPKLEN+ 7. - •
IC_SS_SCL_HCNTandIC_FS_SCL_HCNTregister values must be larger thanIC_FS_SPKLEN+ 5.
Details regarding the
DW_apb_i2c high and low counts are as follows:
- • The minimum value of
IC_*_SPKLEN+ 7 for the *_LCNT registers is due to the time required for theDW_apb_i2cto driveSDAafter a negative edge ofSCL. - • The minimum value of
IC_*_SPKLEN+ 5 for the *_HCNT registers is due to the time required for theDW_apb_i2cto sampleSDAduring the high period ofSCL. - • The
DW_apb_i2cadds one cycle to the programmed *_LCNT value in order to generate the low period of theSCLclock; this is due to the counting logic forSCLlow counting to (*_LCNT + 1). - • The
DW_apb_i2caddsIC_*_SPKLEN+ 7 cycles to the programmed *_HCNT value in order to generate the high period of theSCLclock, due to the following factors:- ◦ The counting logic for
SCLhigh counts to (*_HCNT + 1). - ◦ The digital filtering applied to the
SCLline incurs a delay ofSPKLEN+ 2ic_clkcycles, whereSPKLENisIC_FS_SPKLENif the component is operating in SS or FS. - ◦ Whenever
SCLis driven one to zero by theDW_apb_i2c(completing theSCLhigh time) an internal logic latency of threeic_clkcycles is incurred. Consequently, the minimumSCLlow time of which theDW_apb_i2cis capable is nineic_clkperiods (7 + 1 + 1), while the minimumSCLhigh time is thirteenic_clkperiods (6 + 1 + 3 + 3).
- ◦ The counting logic for
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:
- • Characteristics of the IO driver
- • Pull-up resistor value
- • Total capacitance on SCL line
These characteristics are beyond the control of the DW_apb_i2c .
Figure 90. Impact of SCL Rise Time and Fall Time on Generated SCL

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:
- • Fast mode has data rate of 400 kb/s; implies SCL period of 1/400 kHz = 2.5μs
- • Minimum hcnt value of 14 as a seed value; IC_HCNT_FS = 14
- • Protocol minimum
SCL
high and low times:
- ◦ MIN_SCL_LOWtime_FS = 1300 ns
- ◦ MIN_SCL_HIGHTime_FS = 600 ns
Derived equations:
Combined, the previous equations produce the following:
Solving for IC_LCNT_FS :
The previous equation gives:
These calculations produce IC_LCNT_FS = 16 and IC_HCNT_FS = 14 , giving an ic_clk value of:
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 Mode | ic_clkfreq (MHz) | Minimum Value of IC_*_SPKLEN | SCL Low Time in 'ic_clk's | SCL Low Program Value | SCL Low Time | SCL High Time in 'ic_clk's | SCL High Program Value | SCL High Time |
|---|---|---|---|---|---|---|---|---|
| SS | 2.7 | 1 | 13 | 12 | 4.7μs | 14 | 6 | 5.2μs |
| FS | 12.0 | 1 | 16 | 15 | 1.33μs | 14 | 6 | 1.16μs |
| FM+ | 32 | 2 | 16 | 15 | 500 ns | 16 | 7 | 500 ns |
- The IC_*_SCL_LCNT and IC_*_SCL_HCNT registers are programmed using the SCL low and high program values in Table 1053 , which are calculated using SCL low count minus one, and SCL high counts minus eight, respectively. The values in Table 1053 are based on IC_SDA_RX_HOLD = 0. The maximum IC_SDA_RX_HOLD value depends on the IC_*CNT registers in Master mode.
- In order to compute the HCNT and LCNT considering RC timings, use the following equations:
- \( \text{IC\_HCNT\_}^* = [(\text{HCNT} + \text{IC\_}^*\text{SPKLEN} + 7) * \text{ic\_clk}] + \text{SCL\_Fall\_time} \)
- \( \text{IC\_LCNT\_}^* = [(\text{LCNT} + 1) * \text{ic\_clk}] - \text{SCL\_Fall\_time} + \text{SCL\_Rise\_time} \)
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 Fields | Set by Hardware/Cleared by Software | Set and Cleared by Hardware |
|---|---|---|
| RESTART_DET | Y | N |
| GEN_CALL | Y | N |
| START_DET | Y | N |
| STOP_DET | Y | N |
| ACTIVITY | Y | N |
| RX_DONE | Y | N |
| TX_ABRT | Y | N |
| RD_REQ | Y | N |
| TX_EMPTY | N | Y |
| TX_OVER | Y | N |
| RX_FULL | N | Y |
| RX_OVER | Y | N |
| RX_UNDER | Y | N |
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).
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
| Offset | Name | Info |
|---|---|---|
| 0x00 | IC_CON | I2C Control Register |
| 0x04 | IC_TAR | I2C Target Address Register |
| 0x08 | IC_SAR | I2C Slave Address Register |
| 0x10 | IC_DATA_CMD | I2C Rx/Tx Data Buffer and Command Register |
| 0x14 | IC_SS_SCL_HCNT | Standard Speed I2C Clock SCL High Count Register |
| 0x18 | IC_SS_SCL_LCNT | Standard Speed I2C Clock SCL Low Count Register |
| 0x1c | IC_FS_SCL_HCNT | Fast Mode or Fast Mode Plus I2C Clock SCL High Count Register |
| 0x20 | IC_FS_SCL_LCNT | Fast Mode or Fast Mode Plus I2C Clock SCL Low Count Register |
| 0x2c | IC_INTR_STAT | I2C Interrupt Status Register |
| 0x30 | IC_INTR_MASK | I2C Interrupt Mask Register |
| 0x34 | IC_RAW_INTR_STAT | I2C Raw Interrupt Status Register |
| 0x38 | IC_RX_TL | I2C Receive FIFO Threshold Register |
| 0x3c | IC_TX_TL | I2C Transmit FIFO Threshold Register |
| 0x40 | IC_CLR_INTR | Clear Combined and Individual Interrupt Register |
| 0x44 | IC_CLR_RX_UNDER | Clear RX_UNDER Interrupt Register |
| 0x48 | IC_CLR_RX_OVER | Clear RX_OVER Interrupt Register |
| 0x4c | IC_CLR_TX_OVER | Clear TX_OVER Interrupt Register |
| 0x50 | IC_CLR_RD_REQ | Clear RD_REQ Interrupt Register |
| 0x54 | IC_CLR_TX_ABRT | Clear TX_ABRT Interrupt Register |
| 0x58 | IC_CLR_RX_DONE | Clear RX_DONE Interrupt Register |
| 0x5c | IC_CLR_ACTIVITY | Clear ACTIVITY Interrupt Register |
| 0x60 | IC_CLR_STOP_DET | Clear STOP_DET Interrupt Register |
| 0x64 | IC_CLR_START_DET | Clear START_DET Interrupt Register |
| 0x68 | IC_CLR_GEN_CALL | Clear GEN_CALL Interrupt Register |
| 0x6c | IC_ENABLE | I2C ENABLE Register |
| 0x70 | IC_STATUS | I2C STATUS Register |
| 0x74 | IC_TXFLR | I2C Transmit FIFO Level Register |
| 0x78 | IC_RXFLR | I2C Receive FIFO Level Register |
| 0x7c | IC_SDA_HOLD | I2C SDA Hold Time Length Register |
| 0x80 | IC_TX_ABRT_SOURCE | I2C Transmit Abort Source Register |
| 0x84 | IC_SLV_DATA_NACK_ONLY | Generate Slave Data NACK Register |
| 0x88 | IC_DMA_CR | DMA Control Register |
| Offset | Name | Info |
|---|---|---|
| 0x8c | IC_DMA_TDLR | DMA Transmit Data Level Register |
| 0x90 | IC_DMA_RDLR | DMA Transmit Data Level Register |
| 0x94 | IC_SDA_SETUP | I2C SDA Setup Register |
| 0x98 | IC_ACK_GENERAL_CALL | I2C ACK General Call Register |
| 0x9c | IC_ENABLE_STATUS | I2C Enable Status Register |
| 0xa0 | IC_FS_SPKLEN | I2C SS, FS or FM+ spike suppression limit |
| 0xa8 | IC_CLR_RESTART_DET | Clear RESTART_DET Interrupt Register |
| 0xf4 | IC_COMP_PARAM_1 | Component Parameter Register 1 |
| 0xf8 | IC_COMP_VERSION | I2C Component Version Register |
| 0xfc | IC_COMP_TYPE | I2C 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
| Bits | Description | Type | Reset |
|---|---|---|---|
| 31:11 | Reserved. | - | - |
| 10 | STOP_DET_IF_MASTER_ACTIVE: Master issues the STOP_DET interrupt irrespective of whether master is active or not | RO | 0x0 |
| 9 | RX_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. | RW | 0x0 |
| Enumerated values: | |||
| 0x0 → DISABLED: Overflow when RX_FIFO is full | |||
| 0x1 → ENABLED: Hold bus when RX_FIFO is full | |||
| 8 | TX_EMPTY_CTRL:
This bit controls the generation of the TX_EMPTY interrupt, as described in the IC_RAW_INTR_STAT register. Reset value: 0x0. | RW | 0x0 |
| Enumerated values: | |||
| 0x0 → DISABLED: Default behaviour of TX_EMPTY interrupt | |||
| 0x1 → ENABLED: Controlled generation of TX_EMPTY interrupt |
| Bits | Description | Type | Reset |
|---|---|---|---|
| 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). | RW | 0x0 |
| 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. | RW | 0x1 |
| 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 | RW | 0x1 |
| 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 | RW | 0x0 |
| Enumerated values: | |||
| 0x0 → ADDR_7BITS: Master 7Bit addressing mode | |||
| 0x1 → ADDR_10BITS: Master 10Bit addressing mode |
| Bits | Description | Type | Reset |
|---|---|---|---|
| 3 | IC_10BITADDR_SLAVE: When acting as a slave, this bit controls whether the DW_apb_i2c responds to 7- or 10-bit addresses. - 0: 7-bit addressing. The DW_apb_i2c ignores transactions that involve 10-bit addressing; for 7-bit addressing, only the lower 7 bits of the IC_SAR register are compared. - 1: 10-bit addressing. The DW_apb_i2c responds to only 10-bit addressing transfers that match the full 10 bits of the IC_SAR register. | RW | 0x0 |
| Enumerated values: | |||
| 0x0 → ADDR_7BITS: Slave 7Bit addressing | |||
| 0x1 → ADDR_10BITS: Slave 10Bit addressing | |||
| 2:1 | SPEED:
These bits control at which speed the DW_apb_i2c operates; its setting is relevant only if one is operating the DW_apb_i2c in master mode. Hardware protects against illegal values being programmed by software. These bits must be programmed appropriately for slave mode also, as it is used to capture correct value of spike filter as per the speed mode. This register should be programmed only with a value in the range of 1 to IC_MAX_SPEED_MODE; otherwise, hardware updates this register with the value of IC_MAX_SPEED_MODE. 1: standard mode (100 kbit/s) 2: fast mode (<=400 kbit/s) or fast mode plus (<=1000Kbit/s) 3: high speed mode (3.4 Mbit/s) Note: This field is not applicable when IC_ULTRA_FAST_MODE=1 | RW | 0x2 |
| Enumerated values: | |||
| 0x1 → STANDARD: Standard Speed mode of operation | |||
| 0x2 → FAST: Fast or Fast Plus mode of operation | |||
| 0x3 → HIGH: High Speed mode of operation | |||
| 0 | MASTER_MODE:
This bit controls whether the DW_apb_i2c master is enabled. NOTE: Software should ensure that if this bit is written with '1' then bit 6 should also be written with a '1'. | RW | 0x1 |
| 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
| Bits | Description | Type | Reset |
|---|---|---|---|
| 31:12 | Reserved. | - | - |
| 11 | SPECIAL: This bit indicates whether software performs a Device-ID or General Call or START BYTE command. - 0: ignore bit 10 GC_OR_START and use IC_TAR normally - 1: perform special I2C command as specified in Device_ID or GC_OR_START bit Reset value: 0x0 | RW | 0x0 |
| Enumerated values: | |||
| 0x0 → DISABLED: Disables programming of GENERAL_CALL or START_BYTE transmission | |||
| 0x1 → ENABLED: Enables programming of GENERAL_CALL or START_BYTE transmission | |||
| 10 | GC_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: 0x0 | RW | 0x0 |
| Enumerated values: | |||
| 0x0 → GENERAL_CALL: GENERAL_CALL byte transmission | |||
| 0x1 → START_BYTE: START byte transmission | |||
| 9:0 | IC_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. | RW | 0x055 |
I2C: IC_SAR Register
Offset: 0x08
Description
I2C Slave Address Register
Table 1058. IC_SAR Register
| Bits | Description | Type | Reset |
|---|---|---|---|
| 31:10 | Reserved. | - | - |
| Bits | Description | Type | Reset |
|---|---|---|---|
| 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. | RW | 0x055 |
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
| Bits | Description | Type | Reset |
|---|---|---|---|
| 31:12 | Reserved. | - | - |
| 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,
| RO | 0x0 |
| Enumerated values: | |||
| 0x0 → INACTIVE: Sequential data byte received | |||
| 0x1 → ACTIVE: Non sequential data byte received |
| Bits | Description | Type | Reset |
|---|---|---|---|
| 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 | SC | 0x0 |
| 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 | SC | 0x0 |
| 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 | SC | 0x0 |
| Enumerated values: | |||
| 0x0 → WRITE: Master Write Command |
| Bits | Description | Type | Reset |
|---|---|---|---|
| 0x1 → READ: Master Read Command | |||
| 7:0 | DAT
: This register contains the data to be transmitted or received on the I2C bus. If you are writing to this register and want to perform a read, bits 7:0 (DAT) are ignored by the DW_apb_i2c. However, when you read this register, these bits return the value of data received on the DW_apb_i2c interface. Reset value: 0x0 | RW | 0x00 |
I2C: IC_SS_SCL_HCNT Register
Offset: 0x14
Description
Standard Speed I2C Clock SCL High Count Register
Table 1060.
IC_SS_SCL_HCNT
Register
| Bits | Description | Type | Reset |
|---|---|---|---|
| 31:16 | Reserved. | - | - |
| 15:0 | IC_SS_SCL_HCNT
: This register must be set before any I2C bus transaction can take place to ensure proper I/O timing. This register sets the SCL clock high-period count for standard speed. For more information, refer to 'IC_CLK Frequency Configuration'. This register can be written only when the I2C interface is disabled which corresponds to the IC_ENABLE[0] register being set to 0. Writes at other times have no effect. The minimum valid value is 6; hardware prevents values less than this being written, and if attempted results in 6 being set. For designs with APB_DATA_WIDTH = 8, the order of programming is important to ensure the correct operation of the DW_apb_i2c. The lower byte must be programmed first. Then the upper byte is programmed. NOTE: This register must not be programmed to a value higher than 65525, because DW_apb_i2c uses a 16-bit counter to flag an I2C bus idle condition when this counter reaches a value of IC_SS_SCL_HCNT + 10. | RW | 0x0028 |
I2C: IC_SS_SCL_LCNT Register
Offset: 0x18
Description
Standard Speed I2C Clock SCL Low Count Register
Table 1061.
IC_SS_SCL_LCNT
Register
| Bits | Description | Type | Reset |
|---|---|---|---|
| 31:16 | Reserved. | - | - |
| Bits | Description | Type | Reset |
|---|---|---|---|
| 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. | RW | 0x000d |
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
| Bits | Description | Type | Reset |
|---|---|---|---|
| 31:13 | Reserved. | - | - |
| 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 | RO | 0x0 |
| 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 | RO | 0x0 |
| Bits | Description | Type | Reset |
|---|---|---|---|
| 10 | R_START_DET:
See IC_RAW_INTR_STAT for a detailed description of R_START_DET bit. Reset value: 0x0 | RO | 0x0 |
| Enumerated values: | |||
| 0x0 → INACTIVE: R_START_DET interrupt is inactive | |||
| 0x1 → ACTIVE: R_START_DET interrupt is active | |||
| 9 | R_STOP_DET:
See IC_RAW_INTR_STAT for a detailed description of R_STOP_DET bit. Reset value: 0x0 | RO | 0x0 |
| Enumerated values: | |||
| 0x0 → INACTIVE: R_STOP_DET interrupt is inactive | |||
| 0x1 → ACTIVE: R_STOP_DET interrupt is active | |||
| 8 | R_ACTIVITY:
See IC_RAW_INTR_STAT for a detailed description of R_ACTIVITY bit. Reset value: 0x0 | RO | 0x0 |
| Enumerated values: | |||
| 0x0 → INACTIVE: R_ACTIVITY interrupt is inactive | |||
| 0x1 → ACTIVE: R_ACTIVITY interrupt is active | |||
| 7 | R_RX_DONE:
See IC_RAW_INTR_STAT for a detailed description of R_RX_DONE bit. Reset value: 0x0 | RO | 0x0 |
| Enumerated values: | |||
| 0x0 → INACTIVE: R_RX_DONE interrupt is inactive | |||
| 0x1 → ACTIVE: R_RX_DONE interrupt is active | |||
| 6 | R_TX_ABRT:
See IC_RAW_INTR_STAT for a detailed description of R_TX_ABRT bit. Reset value: 0x0 | RO | 0x0 |
| Enumerated values: | |||
| 0x0 → INACTIVE: R_TX_ABRT interrupt is inactive | |||
| 0x1 → ACTIVE: R_TX_ABRT interrupt is active | |||
| 5 | R_RD_REQ:
See IC_RAW_INTR_STAT for a detailed description of R_RD_REQ bit. Reset value: 0x0 | RO | 0x0 |
| Enumerated values: | |||
| 0x0 → INACTIVE: R_RD_REQ interrupt is inactive | |||
| 0x1 → ACTIVE: R_RD_REQ interrupt is active |
| Bits | Description | Type | Reset |
|---|---|---|---|
| 4 | R_TX_EMPTY:
See IC_RAW_INTR_STAT for a detailed description of R_TX_EMPTY bit. Reset value: 0x0 | RO | 0x0 |
| Enumerated values: | |||
| 0x0 → INACTIVE: R_TX_EMPTY interrupt is inactive | |||
| 0x1 → ACTIVE: R_TX_EMPTY interrupt is active | |||
| 3 | R_TX_OVER:
See IC_RAW_INTR_STAT for a detailed description of R_TX_OVER bit. Reset value: 0x0 | RO | 0x0 |
| Enumerated values: | |||
| 0x0 → INACTIVE: R_TX_OVER interrupt is inactive | |||
| 0x1 → ACTIVE: R_TX_OVER interrupt is active | |||
| 2 | R_RX_FULL:
See IC_RAW_INTR_STAT for a detailed description of R_RX_FULL bit. Reset value: 0x0 | RO | 0x0 |
| Enumerated values: | |||
| 0x0 → INACTIVE: R_RX_FULL interrupt is inactive | |||
| 0x1 → ACTIVE: R_RX_FULL interrupt is active | |||
| 1 | R_RX_OVER:
See IC_RAW_INTR_STAT for a detailed description of R_RX_OVER bit. Reset value: 0x0 | RO | 0x0 |
| Enumerated values: | |||
| 0x0 → INACTIVE: R_RX_OVER interrupt is inactive | |||
| 0x1 → ACTIVE: R_RX_OVER interrupt is active | |||
| 0 | R_RX_UNDER:
See IC_RAW_INTR_STAT for a detailed description of R_RX_UNDER bit. Reset value: 0x0 | RO | 0x0 |
| 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
| Bits | Description | Type | Reset |
|---|---|---|---|
| 31:13 | Reserved. | - | - |
| 12 | M_RESTART_DET
: This bit masks the R_RESTART_DET interrupt in IC_INTR_STAT register. Reset value: 0x0 | RW | 0x0 |
| Enumerated values: | |||
| 0x0 → ENABLED: RESTART_DET interrupt is masked | |||
| 0x1 → DISABLED: RESTART_DET interrupt is unmasked | |||
| 11 | M_GEN_CALL
: This bit masks the R_GEN_CALL interrupt in IC_INTR_STAT register. Reset value: 0x1 | RW | 0x1 |
| Enumerated values: | |||
| 0x0 → ENABLED: GEN_CALL interrupt is masked | |||
| 0x1 → DISABLED: GEN_CALL interrupt is unmasked | |||
| 10 | M_START_DET
: This bit masks the R_START_DET interrupt in IC_INTR_STAT register. Reset value: 0x0 | RW | 0x0 |
| Enumerated values: | |||
| 0x0 → ENABLED: START_DET interrupt is masked | |||
| 0x1 → DISABLED: START_DET interrupt is unmasked | |||
| 9 | M_STOP_DET
: This bit masks the R_STOP_DET interrupt in IC_INTR_STAT register. Reset value: 0x0 | RW | 0x0 |
| Enumerated values: | |||
| 0x0 → ENABLED: STOP_DET interrupt is masked | |||
| 0x1 → DISABLED: STOP_DET interrupt is unmasked | |||
| 8 | M_ACTIVITY
: This bit masks the R_ACTIVITY interrupt in IC_INTR_STAT register. Reset value: 0x0 | RW | 0x0 |
| Enumerated values: | |||
| 0x0 → ENABLED: ACTIVITY interrupt is masked | |||
| 0x1 → DISABLED: ACTIVITY interrupt is unmasked | |||
| 7 | M_RX_DONE
: This bit masks the R_RX_DONE interrupt in IC_INTR_STAT register. Reset value: 0x1 | RW | 0x1 |
| Enumerated values: | |||
| 0x0 → ENABLED: RX_DONE interrupt is masked |
| Bits | Description | Type | Reset |
|---|---|---|---|
| 0x1 → DISABLED: RX_DONE interrupt is unmasked | |||
| 6 | M_TX_ABORT
: This bit masks the R_TX_ABORT interrupt in IC_INTR_STAT register. Reset value: 0x1 | RW | 0x1 |
| Enumerated values: | |||
| 0x0 → ENABLED: TX_ABORT interrupt is masked | |||
| 0x1 → DISABLED: TX_ABORT interrupt is unmasked | |||
| 5 | M_RD_REQ
: This bit masks the R_RD_REQ interrupt in IC_INTR_STAT register. Reset value: 0x1 | RW | 0x1 |
| Enumerated values: | |||
| 0x0 → ENABLED: RD_REQ interrupt is masked | |||
| 0x1 → DISABLED: RD_REQ interrupt is unmasked | |||
| 4 | M_TX_EMPTY
: This bit masks the R_TX_EMPTY interrupt in IC_INTR_STAT register. Reset value: 0x1 | RW | 0x1 |
| Enumerated values: | |||
| 0x0 → ENABLED: TX_EMPTY interrupt is masked | |||
| 0x1 → DISABLED: TX_EMPTY interrupt is unmasked | |||
| 3 | M_TX_OVER
: This bit masks the R_TX_OVER interrupt in IC_INTR_STAT register. Reset value: 0x1 | RW | 0x1 |
| Enumerated values: | |||
| 0x0 → ENABLED: TX_OVER interrupt is masked | |||
| 0x1 → DISABLED: TX_OVER interrupt is unmasked | |||
| 2 | M_RX_FULL
: This bit masks the R_RX_FULL interrupt in IC_INTR_STAT register. Reset value: 0x1 | RW | 0x1 |
| Enumerated values: | |||
| 0x0 → ENABLED: RX_FULL interrupt is masked | |||
| 0x1 → DISABLED: RX_FULL interrupt is unmasked | |||
| 1 | M_RX_OVER
: This bit masks the R_RX_OVER interrupt in IC_INTR_STAT register. Reset value: 0x1 | RW | 0x1 |
| Enumerated values: | |||
| 0x0 → ENABLED: RX_OVER interrupt is masked | |||
| 0x1 → DISABLED: RX_OVER interrupt is unmasked |
| Bits | Description | Type | Reset |
|---|---|---|---|
| 0 | M_RX_UNDER
: This bit masks the R_RX_UNDER interrupt in IC_INTR_STAT register. Reset value: 0x1 | RW | 0x1 |
| 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
| Bits | Description | Type | Reset |
|---|---|---|---|
| 31:13 | Reserved. | - | - |
| 12 | RESTART_DET
: Indicates whether a RESTART condition has occurred on the I2C interface when DW_apb_i2c is operating in Slave mode and the slave is being addressed. Enabled only when IC_SLV_RESTART_DET_EN=1. Note: However, in high-speed mode or during a START BYTE transfer, the RESTART comes before the address field as per the I2C protocol. In this case, the slave is not the addressed slave when the RESTART is issued, therefore DW_apb_i2c does not generate the RESTART_DET interrupt. Reset value: 0x0 | RO | 0x0 |
| Enumerated values: | |||
| 0x0 → INACTIVE: RESTART_DET interrupt is inactive | |||
| 0x1 → ACTIVE: RESTART_DET interrupt is active | |||
| 11 | GEN_CALL
: Set only when a General Call address is received and it is acknowledged. It stays set until it is cleared either by disabling DW_apb_i2c or when the CPU reads bit 0 of the IC_CLR_GEN_CALL register. DW_apb_i2c stores the received data in the Rx buffer. Reset value: 0x0 | RO | 0x0 |
| Enumerated values: | |||
| 0x0 → INACTIVE: GEN_CALL interrupt is inactive | |||
| 0x1 → ACTIVE: GEN_CALL interrupt is active | |||
| 10 | START_DET
: Indicates whether a START or RESTART condition has occurred on the I2C interface regardless of whether DW_apb_i2c is operating in slave or master mode. Reset value: 0x0 | RO | 0x0 |
| Enumerated values: |
| Bits | Description | Type | Reset |
|---|---|---|---|
| 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 | RO | 0x0 |
| 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 | RO | 0x0 |
| 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 | RO | 0x0 |
| Enumerated values: | |||
| 0x0 → INACTIVE: RX_DONE interrupt is inactive | |||
| 0x1 → ACTIVE: RX_DONE interrupt is active |
| Bits | Description | Type | Reset |
|---|---|---|---|
| 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 | RO | 0x0 |
| 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 | RO | 0x0 |
| 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. | RO | 0x0 |
| 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
| Bits | Description | Type | Reset |
|---|---|---|---|
| 31:8 | Reserved. | - | - |
| 7:0 | RX_TL
: Receive FIFO Threshold Level. Controls the level of entries (or above) that triggers the RX_FULL interrupt (bit 2 in IC_RAW_INTR_STAT register). The valid range is 0-255, with the additional restriction that hardware does not allow this value to be set to a value larger than the depth of the buffer. If an attempt is made to do that, the actual value set will be the maximum depth of the buffer. A value of 0 sets the threshold for 1 entry, and a value of 255 sets the threshold for 256 entries. | RW | 0x00 |
I2C: IC_TX_TL Register
Offset: 0x3c
Description
I2C Transmit FIFO Threshold Register
Table 1068. IC_TX_TL Register
| Bits | Description | Type | Reset |
|---|---|---|---|
| 31:8 | Reserved. | - | - |
| 7:0 | TX_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. | RW | 0x00 |
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:28 | column_2 | Description Description Input value for GPIO0…31. Description QSPI_SD : Input value on QSPI SD0 (MOSI), SD1 (MISO), SD2 and SD3 pins | Type RO Type RO Type RO | Reset - Reset 0x00000000 Reset 0x0 |
|---|---|---|---|---|
| 31:1 | Reserved. | - | - | |
| 0 | CLR_INTR | : Read this register to clear the combined interrupt, all individual interrupts, and the IC_TX_ABRT_SOURCE register. This bit does not clear | RO | 0x0 |
| Table 1070. Bits IC_CLR_RX_UNDER | Description | Type | Reset | |
| Register 31:1 | Reserved. | - | - | |
| 0 | CLR_RX_UNDER | : Read this register to clear the RX_UNDER interrupt (bit 0) of the IC_RAW_INTR_STAT register. | RO | 0x0 |
| Table 1071. Bits IC_CLR_RX_OVER | Description | Type | Reset | |
| Register 31:1 | Reserved. | - | - | |
| 0 | CLR_RX_OVER | : Read this register to clear the RX_OVER interrupt (bit 1) of the IC_RAW_INTR_STAT register. | RO | 0x0 |
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
| Bits | Description | Type | Reset |
|---|---|---|---|
| 31:1 | Reserved. | - | - |
| 0 | CLR_TX_OVER
: Read this register to clear the TX_OVER interrupt (bit 3) of the IC_RAW_INTR_STAT register. Reset value: 0x0 | RO | 0x0 |
I2C: IC_CLR_RD_REQ Register
Offset: 0x50
Description
Clear RD_REQ Interrupt Register
Table 1073.
IC_CLR_RD_REQ
Register
| Bits | Description | Type | Reset |
|---|---|---|---|
| 31:1 | Reserved. | - | - |
| 0 | CLR_RD_REQ
: Read this register to clear the RD_REQ interrupt (bit 5) of the IC_RAW_INTR_STAT register. Reset value: 0x0 | RO | 0x0 |
I2C: IC_CLR_TX_ABRT Register
Offset: 0x54
Description
Clear TX_ABRT Interrupt Register
Table 1074.
IC_CLR_TX_ABRT
Register
| Bits | Description | Type | Reset |
|---|---|---|---|
| 31:1 | Reserved. | - | - |
| 0 | CLR_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 | RO | 0x0 |
I2C: IC_CLR_RX_DONE Register
Offset: 0x58
Description
Clear RX_DONE Interrupt Register
Table 1075.
IC_CLR_RX_DONE
Register
| Bits | Description | Type | Reset |
|---|---|---|---|
| 31:1 | Reserved. | - | - |
| 0 | CLR_RX_DONE
: Read this register to clear the RX_DONE interrupt (bit 7) of the IC_RAW_INTR_STAT register. Reset value: 0x0 | RO | 0x0 |
I2C: IC_CLR_ACTIVITY Register
Offset: 0x5c
Description
Clear ACTIVITY Interrupt Register
Table 1076.
IC_CLR_ACTIVITY
Register
| Bits | Description | Type | Reset |
|---|---|---|---|
| 31:1 | Reserved. | - | - |
| 0 | CLR_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 | RO | 0x0 |
I2C: IC_CLR_STOP_DET Register
Offset: 0x60
Description
Clear STOP_DET Interrupt Register
Table 1077.
IC_CLR_STOP_DET
Register
| Bits | Description | Type | Reset |
|---|---|---|---|
| 31:1 | Reserved. | - | - |
| 0 | CLR_STOP_DET
: Read this register to clear the STOP_DET interrupt (bit 9) of the IC_RAW_INTR_STAT register. Reset value: 0x0 | RO | 0x0 |
I2C: IC_CLR_START_DET Register
Offset: 0x64
Description
Clear START_DET Interrupt Register
Table 1078.
IC_CLR_START_DET
Register
| Bits | Description | Type | Reset |
|---|---|---|---|
| 31:1 | Reserved. | - | - |
| 0 | CLR_START_DET
: Read this register to clear the START_DET interrupt (bit 10) of the IC_RAW_INTR_STAT register. Reset value: 0x0 | RO | 0x0 |
I2C: IC_CLR_GEN_CALL Register
Offset: 0x68
Description
Clear GEN_CALL Interrupt Register
Table 1079.
IC_CLR_GEN_CALL
Register
| Bits | Description | Type | Reset |
|---|---|---|---|
| 31:1 | Reserved. | - | - |
| 0 | CLR_GEN_CALL
: Read this register to clear the GEN_CALL interrupt (bit 11) of IC_RAW_INTR_STAT register. Reset value: 0x0 | RO | 0x0 |
I2C: IC_ENABLE Register
Offset: 0x6c
Description
I2C Enable Register
Table 1080.
IC_ENABLE Register
| Bits | Description | Type | Reset |
|---|---|---|---|
| 31:3 | Reserved. | - | - |
| 2 | TX_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_DEFAULT | RW | 0x0 |
| Enumerated values: | |||
| 0x0 → NOT_BLOCKED: Tx Command execution not blocked | |||
| 0x1 → BLOCKED: Tx Command execution blocked |
| Bits | Description | Type | Reset |
|---|---|---|---|
| 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 | RW | 0x0 |
| 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 | RW | 0x0 |
| 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
| Bits | Description | Type | Reset |
|---|---|---|---|
| 31:7 | Reserved. | - | - |
| 6 | SLV_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: 0x0 | RO | 0x0 |
| Enumerated values: | |||
| 0x0 → IDLE: Slave is idle | |||
| 0x1 → ACTIVE: Slave not idle | |||
| 5 | MST_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 | RO | 0x0 |
| Enumerated values: | |||
| 0x0 → IDLE: Master is idle | |||
| 0x1 → ACTIVE: Master not idle | |||
| 4 | RFF : 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: 0x0 | RO | 0x0 |
| Enumerated values: | |||
| 0x0 → NOT_FULL: Rx FIFO not full | |||
| 0x1 → FULL: Rx FIFO is full | |||
| 3 | RFNE : 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: 0x0 | RO | 0x0 |
| Enumerated values: | |||
| 0x0 → EMPTY: Rx FIFO is empty | |||
| 0x1 → NOT_EMPTY: Rx FIFO not empty | |||
| 2 | TFE : 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: 0x1 | RO | 0x1 |
| Enumerated values: | |||
| 0x0 → NON_EMPTY: Tx FIFO not empty | |||
| 0x1 → EMPTY: Tx FIFO is empty | |||
| 1 | TFNF : 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: 0x1 | RO | 0x1 |
| Enumerated values: |
| Bits | Description | Type | Reset |
|---|---|---|---|
| 0x0 → FULL: Tx FIFO is full | |||
| 0x1 → NOT_FULL: Tx FIFO not full | |||
| 0 | ACTIVITY: I2C Activity Status. Reset value: 0x0 | RO | 0x0 |
| 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
| Bits | Description | Type | Reset |
|---|---|---|---|
| 31:5 | Reserved. | - | - |
| 4:0 | TXFLR:
Transmit FIFO Level. Contains the number of valid data entries in the transmit FIFO. Reset value: 0x0 | RO | 0x00 |
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
| Bits | Description | Type | Reset |
|---|---|---|---|
| 31:5 | Reserved. | - | - |
| 4:0 | RXFLR:
Receive FIFO Level. Contains the number of valid data entries in the receive FIFO. Reset value: 0x0 | RO | 0x00 |
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
| Bits | Description | Type | Reset |
|---|---|---|---|
| 31:24 | Reserved. | - | - |
| 23:16 | IC_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]. | RW | 0x00 |
| 15:0 | IC_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]. | RW | 0x0001 |
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
| Bits | Description | Type | Reset |
|---|---|---|---|
| 31:23 | TX_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 | RO | 0x000 |
| 22:17 | Reserved. | - | - |
| 16 | ABRT_USER_ABRT:
This is a master-mode-only bit. Master has detected the transfer abort (IC_ENABLE[1]) Reset value: 0x0 Role of DW_apb_i2c: Master-Transmitter | RO | 0x0 |
| Enumerated values: |
| Bits | Description | Type | Reset |
|---|---|---|---|
| 0x0 → ABRT_USER_ABRT_VOID: Transfer abort detected by master- scenario not present | |||
| 0x1 → ABRT_USER_ABRT_GENERATED: Transfer abort detected by master | |||
| 15 | ABRT_SLVRD_INTX
: 1: When the processor side responds to a slave mode request for data to be transmitted to a remote master and user writes a 1 in CMD (bit 8) of IC_DATA_CMD register. Reset value: 0x0 Role of DW_apb_i2c: Slave-Transmitter | RO | 0x0 |
| Enumerated values: | |||
| 0x0 → ABRT_SLVRD_INTX_VOID: Slave trying to transmit to remote master in read mode- scenario not present | |||
| 0x1 → ABRT_SLVRD_INTX_GENERATED: Slave trying to transmit to remote master in read mode | |||
| 14 | ABRT_SLV_ARBLOST
: This field indicates that a Slave has lost the bus while transmitting data to a remote master. IC_TX_ABRT_SOURCE[12] is set at the same time. Note: Even though the slave never 'owns' the bus, something could go wrong on the bus. This is a fail safe check. For instance, during a data transmission at the low-to-high transition of SCL, if what is on the data bus is not what is supposed to be transmitted, then DW_apb_i2c no longer own the bus. Reset value: 0x0 Role of DW_apb_i2c: Slave-Transmitter | RO | 0x0 |
| Enumerated values: | |||
| 0x0 → ABRT_SLV_ARBLOST_VOID: Slave lost arbitration to remote master- scenario not present | |||
| 0x1 → ABRT_SLV_ARBLOST_GENERATED: Slave lost arbitration to remote master | |||
| 13 | ABRT_SLVFLUSH_TXFIFO
: This field specifies that the Slave has received a read command and some data exists in the TX FIFO, so the slave issues a TX_ABRT interrupt to flush old data in TX FIFO. Reset value: 0x0 Role of DW_apb_i2c: Slave-Transmitter | RO | 0x0 |
| 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 |
| Bits | Description | Type | Reset |
|---|---|---|---|
| 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 | RO | 0x0 |
| 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 | RO | 0x0 |
| 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 | RO | 0x0 |
| 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 | RO | 0x0 |
| Bits | Description | Type | Reset |
|---|---|---|---|
| Enumerated values: | |||
| 0x0 → ABRT_SBYTE_NORSTRT_VOID: User trying to send START byte when RESTART disabled- scenario not present | |||
| 0x1 → ABRT_SBYTE_NORSTRT_GENERATED: User trying to send START byte when RESTART disabled | |||
| 8 | ABRT_HS_NORSTRT
: This field indicates that the restart is disabled (IC_RESTART_EN bit (IC_CON[5]) =0) and the user is trying to use the master to transfer data in High Speed mode. Reset value: 0x0 Role of DW_apb_i2c: Master-Transmitter or Master-Receiver | RO | 0x0 |
| Enumerated values: | |||
| 0x0 → ABRT_HS_NORSTRT_VOID: User trying to switch Master to HS mode when RESTART disabled- scenario not present | |||
| 0x1 → ABRT_HS_NORSTRT_GENERATED: User trying to switch Master to HS mode when RESTART disabled | |||
| 7 | ABRT_SBYTE_ACKDET
: This field indicates that the Master has sent a START Byte and the START Byte was acknowledged (wrong behavior). Reset value: 0x0 Role of DW_apb_i2c: Master | RO | 0x0 |
| Enumerated values: | |||
| 0x0 → ABRT_SBYTE_ACKDET_VOID: ACK detected for START byte- scenario not present | |||
| 0x1 → ABRT_SBYTE_ACKDET_GENERATED: ACK detected for START byte | |||
| 6 | ABRT_HS_ACKDET
: This field indicates that the Master is in High Speed mode and the High Speed Master code was acknowledged (wrong behavior). Reset value: 0x0 Role of DW_apb_i2c: Master | RO | 0x0 |
| 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 | |||
| 5 | ABRT_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 | RO | 0x0 |
| Enumerated values: |
| Bits | Description | Type | Reset |
|---|---|---|---|
| 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 | |||
| 4 | ABRT_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 | RO | 0x0 |
| 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 | |||
| 3 | ABRT_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 | RO | 0x0 |
| 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 | |||
| 2 | ABRT_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 | RO | 0x0 |
| Enumerated values: | |||
| 0x0 → INACTIVE: This abort is not generated | |||
| 0x1 → ACTIVE: Byte 2 of 10Bit Address not ACKed by any slave | |||
| 1 | ABRT_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 | RO | 0x0 |
| Enumerated values: | |||
| 0x0 → INACTIVE: This abort is not generated |
| Bits | Description | Type | Reset |
|---|---|---|---|
| 0x1 → ACTIVE: Byte 1 of 10Bit Address not ACKed by any slave | |||
| 0 | ABRT_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 | RO | 0x0 |
| 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
| Bits | Description | Type | Reset |
|---|---|---|---|
| 31:1 | Reserved. | - | - |
| 0 | NACK:
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 | RW | 0x0 |
| 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
| Bits | Description | Type | Reset |
|---|---|---|---|
| 31:2 | Reserved. | - | - |
| Bits | Description | Type | Reset |
|---|---|---|---|
| 1 | TDMAE : Transmit DMA Enable. This bit enables/disables the transmit FIFO DMA channel. Reset value: 0x0 | RW | 0x0 |
| Enumerated values: | |||
| 0x0 → DISABLED: transmit FIFO DMA channel disabled | |||
| 0x1 → ENABLED: Transmit FIFO DMA channel enabled | |||
| 0 | RDMAE : Receive DMA Enable. This bit enables/disables the receive FIFO DMA channel. Reset value: 0x0 | RW | 0x0 |
| 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
| Bits | Description | Type | Reset |
|---|---|---|---|
| 31:4 | Reserved. | - | - |
| 3:0 | DMATDL
: 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 | RW | 0x0 |
I2C: IC_DMA_RDLR Register
Offset: 0x90
Description
I2C Receive Data Level Register
Table 1089.
IC_DMA_RDLR
Register
| Bits | Description | Type | Reset |
|---|---|---|---|
| 31:4 | Reserved. | - | - |
| 3:0 | DMARDL
: 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 | RW | 0x0 |
I2C: IC_SDA_SETUP Register
Offset: 0x94
Description I2C SDA Setup RegisterThis 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
| Bits | Description | Type | Reset |
|---|---|---|---|
| 31:8 | Reserved. | - | - |
| 7:0 | SDA_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. | RW | 0x64 |
Offset: 0x98
Description I2C ACK General Call RegisterThe 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
| Bits | Description | Type | Reset |
|---|---|---|---|
| 31:1 | Reserved. | - | - |
| 0 | ACK_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). | RW | 0x1 |
| Enumerated values: | |||
| 0x0 → DISABLED: Generate NACK for a General Call | |||
| 0x1 → ENABLED: Generate ACK for a General Call |
Offset: 0x9c
Description I2C Enable Status RegisterThe 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
| Bits | Description | Type | Reset |
|---|---|---|---|
| 31:3 | Reserved. | - | - |
| 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 | RO | 0x0 |
| 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 | RO | 0x0 |
| Enumerated values: |
| Bits | Description | Type | Reset |
|---|---|---|---|
| 0x0 → INACTIVE: Slave is disabled when it is idle | |||
| 0x1 → ACTIVE: Slave is disabled when it is active | |||
| 0 | IC_EN:
ic_en Status. This bit always reflects the value driven on the output port ic_en. - When read as 1, DW_apb_i2c is deemed to be in an enabled state. - When read as 0, DW_apb_i2c is deemed completely inactive. Note: The CPU can safely read this bit anytime. When this bit is read as 0, the CPU can safely read SLV_RX_DATA_LOST (bit 2) and SLV_DISABLED_WHILE_BUSY (bit 1). Reset value: 0x0 | RO | 0x0 |
| 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
| Bits | Description | Type | Reset |
|---|---|---|---|
| 31:8 | Reserved. | - | - |
| 7:0 | IC_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'. | RW | 0x07 |
I2C: IC_CLR_RESTART_DET Register
Offset: 0xa8
Description
Clear RESTART_DET Interrupt Register
Table 1094.
IC_CLR_RESTART_DET
Register
| Bits | Description | Type | Reset |
|---|---|---|---|
| 31:1 | Reserved. | - | - |
| 0 | CLR_RESTART_DET
: Read this register to clear the RESTART_DET interrupt (bit 12) of IC_RAW_INTR_STAT register. Reset value: 0x0 | RO | 0x0 |
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
| Bits | Description | Type | Reset |
|---|---|---|---|
| 31:24 | Reserved. | - | - |
| 23:16 | TX_BUFFER_DEPTH : TX Buffer Depth = 16 | RO | 0x00 |
| 15:8 | RX_BUFFER_DEPTH : RX Buffer Depth = 16 | RO | 0x00 |
| 7 | ADD_ENCODED_PARAMS : Encoded parameters not visible | RO | 0x0 |
| 6 | HAS_DMA : DMA handshaking signals are enabled | RO | 0x0 |
| 5 | INTR_IO : COMBINED Interrupt outputs | RO | 0x0 |
| 4 | HC_COUNT_VALUES : Programmable count values for each mode. | RO | 0x0 |
| 3:2 | MAX_SPEED_MODE : MAX SPEED MODE = FAST MODE | RO | 0x0 |
| 1:0 | APB_DATA_WIDTH : APB data bus width is 32 bits | RO | 0x0 |
I2C: IC_COMP_VERSION Register
Offset: 0xf8
Description
I2C Component Version Register
Table 1096.
IC_COMP_VERSION
Register
| Bits | Description | Type | Reset |
|---|---|---|---|
| 31:0 | IC_COMP_VERSION | RO | 0x3230312a |
I2C: IC_COMP_TYPE Register
Offset: 0xfc
Description
I2C Component Type Register
Table 1097.
IC_COMP_TYPE
Register
| Bits | Description | Type | Reset |
|---|---|---|---|
| 31:0 | IC_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. | RO | 0x44570140 |