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

SAADC Example - NRFX_SAADC_EVT_DONE & NRF_SAADC_INT_DONE

Hi Nordic

I am working on the SAADC example and I have noticed that when the buffer is filled the NRFX_SAADC_EVT_DONE event is generated. My question is on NRF_SAADC_INT_DONE interrupt. I've read that interrupts on EVENTS_DONE event.

Also, I know that there is the function nrf_saadc_int_enable() for enabling specified SAADC interrupts and you can pass the NRF_SAADC_INT_DONE as parameter...

So, after the buffer is filled, an event DONE (NRFX_SAADC_EVT_DONE) is generated, right? The DONE event calls the nrf_saadc_int_enable() function passing as parameter the NRF_SAADC_INT_DONE? Is this correct?

In case I'm wrong, when should I use the nrf_saadc_int_enable(NRF_SAADC_INT_DONE) for enabling the interrupt?

Thanks in advance

Nick

  • Hello again, Nick! 

    I am working on the SAADC example and I have noticed that when the buffer is filled the NRFX_SAADC_EVT_DONE event is generated.

    You are correct, the NRFX_SAADC_EVT_DONE is generated when the provided buffer is filled.

    My question is on NRF_SAADC_INT_DONE interrupt. I've read that interrupts on EVENTS_DONE event.

    I am not sure I understand what you are asking about here, what have you read about interrupts on the DONE event?

    So, after the buffer is filled, an event DONE (NRFX_SAADC_EVT_DONE) is generated, right?

    Correct.

    The DONE event calls the nrf_saadc_int_enable() function passing as parameter the NRF_SAADC_INT_DONE? Is this correct?

    This is not correct.
    The nrf_saadc_int_enable() function is a HAL function, which is used by the nrfx_saadc driver. The nrfx_saadc driver itself does not make use of the DONE interrupt.
    You can verify this by looking into the IRQ handler in the nrfx_saadc,c source code.

    In case I'm wrong, when should I use the nrf_saadc_int_enable(NRF_SAADC_INT_DONE) for enabling the interrupt?

    Could you elaborate on what you intend to use the DONE interrupt for?
    I do not recommend using HAL functions directly in combination with the nrfx drivers - since that may place the driver in an invalid state.
    When using the nrfx_saadc driver, I recommend making use of the events generated by the driver. You do not need to enable anything specifically for the driver to generate the DONE event, as long as the driver is configured and initialized correctly.

    Please let me know if this did not answer your questions, or if you have any other questions! :)

    Best regards,
    Karl

Related