Using register A for digital I/O on Teensy++

Status
Not open for further replies.

rcade

New member
Hi all - new to the forum.

I'm trying to use register A for digital I/O on a Teensy++. I believe this is a Teensy++ 2.0 (the AVR is clearly an Atmel AT90US1286).

I'm setting direction register with:

DDRA = 0b00000111;

I'm trying to use A0-2 as digital outputs (A3-7 will be unused, so I'll maintain them as inputs with internal pull-up enabled). However, if I try to command the output using PORTA, the pins don't behave as expected. Sometimes they seem to go from ground to ~2.6V instead of ground to 5V, and sometimes they go from ~2.6V to 5V.

I don't have any issues with any other registers (B-E). I understand that register A can be used for analog I/O, but I don't know what to do to disable this, and make it function like any digital I/O register.

I've seen some things about connecting AVCC to VCC and AGND to GND. From what I see in schematics for the Teensy++ 2.0 and AT90USB1286, it looks like AVCC is already connected to VCC and AGND isn't available, so I don't know where to start with that. I also don't know if there's something I should be doing in code to specifically configure register A for digital I/O.

Any help is appreciated.

Thanks,
-Rob
 
I ran this here on a Teensy++ 2.0.

Code:
void setup() {
  DDRA =  0b00000111;
  PORTA = 0b00000001;
}

void loop() {

}

Measuring with my multimeter, I see 4.96 volts on PA0, and 0.008V on PA1 and PA2. Those voltages are solid - no change if I tough the multimeter lead with my finder. The other 5 pins have between 0 to 1V and the reading changes all over the place when I touch the lead.
 
I tried your code and it didn't work for me. Completely removed the Teensy from my circuit and tried it again, and it did work. Double checked my circuit and found a bad solder connection that had shorted A0 and A1 together, causing them to both read ~2.6V if one was set high and the other low.

Sorry for the waste of time. I thought I had ruled out an issue with the circuit but I missed this somehow before posting. It took me some work to totally isolate the Teensy from the circuit, as the USB connection had been coming in through an FSUSB42 switching IC.
 
Status
Not open for further replies.
Back
Top