Go Down

Topic: What pins is PORTB on the Teensy 3.0? (Read 1 time) previous topic - next topic

mixania

Hi guys, I have a Teensy 3.0 board and the reason for having it is because it has 32bit processor running at 48 MHz which is much more powerful than the one on the regular Arduino's. Not mentioning that it has more memory and other goodies. And it's compatible with the Arduino IDE.

http://www.pjrc.com/store/teensy3.html

Unfortunately the problem is that it's reference info online is limited compared to the one Arduino provides. Now I'm aiming for a project with sound synthesis which I found really cool such as this one. http://little-scale.blogspot.com/2013/05/diy-polyphonic-drum-machine-and-rhythm.html

In the example the guy uses a Teensy 2.0 and I have a Teensy 3.0 board. To Anybody that knows about this board, do you know on what pins the PORTB is on?

Thank you, sorry if this post doesn't belong to the Arduino Website. Just trying to seek for some help  :)
Arduino Uno R3
Mac OSX Lion

el_supremo

#1
Dec 06, 2013, 01:20 am Last Edit: Dec 06, 2013, 01:28 am by el_supremo Reason: 1
http://forum.pjrc.com/forum.php
would be a better place to ask.

But they are:
0, 1, 16, 17, 18, 19, 25, 32

The code from a Teensy2 will not necessarily be easy to port to a Teensy3. The T3 is not just a bigger T2. It uses a completely different type of chip, an ARM Cortex M4.

Pete

westfw

"PORTB" is an AVR chip thing.  Teensy3 uses an ARM chip, which has GPIOA_PDOR as a "somewhat similar" thing.
Any Arduino code that uses PORTB will require some significant effort to run on a Teensy3 (this is "direct port manipulation", which is "underneath" the Arduino libraries.  Any compatibility between Arduino variants with different CPUs will only be for programs that use the libraries...

mixania


The code from a Teensy2 will not necessarily be easy to port to a Teensy3. The T3 is not just a bigger T2. It uses a completely different type of chip, an ARM Cortex M4.


That's a good point, but thank you as a start! :)
Arduino Uno R3
Mac OSX Lion

mixania


"PORTB" is an AVR chip thing.  Teensy3 uses an ARM chip, which has GPIOA_PDOR as a "somewhat similar" thing.
Any Arduino code that uses PORTB will require some significant effort to run on a Teensy3 (this is "direct port manipulation", which is "underneath" the Arduino libraries.  Any compatibility between Arduino variants with different CPUs will only be for programs that use the libraries...



Thanks for this suggestion! I will certainly do some research on that one!  :)
Arduino Uno R3
Mac OSX Lion

bperrybap


"PORTB" is an AVR chip thing.  Teensy3 uses an ARM chip, which has GPIOA_PDOR as a "somewhat similar" thing.
Any Arduino code that uses PORTB will require some significant effort to run on a Teensy3 (this is "direct port manipulation", which is "underneath" the Arduino libraries.  Any compatibility between Arduino variants with different CPUs will only be for programs that use the libraries...



That said, Paul has gone to great lengths to provide some AVR port emulation.
The emulation code will emulate the PORTx/DDRx/PINx registers of the UNO.
The resulting pins controlled with be same Arduino pin # as the corresponding
Arduino pin # in the AVR port register for an Arduino UNO.

i.e.
Code: [Select]
PORTB |= 0x2;
will control Arduino pin #9.

While not a true and full emulation of the AVR registers, it may
allow some code to work unmodified.

You can see the code in avr_emulation.h down in the core directory.

--- bill


westfw

Quote
Paul has gone to great lengths to provide some AVR port emulation.
The emulation code will emulate the PORTx/DDRx/PINx registers of the UNO.

Really?  Cool; I have some Teensy3s, but I didn't realize that he had done this!
The miracles of C++, I guess; I'll have to take a look at how this was implemented.

westfw

Quote
The emulation code will emulate the PORTx

Hmm.  Does that mean that you can make PORTB be some ARBITRARY set of 8 pins?!

bperrybap

I think so. But the current code seems to hard code the pins in the code.
It also controls each pin seperately.
It has to because of the way the i/o pins have been configured
as most of them are not consecutive bits in the same i/o register.

It would be kind of cool to make a configurable class that allowed
the user the configure the Arduino pin assigned to each bit.

--- bill


mixania


Really?  Cool; I have some Teensy3s, but I didn't realize that he had done this!
The miracles of C++, I guess; I'll have to take a look at how this was implemented.



I found some awesome sources on the pjrc Forum. Check them out if you want to play with PORTs.
http://forum.pjrc.com/threads/23950-Parallel-GPIO-on-Teensy-3-0?highlight=teensy+3.0+PORTB

especially this one:
http://forum.pjrc.com/threads/17532-Tutorial-on-digital-I-O-ATMega-PIN-PORT-DDR-D-B-registers-vs-ARM-GPIO_PDIR-_PDOR
Arduino Uno R3
Mac OSX Lion

Go Up