Hi,
I have a problem with resume suspended TWIM transmission. My goal is to send | START | ADDR | DATA 1 | DATA 2 | STOP | where DATA 1 and DATA 2 will be send in two separate TX transactions without repeated START between them. When I send DATA 1 I use short NRF_TWIM_SHORT_LASTTX_SUSPEND_MASK to suspend transfer after sent last byte. When I get NRF_TWIM_EVENT_SUSPENDED, I setup DMA buffer with DATA 2 and use NRF_TWIM_SHORT_LASTTX_STOP_MASK to generate STOP after sending the last byte of the DATA 2. To start the DATA 2 transfer I suppose to use NRF_TWIM_TASK_RESUME but this task does not start DATA 2 transfer. Only when I use NRF_TWIM_TASK_STARTTX after NRF_TWIM_TASK_RESUME data are transferred but with additional | START | ADDR | which is not what I expect.
So the question is: How to resume TWIM TX with the new buffer without sending additional | START | ADDR | ? Is it possible any way?
Here is a snippet of my code:
const uint8_t data1[] = "data 1"; const uint8_t data2[] = "data 2"; nrf_twim_address_set(pSelf->twim.p_twim, 0x17); nrf_twim_event_clear(pSelf->twim.p_twim, NRF_TWIM_EVENT_TXSTARTED); nrf_twim_event_clear(pSelf->twim.p_twim, NRF_TWIM_EVENT_STOPPED); nrf_twim_event_clear(pSelf->twim.p_twim, NRF_TWIM_EVENT_SUSPENDED); nrf_twim_event_clear(pSelf->twim.p_twim, NRF_TWIM_EVENT_LASTTX); nrf_twim_tx_buffer_set(pSelf->twim.p_twim, data1, strlen((char*)data1)); nrf_twim_shorts_set(pSelf->twim.p_twim, NRF_TWIM_SHORT_LASTTX_SUSPEND_MASK); nrf_twim_task_trigger(pSelf->twim.p_twim, NRF_TWIM_TASK_STARTTX); while (!nrf_twim_event_check(pSelf->twim.p_twim, NRF_TWIM_EVENT_SUSPENDED)); nrf_twim_event_clear(pSelf->twim.p_twim, NRF_TWIM_EVENT_TXSTARTED); nrf_twim_event_clear(pSelf->twim.p_twim, NRF_TWIM_EVENT_STOPPED); nrf_twim_event_clear(pSelf->twim.p_twim, NRF_TWIM_EVENT_SUSPENDED); nrf_twim_event_clear(pSelf->twim.p_twim, NRF_TWIM_EVENT_LASTTX); nrf_twim_tx_buffer_set(pSelf->twim.p_twim, data2, strlen((char*)data2)); nrf_twim_shorts_set(pSelf->twim.p_twim, NRF_TWIM_SHORT_LASTTX_STOP_MASK); nrf_twim_task_trigger(pSelf->twim.p_twim, NRF_TWIM_TASK_RESUME); /* I do not want to use STARTTX task but without this transfer did not start */ // nrf_twim_task_trigger(pSelf->twim.p_twim, NRF_TWIM_TASK_STARTTX); while (!nrf_twim_event_check(pSelf->twim.p_twim, NRF_TWIM_EVENT_STOPPED));
Thank you in advance!