SDK13, nRf52.
I want measure at one time batt level and data from AIN0.
How to configure ADC for this measure? I mean void saadc_init(void);
SDK13, nRf52.
I want measure at one time batt level and data from AIN0.
How to configure ADC for this measure? I mean void saadc_init(void);
Hi,
Please have a look at this answer. I also attached a similar example for SDK 13.0.0:
[EDIT]:
It is possible to sample channels at different sample interval, but this is not supported by the driver. In general, each scan mode will be enabled with multiple channels enabled, and each channel will be sampled. You are therefore required to disable the "slow" channel between its sample interval.
Attached you can find an example of how to sample two channels without using scan mode. The example will sample the battery channel every 5000ms, while the signal channel is set to sample every 5ms.
The example is only tested with PCA10040 board and Keil IDE, but it should work with other compilers without huge modifications.
Let me know if you have any questions regaring the example.
You can also find some information about sampling channels at different sample rates in this Devzone post, but this use registers directly instead of the driver, and does not contain a complete working example.
Best regards,
Jørgen
Hi! Looked. But I mean, how to use at same different time period measure from BATT and from AIN0 AIN1...
Is it possible? Or each time I should reinit ADC?
Sorry, I did not understand this from your initial question. I have updated my answer above.
You just check by nrf_drv_saadc_is_busy() for busy driver and than make /* Uninit signal channel */ is it all? At same time measure with different channel is impossible?
Yes, the driver needs to be in IDLE state to uninit/init channels. It is possible to sample both channels at the same time, but this will put the SAADC into scan mode. You will then need a buffer of size equal or greater than the number of active channels. When the "slow" channel is activated, it will be put into the buffer along with the signal. You will not have any indication on where in the buffer the sample is stored.