How to resolve conflict between Audio and ADC libraries on ADC_0

Status
Not open for further replies.
Use ADC_1 on pins A10 and A11

I resolved a few of the issues I had but still have one question. I need a differential input and currently use pins A10 and A11 for this because these pins are easy to access and I already have a circuit board designed to access these pins. I tried to access these pins with ADC_1 and it didn’t work even though it works fine with ADC_0. My understanding from the diagrams posted by Pedvide is that these pins should be accessible to ADC_1. Is this incorrect?

Code:
const int readPin1 = A10;      
const int readPin1diff = A11; 

pinMode(readPin1, INPUT);
pinMode(readPin1diff, INPUT);

//  // ADC_0 setup
adc->setAveraging(16, ADC_0); // number of averages, 32 starts to cause problems at 1 kHz
adc->setResolution(16, ADC_0); // bits of resolution 16, effective resolutions is supposed to be approximately 13 bits
adc->setConversionSpeed(ADC_CONVERSION_SPEED::VERY_LOW_SPEED , ADC_0);  // change the conversion speed
adc->setSamplingSpeed(ADC_SAMPLING_SPEED::VERY_LOW_SPEED , ADC_0);      // change the sampling speed
adc->enablePGA(1, ADC_0); // only works in differential mode
adc->setReference(ADC_REFERENCE::REF_3V3, ADC_0);

// ADC_1 setup
adc->setAveraging(32, ADC_1); // set number of averages
adc->setResolution(16, ADC_1); // set bits of resolution
adc->setConversionSpeed(ADC_CONVERSION_SPEED::VERY_LOW_SPEED , ADC_1);  // change the conversion speed
adc->setSamplingSpeed(ADC_SAMPLING_SPEED::VERY_LOW_SPEED , ADC_1);      // change the sampling speed
adc->enablePGA(1, ADC_1); // only works in differential mode
adc->setReference(ADC_REFERENCE::REF_3V3, ADC_1);


buf0[sampleCount] = adc->analogReadDifferential(readPin1, readPin1diff, ADC_0); //this works
buf1[sampleCount] = adc->analogReadDifferential(readPin1, readPin1diff, ADC_1); // this doesn't work
 
Last edited:
Status
Not open for further replies.
Back
Top