I was rerunning a test program i have for digitalWriteFast tonight. The basic idea is to test that all of the commands work correctly by connecting arduino pins with resistors and checking to be sure they can read and write to each other.
Back when I first wrote it I found that the resistor i chose elsewhere didn't work for pin 13, googled that and found a place where RetroLefty had discussed that. It relates to the LED and resistor built into the board for pin 13.
Tonight I was using 10K ohm resistors almost everywhere else. I kept getting errors on the Mega 1280 on some of the commands on pin 20 and 21 until I reduced the resistor there to 330 ohms. Those pins are D0 and D1, SCA, SCL. Here's the code from the test
pinModeFast(20,INPUT);
digitalWriteFast(20,HIGH);
pinModeFast(21,OUTPUT);
digitalWriteFast(21,LOW);
delay(1);
if((int) digitalReadFast(20) != LOW) error(20,21,1); //failed w 10K ohm
pinModeFast2(20,INPUT);
digitalWriteFast2(20,HIGH);
pinModeFast2(21,OUTPUT);
digitalWriteFast2(21,LOW);
delay(1);
if((int) digitalReadFast2(20) != LOW) error(20,21,12); //failed w 10K ohm
pinModeFast(21,INPUT);
digitalWriteFast(21,HIGH);
pinModeFast(20,OUTPUT);
digitalWriteFast(20,LOW);
delay(1);
if((int) digitalReadFast(21) != LOW) error(21,20,2); //failed w 10K ohm
pinModeFast2(21,INPUT);
digitalWriteFast2(21,HIGH);
pinModeFast2(20,OUTPUT);
digitalWriteFast2(20,LOW);
delay(1);
if((int) digitalReadFast2(21) != LOW) error(21,20,21); //failed w 10K ohm
pinModeFast(21,INPUT);
digitalWriteFast(21,LOW);
pinModeFast(20,OUTPUT);
digitalWriteFast(20,HIGH);
delay(1);
if((int) digitalReadFast(21) != HIGH) error(21,20,3); //suceeded
pinModeFast2(21,INPUT);
digitalWriteFast2(21,LOW);
pinModeFast2(20,OUTPUT);
digitalWriteFast2(20,HIGH);
delay(1);
if((int) digitalReadFast2(21) != HIGH) error(21,20,3); //suceeded
pinModeFast(20,INPUT);
digitalWriteFast(20,LOW);
pinModeFast(21,OUTPUT);
digitalWriteFast(21,HIGH);
delay(1);
if((int) digitalReadFast(20) != HIGH) error(20,21,4); //suceeded
pinModeFast2(20,INPUT);
digitalWriteFast2(20,LOW);
pinModeFast2(21,OUTPUT);
digitalWriteFast2(21,HIGH);
delay(1);
if((int) digitalReadFast2(20) != HIGH) error(20,21,4); //suceeded
I imagine I happened to pick a small resistor the last time I did this on these pins. What would be special about pins 20 and 21??