This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

nRF52840 twi drivers for ICM 20948 sensor data burst read

Hello,

I am using a custom board with nrf52840 using SDK 15.3 and ICM 20948. I see a lot of twi drivers and its confusing which one to use. I want to read the ICM 20948 sensor data in burst mode for my application. In the second step I want to use the tap detection in DMP, so i have to write the DMP firmware into the ICM. But my twi drivers seem to constantly return with err_code 0x11 or 0x03 errors. Please let me know which is the best consistent twi drivers for ICM at max I2C speed (~400 KHz). Thanks and regards.

Parents
  • Hi

    If you're starting out today you should definitely use the nrfx drivers, and for TWI master the best option is nrfx_twim.c. 

    nrfx_twi.c is kept for backwards compatibility with older parts like the nRF51 seires, while nrf_twim.c utilizes the new DMA enabled TWI master available in the nRF52 family. 

    0x11 corresponds to the NRF_ERROR_BUSY error, and often occurs if the driver is used in non-blocking mode, but is called as if it was blocking. 

    In non-blocking mode you will get an event in return once the current TWI operation is completed, and you have to wait for this event to occur before you can send or receive more data. If you try to call into the driver multiple times without waiting for this event you will get the busy error to tell you that the driver is currently busy with the current transaction. 

    Best regards
    Torbjørn

  • thanks for the valuable suggestion dear ovrebekk. I changed all the instances from nrf_drv_twi.. to nrfx_twim.. now, i have the error

    Error[Pe020]: identifier "NRFX_TWIM0_INST_IDX" is undefined .. in main.c

    pls help how i resolve this..

Reply Children
Related