Can't get ADC MUX to work


I’m having trouble initializing a MUX on an ADC channel. I’m using a 4051 with 8 pots, output connected to ADC10 on the Seed, and mux select pins 0, 1 and 2 connected to daisy pins 14, 13 and 12 respectively.

I’m trying to initialize 8 single ADC channels and 1 MUX channel with the following:

AdcChannelConfig adc[9];

//CV inputs

//Pots on mux

hw.adc.Init(adc, 9);

And I’m attempting to get floats from the MUX inputs using the following (for the first MUX channel):

PotValue = hw.adc.GetMuxFloat(8,0);

This however results in none of the ADC channels working at all. When the .InitMux line is commented out the rest work fine. Any idea what I’m doing wrong? I’m totally stumped.

Thanks in advance!

Have you looked at diaisy_field.cpp ?

When you say “This however results in none of the ADC channels working at all.” - what are they doing-what results are you getting?

Static seemingly random values between 0 and 1:

Screen Shot 2021-02-13 at 7.08.52 PM

Yeah I tried to set it up pretty much the same as in daisy_field.cpp - only difference is I have 9 ADC channels in total on the same AdcChannelConfig (the last one the MUX of 8 pots) whereas the field has 5.

OK so I’ve got it working when the total number of ADC channels is 8 or less. So 7 normal ADC channels and 1 MUX. It’s funny because DSY_ADC_MAX_CHANNELS is defined as 14 in adc.cpp.