About I2C program issue of Radio Test in Zephyr SDK2.0.0

Hi,

I try to use: nRF52840 device (Master) + LIS3DH device (Slave) for I2C interface communication.
When the I2C Sensor library of LIS3DH is not applied, the nRF52840 (master) can write or read LIS3DH (slave) registers through the I2C interface.
The problems I encountered include:
When reading the register using i2c_reg_read_byte test results will occur error (-5).
When writing to the register using i2c_reg_write_byte test results will occur error (-5).

Can you help me to confirm which errors in my Radio Test program cause the I2C communication to be invalid?
So far, I2C communication has not been successful.
Do you have any idea what is the right way to do so?

Best regards,

Lulu.C

  • When the I2C Sensor library of LIS3DH is not applied, the nRF52840 (master) can write or read LIS3DH (slave) registers through the I2C interface.

    Which API were you using when you were able to read or write to the LIS3DH sensor through I2C? why did you need to change it to I2C_read_reg_byte/I2C_write_reg_byte?

    I can see that there is driver in zephyr\drivers\sensor\lis2dh\lis2dh_i2c.c which uses lis2dh_i2c_read_reg/lis2dh_i2c_write_reg. And looking at the spec of LIS2DH and LIS3DH, I see that the communication interface method remains the same. So the API you were using seems to be working fine with the sensor. I would connect a logic analyzer or similar to the sensor I2C pins to get an idea of what is going on in the I2C lines. Maybe there have a wrong init configuration causing a mismatch in the I2C slave/master configuration?

  • Hi,

    Thanks for your quick answer.

    Because I want to confirm: If the driver of the Slave device (such as SKY66408-21) is not included in the zephyr\drivers\sensor folder, the API for I2C interface communication reading and writing is through I2C_read_reg_byte/I2C_write_reg_byte?
    What other definitions need to be set when the driver of the Slave device is not included in zephyr\drivers\sensor?
    Do you have any idea what is the right way to do so? Thanks.

    Best regards,

    Lulu.C

  • I am confused  The initial question was regarding LIS3DH accelerometer, and hence my reply was based on that. 

    Lulu.C said:
    : If the driver of the Slave device (such as SKY66408-21) is not included in the zephyr\drivers\sensor folder, the API for I2C interface communication reading and writing is through I2C_read_reg_byte/I2C_write_reg_byte?

    SKY66408 looks like a Front End Module. Adding support for the front end module might not be as straight forward as adding support for the sensor.

    We have our own Front End Module and there we have given more information on how it is supported. Unfortunately I do not know what is the right way to add support for SKY66408

Related