Multiple ADC reading - NCS

Hello everyone!

I'm trying to read 4 channels of ADC, and for future production, I'd have to read all 8.

There is two channels example, yet it isn't scalable. I'm thinking about building a dynamic setup based on the example, but it doesn't go so well due to the limits of specific macros in the given example code.

Parents
  • Hi Tamir

    It sounds a bit odd that the standard example shouldn't be scalable. The way it works is that it goes through all the channels defined in the device tree and configures each channel as required. 

    As an example the nrf52840 overlay can be seen here, where 3 different channels are defined with different settings. In order to add more channels all you have to do is update the overlay, and the sample should handle the rest (just make sure to use each index between 0-7 only once). 

    Best regards
    Torbjørn

Reply
  • Hi Tamir

    It sounds a bit odd that the standard example shouldn't be scalable. The way it works is that it goes through all the channels defined in the device tree and configures each channel as required. 

    As an example the nrf52840 overlay can be seen here, where 3 different channels are defined with different settings. In order to add more channels all you have to do is update the overlay, and the sample should handle the rest (just make sure to use each index between 0-7 only once). 

    Best regards
    Torbjørn

Children
Related