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

Thread: Two SPI devices on Teensy 4.0

  1. #1
    Senior Member
    Join Date
    Nov 2020
    Location
    Czech Republic
    Posts
    124

    Two SPI devices on Teensy 4.0

    Hi all,
    is possible to conenct two SPI devices, display and 24-bit ADC on Teensy 4.0? I have no clue hot to do it.
    Wiring you can see on picture.
    Could I use same pins and control both devices by software?
    Thanks for any advice.
    Michal

    Click image for larger version. 

Name:	SPI.jpg 
Views:	30 
Size:	38.8 KB 
ID:	27085

  2. #2
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    16,874
    See Better SPI Bus Design in 3 Steps

    It is possible, as long as the devices are designed to tri-state their MISO to keep the Pin #12 usable.

    SPI BUS on Teensy pins 11, 12, 13 can then be shared to multiple devices for use 'in turn' where each requires a unique CS pin connected.

    And for Teensy 4.0, those pins must see only 3.3V from the device.

  3. #3
    Senior Member
    Join Date
    Dec 2016
    Location
    Montreal, Canada
    Posts
    4,077
    the MISO/MOSI/SCK can be ran in parallel provided the devices tri-state their MISO pin on deassertion of the CS pin. However, the other pins should be different: CS, RST, DRDY, RST etc

  4. #4
    Junior Member
    Join Date
    Jan 2022
    Posts
    3
    I am working on a project that could use two SPI signals. How do you configure the two CS pins using TeensyDuino? Can you use pins 9 and 10 and somehow tell the Teensy to switch, or can you not use pin 10 (say use pins 8 and 9 as GPIO) and disconnect 10 all together? Thanks for your great work.
    Jack

  5. #5
    Senior Member PaulS's Avatar
    Join Date
    Apr 2015
    Location
    Netherlands
    Posts
    1,034
    On this page, scroll down to Example using transactions to see how 2 SPI devices are handled.

    Paul

  6. #6
    Senior Member
    Join Date
    Jan 2014
    Posts
    113
    The problem with that is that while the display is updating which can take some time depending on bit depth and resolution, you can't use the ADC, It may or may not matter depending how fast you need to read the ADC.

    I'm using DAC and ILI9341 on 2 SPI busses on teensy 4.1 (and the optional psram with qspi) The display uses ILI9341_T3n which controls it's own bus, and the DAC is controlled with SPI library. they work completely independently without affecting each other's speed.

Posting Permissions

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