Adafruit is open and shipping! Let's build back better, together!
0

Teensy 3.0, 128x32 OLED, and Pin Mapping
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Teensy 3.0, 128x32 OLED, and Pin Mapping

by hopworks on Wed Dec 11, 2013 11:56 am

I thought I would post for clarification before I blow anything up on my bread board. :shock:

I have a teensy 3.0 and want to connect it to a Adafruit OLED 128x32 and I am stuck on pin mapping. I looked at a diagram for the teensy 3.0, and another for an Arduino Uno, and picked a connection referred to on page http://learn.adafruit.com/monochrome-oled-breakouts/wiring-128x32-spi-oled-display, specifically the text
"Finally, connect the pins to your Arduino - GND goes to ground, Vin goes to 5V, DATA to digital 9, CLK to digital 10, D/C to digital 11, RST to digital 13 and finally CS to digital 12."
RST to digital 13 - On the teensy 3.0, that is CS2. On the Uno, it is SCK. SCK is digital pin 12 on the teensy 3.0.

I have looked and looked, and looked some more and I cannot find a connection diagram for the teensy 3.0 and this neat little display. I also have failed to find a diagram showing what the teensy 3.0 pins refer to on an arduino. So if a hookup tutorial like the page mentioned above says "digital 10" I would know what that would refer to on a Teensy 3.0.

I hope someone can help. I love these little teensy boards, and have a 3.1 on the way. I figure if you can write sketches that use arduino libraries and can run on the teensy, there would be a guide to show what pins refer to as it would on an Arduino Uno or whatever.

Thank you so very much for your time!

hopworks
 
Posts: 10
Joined: Fri Jul 06, 2012 5:50 pm

Re: Teensy 3.0, 128x32 OLED, and Pin Mapping

by adafruit_support_mike on Wed Dec 11, 2013 5:36 pm

Let me pass this to Paul Stoffregen, who makes the Teensy. He's a frequent and much-loved contributor here.
When you void a product warranty, you give up your right to sue the manufacturer if something goes wrong and accept full responsibility for whatever happens next. And then you truly own the product.

adafruit_support_mike
 
Posts: 61473
Joined: Thu Feb 11, 2010 2:51 pm

Re: Teensy 3.0, 128x32 OLED, and Pin Mapping

by hopworks on Wed Dec 11, 2013 6:22 pm

I posted on PJRC also and learned a few things. I know there are people doing it, mostly with hardware SPI, but I cannot find any code at all. The main sticker for me is that the Teensy 3 is ARM and the libraries you offer are for AVR. Interrupts, pin designations, etc are all different.

I'll figure it out but didn't want to have to do it from scratch like I did with the chipKIT Max32. It's a great little OLED display and I want to use it in my Teensy 3 projects as a standard included module in every prototype I create.

Thank you sir for your time and the reply!

hopworks
 
Posts: 10
Joined: Fri Jul 06, 2012 5:50 pm

Re: Teensy 3.0, 128x32 OLED, and Pin Mapping

by paulstoffregen on Thu Dec 12, 2013 10:37 pm

Just a quick followup... Adafruit sent me one of these OLED displays today. I had the I2C one here, but not the SPI. When it arrives, I'll test and document it with Teensy 3.0 & 3.1.

This thread appears to duplicated on the PJRC forum. Here's the link:

http://forum.pjrc.com/threads/24642-Tee ... signations

paulstoffregen
 
Posts: 436
Joined: Sun Oct 11, 2009 11:23 am
Location: Portland, Oregon, USA

Re: Teensy 3.0, 128x32 OLED, and Pin Mapping

by paulstoffregen on Wed Dec 25, 2013 2:47 am

The package from Adafruit arrived yesterday, Dec 23. Postal mail is slow this time of year.

I'm connecting it now. I hope to have a good, well tested answer for you in a couple days. Odds are slim I'll get much work in until the 26th or 27th, with family and social plans for most of Christmas.

paulstoffregen
 
Posts: 436
Joined: Sun Oct 11, 2009 11:23 am
Location: Portland, Oregon, USA

Re: Teensy 3.0, 128x32 OLED, and Pin Mapping

by paulstoffregen on Wed Dec 25, 2013 3:39 am

Ok, I played with this and here's an answer. It is indeed Christmas Eve here, but I couldn't sleep....

TL;DR = Connect exactly as Adafruit's tutorial says (even it seems weird) and it works perfectly.

First, here's a photo, so you can see it does indeed work.

Image

Here's a photo of the wiring on the bottom side. I printed paper labels so it's easy to see the pins for both Teensy 3 and Adafruit's OLED breakout.

Image

As you can see, this info from Adafruit's tutorial is absolutely correct. Hopefully this photo is clear enough so you can see where each wire goes.

connect the pins to your Arduino - GND goes to ground, Vin goes to 5V, DATA to digital 9, CLK to digital 10, D/C to digital 11, RST to digital 13 and finally CS to digital 12.


Probably the confusing part is these connections do NOT correspond with the pin name on Teensy3 or Arduino Uno. For example, on both Teensy3 and Uno, pin 13 is labeled SCK. It turns out, Adafruit's library accesses the pins directly. It does not actually use the SPI port. You should simply disregard the pin names (green background) printed on the Teensy 3.0 pinout card and use only the pin numbers (gray background).

Because this library access the 5 pins using only normal digital output mode, you can actually use any 5 pins. This is the relevant part in the example code.

Code: Select all | TOGGLE FULL SIZE
#define OLED_DC 11
#define OLED_CS 12
#define OLED_CLK 10
#define OLED_MOSI 9
#define OLED_RESET 13
Adafruit_SSD1306 display(OLED_MOSI, OLED_CLK, OLED_DC, OLED_RESET, OLED_CS);


These names are similar to the SPI port names, but there's actually no requirement to match the actual SPI pins, because this library never actually uses the SPI port. It always accesses directly accesses the pins, so you can use any 5 digital pins.

paulstoffregen
 
Posts: 436
Joined: Sun Oct 11, 2009 11:23 am
Location: Portland, Oregon, USA

Re: Teensy 3.0, 128x32 OLED, and Pin Mapping

by mobilewill on Thu Jan 02, 2014 9:00 pm

Hi,

I have this display working with the Teensy 3.1 using the hardware labeled pins for SPI. I am using a modified library to support hardware SPI on AVR and it works on the Teensy.

Here is my pinout

Code: Select all | TOGGLE FULL SIZE
DC 9
CS 10
CLK 13
MOSI 11
RESET 14


Only thing with this setup CLK conflicts with use the LED.

I am also going to try the U8Glib for the display on the Teensy.

mobilewill
 
Posts: 49
Joined: Mon Dec 13, 2010 7:58 pm

Please be positive and constructive with your questions and comments.