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

Reading SPIM END event register

Hi,

Is it possible to somehow read END event register via CPU (not with ppi usage)? If yes, how? I have tried to read value on address from pointer returned from function nrf_drv_spi_end_event_get() but without succes. And how does it work? When transfer is finished the END event register has value 1 and then after reading does it get cleared? Thanks,

Pepam

Parents
  • When transfer is finished the END event register has value 1 and then after reading does it get cleared?

    Careful: The nrf_drv_spi uses an interrupt handler  - once enabled, you will never read this register 1 in your main program because the interrupt preempts it and also set this register back to zero.

    Thus you would need to disable interrupt processing first - INTENCLR register in the SPIM peripherial.

  • Hi ,

    Thanks for answer. I have a ppi channel configured to sample sensor synchronously and there is  NRF_DRV_SPI_FLAG_NO_XFER_EVT_HANDLER defined in spi init. Does it mean there is a capability to read an end event via CPU directly from END event register? In my app the end event is also connected to timer in counter mode via ppi. But in a moment when read buffer pointer gets to its end it is neccessary to recall nrf_drv_xfer() too reset pointer. This unfortunately cannot be done without CPU involvemention because of tasks corruption in my app, thus I have to for example wait for some task to finish before reseting the buffer pointer. So the idea is after tasks that must be done before buffer reset are proccessed start looking at end event register and when 1 occurs, reset buffer to prevent reseting while spim tries to write some data to it.

Reply
  • Hi ,

    Thanks for answer. I have a ppi channel configured to sample sensor synchronously and there is  NRF_DRV_SPI_FLAG_NO_XFER_EVT_HANDLER defined in spi init. Does it mean there is a capability to read an end event via CPU directly from END event register? In my app the end event is also connected to timer in counter mode via ppi. But in a moment when read buffer pointer gets to its end it is neccessary to recall nrf_drv_xfer() too reset pointer. This unfortunately cannot be done without CPU involvemention because of tasks corruption in my app, thus I have to for example wait for some task to finish before reseting the buffer pointer. So the idea is after tasks that must be done before buffer reset are proccessed start looking at end event register and when 1 occurs, reset buffer to prevent reseting while spim tries to write some data to it.

Children
No Data
Related