SPI -- CS and D/C: arbitrary data pins?

First, can I choose any data pin for CS?
Second, I want to make sure I'm doing this right. D/C is still needed, and just like CS, I can choose an arbitrary data pin...?
 
It depends on which library code you use, but usually yes, most libraries using SPI support CS on any digital pin.

Maybe you're asking about a display, perhaps ILI9431 or ILI9488 or ST7789 since you also mentioned "D/C"?
 
First, can I choose any data pin for CS?
Second, I want to make sure I'm doing this right. D/C is still needed, and just like CS, I can choose an arbitrary data pin...?
Depends, which Teensy are you using?

If it is a Teensy 3.x, then for some of these libraries like ILI9341_t3 may require special pins to be used, especially for the DC pin.

However on the Teensy 4.x any digital pin should work. Some of these libraries might get a slight boost in performance if the DC pin is
on one of the Hardware CS pins.

Shortish version of why: When you do things like lets say set a pixel:
The code needs to set the address, followed, by the data. This can look something like:
Code:
<caset>x1 x2 <paset> y1 y2 <write mem> color...
the parts within <> are commands. For these we need to set DC low output the command and set it High again before we we
write out the non command bytes like x1 and x2 (which are two bytes each).

Without DC being on special CS pin, the code has to wait until all data has been output over the SPI pins, before it can change
the state of the DC pin, which introduces gaps in the output of data. Where as with DC on hardware CS pin we can tell the
SPI subsystem to update the state of that pin after the data has output and already queue up the next data to be output.

On T3.x - SPI allows multiple CS pins to be updated at the same time, where as on T4.x you can only choose one (by index)
of the CS pins to be updated. So on T3.x some libraries only would run if both were on CS pins. Later in some of them I relaxed
it slightly to only require DC. And on T4.x would run regardless...
 
THANK YOU!!!
I have the 3.2 working fine. I am in the process of designing the same circuit for the 4.0. I will, of course, knuckle down and buy a few 4.0's to test the circuitry, but that will have to wait until I have $70 of mad money.
BTW, I've had to solder elbow headers to the bottom of the 3.2. Is there a "jig" that simply use something like pogo pins instead? If not I've been thinking of making something like a socket like a sdcard for inserting the boards...
 
THANK YOU!!!
I have the 3.2 working fine. I am in the process of designing the same circuit for the 4.0. I will, of course, knuckle down and buy a few 4.0's to test the circuitry, but that will have to wait until I have $70 of mad money.
BTW, I've had to solder elbow headers to the bottom of the 3.2. Is there a "jig" that simply use something like pogo pins instead? If not I've been thinking of making something like a socket like a sdcard for inserting the boards...
There were several PCBs that extended the Teensy 4.0s to allow access to the bottom pins. I kind of lost interest in those PCBs when the Teensy 4.1 started shipping. I have some that I had made up that I haven't soldered to a Teensy that I could send you via USPS if desired (I don't remember exactly what I have lying around):

 
Last edited:
Back
Top