Teensy 4.1 SPI pinout question

Status
Not open for further replies.

lrtjosh

Active member
Hello!

I am hooking up an SPI device to my Teensy 4.1 for the first time, and I notice on the PJRC pinout image that there are two pins for each of MISO1 and CS1. Are these just duplicates that are hooked up to the same thing?

Thanks in advance!

- Josh
 
The T4.1 like many other T3.x have Alternate pins can be used for some functionality.

Note: CS pins are different, but back to that in a second.

Example with T3.2(or 5 or 6), you have two SCK pins (maybe more) shown on pins 13 and 14, where 13 is the default. So for example on those boards, if you wish to use pin 14 you code would do:
SPI.setSCK(14);
To use the alternate pin.

That is the same thing on T4.1 with MISO1 pins which can be on 1 or 39... The default is 1 (as this is the same and only pin for this on T4). So again
to use 39 you would do. SPI1.setMISO(39);

CS pins are a little more confusing here. But first thing to note, that unless you are using special code that uses the underlying hardware CS support, it does not matter. Most libraries and user code simply use any valid digital IO pin for CS.

There are a few exceptions: SPI Slave code (which is not part of our SPI library), and a few libraries, that bypass the SPI library and work directly with the SPI registers, and in this case the FIFO queue, Where you push data onto the queue using the TDR register and control data using the TCR register, that as part of it can control which CS pin(index)... Can go more into this if need be, but again there can be multiple CS pins which are alternates to the same index and there can be some that are unique indexes. Again why this matters is only one of any particular index can be used...
 
Thanks KurtE, that helps! I'm trying to drive an Adafruit 1.14'' TFT SPI display with my Teensy 4.1, currently having no luck getting anything to appear, even using the modified ST7789_t3 library. I think I need to hook it up to an older Arduino first and verify that the display actually works. Might post a new thread tomorrow if still not having any luck on Teensy after eliminating the display itself as a variable.

Is there a list somewhere of what the pins across the middle of the board all do? I assume in there somewhere is a third set of SPI pins, like the Teensy 4.0 has? I was hoping at some point to experiment with driving three of these little displays from one Teensy 4.1.

Thanks!
 
T4.1-Cardlike.jpg

Here is image of my excel document...
 
Status
Not open for further replies.
Back
Top