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

Thread: Teensy MicroMod SPI1

  1. #1
    Senior Member
    Join Date
    Apr 2019
    Posts
    174

    Teensy MicroMod SPI1

    Hello, does SPI1 on Teensy MicroMod function or is it SDIO only? Something's not working for me. Thanks.

    From SparkFun:

    The Teensy Processor has two SPI ports. The primary SPI connects to the following pins:

    SDI/CIPO - Serial data input (Controller In/Peripheral Out). MicroMod pad 61. Teensy pin 12.
    SDO/COPI - Serial data output (Controller Out/Peripheral In). MicroMod pad 59. Teensy pin 11.
    SCK - SPI Clock. MicroMod pad 57. Teensy pin 13.
    CS - Chip select. MicroMod pad 55. Teensy pin 10.

    Due to hardware limitations on most MicroMod Carrier Boards, SPI1 is only available for hardware SDIO communication with an SD card. Use the ATP Carrier to directly interact with SPI1.

  2. #2
    Senior Member
    Join Date
    Apr 2019
    Posts
    174
    Anyone who worked on TD1.54 perhaps?

  3. #3
    Senior Member
    Join Date
    Jul 2014
    Posts
    3,338
    AFAIK,
    you always cam use the SPI instead of the SDIO protocol.
    For this reason the T4.1 card shoes for the pin numbers and the SPI names.
    However it is spi2 and not spi1
    Should be easy to translate to MicroMod

  4. #4
    Senior Member+ mjs513's Avatar
    Join Date
    Jul 2014
    Location
    New York
    Posts
    7,670
    Quote Originally Posted by WMXZ View Post
    AFAIK,
    you always cam use the SPI instead of the SDIO protocol.
    For this reason the T4.1 card shoes for the pin numbers and the SPI names.
    However it is spi2 and not spi1
    Should be easy to translate to MicroMod
    For Teensy Micromod its SPI1 - was changed to matched the naming convention used by Sparkfun for Mircomod boards. As for using SPI1 - you can use it but you will be able to use the built in SDCard reader on the board. In addition when using the SD Card reader on a Micromod board CS is 10 so you can get into conflicts.

  5. #5
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    25,217
    Sparkfun's hookup guide page has many technical errors. I've exchanged several emails with them. They're planning to update it, but progress has been slow. I believe some of the delay may be that key people have been out for summer vacations.

    I know that page is meant to be the authoritative info about MicroMod Teensy hardware, but at least for now, please read it with some skepticism. It will eventually get updated with more info and hopefully all mistakes will get fixed.

    The folks are Sparkfun are good people who are trying, but they're probably not familiar with hardware as complex at Teensy 4. While they mention both SPI and SDIO, from the wording it seems like they might not be familiar with the distinction between those peripherals. The fact that NXP muxed both peripherals to those pins (but not in a way where the SD card mates properly with the same pins when you switch between SPI vs SDIO) also adds more confusing detail, which I believe is the point those words on the hookup guide are trying to explain. But it is SPI2, not SPI1, which shares the same physical pins as SDIO.

    The hookup guide also says you get 2 SPI ports, but there are actually 3 SPI ports.

    To be honest, I personally tested SPI (arduino pins 11-13) and SDIO (arduino pins 34-39) pretty extensively during the beta test, but I didn't do much with SPI1 (arduino pins 0,1,32) or SPI2 (arduino pins 42,43,35). I'm pretty sure all 3 SPI do work. Everything is the same as with Teensy 4.0.

    If you try SPI1 or SPI2 and have trouble, please reply here with details (like photos of the wiring so we can see the specific carrier board see how you're connecting wires) and I'll investigate.

    If your intention is to use a SD card, your options may be limited to only SPI (arduino pins 11-13) if you use SD.begin(pin) and SDIO (arduino pins 34-39) if you use SD.begin(BUILTIN_SDCARD). You can access SdFat's many more hardware options, as shown in File > Examples > SD > SdFat_Usage. But again to be honest, I'm not sure if SdFat can support use of SPI1 or SPI2. If anyone knows how to make SPI1 & SPI2 work with SdFat, please chime in. I'll try it here and update the SdFat_Usage example.

    Likewise, many Arduino libraries for SPI chips are hard-coded to only use SPI. Some have a constructor or begin() function which lets you specify another SPI port.

    Of course, if you use the SPI library directly, you definitely can use SPI1.begin(), SPI1.transfer(), SPI2.begin(), SPI2.transfer(), etc. Again, if you try to do this and it's not working, please show us photos of which carrier you used and how you connected the wires, and the complete code so anyone can try to reproduce the problem. I'm pretty sure SPI1 & SPI2 do indeed work... but if there's any doubt (with photos & code) I'll get the hardware set up on my workbench and try to investigate.

    I'll also ping Sparkfun again about getting that hookup guide updated. It needs a lot of work in so many ways, not just SPI & SDIO. Please be patient with the Sparkfun folks. They're not used to documenting hardware with this much complexity.

Posting Permissions

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