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

TWIM issue (nrf_twim_event_check)

Hi,

I have faced an issue during an I2C read operation. My code stuck in the infinite loop of

while (!nrf_twim_event_check(p_twim, evt_to_wait))
    {
        if (nrf_twim_event_check(p_twim, NRF_TWIM_EVENT_ERROR))
        {
            NRF_LOG_DEBUG("TWIM: Event: %s.\r\n", (uint32_t)EVT_TO_STR_TWIM(NRF_TWIM_EVENT_ERROR)); 
            nrf_twim_event_clear(p_twim, NRF_TWIM_EVENT_ERROR);
            nrf_twim_task_trigger(p_twim, NRF_TWIM_TASK_RESUME);
            nrf_twim_task_trigger(p_twim, NRF_TWIM_TASK_STOP);
            evt_to_wait = NRF_TWIM_EVENT_STOPPED;
        }
    }

The issue occurred after I was running my application for the entire day in debug mode, and did a breakpoint to check on some program variables. My code went into softreset and stuck in the aforementioned while loop. Before that the reading operation is smooth. The only way to fix this issue is to perform a hard restart which involves powering down completely and powering up. Is there any way to prevent this or breakout from this loop. Before using the TWIM (with easyDMA), I also have similar issue when I was using the TWI driver. In both cases, the code stuck in a while loop. The SCL pin is held high (normal) but the SDA is held low. FYI: I was porting my application from SDK11 to SDK12. The code worked well in SDK11.

Similar issues have been mentioned before -> devzone.nordicsemi.com/.../ devzone.nordicsemi.com/.../

Parents Reply Children
No Data
Related