TWIM (I2C) on NCS is not working properly.

First of all, the fast mode should be 400kHz, but it seems to be only 200kHz according to the waveform. Also, the duty cycle seems to be wrong.

Secondly, It seems that CONFIG_I2C_CALLBACK is not working at all. I have written the callback function as follows, but it is not called.

/* Callback */
K_SEM_DEFINE(k_sem, 0, 1);
static void twim_callback(const struct device *dev, int result, void *data)
{
    printk("Callback\n");
    k_sem_give(&k_sem);
}
That is obvious since there is no log display and no semaphore to go through.
I am working on a project using TWIM and I hope these bugs will be fixed soon.
Parents Reply
  • Hello,

    Sorry, I was handling another job and neglected this matter.

    As you say, i2c_nrfx_twim.c uses the i2c_driver_api structure to set up each callbacks. That of course includes i2c_nrfx_twim_transfer.
    But when I actually debug the program and look into the contents of the device structure, only the address of i2c_nrfx_twim_transfer is 0(null).
    What does this mean? I can think it is a bug.

Children
Related