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

When does the event NRF_DRV_ADC_EVT_SAMPLE occur

Hi there, I was trying out the ADC example which is sampling 10 times the ADC and then generating the event NRF_DRV_ADC_EVT_DONE to process the data. I extended the handler function to also react to event NRF_DRV_ADC_EVT_SAMPLE. But this does not occure.

How to change the initialisation to activate both events? Idea is: timer with 100ms which triggers the ADC driver. Get a "sample" event every 100ms and a "finished" event after 10 Samples = 1sec. Thanx, fran

Parents
  • Hi Fran,

    I'm not sure I understand the purpose of what you are trying to do. The ADC on nRF51x22 does not support any form of DMA, and it can only convert a single sample at the time. When the sample conversion is completed, a END event is generated. There is no SAMPLE event in the hardware of the peripheral, this is only an internal event used in the ADC driver. It seems that this event is only generated when no buffer is provided to nrf_drv_adc_buffer_convert, or internally in the driver when nrf_drv_adc_sample_convert is called.

    I can't see any difference in what you are trying to do, and to do sampling with a buffer size of 1. All buffering of the ADC samples are handled by the ADC driver anyway, so you will get an interrupt after each sample. Can you use an ADC buffer size of 1, with a counter, to achieve what you are trying to do? If you need all 10 samples at the end, you can just store it in a buffer yourself.

    Best regards,

    Jørgen

Reply
  • Hi Fran,

    I'm not sure I understand the purpose of what you are trying to do. The ADC on nRF51x22 does not support any form of DMA, and it can only convert a single sample at the time. When the sample conversion is completed, a END event is generated. There is no SAMPLE event in the hardware of the peripheral, this is only an internal event used in the ADC driver. It seems that this event is only generated when no buffer is provided to nrf_drv_adc_buffer_convert, or internally in the driver when nrf_drv_adc_sample_convert is called.

    I can't see any difference in what you are trying to do, and to do sampling with a buffer size of 1. All buffering of the ADC samples are handled by the ADC driver anyway, so you will get an interrupt after each sample. Can you use an ADC buffer size of 1, with a counter, to achieve what you are trying to do? If you need all 10 samples at the end, you can just store it in a buffer yourself.

    Best regards,

    Jørgen

Children
No Data
Related