Teensy3 Pinout Options and SPI Question.

Status
Not open for further replies.

PaulG

Member
Hi all,

The Teensy3 pinout drawing shows a second copy of Serial1 signals and some SPI signals. I checked the MK20 datasheet and these are valid pin routing options. Is it possible to make use of them using the supplied libraries? For example, I would like to put SCK on pin D14.

Also, the SPI pinout shows 5 chip selects. Does the Teensy3 SPI library make use of them? If so, how? Or do I have to manually manipulate them as per the standard Arduino SPI library?

Paul
 
TeensyDuino 1.16 has just been released and one of its new features is:
SPI library can assign alternate Teensy3 pins: setMOSI, setMISO, setSCK.

I haven't tried it yet but it looks like it'll do what you want.

Pete
 
Yes, the functions to change the 3 main pins are now in the SPI library.

Also, the SPI pinout shows 5 chip selects. Does the Teensy3 SPI library make use of them?

No.


If so, how? Or do I have to manually manipulate them as per the standard Arduino SPI library?

Yes. The SPI library attempts to work just like it does on Arduino (even though the underlying hardware is vastly different).
 
Thanks guys,

I will try this out.

BTW, glad to see Teensyduino 1.16 is released - hopefully this will cure my Mac upload problems.

Paul
 
OK, I located these functions in .../cores/teensy3/avr_emulation.h and can see how to call them. Should I call them before or after calling SPI.begin()?

As an aside, where is the SPI library code located? I can't find it in the teensy3 folder.
 
Call them before SPI.begin().

The SPI library code is in the libraries/API folder. On a Mac, control-click Arduino and use "show package contents", then dig in a few layers of folders until you find "libraries".
 
Thanks Paul.

I found the SPI code, but i'm even more confused now. It appears to be for the AVR chips. How does it relate to the MK20 chip?
 
Thanks, found it.

Wow, you've certainly put a lot of work into this. Why did you need to emulate the AVR SPI hardware? Could you not have just implemented the half dozen or so SPI API functions?
 
Many important libraries have the AVR SPI registers hard-coded. Nearly all of Adafruit's libraries which access SPI do this.
 
Status
Not open for further replies.
Back
Top