Teensy 3.5 - Ports A & E 'not declared in scope'

Status
Not open for further replies.

mufff

New member
Hey there,
I got a Teensy 3.5 and I´m using the Arduino 1.8.8 IDE with Teensyduino, version 1.45 installed.
After reading some older posts, I decided to try out port manipulation as a simple way of detecting pressed buttons. Now this post has some helpful pin spreadsheets for the 3.5 / 3.6 attached: https://forum.pjrc.com/threads/34808-K66-Beta-Test?p=106291&viewfull=1#post106291

But first thing that I stumbled across: Referring to the spreadsheets, the led pin should be on pin C5. Mine is on pin B5. Additionally: I read the datasheets, stating that the Teensy 3.5 should have PORTA-PORTE available, but when I try to set some pins of PORTA or PORTE to input, it says that 'DDRA not declared in this scope'.

Are there any settings in the Arduino IDE I missed to configure? An update I should have/ should not have done? Thanks in advance for your help.

Code:
void Setup(){
Serial.begin(9600);
DDRA = B00000000;
}
 
Look for the schematic view on PJRC.com perhaps. The pins are ordered to match existing Arduino functionality as the chip can provide. The pins of any one port may be present in mixed order to accomplish that - and with limited room not all pins of any or all ports are there.

Looking at the schematic will give a view of the pin source that may help, and is 100% accurate for each device.
 
Last edited:
DDRA-DDRE isn't a hardware register at all on this chip! It's actually a C++ class that's trying to emulate some of the AVR registers, so ancient code for Arduino Uno can (sometimes) run properly.

The actual hardware register is named GPIOA_PDIR.

Here's the info you need.

https://forum.pjrc.com/threads/1753...-GPIO_PDIR-_PDOR?p=21228&viewfull=1#post21228

Also check the reference manuals.

https://www.pjrc.com/teensy/datasheets.html

Something to keep in mind is there are 2 separate chapters, the "PORT" chapter for configuring the pins, and "GPIO" for when you've configured a pin to be controlled by GPIO. If you're used to AVR, where the pins are always controlled by the registers unless a peripheral takes over, you'll need to adjust your thinking slightly. In all these new chips, you configure a register that explicitly controls which peripheral accesses the pin. GPIO is treated as just another type of peripheral.

Of course, you don't need to worry about this stuff if you use the easy functions. The digitalWriteFast() function always compiles to the minimum code if the inputs are constants.
 
Thanks a lot guys! The thread Paul posted made things clear for me. Now onto work with my keytar :p
 
Status
Not open for further replies.
Back
Top