Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 9 of 9

Thread: T3 - Multiple SPI?

  1. #1
    Junior Member
    Join Date
    Nov 2012
    Location
    Lake Worth, Florida
    Posts
    4

    T3 - Multiple SPI?

    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!

  2. #2
    Senior Member
    Join Date
    Oct 2012
    Location
    Portland OR
    Posts
    711
    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)
    Last edited by JBeale; 11-22-2012 at 03:04 PM.

  3. #3
    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.

  4. #4
    Junior Member
    Join Date
    Nov 2012
    Location
    Lake Worth, Florida
    Posts
    4
    Thanks to all, exactly the details needed.

  5. #5
    Junior Member
    Join Date
    Oct 2012
    Location
    Switzerland
    Posts
    19
    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:
    Click image for larger version. 

Name:	b47af8930ab8a169e37c95534ab9945e_large.png 
Views:	2231 
Size:	336.4 KB 
ID:	66

  6. #6
    Senior Member
    Join Date
    Nov 2012
    Posts
    1,743
    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-Re...-%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

  7. #7
    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 :




  8. #8
    So what does one do to reassign these pins? is there a way to do it?

  9. #9
    Senior Member
    Join Date
    Nov 2012
    Posts
    1,743
    Search the forum for "reassign".
    Try this thread: http://forum.pjrc.com/threads/431

    Pete

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •