Issue with NRF_TWIM_TASK_STOP and NRF_TWIM_EVENT_STOPPED on NRF52833 DK

Issue:

While trying to initialize and check the viability of an I2C interface using TWIM, my NRF_TWIM_TASK_STOP never triggers NRF_TWIM_EVENT_STOPPED.

Code:

nrf_twim_task_trigger(reg, NRF_TWIM_TASK_STOP);
while (nrf_twim_event_check(reg, NRF_TWIM_EVENT_STOPPED) == 0) {
    printf("IN WHILE WAITING FOR (NRF_TWIM_EVENT_STOPPED == 1)\n");
}

This causes the "IN WHILE" message to print indefinitely.

Wondering how I can verify that the trigger is being pushed to the correct address, and diagnose why the event is not getting fired.

Cheers!

Parents Reply Children
  • The error is coming from debugging code I've added. e.g.

    if (nrf_twim_event_check(reg, NRF_TWIM_EVENT_ERROR)) {
        printf("nrf_twim_event_check(reg, NRF_TWIM_EVENT_ERROR) returned true\n");
    
        uint32_t err_src = nrf_twim_errorsrc_get_and_clear(reg);
        nrfx_err_t err_code = twi_process_error(err_src);
        printf("nrf_twim_errorsrc_get_and_clear(%d) returned %d \n", reg, err_code);
        nrf_twim_event_clear(reg, NRF_TWIM_EVENT_ERROR);
    }


    The number can then be checked against an nrfx_err_t to decode the error.

    I have two TWI slave devices, but only am only using one at a time.

    I'm currently using nrfx v2.0.

    Cheers,

    S.

  • Hi,

    Can you check the value of err_src passed to twi_process_error? It seems that NRFX_ERROR_INTERNAL is the default error code if the err_src does variable does not match any expected error codes.

    The nrf_twim_errorsrc_get_and_clear function should return the content of the ERRORSRC register.

    Best regards,
    Jørgen

Related