Does unblocked saadc sample the buffer size and stop or does it start re-sampling after the callback? In other words, if the buffer is 100 entries in length, will it issue a callback every 100 samples, continuously. The documentation isn't clear.
Does unblocked saadc sample the buffer size and stop or does it start re-sampling after the callback? In other words, if the buffer is 100 entries in length, will it issue a callback every 100 samples, continuously. The documentation isn't clear.
This is where your documentation is confusing, or doesn't give a simple explanation of what the individual functions do! Here are my questions:
1) Are you saying that nrfx_saadc_sample() simply sits and 'spins' until the number of samples are acquired?
2) Are you saying that nrfx_saadc_buffer_convert() enables the DMA to transfer the data?
3) DOZENS of other micros I have used has a simple method to have the ADC connected directly to the DMA and just sample, convert and transfer without multiple steps. Is this process possible with Nordic?
This is where your documentation is confusing, or doesn't give a simple explanation of what the individual functions do! Here are my questions:
1) Are you saying that nrfx_saadc_sample() simply sits and 'spins' until the number of samples are acquired?
2) Are you saying that nrfx_saadc_buffer_convert() enables the DMA to transfer the data?
3) DOZENS of other micros I have used has a simple method to have the ADC connected directly to the DMA and just sample, convert and transfer without multiple steps. Is this process possible with Nordic?
SentinelLighting said:This is where your documentation is confusing, or doesn't give a simple explanation of what the individual functions do!
Please tell me exactly which section or sentences from the documentation that you find confusing, so I may attempt to clear things up.
SentinelLighting said:1) Are you saying that nrfx_saadc_sample() simply sits and 'spins' until the number of samples are acquired?
No, this is not what I am saying.
I think a lot of your confusion would vanish if you took a look at the nrfx_saadc source code instead of making assumptions or guesses at what is happening behind the scenes. As mentioned the nrfx_saadc_sample triggers the TASKS_SAMPLE task, which initiates a sampling. It is not a blocking function, such as nrfx_saadc_convert_sample.
If you want multiple samples you will need to trigger the sample task multiple times, as mentioned in the continuous mode section of the SAADC documentation.
SentinelLighting said:2) Are you saying that nrfx_saadc_buffer_convert() enables the DMA to transfer the data?
This is part of what it does, yes. In essence it is used to provide the SAADC with buffers and make it ready to begin sampling.
An exempt from the nrfx_saadc_buffer_convert API Reference reads:
The SAADC will be ready for sampling and wait for the SAMPLE task. It can be triggered manually by the nrfx_saadc_sample function or by PPI using the NRF_SAADC_TASK_SAMPLE task.
SentinelLighting said:3) DOZENS of other micros I have used has a simple method to have the ADC connected directly to the DMA and just sample, convert and transfer without multiple steps. Is this process possible with Nordic?
I do not know what other micros you are referring to here, but there is indeed a simple way - configuring the SAADC and calling nrfx_saadc_sample or nrfx_saadc_sample_convert every time you would like a sample to be taken. Alternatively, you could also use the nrfx_saadc_sample_convert function if you would like the call to be blocking (waiting for the sampling to complete before moving on with the program). This is, as I have previously advised, not a good way of generating periodic samples because it requires CPU involvement for every sample and it is therefore vulnerable to interruption by higher priority tasks such as the SoftDevice.
The recommended way to produce a series of periodic samples is therefore to connect an event to the TASKS_SAMPLE through PPI, like demonstrated in the SAADC example mentioned earlier. I again urge you to take a look at this example if you have not already.
Best regards,
Karl