Shop OBEX P1 Docs P2 Docs Learn Events
Could an SD Card Signal be Shared to Provide Audio When the SD Card is Not Active? — Parallax Forums

Could an SD Card Signal be Shared to Provide Audio When the SD Card is Not Active?

JRetSapDoogJRetSapDoog Posts: 954
edited 2013-12-05 11:20 in Propeller 1
Greetings. On a design in the making I've got all pins in use. But I'd like to add audio of some kind, even if just a piezoelectric device for beeps/buzzes.

In the design, almost all of the Prop pins are in constant use, with the possible exception of the four SD card signals (DO, CLK, DI, /CS). I don't really have any other good candidates elsewhere (and can't use I/O expanders, etc). Even P28-31 are busy. So, I'm eyeing these SD card signals to see if something could be done there.

Might an audio signal be sent out on one of those pins if the active-low chip select line were held high during the time the card wasn't actively being accessed? Or is there some data coming back from the card when the CS line is high? Hopefully not. If not and nothing else stands in the way, I wonder what would be the best SD card pin choice to pass the audio on.

Also, as you can probably guess, I wouldn't want an audio transducer emitting sound or otherwise spazzing out while the SD card was in use. So, perhaps the CS line could be used to disable an AND gate or similar to prevent passing through the signal associated with an active SD card. I won't need the audio transducer to emit sound while accessing the SD card, just when the SD card is not in use. Incidentally, currently, I don't access the SD card all that often, perhaps once a minute for a couple seconds (and at least most, currently all, of the accesses are/will be reads). Lastly, the audio signal would NOT be generated and OR'ed in (by the Prop's internal pin circuitry) with an SD pin when the SD card was active.

And if something along those lines is possible, I wonder if I'd have to unmount the SD card when doing audio. I'm all ears for any comments or tips, definitely including the "it-won't-work-because" kind. Thanks. --Jim

Comments

  • Dr_AculaDr_Acula Posts: 5,484
    edited 2013-12-03 14:52
    That should work fine :)

    Which pins to use?

    Well, /CS like you say can select audio or SD, and like you say, an AND gate (eg 74HC08) would work. Low for SD, High for Audio.

    That leaves 3 pins, and it may not matter, but DO is data from the SD to the Prop, so in the event of a software glitch and data clash, maybe audio and DO might end up fighting each other, so would suggest use CLK and DI. Why not use both and have stereo sound?

    In terms of unmounting, I think it is the unmounting in software that might be the part that makes /CS high, but maybe double check that.

    Sounds like a really clever idea.
  • JRetSapDoogJRetSapDoog Posts: 954
    edited 2013-12-03 19:52
    Thanks for the feedback/suggestions, Drac! Yeah, maybe it's worth trying. Still wondering if there's a "deal breaker" involved somewhere. As you said, I'll have to check on how the /CS level is handled (may depend on which driver I select), though maybe I can override the handling, if need be. Anyway, even if this works, I realize that a lot of users wouldn't want to limit themselves to not being able to listen to audio off the SD while reading it in (and hopefully they have other pins available for audio, too). But this scheme should be useful in my situation...if it works. Thanks, again!
  • Dr_AculaDr_Acula Posts: 5,484
    edited 2013-12-04 03:17
    There are lots of options in the software to "shut down" the SD card, ie make /CS high. I reckon it should work fine.

    If you are going to add a 74HC08 chip and one one (mono) or two (stereo) gates, with another spare gate, you could use it as a buffer (possibly not even needed) on the /CS line to a LED and then you can easily see if the /CS line is being deselected by the software.

    Only catch like you say is that playing .WAV files off the SD card won't work so well but many other things would work fine - eg synthesizer objects.
  • JRetSapDoogJRetSapDoog Posts: 954
    edited 2013-12-04 18:31
    Thanks for those additional comments, Drac. Sounds like it's worth trying. Your words give me additional confidence.
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2013-12-04 18:44
    Thanks for those additional comments, Drac. Sounds like it's worth trying. Your words give me additional confidence.

    This whole discussion presumes that there are no other pins available and that the SD card is the only viable option. Unless you let us in on the big picture I'm afraid you will only get answers couched within the narrow confinements of your question. State openly what you do have and you may be surprised to find that there is a much better solution.
  • JRetSapDoogJRetSapDoog Posts: 954
    edited 2013-12-05 11:20
    Thanks, Peter. You're quite right; there is a risk with asking such a narrow question, and doing so will often deprive the poster or community of some related knowledge or clever alternative approaches. However, in this particular case, I know that I won't be messing with the other pins, so my only candidates are the SD pins. All the other pins are really quite busy, but I didn't want to go into the details in this thread, hence my narrow post. Prior to posting, I realized that one of the first suggestions would be to figure out a way to use other pins, and so I tried to avoid that (and save people's time). But even though the question is quite narrow and relevant to specific circumstances, I think it's a valid and interesting question in its own right. Hope I didn't offend anyone. Anyway, I'll try to ask broader questions when the situation allows for it and I feel comfortable doing so. I'm grateful for and pleased with the responses I've received and glad that, so far, I haven't received an "it'll never fly" response. Thanks again for your valid critique (and for bumping my thread). I know that I'm limiting the responses, but I can live with that and feel it's appropriate in this case. BTW, Australia is working overtime to support the Propeller. You guys are amazing! I'm so glad the Prop is well-represented down under for the benefit of us all. --Jim
Sign In or Register to comment.