This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

nRF52832 TWI implementation with 16-bit register addresses

We need to read/write to an I2C device that uses a 16-bit register addresses (Melexis MLX90632), and the nrf_drv_twi_tx() and nrf_drv_twi_rf() functions seem to be limited to 8-bit addresses.

How can we use the TWI module to read 16-bit addressed registers?

Thanks!

Parents
  • Here a user describes accessing a device which uses a 32 bit address, maybe the proposed configuration is interesting for you.
    In this question another user has the same question as you do - the answer contains multiple links to additional ressources learning about I2C in general and notes:

    Note that I2C itself has no notion of "registers" - that's just to do with the particular Slave you're talking to.

    As far as I2C itself is concerned, it's all just data.

    functions seem to be limited to 8-bit addresses

    Do you mean the I2C device address? I think the I2C protocol specifies 7 bit standard addresses and 10 bit addressing to expand the number of devices connected to the same bus.

    I assume you confuse the I2C device address with the "register address".

    The datasheet of the Melexis MLX90632 states (on p.22):

    "By default, the device responds to the 7-bit slave address 0x3A.
    Configuration of the 7-bit slave address is possible at EEPROM address 0x24D5.
    "

    Section 9.2 Addressed read of the datasheet (p.24) shows how to perform a read from a 16-bit address on the device.
    1. Send the 7-bit device address
    2. Send the MSB of the 16 bit address
    3. Send the LSB of the 16 bit address

    JaTi

Reply
  • Here a user describes accessing a device which uses a 32 bit address, maybe the proposed configuration is interesting for you.
    In this question another user has the same question as you do - the answer contains multiple links to additional ressources learning about I2C in general and notes:

    Note that I2C itself has no notion of "registers" - that's just to do with the particular Slave you're talking to.

    As far as I2C itself is concerned, it's all just data.

    functions seem to be limited to 8-bit addresses

    Do you mean the I2C device address? I think the I2C protocol specifies 7 bit standard addresses and 10 bit addressing to expand the number of devices connected to the same bus.

    I assume you confuse the I2C device address with the "register address".

    The datasheet of the Melexis MLX90632 states (on p.22):

    "By default, the device responds to the 7-bit slave address 0x3A.
    Configuration of the 7-bit slave address is possible at EEPROM address 0x24D5.
    "

    Section 9.2 Addressed read of the datasheet (p.24) shows how to perform a read from a 16-bit address on the device.
    1. Send the 7-bit device address
    2. Send the MSB of the 16 bit address
    3. Send the LSB of the 16 bit address

    JaTi

Children
No Data
Related