Hey guys!
I’m currently trying to run the following:
8 default CV_IN
pins (C2,3,4,5,6,7,8,9);
2 Multiplexers (CD4051) on pins A2, A3;
2 pots on pins D8, D9 (just as voltage dividers from 3.3v).
Separately they work as intended. But when I try to initialize them together, either some pins or default CV_IN
s do not work.
Could you please explain how to properly initialize them? Am I doing something wrong?
Here’s relevant parts of my code:
int main(void)
{
patch.Init();
patch.adc.Stop();
AdcChannelConfig adc_cfg[12];
adc_cfg[0].InitMux(patch.GetPin(DaisyPatchSM::PinBank::A, 3), 8,
patch.GetPin(DaisyPatchSM::PinBank::D, 4),
patch.GetPin(DaisyPatchSM::PinBank::D, 5),
patch.GetPin(DaisyPatchSM::PinBank::D, 6));
adc_cfg[1].InitMux(patch.GetPin(DaisyPatchSM::PinBank::A, 2), 8,
patch.GetPin(DaisyPatchSM::PinBank::D, 1),
patch.GetPin(DaisyPatchSM::PinBank::D, 2),
patch.GetPin(DaisyPatchSM::PinBank::D, 3));
for(int i = 0; i < 10; i++)
{
adc_cfg[i+2].InitSingle(adc_pins[i]);
}
patch.adc.Init(adc_cfg, 12);
patch.adc.Start();
...
}
adc_pins
are copypasted from DaisyPatchSM
class.
constexpr Pin PIN_ADC_CTRL_1 = DaisyPatchSM::C5;
constexpr Pin PIN_ADC_CTRL_2 = DaisyPatchSM::C4;
constexpr Pin PIN_ADC_CTRL_3 = DaisyPatchSM::C3;
constexpr Pin PIN_ADC_CTRL_4 = DaisyPatchSM::C2;
constexpr Pin PIN_ADC_CTRL_5 = DaisyPatchSM::C6;
constexpr Pin PIN_ADC_CTRL_6 = DaisyPatchSM::C7;
constexpr Pin PIN_ADC_CTRL_7 = DaisyPatchSM::C8;
constexpr Pin PIN_ADC_CTRL_8 = DaisyPatchSM::C9;
constexpr Pin PIN_ADC_CTRL_11 = DaisyPatchSM::D9;
constexpr Pin PIN_ADC_CTRL_12 = DaisyPatchSM::D8;
constexpr Pin adc_pins[] = {
PIN_ADC_CTRL_1,
PIN_ADC_CTRL_2,
PIN_ADC_CTRL_3,
PIN_ADC_CTRL_4,
PIN_ADC_CTRL_8,
PIN_ADC_CTRL_7,
PIN_ADC_CTRL_5,
PIN_ADC_CTRL_6, // skipped A2/A3 pins that are used for multiplexers
PIN_ADC_CTRL_11,
PIN_ADC_CTRL_12,
};
When I drop PIN_ADC_CTRL_11
, PIN_ADC_CTRL_12
from initialization, both multiplexers and CV_IN
s work. When I add them back, CV_IN
s do not work (from logs, reads as ~5v) and pins D8
, D9
work.
I would be glad to any suggestions I could try. Really don’t want to drop D8
/D9
pins since I already designed/soldered some stuff for them