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
  • Thank you for reply and best regards.

    Yes, I just remembered. There are still a few things that seem to be glitches.

    1. Both SCL and SDA keep low level till the first TWI command executed if no I2C device is connected. Both SCL and SDA change high level after the first TWI command is executed. I guess the internal pull-up is enabled after the first command is executed.

    2. If 'nrf-twi' is specified in DeviceTree, the TWI read command(waveform) is not output. if 'nrf-twim' is specified, the TWI read command is output.

    I would appreciate it if you could look into this problem.

Children
No Data
Related