Can't get ADC MUX to work

Hi,

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:

//ADC
AdcChannelConfig adc[9];

//CV inputs
adc[0].InitSingle(hw.GetPin(15));
adc[1].InitSingle(hw.GetPin(16));
adc[2].InitSingle(hw.GetPin(17));
adc[3].InitSingle(hw.GetPin(18));
adc[4].InitSingle(hw.GetPin(19));
adc[5].InitSingle(hw.GetPin(20));
adc[6].InitSingle(hw.GetPin(21));
adc[7].InitSingle(hw.GetPin(22));

//Pots on mux
adc[8].InitMux(hw.GetPin(25),8,hw.GetPin(14),hw.GetPin(13),hw.GetPin(12));

hw.adc.Init(adc, 9);
hw.adc.Start();

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.