AtTiny85 SD Card Wav Player

posted in: attiny, brandon | 0

Hello there,

I haven’t been posting too much, and most of this has been the lack of anything interesting (for me at least).  Administrating “The UAV Project” had been quite a hassle.  Not to mention, the years of project-buildup have more or less deprived me of my primary source of joy.  At least I know now that I really don’t like administrative things…  with that said, I guess it doesn’t come as much of a surprise that I resigned.  It was quite a difficult decision.

A long rant about the UAV project

My view on the project as a whole (if anybody wants to know) would be that this year should be focused on finding new team leads.  Many projects I’ve seen over the years have had awful endings because nobody was around to take the project.  CalState Fullerton will not be competing this year because their main work team graduated.  UC San Diego last year had a lot of trouble with old members graduating.  In short, we need to prepare for the future.  (Oddly enough, we seem to be out-of-phase with the rest of the schools’ transition periods.)  This year is perfect because we’re also very low on funding.  (Last year’s administration seemed to use money quite excessively…)

I’ve also had a bit of trouble with a lot of the people in the UAV team.  Unfortunately, I play favorites when it comes to people.  Humans in general like to make inferences from previous data.

From the previous data gathered about a person in times that their original guess did not work as intended, I like to infer how someone will behave in the future.  If what they originally proposed did not work as intended, and they try to fix it, then I will play favorites for said person.  If what they originally proposed did not work as intended, and they believe it works perfectly fine despite glaring deficiencies, then I will play favorites against said person.

Engineering is quite weird.  Sometimes, what is proposed is absolutely preposterous.  If it works, then who is to argue?  If it doesn’t work, the engineer must realize that it doesn’t work and move on.  Sometimes, it’s difficult to see that it doesn’t work or it’s difficult to move on.  This is the case for the current UAV camera.  (Did I mention that almost every single test image was more or less deleted from all existence?)

From the original days when I actually was involved with “UAV Things” simply as the comms. guy, I remember using a Canon DSLR (T2i) to take the images.  It was hacked to pieces, and the mechanical engineering team had quite a go at it.  But it fit into the plane and it took pictures well, who’s to argue that?  (Granted, a mechanical problem did arise when it landed.  Our “engineering guestimate” is that the mirror was nudged in a way that the camera firmware wasn’t comfortable with.  A mirrorless camera can fix this quite easily.)

As far as I’m concerned, it may have been a good decision to leave when my gut feeling told me to leave (the beginning of last year).  We may have won tenth place this year (3rd nationally, 1st statewide), but we have lost the vote of confidence from our members (our entire ME department (with the exception of a few select people) collapsed including the previous ME coordinator).

 

But anyway, let’s talk about SD card WAV players!

My idea of having an SD card WAV player comes from the Intel chimer that we used to have.  (Not a video of us!)  And I wanted to implement the same thing — but with Nyan Cat.  (This is a customary thing for me — after my Nyan Cat Soldering oven.)

Recently, I have looked at an “electrical handiwork” from ChaN called the SD8P.  http://elm-chan.org/works/sd8p/report.html  ChaN implemented an SD card playing AtTiny85 thing!

And I kind of did the same thing but with my electrical handiwork materials…  albeit, I had a lot of bugs along the way (they were caused by my ignorance.)

First of all, apparently SD cards like to be power cycled in just the right manner before they will cooperate and initialize…  (I must confess that I don’t actually know about the operation of SD cards beyond what I’ve read in ChaN’s code.)  Otherwise, ACMD41 (send HCS info and activate the card INIT process) will always return with an uninitialized card.  With some cards, (a particular 2Gb card that I had lying around my house), it is acceptable to keep the card plugged in while powerup.  With the particular SHDC 32Gb card that I was using, this is not the case.

ACMD41_fail
Closeup of ACMD41 failing…

I should note that ACMD41 should eventually lead to an initialized card after a few attempts.  This is not the case with this particular (32Gb) card with this particular power cycling.

ACMD41 everywhere
Look at all the ACMD41 uninitializations!

Unfortunately, I don’t actually have a picture of the SD card working correctly…

This leaves the problem of my system clock not being correct.  ChaN set the registers to use the in-system PLL which enables the AVR core to run at 16MHz.  I forgot to set the registers in the correct manner.  (Douh!)  So I had my files play at half the speed that they were supposed to play at!  (I fixed it by making my files exactly two times faster!)  Here is a horrible self-promoting Youtube video with such fixes.

Sorry my voice is much louder than the actual sound device.  This is to be fixed with “boost converters and insanity” in an upcoming version.  It should be noted that sharp square wave edges make for very good boost conversion.  (I should also mention that I concatenate ” and insanity” to many strings that I find interesting.  I haven’t concatenated “UAV’s” and ” and insanity” for quite a while, but I may just be salty.)

You can expect a (hopefully unbearably) louder version of this along with a CdS photocell at a later date.  (Next week if we want to be very positive thinkers!)  (Maybe I’ll even add in power management and insanity!)

Leave a Reply

Your email address will not be published. Required fields are marked *