PDA

View Full Version : T3 - Multiple SPI?



hookedup
11-22-2012, 03:15 PM
I noticed there seemed to be 4 SPI outputs on the T3. Can these be used at the same time (i.e. one clock, three data) or is this really a single SPI output? The FEZ Panda II has 2 SPI ports which allows 2 runs of LEDs that do not have chip select / disable capabilities. If there were a way to stream 4 sets of such LEDs at once, that would be an amazing capability. I am not asking for a library to do this, just to know the raw SPI system could or could not handle such a task.

Side note: I have two T3s from the kickstarter project - congrats and great work!

JBeale
11-22-2012, 03:57 PM
AFAIK there is just one SPI port (a normal SPI port uses 4 lines: CLOCK, MISO/DIN, MOSI/DOUT, CS) but of course you can also use any available digital I/O for the CS line(s), if your program bit-bangs the CS pin. The Teensy 3 chip allows the CLOCK, DIN, DOUT to be reassigned to a secondary set of pins shown in light grey on the pinout diagram below, although Paul's Arduino environment does not yet enable that feature.
http://www.pjrc.com/teensy/pinout.html

Of course, depending on the data rate you need, a software SPI implementation may be usable as well.

I would consider a device with no CS (chip select) input as a bare shift register, rather than SPI. With a simple external tri-state latch you could easily expand the SPI output to drive several such devices (eg. just turn off the CLOCK output to the devices you aren't driving at the moment)

pixelk
11-22-2012, 04:02 PM
There is only one SPI port available, with 5 Select Lines ( CS0 to CS4 ) so you can directly drive 5 SPI devices with 1 port (CLK/DIN/DOUT/CSx). That means that CLK DIN & DOUT are shared by all devices, but CSx is specifit to each device.
The light gray SPI pins are, as JBeale just said, just an alternative pinout.

hookedup
11-23-2012, 01:10 AM
Thanks to all, exactly the details needed.

THT
11-26-2012, 03:04 PM
There's more (as always...)

CLK/DIN/DOUT are fixed as they are driven by hardware. But the CS pin is not time critical so you could use digitalWrite([port], LOW) to select a device and HIGH to deselect it (CS is active LOW).

On these nice little Teensy 3.0 cards there is actually a second SPI bus visible where the ports are written in grey. But I don't know how to use them:
66

el_supremo
11-26-2012, 04:06 PM
there is actually a second SPI bus visible where the ports are written in grey
There is only one SPI bus - see Chapter 43 of the manual. The chip has a multiplexer which allows you to reassign inputs/outputs to different pins - see Chapter 10. For example, the SPI SCK signal is normally on T3 pin13 but it can be reassigned to pin14 - I've done it (with help from Paul). See http://forum.pjrc.com/threads/431-Reassigning-a-pin-%28SPI-SCK%29
So you could reassign the bus DOUT/DIN signals from pins 11/12 to pins 7/8 but it isn't a different bus.

Pete

pixelk
11-27-2012, 10:56 AM
THT, this picture is the old, wrong one (I know it's on the KS front page, but Paul explained that he can't change anything there after the ks was finished.

this is the one you get with your teensy :

http://www.pjrc.com/teensy/card5a.png

http://www.pjrc.com/teensy/card5b.png

btmcmahan
05-27-2013, 05:42 PM
So what does one do to reassign these pins? is there a way to do it?

el_supremo
05-27-2013, 06:08 PM
Search the forum for "reassign".
Try this thread: http://forum.pjrc.com/threads/431

Pete