.. include:: ../substitutions.rst .. include:: stdout.rst I2C === The phyCORE-RT1170 module provides support for Inter-Integrated Circuit (I2C) communication, enabling connections with a variety of external I2C-compatible devices. This standard two-wire bus is commonly used for low-speed communication between integrated circuits on the same board or across short distances. The i.MX RT1170 processor includes two I2C controllers. For in-depth technical information, refer to the *I2C Interface* chapter in the |hw-manual-link|. I2C Buses --------- The phyBOARD-Atlas RT1170 exposes two I2C buses through the carrier board: * ``lpi2c2`` * ``lpi2c5`` Each bus is connected to specific onboard peripherals, as shown below. .. list-table:: lpi2c2 Devices :header-rows: 1 * - Interface - Address (7-bit) * - EEPROM - 0x50 * - EEPROM Identification Page - 0x58 .. list-table:: lpi2c5 Devices :header-rows: 1 * - Interface - Address (7-bit) * - Audio Codec - 0x18 * - Accelerometer - 0x69 Accessing I2C Devices via Shell ------------------------------- To interact with I2C devices from the command line, begin by scanning the bus for connected peripherals. The example below scans the ``lpi2c5`` bus: .. code-block:: console :substitutions: |target-prompt| i2c scan lpi2c5 |intf-i2c-scan| In this case, the scan reveals that the audio codec is available at address ``0x18``. To read a register from this device, use the ``i2c read`` command followed by the bus name, device address, and register offset: .. code-block:: console :substitutions: |target-prompt| i2c read lpi2c5 0x18 0 |intf-i2c-read| .. note:: Direct register access via the I2C shell commands is primarily intended for debugging. For production use, it is strongly recommended to access I2C devices through dedicated drivers whenever possible. EEPROM Uptime Counter Example ----------------------------- .. jinja:: :file: templates/i2c-uptime-counter.jinja Source Code ~~~~~~~~~~~ .. literalinclude :: source-code/uptime_counter.c :language: c For more information see the |http-link-intf-i2c-uptime-counter| file.