SPIM task START synchronization

Hi,

I have a question about SPIM. Is it possible to have two events via DPPI that will start different SPIM transfers for the same SPIM channel?

What would happen if a task start happened for one transfer before the other one finished the transfer?

Is there any example that shows some synchronization between those two transfers?

My idea is to have GPIOTE pin that will trigger a SPIM reading of ADC and the other is TIMER to do a SPIM transfer to set ADC in standby mode all connected via DPPI, is it possible to do that, i.e. will the task start to start the transfer when the previous one is finished or will there be some error ?

Parents
  • If the idea is to have two prepared transfers (i.e. prepared outgoing data) and be able to, through DPPI, trigger any one of these, then this is not possible. The SPIM peripheral only has a single START task, which will start the transfer with the data prepared according to the set data pointer.

    However, if you know that you will send the two transfers in sequence, then you can use "EasyDMA list type", which means that the SPIM peripheral will send different data the second time the START task is triggered. You could for example have it so that the GPIOTE event triggers the first SPIM transfer, and at the same time start a TIMER. When the TIMER triggers some time later, the second SPIM transfer will finish. Just make sure you don't exceed the size of the array by triggering too many START tasks. You should set up an interrupt to handle the received data anyway I guess, so you probably need to wake up the CPU anyway.

    You can use the SUBSCRIBE_CHG[n].DIS feature of DPPI to make the triggers "one-shot". Then re-set everything from the CPU side when you have finished processing the data from the SPI slave.

Reply
  • If the idea is to have two prepared transfers (i.e. prepared outgoing data) and be able to, through DPPI, trigger any one of these, then this is not possible. The SPIM peripheral only has a single START task, which will start the transfer with the data prepared according to the set data pointer.

    However, if you know that you will send the two transfers in sequence, then you can use "EasyDMA list type", which means that the SPIM peripheral will send different data the second time the START task is triggered. You could for example have it so that the GPIOTE event triggers the first SPIM transfer, and at the same time start a TIMER. When the TIMER triggers some time later, the second SPIM transfer will finish. Just make sure you don't exceed the size of the array by triggering too many START tasks. You should set up an interrupt to handle the received data anyway I guess, so you probably need to wake up the CPU anyway.

    You can use the SUBSCRIBE_CHG[n].DIS feature of DPPI to make the triggers "one-shot". Then re-set everything from the CPU side when you have finished processing the data from the SPI slave.

Children
No Data
Related