ADC return always 32768

I have receive my new board with 32 potentiometers/16 Push buttons/16 Leds and a nextion screen and a Daisy seed of course.
I have test the ADC on my board, but the ADC always return 32768. The analog values are correct on the 4 analog pins ADC0/ADC1/ADC2/ADC3.
So i have try whith a breadboard and a potentiometer…same thing.
I have also try with directl a short cut between the ground and the ADC0 pin…same result :frowning:

I really do not understand, maybe something around the DMA for the ADC or a bad building for the daisylib…

I use Visual studio code.

The code is

Blockquote

#include “daisy_seed.h”

using namespace daisy;

DaisySeed hardware;

int main(void)
{
hardware.Configure();
hardware.Init();
hardware.StartLog();

Led led1;
led1.Init(hardware.GetPin(28), false);

AdcChannelConfig adcConfig;
adcConfig.InitSingle(seed::A0);
hardware.adc.Init(&adcConfig, 1);
hardware.adc.Start();
for(;;)
{
    uint16_t val=hardware.adc.Get(0);
    hardware.PrintLine("Val %d\r\n",val);
    System::Delay(500);
}

}

Blockquote

Hi Gilles!

Is this a custom board that you have made? And it sounds like you are using a multiplexer since you have 32 potentiometers.

I would like to know more about which ADC pins are only returning 32768 (interesting that it’s half of the max value of 65536/3.3volt). It sounds like ADC 0 through 3 are working as expected? But in your code it’s using ADC 0 only.

Let’s test this with just the Daisy Seed on a breadboard with a potentiomter connected to ADC0. Your current code looks fine for this testing (by the way, this page is a good reference: libDaisy: Getting Started - ADCs).

With that setup, could you test the ADC read again?
And please do make sure that you have the AGND and DGND connected together on your breadboard.

Thank a lot Takumi for your helpfull and quick support.
In fact i have already done the first part…breadboard + pot or only breadboard…
But the answer was at the end…
And please do make sure that you have the AGND and DGND connected together
So i have connected the 2 gnd on my board and now it ok :slight_smile:

Thx again

1 Like

Glad to hear that it works now!!