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

nrf52 with Mynewt multi channel ADC configuration

Hi all,

We are using nrf52 DK (both pca10040 and 10056) to develop a multi-channel ADC sampling module running Mynewt.

The example ADC code with Mynewt is a single-channel one and it works. We need to add more channels to include more analog inputs.

We met difficulties in adding more channels and the Mynewt team did not provide helpful suggestions in this regard.

With the following modified code, we can have the first channel (no matter which PIN/AINx it is assigned) return a correct value, however, the second channel (again no matter which PIN/AINx it is assigned) always returns a value of 0. We are not sure if this is 1) a problem with the Channel Configuration or 2) the method that we retrieve the sampled value is not correct. 

Would you please help look into that? Your time and help are highly appreciated! Thanks,

Code:

Parents
  • I solved the problem. It was caused by code error in the value readout function:

    below is the correct one which works now.

Reply
  • I solved the problem. It was caused by code error in the value readout function:

    below is the correct one which works now.

Children
No Data