Need to change I2C bus speed to 50KHz

Hi Folks,
I’m working with an I2C LCD rated for up to 50KHz and it is showing a fair number of glitches. Can anyone tell me how to lower the I2C speed from the default values, which I understand to be 100KHz, minimum?  The platform is the nRF Feather, board rev 5. I have posted this over in Circuit Dojo.

I tried the I2C_SPEED_SET() macro, which threw a warning and I tried a few speed settings in the overlay file but am still seeing display glitches. Does anyone know the proper way to do is?

Thanks,
Jim

Parents
  • Hi,

    The I2C driver will throw an error if you try to configure anything else than the supported speeds. It will not be possible to configure this through the APIs in nRF Connect SDK or Zephyr. If you need to try out different speeds, you will have to write directly to the FREQUENCY register of the TWI(M) peripheral, after configuration and before transmits. Note that only the defined speeds mentioned in the register documentation (100K/250K/400K) is supported and tested, all other values are used at your own risk. We do not provide register values for other speeds.

    Best regards,
    Jørgen

  • Thanks Jørgen.

    I confirmed that bus speed is the problem with this peripheral after changing the 100KHz value in nrf9160_bitfields.h from 0x01980000 to 0x00C80000. It's rock-steady with this change.

    I'm afraid I don't know how to access the FREQUENCY register - can you point me to an example? I've got minimal interaction with the device in my LCD interface:

    static const struct i2c_dt_spec i2c_dev = I2C_DT_SPEC_GET(I2C_INST);   

    That's all I have that references the I2C driver. Unfortunately, I don't know how to follow this reference all the way to the FREQUENCY register.

    On a side note, why not make sub-100K frequencies available via the SDK? Can that be a feature request?

    Thanks,

    Jim

Reply
  • Thanks Jørgen.

    I confirmed that bus speed is the problem with this peripheral after changing the 100KHz value in nrf9160_bitfields.h from 0x01980000 to 0x00C80000. It's rock-steady with this change.

    I'm afraid I don't know how to access the FREQUENCY register - can you point me to an example? I've got minimal interaction with the device in my LCD interface:

    static const struct i2c_dt_spec i2c_dev = I2C_DT_SPEC_GET(I2C_INST);   

    That's all I have that references the I2C driver. Unfortunately, I don't know how to follow this reference all the way to the FREQUENCY register.

    On a side note, why not make sub-100K frequencies available via the SDK? Can that be a feature request?

    Thanks,

    Jim

Children
No Data
Related