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

Thread: Is there any sd card detect pin for Teensy 3.6 builtin SD Card

  1. #1
    Junior Member
    Join Date
    Jun 2017
    Posts
    18

    Is there any sd card detect pin for Teensy 3.6 builtin SD Card

    Hi,

    I cannot find any information for detecting the presence of an SD card for T3.6's built-in Sdio card slot. I'm aware this can be done with may of the spi card reader modules but I need the additional speed provided by the builtin sd card.

    Does anybody know if this is directly wired to any pins on the T3.6 processor, and if so could you give some guidelines on whether I can include an ISR to implement code when the card is detected vs. not detected.

    I am using this with a TFT screen so in the absence of a card detect pin the only option I see is to have the Teensy read the card and if an error is returned when reading, then assume the card is removed and enter a reset type screen waiting for a user to touch a button on TFT screen to say it has been inserted. Then I can get it to go through initialization of the SDFat library again and resume operation. However a Card Detect pin on an ISR would be simpler and more reliable in my opinion.

    Hopefully, someone can help.

    Regards,
    Pat

  2. #2
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    28,481
    No, sadly there isn't any hardware provision like a physical card detect switch or resistor on a data line. The only viable way is polling by trying to communicate with the card.

  3. #3
    Senior Member
    Join Date
    Apr 2014
    Location
    -
    Posts
    9,735
    Quote Originally Posted by paqwa View Post
    more reliable in my opinion.
    Not sure if this is correct. It does not help to know if the card is inserted - but does not respond. The only reliable way, in my opinion, is to test if the communication works.

  4. #4
    Junior Member
    Join Date
    Jun 2017
    Posts
    18
    Thanks Paul and Frank,

    Firstly, I just wanted to say that while this is my first time posting here I've followed 100's of your discussions on forums over the past year/two since I got my first micro-controller and have always found them a great inspiration as well as being a very helpful guide to tinkering with them. So thanks for that and please keep up the excellent work.

    Anyway, back to the issue. May be worth noting that I also just came across a thread which is of interest to this topic (link below), specifically a post by posse noting a register on the chip that should be able to report if card is present. However, I believe it needs to be polled rather than the neater implementation of being coupled to an ISR, very much doubt the NVIC has an IRQ for it. Anyway, going to try this out over the weekend and will update thread if successful to further share with others.

    https://forum.pjrc.com/threads/43422...etect?p=140505

    Thanks to all for now.
    P

  5. #5
    Senior Member xxxajk's Avatar
    Join Date
    Nov 2013
    Location
    Buffalo, NY USA
    Posts
    602
    I know this is an old thread, however, you can do sdcard detect with an interrupt.
    Click image for larger version. 

Name:	Teensy_sdcard_detect_mod.jpg 
Views:	57 
Size:	237.5 KB 
ID:	25344
    Works for Teensy 3.5/6 and Teensy 4.0/1 with UHS3 (which properly supports the change detect pin!!!).

  6. #6
    Senior Member xxxajk's Avatar
    Join Date
    Nov 2013
    Location
    Buffalo, NY USA
    Posts
    602

    Cool

    Here's my modified Teensy 3.6 for SDcard IRQ detection of card presence.
    Click image for larger version. 

Name:	pin_37_irq_t4.x_t3.6.jpg 
Views:	46 
Size:	81.2 KB 
ID:	25347
    One extra detail for the Teensy 3.6 only, as it is missing the ground connection. This connection is present on Teensy 4.x. and only required on the 3.6 model.

    Side view:
    Click image for larger version. 

Name:	t3.6_ground_side_view.jpg 
Views:	49 
Size:	83.7 KB 
ID:	25348

    ...and zoomed in from above.
    Click image for larger version. 

Name:	t3.6_ground_zoom.jpg 
Views:	49 
Size:	68.3 KB 
ID:	25349

    Hope this might help someone in the future. Cheers!

Tags for this Thread

Posting Permissions

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