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

Howto reset I2C controller for 52840

Hi,

Working on a product with a couple to sensors with i2c communication. Are normally able read values from the sensors, but sometimes the i2c bus seem to be down. No more read/write operation succeeds.

We are using a pre-production version of the Nordic 52840. Are there any known issues regarding i2c for the pre-production devices?

How do I reset the i2c controller to see if this is the reason for hanging the i2c bus?

Thanks,

   Henrik

Parents
  • It might help to have a logic analyzer available, so you may see when and if serial transfer stops. But to answer your question. You likely need to uninit() the driver, and then power cycle the peripheral, and then init(() the driver again. To power cycle the peripheral, write 0 followed by 1 to the POWER register (address 0xFFC) of the peripheral instance that you want to  power cycle like this:

    • If TWIM0:
       
      *(volatile uint32_t *)0x40003FFC = 0;
      *(volatile uint32_t *)0x40003FFC;
      *(volatile uint32_t *)0x40003FFC = 1;
      
    • If TWIM1:
       
      *(volatile uint32_t *)0x40004FFC = 0;
      *(volatile uint32_t *)0x40004FFC;
      *(volatile uint32_t *)0x40004FFC = 1;
Reply
  • It might help to have a logic analyzer available, so you may see when and if serial transfer stops. But to answer your question. You likely need to uninit() the driver, and then power cycle the peripheral, and then init(() the driver again. To power cycle the peripheral, write 0 followed by 1 to the POWER register (address 0xFFC) of the peripheral instance that you want to  power cycle like this:

    • If TWIM0:
       
      *(volatile uint32_t *)0x40003FFC = 0;
      *(volatile uint32_t *)0x40003FFC;
      *(volatile uint32_t *)0x40003FFC = 1;
      
    • If TWIM1:
       
      *(volatile uint32_t *)0x40004FFC = 0;
      *(volatile uint32_t *)0x40004FFC;
      *(volatile uint32_t *)0x40004FFC = 1;
Children
Related