Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs
This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

SAADC + EasyDMA + timer

Is there an example that shows the "Nordic way" of "continuous" conversions using DMA? I think a timer and PPI are needed to generate a conversion task for each timer compare event?

Also, the SAADC END (of EasyDMA transfers for a conversion round) event is still available for interrupt?

I didn't find library support for ADC with DMA.

The idea is to let timer to trig several "rounds" of multi-channel conversions that DMA would store in a buffer. After pre-defined number of rounds a new buffer is taken into use by the N:th SAADC END interrupt, and the old buffer is used for further calculations.

Parents
  • Hello,

    Is there an example that shows the "Nordic way" of "continuous" conversions using DMA? I think a timer and PPI are needed to generate a conversion task for each timer compare event?

    Additionally, you can check out how things are done in this github repository - please not that the NordicPlayground repositories are just intended as simple demos, and are not as thoroughly tested as our SDK examples.

    I didn't find library support for ADC with DMA.

    The saadc peripheral uses easyDMA, by extension so does the nrfx_saadc and nrfx_saadc2 drivers.

    Also, the SAADC END (of EasyDMA transfers for a conversion round) event is still available for interrupt?

    No, the END event is not part of the nrfx_saadc driver - this is only available to the driver itself, or in the SAADC HAL.
    I would advice against mixing from both SAADC HAL and the nrfx driver, as this may place the driver in an invalid state.
    I would also recommend using the driver instead of implementing the functionality yourself from HAL - since a lot of this work is already done for you in the driver.

    If you want to do continuous sampling you should use the double buffering feature, and instead do your data processing once one buffer fills up - generating the DONE event.

    Please do not hesitate to ask if anything should be unclear, or if you should encounter any issues or questions!

    Best regards,
    Karl

  • Hmm, the nRF52832 data sheet says:

    "The EasyDMA will have finished accessing the RAM when the END or STOPPED event has been generated."

    and

    "EVENTS_DONE 0x108 A conversion task has been completed. Depending on the mode, multiple conversions might be
    needed for a result to be transferred to RAM."

    I guess this means that EVENTS_DONE signals that the last conversion is done, but the results are not yet read from the registers to memory?

  • Aha, the driver's interrupt routine checks the actual event, and if it's END, the interrupt routine calls the callback function with DONE-event.

Reply Children
No Data
Related