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

ADC how to use plural measure?

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);

Parents
  • Hi,

    Please have a look at this answer. I also attached a similar example for SDK 13.0.0:

    saadc_blocking_simple.zip

    [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.

    saadc_sample_two_channels.zip

    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

  • 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.

Reply Children
No Data
Related