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

Blocking & Non-Blocking operations on TWI

Hello,

 

I am using nRF52832, SDK_15.3.0, S132 SoftDevice and Segger for flashing the image. I am using ‘ble_app_blinky’.

I connected my sensor to nRF52832 DK over TWI. When ‘twi_scanner’ example code loaded I received the address of the slave device.

Just to crosscheck I ported ‘twi_scanner’ as is into ‘ble_app_blinky’. Even here it worked fine.

 

1) But later I have gone through ‘twi_senor’ example and changed

From     :  nrf_drv_twi_init(&m_twi, &twi_config, NULL, NULL);

To          :  nrf_drv_twi_init(&m_twi, &twi_config, twi_handler, NULL);

 When ‘twi_handler’ added, I get success for all 127 address. I am not sure why this happened.

    for (address = 1; address <= TWI_ADDRESSES; address++)
    {
        err_code = nrf_drv_twi_rx(&m_twi, address, &sample_data, sizeof(sample_data));
        if (err_code == NRF_SUCCESS)
        {
            detected_device = true;
            NRF_LOG_INFO("TWI device detected at address 0x%x.", address);
        }
        NRF_LOG_FLUSH();
    }

2) Under ‘nrf_drv_twi_init’ for event handler it is mentioned as “If NULL, blocking mode is enabled”. What does it mean.

Thanks & Regards

Vishnu Beema

Parents Reply Children
No Data
Related