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

Possible bug: I2C stuck

Hi

I'm having problems with the I2C. For now what I see is the twi_transfer function remains in infinite loop. Other symtomp is the SDA line remains normally at low level. I've no idea what's happening. Errata documents looks ok, and the ERRORSRC register shows 0x00.

In order to try what's happening, I have the following questions:

  • What's the difference between TWI and TWIM? TWIM has a DMA mode, but it is mandatory to use it? All I want is to read and to write into a peripheral, I don't need DMA.

  • TWI peripheral is listed in the section 8.4 of the Reference Manual
    as Deprecated. What does mean? Should I migrate to TWIM peripheral?

  • ENABLE register needs to have 0x06 value in order to be enabled, but the nrf_drv_twi driver writes on this register the value 0x05. Is this a problem?

Thanks in advance. Any help would be appreciated.

Regards,

Elena

  • TWIM is the new peripheral with DMA. You have to use DMA if you use TWIM.

    TWI is deprecated. It is there for backward compatibility with nRF51 and in case the new modules have problems. Deprecated means that the module may not be present in other versions of the nrf52 chip. They will not be removed on the nRF52832 chip. We recommend to use the new modules; it will then be easier to upgrade to newer chips if that is desired in the future.

    If ENABLE register is 0x05 it means that TWI is enabled and not TWIM. You make the driver use TWIM instead with (for TWI0/TWIM0):

    #define TWI0_USE_EASY_DMA 1
    

    As for your problem with the twi_transfer function remains in infinite loop or the SDA line remains low, I don’t know why this is happening, I think you need to give us more information and first you can switch to TWIM to see if the problem is still there with the new peripheral. You can also try TWIM0, TWIM1 and TWIM2 to see if there is any difference.

Related