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
  • Hello,

    ''Is it possible to have two events via DPPI that will start different SPIM transfers for the same SPIM channel?''

    This is possible. DPPI supports one to one and many to many and many to one connection. Many to one connection means multiple events can be published to the same channel, or different tasks can subscribe to different channels (https://docs.nordicsemi.com/bundle/ps_nrf5340/page/dppi.html#ariaid-title1 )

    ''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''

    In this case you would set up two different channels for two different events. For example, one channel can be triggered by GPIOTE event and another can be triggered by timer event- each subscribing to the SPIM START task.

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

    According to SPIM driver documentation, if the driver is in a busy state (transfer ongoing), a new transfer request will return -EBUSY

    https://docs.nordicsemi.com/bundle/ps_nrf5340/page/dppi.html#ariaid-title1 

    However, I have not found an ready sample for your idea. There is no built-in hardware protection when a second task arrives in the mid of ongoing one. You should design your system so that the timer event only fired when GPIOTE-triggered transfer is completed.

    Thanks.

    BR

    Kazi

Reply
  • Hello,

    ''Is it possible to have two events via DPPI that will start different SPIM transfers for the same SPIM channel?''

    This is possible. DPPI supports one to one and many to many and many to one connection. Many to one connection means multiple events can be published to the same channel, or different tasks can subscribe to different channels (https://docs.nordicsemi.com/bundle/ps_nrf5340/page/dppi.html#ariaid-title1 )

    ''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''

    In this case you would set up two different channels for two different events. For example, one channel can be triggered by GPIOTE event and another can be triggered by timer event- each subscribing to the SPIM START task.

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

    According to SPIM driver documentation, if the driver is in a busy state (transfer ongoing), a new transfer request will return -EBUSY

    https://docs.nordicsemi.com/bundle/ps_nrf5340/page/dppi.html#ariaid-title1 

    However, I have not found an ready sample for your idea. There is no built-in hardware protection when a second task arrives in the mid of ongoing one. You should design your system so that the timer event only fired when GPIOTE-triggered transfer is completed.

    Thanks.

    BR

    Kazi

Children
No Data
Related