Dear all,
In scaling my little Arduino projects up to use more and more pins with the Arduino Due, I'm finding that some of them are not operating as I thought they would, which is good because it means I'm about to learn something new.
My current understanding of CMOS logic operating between 0 and 3.3 V of the Due (as opposed to TTL 0 to 5 V with other Arduino species) is that any pin with a voltage between 2.4 V and 3.3 V is HIGH and anything with a pin voltage between 0 and 0.8 V is LOW relative to the board's ground (GND) pin.
When I declare some pins to be OUTPUTS and then use digitalWrite to pull them HIGH, the voltage between these pins and GND is sometimes far below the minimum 2.4 V as measured by my multimeter. There is nothing else to the code: no other functions declared or activities being performed. Neither is there anything attached to the pins other than a Dupont-style connector to measure the voltage.
My simple experiment then. For the bank of pins between 22 and 48, I find the following experimentally determined voltage relationships apply when all these pins are all declared as OUTPUTS and all of them are pulled HIGH (V_high) at the same time, or one-by-one:
Pins 22-36: V_high = 3.2 V
Pins 37-41: V_high = 3. 1 V
Pins 42-45: V_high = ~2.7 V
Pins 46-49: V_high = ~0.5 V
Pin 50: V_high = ~0.4 V
Pin 51: V_high = 3.3 V
Pin 52: V_high = 2.78 V
Pin 53: V_high = 3.25 V
So something seems to be odd between pins 46 and 50. On the other hand, when I repeat this experiment but pull all the pins LOW, all of the values are correct with no similar discrepancy. I did not see anything significant about these pins when looking at the board schematic online, but perhaps I do not know what I am looking for.
My idiot's test code is as follows:
#define Pin_Up22 22
#define Pin_Up23 23
#define Pin_Up24 24
#define Pin_Up25 25
#define Pin_Up26 26
#define Pin_Up27 27
#define Pin_Up28 28
#define Pin_Up29 29
#define Pin_Up30 30
#define Pin_Up31 31
#define Pin_Up32 32
#define Pin_Up33 33
#define Pin_Up34 34
#define Pin_Up35 35
#define Pin_Up36 36
#define Pin_Up37 37
#define Pin_Up38 38
#define Pin_Up39 39
#define Pin_Up40 40
#define Pin_Up41 41
#define Pin_Up42 42
#define Pin_Up43 43
#define Pin_Up44 44
#define Pin_Up45 45
#define Pin_Up46 46
#define Pin_Up47 47
#define Pin_Up48 48
#define Pin_Up49 49
#define Pin_Up50 50
#define Pin_Up51 51
#define Pin_Up52 52
#define Pin_Up53 53
void setup() {
Serial.begin(9600);
pinMode(Pin_Up22, OUTPUT);
pinMode(Pin_Up23, OUTPUT);
pinMode(Pin_Up24, OUTPUT);
pinMode(Pin_Up25, OUTPUT);
pinMode(Pin_Up26, OUTPUT);
pinMode(Pin_Up27, OUTPUT);
pinMode(Pin_Up28, OUTPUT);
pinMode(Pin_Up29, OUTPUT);
pinMode(Pin_Up30, OUTPUT);
pinMode(Pin_Up31, OUTPUT);
pinMode(Pin_Up32, OUTPUT);
pinMode(Pin_Up33, OUTPUT);
pinMode(Pin_Up34, OUTPUT);
pinMode(Pin_Up35, OUTPUT);
pinMode(Pin_Up36, OUTPUT);
pinMode(Pin_Up37, OUTPUT);
pinMode(Pin_Up38, OUTPUT);
pinMode(Pin_Up39, OUTPUT);
pinMode(Pin_Up40, OUTPUT);
pinMode(Pin_Up41, OUTPUT);
pinMode(Pin_Up42, OUTPUT);
pinMode(Pin_Up43, OUTPUT);
pinMode(Pin_Up44, OUTPUT);
pinMode(Pin_Up45, OUTPUT);
pinMode(Pin_Up46, OUTPUT);
pinMode(Pin_Up47, OUTPUT);
pinMode(Pin_Up48, OUTPUT);
pinMode(Pin_Up49, OUTPUT);
pinMode(Pin_Up50, OUTPUT);
pinMode(Pin_Up51, OUTPUT);
pinMode(Pin_Up52, OUTPUT);
pinMode(Pin_Up53, OUTPUT);
}
void loop() {
digitalWrite(Pin_Up22, HIGH);
digitalWrite(Pin_Up23, HIGH);
digitalWrite(Pin_Up24, HIGH);
digitalWrite(Pin_Up25, HIGH);
digitalWrite(Pin_Up26, HIGH);
digitalWrite(Pin_Up27, HIGH);
digitalWrite(Pin_Up28, HIGH);
digitalWrite(Pin_Up29, HIGH);
digitalWrite(Pin_Up30, HIGH);
digitalWrite(Pin_Up31, HIGH);
digitalWrite(Pin_Up32, HIGH);
digitalWrite(Pin_Up33, HIGH);
digitalWrite(Pin_Up34, HIGH);
digitalWrite(Pin_Up35, HIGH);
digitalWrite(Pin_Up36, HIGH);
digitalWrite(Pin_Up37, HIGH);
digitalWrite(Pin_Up38, HIGH);
digitalWrite(Pin_Up39, HIGH);
digitalWrite(Pin_Up40, HIGH);
digitalWrite(Pin_Up41, HIGH);
digitalWrite(Pin_Up42, HIGH);
digitalWrite(Pin_Up43, HIGH);
digitalWrite(Pin_Up44, HIGH);
digitalWrite(Pin_Up45, HIGH);
digitalWrite(Pin_Up46, HIGH);
digitalWrite(Pin_Up47, HIGH);
digitalWrite(Pin_Up48, HIGH);
digitalWrite(Pin_Up49, HIGH);
digitalWrite(Pin_Up50, HIGH);
digitalWrite(Pin_Up51, HIGH);
digitalWrite(Pin_Up52, HIGH);
digitalWrite(Pin_Up53, HIGH);
Serial.println(digitalRead(Pin_Up46));
}
Here the plot becomes even stranger. When I use Serial.println(digitalRead(Pin_X) where X corresponds to pins between 46 and 50 to read off the status of the pin, the value is returned as 1, not zero, which indicates that even though these logic voltages should be considered low as read by my multimeter, the Arduino is reading them as high.
My multimeter is a Fluke 289, which should be within calibrated specs.
Any suggestions for a newbie?
Cheers