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

Thread: Which pin is SD card's SS on Teensy 3.5?

  1. #1
    Junior Member
    Join Date
    May 2016
    Posts
    11

    Which pin is SD card's SS on Teensy 3.5?

    Hello!

    I am trying to use the on board micro sd card on a Teensy 3.5 but i can't find which is the SD card's SS pin.
    Any help?

  2. #2
    Senior Member
    Join Date
    Dec 2016
    Location
    Montreal, Canada
    Posts
    3,336
    there is no pin it's on the SPI SDIO bus, you need to use the SDFat Beta library on github to access it. I repeat, the SDCARD doesnt use the SPI pins, it has it's own bus.

  3. #3
    Junior Member
    Join Date
    May 2016
    Posts
    11
    Thank you for your help, i will search at the github.

    (I thought i could use the ready examples that are contained inside the teensduino).

    By the way, where i can find the schematics of teensy 3.5?

  4. #4
    Senior Member
    Join Date
    Jul 2014
    Posts
    2,640
    Quote Originally Posted by tonton81 View Post
    there is no pin it's on the SPI SDIO bus, you need to use the SDFat Beta library on github to access it. I repeat, the SDCARD doesnt use the SPI pins, it has it's own bus.
    Not correct, there IS a SPI bus overlaying the SDHC, and it has been used to program the uSDCard using SPI.
    But you are correct if you suggest to use the sdhc interface and not the SPI interface

    Edit: while there is No pin number for CS you can explicitly use PTE4 (alt1)

    By the way, where i can find the schematics of teensy 3.5?
    where it should be: https://www.pjrc.com/teensy/schematic.html
    Last edited by WMXZ; 01-04-2017 at 07:27 AM.

  5. #5
    Junior Member
    Join Date
    May 2016
    Posts
    11
    I think i must start reading more about Teensy 3.5!

  6. #6
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    21,827
    Quote Originally Posted by vagyver View Post
    (I thought i could use the ready examples that are contained inside the teensduino).
    You can. Just make sure you select Teensy in the Tools > Boards menu first, since modern versions of Arduino show a different Examples menu depending on which board is selected.

    When you open any of the examples from File > Examples > SD, you should see this:

    Code:
    // change this to match your SD shield or module;
    // Arduino Ethernet shield: pin 4
    // Adafruit SD shields and modules: pin 10
    // Sparkfun SD shield: pin 8
    // Teensy audio board: pin 10
    // Teensy 3.5 & 3.6 on-board: BUILTIN_SDCARD
    // Wiz820+SD board: pin 4
    // Teensy 2.0: pin 0
    // Teensy++ 2.0: pin 20
    const int chipSelect = 4;
    Again, you need to have Teensy selected. If a non-Teensy board is selected, you'll see Arduino opens the examples from its own copy of the SD library, which doesn't have this extra info (or support for the dedicated SDIO port on Teensy 3.5).


    By the way, where i can find the schematics of teensy 3.5?
    https://www.pjrc.com/teensy/schematic.html

  7. #7
    Junior Member
    Join Date
    Jan 2017
    Posts
    1
    Quote Originally Posted by PaulStoffregen View Post
    When you open any of the examples from File > Examples > SD, you should see this:
    I ran into an issue: If you update the SD car library through the library manager, it saves it in the library folder (where it saves sketches), after which the IDE ignores the Teensy version and only offers the one it just saved (even when the board is selected).

    After updating to Arduino IDE 1.8, Teensyduino 1.34, and deleting the SD library in the above folder, it's all working.

  8. #8
    Junior Member
    Join Date
    Jan 2017
    Location
    Seattle, WA
    Posts
    4

    SD Card Library Name Ambiguity

    Quote Originally Posted by gribov42 View Post
    I ran into an issue: If you update the SD car library through the library manager, it saves it in the library folder (where it saves sketches), after which the IDE ignores the Teensy version and only offers the one it just saved (even when the board is selected).

    After updating to Arduino IDE 1.8, Teensyduino 1.34, and deleting the SD library in the above folder, it's all working.
    ----------------------------------------------------------------------------------------------------------------------------------
    I had the same issue and resolved it the same way as above.

    Prior to resolution, "SD" showed up under "Examples for any board" and not under "Examples for Teensy 3.6".

    After "SD" folder deletion from under "C:\Users\DickC\Documents\Arduino\libraries": "SD" is absent from "Examples for any board" and present under "Examples for Teensy 3.6".

    Apparently, the "Examples" menu cannot handle duplicate names even if they occur in separate groups.
    Perhaps a fix is needed in the Arduino IDE.

  9. #9
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    6,638
    Most of this has already been said, but...

    Not sure why anyone would want to use the SPI interface to communicate with the SDCard when the SDHC is available and the like.

    I also wish Arduino had a better way to control which version libraries get included especially when you have duplicates. If you install a library from GitHub to your <sketch folder> \ libraries it will override the ones Teensy installs. ...

    Quote Originally Posted by WMXZ View Post
    Not correct, there IS a SPI bus overlaying the SDHC, and it has been used to program the uSDCard using SPI.
    But you are correct if you suggest to use the sdhc interface and not the SPI interface

    Edit: while there is No pin number for CS you can explicitly use PTE4 (alt1)
    As I mentioned in another very similar thread maybe yesterday or the day before. The IO pins associated with the SDCard are defined in the IO pins with pin numbers 58-63. I have made a couple of adapters that can plug into the sdcard reader and use these IO pins for other purposes.

    Code:
    58	PTE0	ADC1_SE4a	ADC1_SE4a	PTE0	SPI1_PCS1	UART1_TX	SDHC1_D1	TRACE_CLKOUT	I2C1_SDA	RTC_CLKOUT
    59	PTE1	ADC1_SE5a	ADC1_SE5a	PTE1/LLWU_P0	SPI1_SOUT	UART1_RX	SDHC0_D0	TRACE_D3	I2C1_SCL	SPI1_SIN
    60	PTE2	PTE2/LLWU_P1	ADC1_SE6a	PTE2/LLWU_P1	SPI1_SCK	UART1_CTS_b	SDHC0_DCLK	TRACE_D2		
    61	PTE3	ADC1_SE7a	ADC1_SE7a	PTE3	SPI1_SIN	UART1_RTS_b	SDHC0_CMD	TRACE_D1		SPI1_SOUT
    62	PTE4	DISABLED		PTE4/LLWU_P2	SPI1_PCS0	UART3_TX	SDHC0_D3	TRACE_D0		
    63	PTE5	DISABLED		PTE5	SPI1_PCS2	UART3_RX	SDHC0_D2		FTM3_CH0
    Sorry quick copy/paste from my Excel document.

    All of these pins have ALT1, which is to use as digital pin, some have Alt0 and can be used for Analog pins (not sure if done).

    Also all of these pins have ALT3 functions and have Serial2 and Serial4 capabilities.

    But more to the point of this thread. All of these pins have SPI1(ALT2 and ALT7) and SDCARD (ALT4) functionality. The SPI library (and Core) was updated to allow these pins to be used for SPI1.

    That is you can call:
    SPI1.setMISO(59) or pin 61,
    SPI1.setMOSI(59) or 61,
    SPI1.setSCLK(60)
    SPI1.setCS(58) or 62, or 63.

    So the pieces are maybe there allow you to use SPI1 to talk to the SDCard, again not sure if anyone has tried to do so...
    I have however used these SPI1 pins to run an ILI9341 display

    Also sort of interesting the pin PTE4 in SPI mode is CS1-0 (cs 0 on buss 1), in SDCARD mode it is Data2 pin...

Posting Permissions

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