Seed ADC not reading correctly?

I have a 4051 multiplexer muxing 8 pots into ADC1 Ch0 pin 22 ( GPIO 15) on the Seed.
ChipEn and Select lines of the 4051 being driven from pin 1 to pin 4 of the Seed.header
All timing signals etc are perfectly ok.
Seed digital and analog vcc are 3.3v.
My 4051 is at digital 3.3v
Pots are wired to digital 3.3v
On the output of the 4051 the lowest voltage is 0.3v highest is 3.2v for min to max pot rotation

My mux circuit works perfectly well, it’s worked with both STM32F4 and ESP32 processors.
On the F4 and ESP I use 10bit resolution and read 20 to 4070 decimal for pot rotations min to max.


On the Seed using 16bit resolution I get 51856 to 63567 decimal for pot rotations min to max.

If I set the ADC to 10bit resolution (recompile libdaisy) I get 75 to 939 decimal for pot rotations min to max.

As you can see these values are not what I’d expect.
I’d expect 16 bit to be 200 to 65000 at least:
10bit 30 to 4050. allowing for dither/noise etc etc.

To read the ADC I use hardware.adc.Get(0)

Can someone please tell me what I’m doing wrong.
As I mentioned the mux works perfectly on F4 and ESP, my code is ok.
I’ve experimented with delays on the select lines changing logical states for stability etc.

Think this might be the answer ?

In the Knob ( that’s me :slight_smile: ) example ADC is read using
hardware.adc.GetFloat(0);
And I read 0.0 to 0.99999 min the max pot rotation.

In ADC init sets DSY_ADC_MAX_RESOLUTION
And divides by DSY_ADC_MAX_RESOLUTION in GetFloat

So I can get min to max and then I can multiply by a factor to get 0 to 65000

But this doesn’t explain why using Get doesn’t read “true” decimal unsigned int 0 to 65000

I also need to Xreference my STM32F4 CubeIDE ADC setup against the Daisy lib ADC setup

But in the Knob example the pot is directly wired to the ADC, it’s not wired via a 4051 ?
hmm ???

I have fixed it
Even though my small logic analyser was showing correct timing signals etc.
I’ve had to add a couple of short delay slugs in-between chip enable and mux output S0,S1, S3 select lines logical switching.
My hardware has 3 4051’s ( muxing 24 inputs if required ) I also had to make sure that the chip Enables to the other 4051s were timed correctly as well.
I’m now getting in 16bit mode a min reading of 2000, max of 57000 decimal uint