Differential analog read on Teensy 3.5 pins A12/A13: "ADC1: Wrong pin" error

Status
Not open for further replies.

jfung

Member
Differential analog read on Teensy 3.5 pins A12/A13: "ADC1: Wrong pin" error

I'm trying to perform a differential analog read with the ADC library using pins A12 and A13 of a Teensy 3.5 plugged into a solderless breadboard. I'm using Teensyduino 1.53 and the latest version (from Github) of the ADC library at http://https://github.com/pedvide/ADC.

In order to test the differential read in the simplest possible way, I connected a jumper wire between A12 and A13 (so that the pins were shorted together). Aside from the USB connection to my Macbook Pro, there were no other connections made to the Teensy. I then ran the example analogRead.ino at http://https://github.com/pedvide/ADC/blob/master/examples/analogRead/analogRead.ino, but the results weren't what I expected. A sample of the serial monitor output follows:

Code:
Pin: 23, value ADC0: 0.6543099284
Pin: 16, value ADC1: 2.9335682392
 Value A10-A11: -0.2472419246
 Value A12-A13: -3.5248339555
ADC1: Wrong pin
Pin: 23, value ADC0: 0.2376241684
Pin: 16, value ADC1: 2.9584434032
 Value A10-A11: -0.4882398576
 Value A12-A13: -3.5248339555
ADC1: Wrong pin
Pin: 23, value ADC0: 0.7244037390
Pin: 16, value ADC1: 2.9433369637
 Value A10-A11: -0.1721126066
 Value A12-A13: -3.5248339555
ADC1: Wrong pin
Pin: 23, value ADC0: 0.7431860566
Pin: 16, value ADC1: 2.9444448948
 Value A10-A11: -0.2579171360
 Value A12-A13: -3.5248339555
ADC1: Wrong pin

I expected the readings from pins 23, 16, and A10-A11 to fluctuate because those pins were floating, but I expected the value for A12-A13 to be 0. Moreover, I don't understand why I got the "ADC1: Wrong pin" error.

Does anyone have suggestions of next steps I could take to figure out what's going on, or am I making an elementary mistake? This is not a new Teensy and has been used for other projects in the past; is it possible that there's a hardware problem with my board? Thanks in advance for your help.
 
There is a set of HTML documentation in that repository.

That error detail says :: WRONG_PIN A pin was selected that cannot be read by this ADC module.

There are two ADC modules on the Teensy - each ADC unit can only read a subset of the analog pins.

The error is saying that ADC1 is being requested to read a pin it cannot connect to. That pin has to be read from the alternate ADC unit, if those pins are available.
 
My bad. I had seen "A10-A11 is the only differential pair" on Pedvide's image, but the ADC library documentation for Teensy 3.5 herehttp://pedvide.github.io/ADC/docs/Teensy_3_5_html/class_a_d_c___module.html#a4a57f6a9b0e3884f3862062b33f1a447 seemed to suggest that A12/13 could be used.

I just decided to check A12/A13 using the checkDifferentialPins() method. From its output, A12/A13 are indeed not a valid differential pair on the Teensy 3.5. While it's not an insurmountable problem, the reason I had hoped I could get a differential input to work on A12/A13 is that A10/A11 are on the bottom of the board and aren't as easy to access.
 
To close the loop here, I soldered some female header pins I had on hand to A10/A11 and found that differential measurements with those two pins work as expected. Thanks to everyone for your help!
 
Status
Not open for further replies.
Back
Top