I2C#
Introduction#
I2C, which stands for Inter-Integrated Circuit, is a serial communication protocol commonly used in micro-controllers and other integrated circuits for communication between various peripheral devices and sensors. In micro-controllers, I2C is often used to connect peripherals like sensors, EEPROMs, real-time clocks, and other integrated circuits. The I2C protocol uses only two wires for communication: a serial data line (SDA) and a serial clock line (SCL). This makes it very efficient in terms of pin usage, which is particularly important in micro-controller systems where pin count might be limited.
In embedded industries, I2C (Inter-Integrated Circuit) is widely used for various applications due to its simplicity, flexibility, and low pin count requirements. Here are some common use cases of I2C in embedded systems:
Sensor Integration
Sensor Hubs and Fusion Algorithms
Memory Expansion
Real-Time Clock (RTC)
Display Interfaces
Peripheral Control
Communication with Other Micro-controllers and Modules
System Configuration and Control
Configuration#
I2C can be configured by configuring parameters such as Leader or Follower mode using sl_i2c_mode_t, the Transfer type using sl_i2c_transfer_type_t and operating speed Mode using sl_i2c_operating_mode_t. All of these configurations can be made using a structure called sl_i2c_config_t, after which the API sl_i2c_driver_init() can be called.
For more information on configuring available parameters refer to the respective peripheral example readme document.
Usage#
The common I2C functions can be used after the I2C Structures are specified, passing an instance of sl_i2c_config_t. These functions will initiate and configure the I2C below, which is the flow for implementation.
sl_i2c_driver_set_follower_address (for follower)
Note : The above flow is for I2C non-DMA operations. If the requirement is to use DMA Mode, then use send and receive non-blocking APIs sl_i2c_driver_receive_data_non_blocking and sl_i2c_driver_send_data_non_blocking.
Modules#
Enumerations#
Enumeration to represent I2C driver status values.
Enumeration to represent I2C transfer type.
Enumeration to represent I2C operating mode.
Enumeration to represent I2C power modes.
Typedefs#
Callback for I2C Driver.
Variables#
Leader/Follower Mode, 0 for leader mode and 1 for follower mode.
Speed mode sl_i2c_operating_mode_t for possible values.
Transfer type sl_i2c_transfer_type_t for possible values.
I2C callback sl_i2c_callback_t.
DMA transmit channel number.
DMA receive channel number.
Pointer to Tx Data buffer.
Number of bytes to transmit.
Pointer to Rx Data buffer.
Number of bytes to receive.
PWM GPIO port.
PWM GPIO pin.
PWM GPIO mux.
PWM GPIO pad.
PWM GPIO port.
PWM GPIO pin.
PWM GPIO mux.
PWM GPIO pad.
Functions#
Initialize the I2C Module and clock.
This API configures the follower address of the I2C module.
This API configures the TX and RX FIFO threshold values.
This API will read the current I2C clock frequency.
This API sends the data in blocking mode.
This API sends the data in non-blocking mode.
This API receives the data in blocking mode.
This API receives the data in non-blocking mode.
This API transmits data and then receives data from an I2C device.
De-initializes the I2C peripheral and clock.
Set the Pin configuration for I2C.
This API re-configures the I2C leader device on power mode changes.
To enable or disable repeated start, to enable or disable combined format transfer.
Enumeration Documentation#
sl_i2c_instance_t#
sl_i2c_instance_t
Enumeration to represent I2C instances.
Enumerator | |
---|---|
SL_I2C0 | I2C Instance 0. |
SL_I2C1 | I2C Instance 1. |
SL_I2C2 | I2C Instance 2. |
SL_I2C_LAST | Last member of enum for validation. |
84
of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_i2c.h
sl_i2c_status_t#
sl_i2c_status_t
Enumeration to represent I2C driver status values.
Enumerator | |
---|---|
SL_I2C_SUCCESS | Success. |
SL_I2C_IDLE | I2C Idle. |
SL_I2C_7BIT_ADD | I2C 7 Bit address transfer. |
SL_I2C_10BIT_ADD | I2C 10 Bit address transfer. |
SL_I2C_10BIT_ADD_WITH_REP_START | I2C 10 Bit address transfer with Repeated Start. |
SL_I2C_ACKNOWLEDGE | I2C ACK. |
SL_I2C_NACK | I2C NACK. |
SL_I2C_DATA_TRANSFER_COMPLETE | I2C data transfer complete. |
SL_I2C_ARIBITRATION_LOST | I2C Arbitration Lost. |
SL_I2C_BUS_ERROR | I2C Bus Error. |
SL_I2C_BUS_HOLD | I2C Bus held by I2C Bus. |
SL_I2C_SDA_ERROR | I2C SDA at loopback path is not equal to SDA output. |
SL_I2C_SCL_ERROR | I2C SCL at loopback path is not equal to SCL output. |
SL_I2C_CALLBACK_BUSY | I2C instance callback already registered. |
SL_I2C_DMA_TRANSFER_ERROR | I2C DMA transfer error. |
SL_I2C_INVALID_PARAMETER | Invalid Parameter. |
92
of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_i2c.h
sl_i2c_transfer_type_t#
sl_i2c_transfer_type_t
Enumeration to represent I2C transfer type.
Enumerator | |
---|---|
SL_I2C_USING_INTERRUPT | The driver will use interrupts to perform I2C transfer. |
SL_I2C_USING_DMA | The driver will use DMA to perform I2C transfer. |
SL_I2C_TRANFER_TYPE_LAST | For Validation. |
112
of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_i2c.h
sl_i2c_operating_mode_t#
sl_i2c_operating_mode_t
Enumeration to represent I2C operating mode.
Enumerator | |
---|---|
SL_I2C_STANDARD_MODE | Standard-mode, bidirectional data transfers up to 100 kbit/s. |
SL_I2C_FAST_MODE | Fast-mode, bidirectional data transfers up to 400 kbit/s. |
SL_I2C_HIGH_SPEED_MODE | High speed-mode, bidirectional data transfers up to 3.4 Mbit/s. |
SL_I2C_FAST_PLUS_MODE | Fast-mode Plus, bidirectional data transfers up to 1 Mbit/s. |
SL_I2C_OPERATING_MODE_LAST | Last member of enum for validation. |
119
of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_i2c.h
sl_i2c_power_modes_t#
sl_i2c_power_modes_t
Enumeration to represent I2C power modes.
Enumerator | |
---|---|
SL_I2C_ULP_MODE | The driver leader ULP mode. |
SL_I2C_HP_MODE | The driver leader HP mode. |
SL_I2C_POWER_MODE_LAST | For Validation. |
164
of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_i2c.h
Typedef Documentation#
sl_i2c_callback_t#
typedef void(* sl_i2c_callback_t) (sl_i2c_instance_t i2c_instance, uint32_t status) )(sl_i2c_instance_t i2c_instance, uint32_t status)
Callback for I2C Driver.
127
of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_i2c.h
Variable Documentation#
mode#
sl_i2c_mode_t sl_i2c_config_t::mode
Leader/Follower Mode, 0 for leader mode and 1 for follower mode.
131
of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_i2c.h
operating_mode#
sl_i2c_operating_mode_t sl_i2c_config_t::operating_mode
Speed mode sl_i2c_operating_mode_t for possible values.
132
of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_i2c.h
transfer_type#
sl_i2c_transfer_type_t sl_i2c_config_t::transfer_type
Transfer type sl_i2c_transfer_type_t for possible values.
133
of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_i2c.h
i2c_callback#
sl_i2c_callback_t sl_i2c_config_t::i2c_callback
I2C callback sl_i2c_callback_t.
134
of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_i2c.h
dma_tx_channel#
uint32_t sl_i2c_dma_config_t::dma_tx_channel
DMA transmit channel number.
139
of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_i2c.h
dma_rx_channel#
uint32_t sl_i2c_dma_config_t::dma_rx_channel
DMA receive channel number.
140
of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_i2c.h
tx_buffer#
uint8_t* sl_i2c_transfer_config_t::tx_buffer
Pointer to Tx Data buffer.
145
of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_i2c.h
tx_len#
uint32_t sl_i2c_transfer_config_t::tx_len
Number of bytes to transmit.
146
of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_i2c.h
rx_buffer#
uint8_t* sl_i2c_transfer_config_t::rx_buffer
Pointer to Rx Data buffer.
147
of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_i2c.h
rx_len#
uint32_t sl_i2c_transfer_config_t::rx_len
Number of bytes to receive.
148
of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_i2c.h
sda_port#
uint8_t sl_i2c_pin_init_t::sda_port
PWM GPIO port.
153
of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_i2c.h
sda_pin#
uint8_t sl_i2c_pin_init_t::sda_pin
PWM GPIO pin.
154
of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_i2c.h
sda_mux#
uint8_t sl_i2c_pin_init_t::sda_mux
PWM GPIO mux.
155
of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_i2c.h
sda_pad#
uint8_t sl_i2c_pin_init_t::sda_pad
PWM GPIO pad.
156
of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_i2c.h
scl_port#
uint8_t sl_i2c_pin_init_t::scl_port
PWM GPIO port.
157
of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_i2c.h
scl_pin#
uint8_t sl_i2c_pin_init_t::scl_pin
PWM GPIO pin.
158
of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_i2c.h
scl_mux#
uint8_t sl_i2c_pin_init_t::scl_mux
PWM GPIO mux.
159
of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_i2c.h
scl_pad#
uint8_t sl_i2c_pin_init_t::scl_pad
PWM GPIO pad.
160
of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_i2c.h
Function Documentation#
sl_i2c_driver_init#
sl_i2c_status_t sl_i2c_driver_init (sl_i2c_instance_t i2c_instance, const sl_i2c_config_t * p_user_config)
Initialize the I2C Module and clock.
[in] | i2c_instance | I2C Instance to be initialized sl_i2c_instance_t. |
[in] | p_user_config | A pointer to I2C configuration structure sl_i2c_config_t |
Sets I2C instance mode,operating mode (bus-speed), frequency, and transfer type (using Interrupt or DMA). If the transfer type is DMA, it initializes DMA as well. Registers I2C instance callback and clears pending interrupts. Configures SDL and SCL pins as per the instance.
Returns
status 0 if successful, else error code as follow
SL_I2C_SUCCESS (0x0000) - Success
SL_I2C_INVALID_PARAMETER (0x0F) - Parameters are invalid
SL_I2C_CALLBACK_BUSY (0x0D) - Driver is busy
188
of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_i2c.h
sl_i2c_driver_set_follower_address#
sl_i2c_status_t sl_i2c_driver_set_follower_address (sl_i2c_instance_t i2c_instance, uint16_t address)
This API configures the follower address of the I2C module.
[in] | i2c_instance | I2C Instance sl_i2c_instance_t |
[in] | address | Follower own address, can be provided in 7-bit length (0-127) or in 10-bit length(0-1023). |
Should be used only in Follower mode after instance initialization. It updates the slave address register I2C leader device initiates transfer with the address that matches slave address register of follower device.
Pre-conditions:
Here I2C mode should be set as follower mode
Returns
status 0 if successful, else error code as follow
SL_I2C_SUCCESS (0x0000) - Success
SL_I2C_INVALID_PARAMETER (0x0F) - Parameters are invalid
209
of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_i2c.h
sl_i2c_driver_configure_fifo_threshold#
sl_i2c_status_t sl_i2c_driver_configure_fifo_threshold (sl_i2c_instance_t i2c_instance, uint8_t tx_threshold_value, uint8_t rx_threshold_value)
This API configures the TX and RX FIFO threshold values.
[in] | i2c_instance | I2C Instance sl_i2c_instance_t |
[in] | tx_threshold_value | Transmit FIFO threshold value: Range between 0 to 255. |
[in] | rx_threshold_value | Receive FIFO threshold value: Range between 0 to 255. |
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. A value of 0 sets the threshold for 1 entry, and a value of 255 sets the threshold for 256 entries. This should be called after I2C instance initialization.
Pre-condition:
Returns
status 0 if successful, else error code as follow
SL_I2C_SUCCESS (0x0000) - Success
SL_I2C_INVALID_PARAMETER (0x0F) - Parameters are invalid
228
of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_i2c.h
sl_i2c_driver_get_frequency#
sl_i2c_status_t sl_i2c_driver_get_frequency (sl_i2c_instance_t i2c_instance, uint32_t * frequency)
This API will read the current I2C clock frequency.
[in] | i2c_instance | I2C Instance sl_i2c_instance_t |
[in] | frequency | Pointer to a variable to store currently configured frequency. |
This API gets the current clock frequency of I2C in MHz, by reading the system core clock frequency.
Pre-condition:
Returns
status 0 if successful, else error code as follow.
SL_I2C_SUCCESS (0x0000) - Success.
SL_I2C_INVALID_PARAMETER (0x0F) - Parameters are invalid.
245
of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_i2c.h
sl_i2c_driver_send_data_blocking#
sl_i2c_status_t sl_i2c_driver_send_data_blocking (sl_i2c_instance_t i2c_instance, uint16_t address, uint8_t * tx_buffer, uint32_t tx_len)
This API sends the data in blocking mode.
[in] | i2c_instance | I2C Instance sl_i2c_instance_t. |
[in] | address | Follower address, can be provided in 7-bit length (0-127) or in 10-bit length(0-1023). In follower mode this parameter will be ignored. |
[in] | tx_buffer | A pointer to transmit data buffer. |
[in] | tx_len | Data length in number of bytes in the range of 1- 80000 bytes. |
This API sends the data in blocking mode using interrupt, sets follower address when used in leader application, sets transmit empty interrupt and enable I2C interrupts. It keeps the call blocked until the last byte is transferred.
Pre-conditions:
Here transfer-type should be set as interrupt-type
sl_i2c_driver_set_follower_address (if sending from slave)
Note
Maximum tx_len used can be 80000 (receives in around 10 seconds).
Returns
status 0 if successful, else error code as follow.
SL_I2C_SUCCESS (0x0000) - Success.
SL_I2C_INVALID_PARAMETER (0x0F) - Parameters are invalid.
269
of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_i2c.h
sl_i2c_driver_send_data_non_blocking#
sl_i2c_status_t sl_i2c_driver_send_data_non_blocking (sl_i2c_instance_t i2c_instance, uint16_t address, uint32_t * tx_buffer, uint32_t tx_len, sl_i2c_dma_config_t * p_dma_config)
This API sends the data in non-blocking mode.
[in] | i2c_instance | I2C Instance. |
[in] | address | Follower address can be provided in 7-bit length (0-127) or in 10-bit length(0-1023). |
[in] | tx_buffer | A pointer to transmit data buffer |
[in] | tx_len | Data length in number of bytes in the range of 1- 30000 bytes. |
[in] | p_dma_config | A pointer to DMA configuration structure sl_i2c_dma_config_t. |
This API sends the data in non-blocking mode using DMA also sets the follower address when used in Leader application. Configures DMA rx and tx channels. Registers DMA callback & enables DMA channels. It updates the transfer complete flag SL_I2C_DATA_TRANSFER_COMPLETE after data transfer completion.
Pre-conditions:
Here transfer-type should be set as DMA-type
sl_i2c_driver_set_follower_address, if used in salve application
Note
Maximum tx_len values can be 30000 (receives back in around 4 seconds)
Returns
status 0 if successful, else error code as follow
SL_I2C_SUCCESS (0x0000) - Success
SL_I2C_INVALID_PARAMETER (0x0F) - Parameters are invalid
SL_DMA_TRANSFER_ERROR - DMA parameters are invalid
298
of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_i2c.h
sl_i2c_driver_receive_data_blocking#
sl_i2c_status_t sl_i2c_driver_receive_data_blocking (sl_i2c_instance_t i2c_instance, uint16_t address, uint8_t * rx_buffer, uint32_t rx_len)
This API receives the data in blocking mode.
[in] | i2c_instance | I2C Instance sl_i2c_instance_t |
[in] | address | Follower address, can be provided in 7-bit length (0-127) or in 10-bit length(0-1023). In follower mode this parameter will be ignored. |
[in] | rx_buffer | A pointer to receive data buffer |
[in] | rx_len | Data length in number of bytes in the range of 1-80000. |
This API receives the data in blocking mode using interrupt, also sets the follower address when used in Leader application. Sets receive full interrupt and enables I2C interrupts. It keeps the call blocked until the last byte is transferred.
Pre-conditions:
Here transfer-type should be set as interrupt-type
sl_i2c_driver_set_follower_address, if used in follower application
Note
Maximum rx_len used can be 80000 (receives in around 10 seconds)
Returns
status 0 if successful, else error code as follow
SL_I2C_SUCCESS (0x0000) - Success
SL_I2C_INVALID_PARAMETER (0x0F) - Parameters are invalid
326
of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_i2c.h
sl_i2c_driver_receive_data_non_blocking#
sl_i2c_status_t sl_i2c_driver_receive_data_non_blocking (sl_i2c_instance_t i2c_instance, uint16_t address, uint8_t * rx_buffer, uint32_t rx_len, sl_i2c_dma_config_t * p_dma_config)
This API receives the data in non-blocking mode.
[in] | i2c_instance | I2C Instance sl_i2c_instance_t |
[in] | address | Follower address, can be provided in 7-bit length (0-127) or in 10-bit length(0-1023). |
[in] | rx_buffer | A pointer to receive data buffer. |
[in] | rx_len | Data length in number of bytes in the range of 1- 30000 Bytes. |
[in] | p_dma_config | A pointer to DMA configuration structure sl_i2c_dma_config_t |
This API receives the data in non-blocking mode (using DMA), also sets the follower address when used in Leader application. Configures DMA rx and tx channels. Registers DMA callback & enables DMA channels. It updates the transfer complete flag SL_I2C_DATA_TRANSFER_COMPLETE after data transfer completion.
Pre-conditions:
Here transfer-type should be set as DMA-type
sl_i2c_driver_set_follower_address, if used in salve application
Note
Maximum rx_len values can be 30000 (receives back in around 4 seconds).
The default values cannot be any of the reserved address locations: that is, 0x00 to 0x07, or 0x78 to 0x7f.
Returns
status 0 if successful, else error code as follow
SL_I2C_SUCCESS (0x0000) - Success
SL_I2C_INVALID_PARAMETER (0x0F) - Parameters are invalid
SL_DMA_TRANSFER_ERROR - DMA parameters are invalid
358
of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_i2c.h
sl_i2c_driver_transfer_data#
sl_i2c_status_t sl_i2c_driver_transfer_data (sl_i2c_instance_t i2c_instance, sl_i2c_transfer_config_t const * p_transfer_config, uint16_t address)
This API transmits data and then receives data from an I2C device.
[in] | i2c_instance | I2C Instance sl_i2c_instance_t |
[in] | p_transfer_config | Follower address, can be provided in 7-bit length (0-127) or in 10-bit length(0-1023). |
[in] | address | A pointer to transfer configuration structure sl_i2c_transfer_config_t |
This API first transmits data and then receives data from an I2C device using interrupts. Also sets follower address when used in Leader application. Sets & enable transmit empty interrupt while transmitting data . Sets & enable receive full interrupt while receiving data.
Pre-conditions:
Here transfer-type should be set as Interrupt-type
sl_i2c_driver_set_follower_address, if used in follower application
Note
Maximum tx_len & rx_len values can be 80000 (sends & receives back in around 20 seconds).
The default values cannot be any of the reserved address locations: that is, 0x00 to 0x07, or 0x78 to 0x7f.
Returns
status 0 if successful, else error code as follow
SL_I2C_SUCCESS (0x0000) - Success
SL_I2C_INVALID_PARAMETER (0x0F) - Parameters are invalid
386
of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_i2c.h
sl_i2c_driver_deinit#
sl_i2c_status_t sl_i2c_driver_deinit (sl_i2c_instance_t i2c_instance)
De-initializes the I2C peripheral and clock.
[in] | i2c_instance | I2C Instance sl_i2c_instance_t |
This API will de-initializes the I2C peripheral, disables its clock and unregisters the callback.
Pre-condition:
Returns
status 0 if successful, else error code as follow
SL_I2C_SUCCESS (0x0000) - Success
SL_I2C_INVALID_PARAMETER (0x0F) - Parameters are invalid
Note
When I2C module is used in combination with other periperals, while deinitializing in the application please refer below notes
Whenever sl_i2c_driver_deinit() gets called it will disable the clock for the peripheral. To power off the peripheral we have to power down the power domain(PERI_EFUSE) which contains different peripherals mentioned below. i.e USART, UART, I2C, SSI Master, SSI Slave, Generic-SPI Master, I2S Master, I2S Slave, Micro-DMA Controller, Config Timer, Random-Number Generator, CRC Accelerator, SIO, QEI, MCPWM and EFUSE. Use below API to power down the particular power doamin, if other periherals's not being used sl_si91x_peri_efuse_power_down(power_down);
Few peripherlas(ULP Peripherls, UULP Peripherlas, GPDMA and SDIO-SPI) have seperate domains those can be powered down indepedently. For additional details refer Power architecture section in Hardware Reference Manual Here ULP_UART has seperate power domain ULPSS_PWRGATE_ULP_UART, which can be power down indepedently.Refer rsi_power_save.h file for all power gates definations.
412
of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_i2c.h
sl_si91x_i2c_pin_init#
sl_i2c_status_t sl_si91x_i2c_pin_init (sl_i2c_pin_init_t * pin_init)
Set the Pin configuration for I2C.
[in] | pin_init | Pointer to pin init structure sl_i2c_pin_init_t |
It configures the SDA and SCL pins. Also enables internal pullups of SDA & SCL lines of follower device.
Returns
status 0 if successful, else error code as follow
SL_I2C_SUCCESS (0x0000) - Success
SL_I2C_INVALID_PARAMETER (0x0F) - Parameters are invalid
426
of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_i2c.h
sl_i2c_driver_leader_reconfig_on_power_mode_change#
sl_i2c_status_t sl_i2c_driver_leader_reconfig_on_power_mode_change (sl_i2c_power_modes_t new_power_mode)
This API re-configures the I2C leader device on power mode changes.
[in] | new_power_mode | power state to switch to sl_i2c_power_modes_t |
Re-Config the I2C driver leader instance (I2C2) for ULP/HP mode. It will re-config I2C clock frequency required for I2C operating(speed) mode to run in ULP/HP mode.
Pre-conditions:
Instance should be ULP mode when new mode is HP
Instance should be HP mode when new mode is ULP
Instance used should be ULP-I2C instance
Returns
status 0 if successful, else error code as follow
SL_I2C_SUCCESS (0x0000) - Success
SL_I2C_INVALID_PARAMETER (0x0F) - Parameters are invalid
443
of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_i2c.h
sl_i2c_driver_enable_repeated_start#
sl_i2c_status_t sl_i2c_driver_enable_repeated_start (sl_i2c_instance_t i2c_instance, boolean_t enable_rep_start)
To enable or disable repeated start, to enable or disable combined format transfer.
[in] | i2c_instance | I2C Instance sl_i2c_instance_t |
[in] | enable_rep_start | true to enable & false to disable repeated start |
Details :
This API should be called by a leader application to enable repeated start, before starting data transfer.
By enabling this, one can use combined format transfers.
With this, I2C can perform combined write/read operations to same or different slave without releasing the line, thus with the guarantee that the operation is not interrupted.
Pre-condition:
Returns
status 0 if successful, else error code as follow
SL_I2C_SUCCESS (0x0000) - Success
SL_I2C_INVALID_PARAMETER (0x0F) - Parameters are invalid
464
of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_i2c.h
sl_si91x_i2c_wait_till_i2c_is_idle#
sl_i2c_status_t sl_si91x_i2c_wait_till_i2c_is_idle (sl_i2c_instance_t i2c_instance)
N/A | i2c_instance |
478
of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_i2c.h
Macro Definition Documentation#
SL_I2C0_DMA_TX_CHANNEL#
#define SL_I2C0_DMA_TX_CHANNELValue:
31
I2C Peripheral.
Overview#
I2C standard compliant bus interface with open-drain pins Configurable as Primary or Secondary Four speed modes: Standard Mode (100 kbps), Fast Mode (400 kbps), Fast Mode Plus (1Mbps) and High-Speed Mode (3.4 Mbps) 7 or 10-bit addressing 7 or 10-bit combined format transfers Support for Clock synchronization and Bus Clear Programmable SDA Hold time Integrated transmit and receive buffers with support for DMA Bulk transmit mode in I2C Slave mode Interrupt based operation (polled mode also available)
Initialization#
Call init API with the init parameters. Call set follower address API, in follower mode Call Set FIFO threshold API
72
of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_i2c.h
SL_I2C0_DMA_RX_CHANNEL#
#define SL_I2C0_DMA_RX_CHANNELValue:
30
73
of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_i2c.h
SL_I2C1_DMA_TX_CHANNEL#
#define SL_I2C1_DMA_TX_CHANNELValue:
3
74
of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_i2c.h
SL_I2C1_DMA_RX_CHANNEL#
#define SL_I2C1_DMA_RX_CHANNELValue:
2
75
of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_i2c.h
SL_I2C2_DMA_TX_CHANNEL#
#define SL_I2C2_DMA_TX_CHANNELValue:
5
76
of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_i2c.h
SL_I2C2_DMA_RX_CHANNEL#
#define SL_I2C2_DMA_RX_CHANNELValue:
4
77
of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_i2c.h
ULP_I2C#
#define ULP_I2CValue:
SL_I2C2
78
of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_i2c.h