# Enable I2C bus in sensor low-power island (SLPI)

Source: [https://docs.qualcomm.com/doc/80-88500-1/topic/47_Enable_I2C_bus_in_SLPI.html](https://docs.qualcomm.com/doc/80-88500-1/topic/47_Enable_I2C_bus_in_SLPI.html)

## About this task

The following are the I^2^C APIs available in the core/api/buses/i2c\_api.h file:

| I^2^C API | Description |
| --- | --- |
| `i2c_status i2c_open (i2c_instance instance, void **i2c_handle)` | If successful, the `i2c_handle` points to the handle of the I^2^C instance. This API allocates resources for the I^2^C instance or handle. |
| `i2c_status i2c_poweron (void *i2c_handle)` | Enables the clocks, GPIOs, and any other power resources used by the I^2^C instance. |
| `i2c_status i2c_transfer (void *i2c_handle, i2c_slave_config *config, i2c_descriptor *desc, uint16 num_descriptors, callback_func func, void *ctxt, uint32 delay_us, uint32 *transferred)` | Performs an I^2^C/I3C transfer synchronously or asynchronously. A callback function is passed as a parameter to this function. If the callback parameter is NULL, the function executes synchronously. When the function returns, the transfer is complete. |
| `i2c_status i2c_poweroff(void *i2c_handle)` | Disables the clocks, GPIOs, and any other power resources used by the I^2^C instance. |
| `i2c_status i2c_close(void *i2c_handle)` | Releases the resources allocated to the I^2^C instance. |

The memory space in the SLPI image has limited resources. Therefore, you must enable and compile the corresponding I^2^C instance into the final SLPI image manually. To get the I^2^C instance-related resources compiled or linked into the final image, define the following micro in the slpi\_proc\core\settings\buses\i2c\config\kona\slpi\i2c\_devcfg.h file:

    #define ENABLE_I2C_02
    static plat_device_config i2c_device_config[] ={
         ……………..
    #ifdef ENABLE_I2C_02
        {
            .core_base_addr              = (uint8 *) QUPV3_CORE_BASE_ADDRESS,
            .core_offset                 = 0x00084000,
            .qupv3_instance              = QUP_SSC,
            .core_index                  = 2,
            .core_irq                    = 101,
            .min_data_length_for_dma     = 0,
            .gpi_index                   = 1,
            .active_scl_encoding         = 0x00018021,
            .active_sda_encoding         = 0x00018031,
            .inactive_scl_encoding       = 0x00000020,
            .inactive_sda_encoding       = 0x00000030,
            .gpio_exclusive_access       = TRUE,
            .tcsr_base_addr              = (uint8 *) 0x01FC0000,
            .tcsr_reg_offset             = 0x00000000,
            .tcsr_reg_value              = 0x00000000,
            .common_clocks               = (uint8 **) common_clocks_str_0,
            .se_clock                    = (uint8 **) (se_clocks_str_0     + 1),
            .se_src_clock                = (uint8 **) (se_src_clocks_str_0 + 1),
            .resource_votes              = 0,
            .clock_config                = clk_cfg,
        },
    #endif
     …………………..
    };Copy to clipboard

**Parent Topic:** [I2C in QUP](https://docs.qualcomm.com/doc/80-88500-1/topic/41_I2C_in_QUP_v3.html)

Last Published: Aug 18, 2023

[Previous Topic
Configure I2C in sensor core as sensor low-power island (SLPI) processor](https://docs.qualcomm.com/bundle/publicresource/80-88500-1/topics/46_Configure_I2C_in_sensor_core_as_sensor_low_power_island__SLPI__processor.md) [Next Topic
Update QUP serial engine firmware for I2C](https://docs.qualcomm.com/bundle/publicresource/80-88500-1/topics/48_Update_QUP_v3_serial_engine_firmware_for_I2C.md)