Hi all,
I'm the proud owner of a Teensy 3.5 which is having issues with ADC. My simple code to read a value:
This returns 65364 as an output, which is clearly unexpected. No pins are connected to anything and Teensy gets power from usb.
At first it seems like a fried ADC or something similar. digitalRead() works fine btw.
But then the wierdness starts: Connecting A5 to Analog GND gives me a fluctuating value. Here's an excerpt from the serial:
Then I tried connecting A5 to digital GND, ie the top left pin next to pin 0. This gives me a steady value around 30550 with small fluctuations.
I've tried the same with A8, A9 and A7 and got the same results so I believe that it is a general phenomenon.
All in all the above is quite puzzling to me so I'd like some help. I'm on Arduino 1.8.4 with teensyduino 1.41
First I'd like to know if possible: Is the ADC fried beyond recovery? Btw other chip functionality (such as PWM, i2c) seems fine at first glance.
Secondly, and if the answer to the first is no: What is going on and how can I get a reliable reading from the analog pins.
Thank you.
I'm the proud owner of a Teensy 3.5 which is having issues with ADC. My simple code to read a value:
Code:
#include <ADC.h>
ADC *adc = new ADC();
void setup() {
adc->adc0->setAveraging(16); // set number of averages
adc->adc0->setResolution(16); // set bits of resolution
}
void loop() {
int value = adc->adc0->analogRead(A5);
Serial.println(value);
delay(250);
}
This returns 65364 as an output, which is clearly unexpected. No pins are connected to anything and Teensy gets power from usb.
At first it seems like a fried ADC or something similar. digitalRead() works fine btw.
But then the wierdness starts: Connecting A5 to Analog GND gives me a fluctuating value. Here's an excerpt from the serial:
Code:
34867
34867
34867
34867
34867
39151
39151
34899
32725
30583
39215
32741
32723
37009
37057
Then I tried connecting A5 to digital GND, ie the top left pin next to pin 0. This gives me a steady value around 30550 with small fluctuations.
I've tried the same with A8, A9 and A7 and got the same results so I believe that it is a general phenomenon.
All in all the above is quite puzzling to me so I'd like some help. I'm on Arduino 1.8.4 with teensyduino 1.41
First I'd like to know if possible: Is the ADC fried beyond recovery? Btw other chip functionality (such as PWM, i2c) seems fine at first glance.
Secondly, and if the answer to the first is no: What is going on and how can I get a reliable reading from the analog pins.
Thank you.