TWIM I2C soft reset function?

Hi

The TWI driver has a twi_clear_bus() function but the TWIM does not.

I'm getting an I2C error, and need to do I2C soft reset. I'm doing this manually at moment but just wondering why a there is no reset in the TWIM.

We are using SDK3.2 for thread and zigbee and nrfx_twim_bus_recover does not seem to be present.

kind regards

Liam

Parents
  • Sorry for very late reply, this thread somehow fell in the gaps of not being visible to me.

    Try this

    const struct device *i2c_dev = DEVICE_DT_GET(DT_NODELABEL(i2cXXX)); 
    
    if (i2c_transfer(i2c_dev, msgs, num, addr) < 0) {
        i2c_recover_bus(i2c_dev);
    }

    That should be it. No nrfx calls, no manual disable/enable. The Zephyr wrapper handles peripheral disable, pin recovery, pinctrl restore, and re-enable for you.

Reply
  • Sorry for very late reply, this thread somehow fell in the gaps of not being visible to me.

    Try this

    const struct device *i2c_dev = DEVICE_DT_GET(DT_NODELABEL(i2cXXX)); 
    
    if (i2c_transfer(i2c_dev, msgs, num, addr) < 0) {
        i2c_recover_bus(i2c_dev);
    }

    That should be it. No nrfx calls, no manual disable/enable. The Zephyr wrapper handles peripheral disable, pin recovery, pinctrl restore, and re-enable for you.

Children
No Data
Related