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

Multiple TWI-instances SDK 11

Hi,

I'm currently running two separate TWI-instances on my nRF52 DK with SDK 11.

Each instance runs quite well with no issue, except for when instance 1 becomes active (it either reads or writes); the SDA-line on instance 0 becomes permanently low.

For clarity, I'm wondering why the SDA-line on TWI-instance 0 is going permanently low after the TWI-instance 1 has performed a read/write operation.

I have a Saleae 16 logic analyzer at hand, if needed, I can provide with some captures.

Here is my code for TWI-instance 0:

    static const nrf_drv_twi_t twi_motor = NRF_DRV_TWI_INSTANCE(0);
    const nrf_drv_twi_config_t twi_motor_config = {
      .scl                = SCL_MOTOR_PIN,                     // SCL_MOTOR_PIN = 27
      .sda                = SDA_MOTOR_PIN,                   // SDA_MOTOR_PIN = 26
      .frequency          = NRF_TWI_FREQ_100K,
      .interrupt_priority = TWI0_CONFIG_IRQ_PRIORITY
   };

   nrf_drv_twi_init(&twi_motor, &twi_motor_config, NULL, NULL);

   nrf_drv_twi_enable(&twi_motor);

Here is my code for TWI-instance 1:

static const nrf_drv_twi_t twi_rfid = NRF_DRV_TWI_INSTANCE(1);

 const nrf_drv_twi_config_t twi_rfid_config = {
      .scl                = SCL_RFID_PIN,                              //SCL_RFID_PIN = 25
      .sda                = SDA_RFID_PIN,                            //SDA_RFID_PIN = 24
      .frequency          = NRF_TWI_FREQ_100K,
      .interrupt_priority = TWI1_CONFIG_IRQ_PRIORITY
   };

   nrf_drv_twi_init(&twi_rfid, &twi_rfid_config, NULL, NULL);

   nrf_drv_twi_enable(&twi_rfid);

Here is my configuration in nrf_drv_config.h:

#define TWI0_ENABLED 1

#if (TWI0_ENABLED == 1)
#define TWI0_USE_EASY_DMA 0

#define TWI0_CONFIG_FREQUENCY     NRF_TWI_FREQ_100K
#define TWI0_CONFIG_SCL           0x1b
#define TWI0_CONFIG_SDA           0x1a
#define TWI0_CONFIG_IRQ_PRIORITY  1

#define TWI0_INSTANCE_INDEX      0
#endif

#define TWI1_ENABLED 1

#if (TWI1_ENABLED == 1)
#define TWI1_USE_EASY_DMA 0

#define TWI1_CONFIG_FREQUENCY    NRF_TWI_FREQ_100K
#define TWI1_CONFIG_SCL          0x19
#define TWI1_CONFIG_SDA          0x18
#define TWI1_CONFIG_IRQ_PRIORITY 3

#define TWI1_INSTANCE_INDEX      (TWI0_ENABLED)
#endif

#define TWI_COUNT                (TWI0_ENABLED + TWI1_ENABLED)
Parents Reply Children
No Data
Related