This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

TWI not working on nrf52832 dev board: NRF_DRV_TWI_ERROR

Hi,

I have a pretty hard time to get I2C/TWI running on my 52832 Dev-board (pca 10036). My problem is, that i do not get any physical I2C signal out of the board's pins. I tried nordic's TWI master/slave example from the SDK 0.9.2, shortened the relevant pins, with no success. Then I wrote a minimal TWI test programm. E.g.:

const nrf_drv_twi_t           p_twi_instance = NRF_DRV_TWI_INSTANCE(1);

ret_code = nrf_drv_twi_init(&p_twi_instance, &p_twi_config, twi_event_handler); // Initiate twi driver with instance and configuration values
APP_ERROR_CHECK(ret_code); // Check for errors in return value

nrf_drv_twi_enable(&p_twi_instance); // Enable the TWI instance

// Send dummy data on TWI buss on address 0x68
 ret_code = nrf_drv_twi_tx(&p_twi_instance, address, &dummy_data, 1, false);

and handle the twi event:

// TWI event handler. Processing TWI events originating from
// nrf_drv_twi_tx()

static void twi_event_handler(nrf_drv_twi_evt_t *evt){

   if(evt->type == NRF_DRV_TWI_ERROR)
   {
      /* Error 2 is
      * NRF_TWI_ERROR_ADDRESS_NACK = TWI_ERRORSRC_ANACK_Msk,
      * NACK received after sending the address.
      * as defined in nrf_twi.h
      * So I guess I don't get any response from my external device.
      */
   }

   if(evt->type == NRF_DRV_TWI_TX_DONE)
   {
      SEGGER_RTT_printf(0,"TWI event success ...\r\n");
   }
}

The TWI is initiated without any error and the program runs fine, but in the event handler I always get a NRF_DRV_TWI_ERROR, regardless of the TWI slaves.

Then i attached my Saleae Logic Analyzer into the TWI bus with 10K Ohm pull-up resistors to see, if there are any logic signals. But neither for SCL nor SCA pins was any signal detected.

Then I probed every pin on the 52832 Dev-Board with the logic analyzer, just to make sure I don't have misconfigured pins, but i could not get any signal on any pin.

Next I probed the logic analyzer with a 51822 board, and with this board I can see the SCL and SCA signals, so the logic analyzer is working correctly.

So, is TWI (nrf_drv_twi.c, etc.) working on a 52832 Dev-board?

Any idea, why I don't even get the TWI clock signal on the pin?

Is my board maybe physically damaged?

Any help is greatly appreciated! Yours Johannes

Parents
  • Hi RK,

    I already tried different pins, e.g. 3,4,5,6,7,8, 20,21,30, each configured in the respective header file, erased the board and flashed it completely with the new compiled application. Meanwhile, I waste 3 days :-( If your are successful with TWI, please let me know. Yours Johannes

Reply
  • Hi RK,

    I already tried different pins, e.g. 3,4,5,6,7,8, 20,21,30, each configured in the respective header file, erased the board and flashed it completely with the new compiled application. Meanwhile, I waste 3 days :-( If your are successful with TWI, please let me know. Yours Johannes

Children
No Data
Related