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

questions regarding saadc example

Hi

 

A few questions regarding the "saadc_pca10040" example:

  1. If I read one analog pin then what is the meaning of this matrix of values :

"static nrf_saadc_value_t     m_buffer_pool[2][SAMPLES_IN_BUFFER]; "

(less important but I wonder why to use typedef for uint16_t ->  nrf_saadc_value_t )

 

  1. I could not find the link between the ppi config to the adc channel in the " saadc_sampling_event_init()".

What if I would like to work with 3 adc inputs that each of their handler awake at different time periods via timer and ppi, how would this be implemented ?

 

  1. What is the meaning of the empty "timer_handler()" do we need to have it only for the "nrf_drv_timer_init(..)"

 

  1. Last for now, it’s a bit basic maybe, but I am not clear on the terminology of task and event in hardware or embedded use.. I know when working with free RTOS or any OS there are tasks, but here I am coding bare metal so what does it mean task and event, I know hardware Interrupts, which one is which ?
Parents
  • Hello,

    1. The SAADC peripheral example uses the Double buffering feature, which ensure that no samples is lost while the first buffer is processed after being filled up. The m_buffer_pool holds two arrays, so that it can switch to the next one immediately following reaching the end of a buffer.

    2. The line you are looking for is line 113 with the call to nrf_drv_ppi_channel_assign which links the timer compare event address to the saadc sample task address.
    Following this, the sample task will occur when the timer compare event happens, through PPI(without needing the CPU to initiate the sampling).

    3. Yes, as can be seen in the function documentation the argument may not be NULL.

    4. Please see the answer my colleague gave in this ticket.

    Best regards,
    Karl

Reply
  • Hello,

    1. The SAADC peripheral example uses the Double buffering feature, which ensure that no samples is lost while the first buffer is processed after being filled up. The m_buffer_pool holds two arrays, so that it can switch to the next one immediately following reaching the end of a buffer.

    2. The line you are looking for is line 113 with the call to nrf_drv_ppi_channel_assign which links the timer compare event address to the saadc sample task address.
    Following this, the sample task will occur when the timer compare event happens, through PPI(without needing the CPU to initiate the sampling).

    3. Yes, as can be seen in the function documentation the argument may not be NULL.

    4. Please see the answer my colleague gave in this ticket.

    Best regards,
    Karl

Children
No Data
Related