Teensy & USB SD Card Reader Chip sharing SD/MMC Bus : Noob needs help.

Status
Not open for further replies.

M.Zaki

New member
Hi everyone, Teensy newbie here. Any help / hand holding will be really appreciated :)

I am trying to work out the following block diagram:
Au9331 SD.png

My goal: To read/write some music files directly in to the SD Card in Audio Adaptor from PC via USB cable.

I am able to procure some SD Card reader chips (AU9331, from aliexpress) that is found in USB Card Readers like this (I had to break open one to find what they use:)).
card_reader_explay_micro_sd_m2.jpg

This is the reference design that is given in AU9331 datasheet. I am also attaching the full datasheet.
AU9331 Schematic.jpg
I am using a separate Micro B USB socket for connecting the SD Reader Chip to PC. (I am not using the Micro B socket of Teensy).

Is it possible for Teensy to share the SD/MMC Bus with the SD Card Reader Chip? ( It is ok if Teensy can't play music when files are being copied via SD Card Reader chip).
Is there anything in SPI library that I can use?
Am I heading in the right direction? Please guide.
 

Attachments

  • AU9331R1.2.pdf
    303.5 KB · Views: 693
Hi Paul,
Thanks for the reply. I am making my own PCB. I have purchased some AU9331 chips from aliexpress for the same.

What I am trying to do is to make a custom PCB with PMIC BQ24072 and AU9331 Card Reader Chip and plugging in Teensy and Audio Adapter into it.
 
Last edited:
Are you making your own PCB, or trying to use the check consumer card reader?

Hi Paul,

I know you are very busy, but it will very helpful if you can look in to this.


I am really confused if I am looking at this in the right way. I am wondering if there could be a fix in the SPI library. I have purchased all the components from digikey and aliexpress (hopefully aliexpress ones are not knockoffs). I want to confirm before proceeding into PCB.

Is there any other way to copy files directly in to SD card in the Audio Adapter?
Audio files are big and I think Bluetooth will take for ever. Any ideas?
 
You're going to face some rather difficult challenges with this project. I'm not saying it's impossible, but it will not be easy.

First, you need to understand SD cards have 2 modes, native and SPI. Teensy uses the card in SPI mode. Once a card is placed into SPI mode, the only way to go back to native is power cycling the card. I see the schematic already has a PNP transistor for this.

Look, I can't get really involved, but here some guesswork. Please understand this is just my guessing opinion, and I can't help you dig into the details. I can only help by guessing some of the things you might need to consider....

When each device accesses the card, you need the other to tri-state its signals. On Teensy, you can do this by writing zero to the pin config registers. This means you're going to have to do some ugly coding on the Teensy side. You might need to edit the SD library slightly too, so it will fully "forget" it saw the card previously and redo all the initialization.

Likewise, you will need the AU9331 to fully tri-state all its signal pins, so when Teensy accesses the card. I haven't read the AU9331 datasheet, and I'm not planning to do so. Sometimes info like this isn't clear in datasheets, so you might have to do experiments with the chip to learn if it is tri-stating or just driving its pins low when the PNP transistor is off.

You're going to have to fully power down the card between uses, so it can completely reset. You might have to build a circuit with 2 PNPs, or maybe some logic circuits to control one PNP. Obviously you need to find a way to get the AU9331 to turn off the PNP. How, I do not know. I'd guess it may do that if the card detect switch says the card is removed. Maybe? I have not read the AU9331 specs, and I really can't get any more involved than this message.

This is pretty interesting though, which is why I've written a lengthy reply here. If you make any progress, especially if you learn more about how to get the AU9331 to relinquish control and allow Teensy to access, I hope you'll share the info here. So little of this sort of info exists on the Internet. Maybe other people will find it later by searching.
 
Wow!! Thanks Paul for such a detailed lengthy reply. I am going to plunge in and do some wiring and testing. I will surely post any progress i make. I understand the solution you suggested and it might be do able. Thanks again.:):)
 
Status
Not open for further replies.
Back
Top