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

Thread: Possible to read SD card data on the computer through the teensy 3.0?

  1. #1

    Possible to read SD card data on the computer through the teensy 3.0?

    I want to be able to read data on an SD card that the Teensy 3.0 logs to. However, I don't want to have to take the SD card away from my board.

    In other words, my connection is like:

    SD <--SPI--> Teensy 3.0 <--USB--> Computer

    I want to get the data from the SD card onto my computer without actually plugging the SD card into my computer. So I'll obviously have the Teensy 3.0 in between the SD card and the computer.

    Now my question is: What's the fastest way to get the data from the SD card to the computer in this case?

    The only idea that I have now is to have the computer send a command to the Teensy 3.0, and the Teensy 3.0 will then send the SD card data to the computer via a serial.print command. The problem is that I'm not sure how fast/slow this will be. I want to transfer a few megabytes of data at least. Does anyone know?

    Is there a better way to do this? Thanks!

    Edit: I found something like this, but it's way over my head http://elasticsheep.com/2010/04/teen...th-an-sd-card/
    Last edited by kingforger; 12-11-2012 at 04:34 PM.

  2. #2
    It has been done before with a teensy 2, but the SPI bus is slow and the transfer speed where very slow. Maybe the teensy 3 can do it faster, but it may be a lot of work.

    ** EDIT ** you found the project I was thinking about yourself.

  3. #3
    Yeah, even something as slow as 100kB/s would be perfectly acceptable for me though.

    At the moment, the other thing I'm considering is a hardware connection between the SD card and the USB input. There are little dongles that you can put an SD card inside of. Then, you put the dongle in your USB port and the SD card is recognized as a removable drive. It effectively acts as a slower flash drive.

    The problem is that I can't figure out how to do that hardware connection. There's some chip that's used, but I have no idea what it is. I even ordered one of these dongles and took it apart, but the chip is covered with some sort of black goo that you cannot scrape off. I also cannot find any information on the internet about SD card (SPI) to USB besides people saying "oh just buy that dongle from xx company". If anyone has a lead on this idea, I'd love to hear it.

  4. #4
    Just an FYI for ya'll: Regarding the hardware connection... Maxim apparently makes a chip for this type of idea. See page 18 of http://datasheets.maximintegrated.co...0-MAX14503.pdf

    The "black goo" which I was talking about is apparently some sort of resin used for a "chip-on-board". It reduces costs in certain scenarios and, as I guessed, is sometimes used to prevent reverse engineering. With some pain, it can be removed with a heat gun at around 200C and a scalpal. See: http://www.kaibader.de/exposing-a-chip-on-board/

    I still feel that the chip used in the little SD to USB dongles are far simpler than the one I found that Maxim makes. Something should exist for straight SD/USB without dealing with a host microcontroller.
    Last edited by kingforger; 12-11-2012 at 07:28 PM.

  5. #5
    hey, any updates on this? i just purchased 2 teensy 3s hoping i could do this but am not seeing a way

  6. #6
    Senior Member
    Join Date
    Jan 2013
    Location
    San Francisco Bay Area
    Posts
    650
    Quote Originally Posted by kingforger View Post

    The only idea that I have now is to have the computer send a command to the Teensy 3.0, and the Teensy 3.0 will then send the SD card data to the computer...
    This. Use sdfat library, and it comes with several examples. Sends raw binary data quickly. I did as you described and did something real simple like this in sending the data to PC:
    <file>
    binaryData
    </file>

  7. #7
    hey sorry, but its a bit over my head right now, i have a few questions,

    :: my goal is to allow the user to add/remove bitmaps from the sd card

    with that solution:
    1. how will the end user send files to the teensy? will this require a secondary program on the PC?
    2. basically where do i begin? serial? then read each byte, send it to serial, and have the piece it back together in another program on PC?

  8. #8
    from what i read it looks like the easiest and fastest way for me to accomplish this is to just buy teensy 2 ++ lol

  9. #9
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    25,082
    Yes, only Teensy2 supports the USB mass storage at this time.

  10. #10
    Ok, looks like I'll have to find some other use for these 3s then.. silly question but I want to make sure I'm buying the right thing.. when not plugged into the pc the 2 it will run my Arduino sketch correct?

  11. #11
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    25,082
    Quote Originally Posted by pts View Post
    silly question but I want to make sure I'm buying the right thing.. when not plugged into the pc the 2 it will run my Arduino sketch correct?
    Yes, that's correct.

    In fact, it will even run your Arduino sketch while it is plugged in.

    But each time the PC reads or writes data, an interrupt will stall your program briefly. That 16 MHz AVR can manage to sustain about 500 kbytes/sec, which will starve your sketch of nearly all CPU time if the computer reads or writes a large amount of data. Writing a 3 Mbyte file all at once will cause your sketch to get little or no CPU time for about 6 seconds. But your sketch continues to run and it get all the CPU time that isn't needed for servicing the PC's disk requests, or other normal interrupts like the timer for millis().

Posting Permissions

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