Jump to content
SiskinEDGE

SD Media Player with FAT16

Recommended Posts

 

Here is a video of the music player in action:



The code has the following functionality:
Initilise the FAT16 filesystem from an SD card in a single command - ThinFAT_Init();
Open Files on an SD card and allow you to test each filename with a callback
Index Files by useing the same command as to open them with a callback
returns data on if the filestream is active
returns data on how far the file has been read through
callback for when end of the file is reached
Open Folders on an SD card - Untested

and limitations:
uses 54 bytes of ram approx
dosen't support fragmented files
reads file end to closest sector, not byte (for performance reasons)
reads FAT16 filesystems, not FAT32
has no support for long filenames (it would be silly on these chips)
I dont know if this fits within a 2K flash

when implementing this on your own chip keep in mind you change which wire is the Chip select in the MMC.h file

it is based on the DIY Life Talking MSP430 Project.

It has been designed for the MSP430G2352 but if you remove the CCR2 References it should work for other projects easily.

Wireing:
P1.2 - TA0.1
P1.3 - Input for Playing and Changing Music File
P1.4 - TA0.2
P1.5 - SMCLK out - SD Card Pin 5
P1.6 - SDO - SD Card Pin 2 MOSI
P1.7 - SDA - SD Card Pin 7 MISO
P2.7 - CS - SD Card Pin 1 Card Select
VCC - SD Card Pin 3,6
Ground - SD Card Pin 4

the pins on the SD card are counted from the first contact after the recessed contact across, the recessed one is 9. you can check on wikipedia when your unsure.

SD Media Player.zip

Share this post


Link to post
Share on other sites

I was trying to check our your code, but the zip file appears corrupt. I couldn't open it with winrar or windows explorer. Any chance you could re-compress and re-upload?

 

thnx,

reza

Share this post


Link to post
Share on other sites
I was trying to check our your code, but the zip file appears corrupt. I couldn't open it with winrar or windows explorer.

 

I also had problems extracting the files using Windows 7 explorer. However, the unzip util in the Cygwin package seemed to work fine.

 

-rick

Share this post


Link to post
Share on other sites

Very cool project! Must have been tricky getting nice clean audio using a breadboard, always had noise issues when doing that. I've always wanted to do this at some point in time. Thanks for sharing!

Share this post


Link to post
Share on other sites

I'm looking into write support at the moment, dose anyone know any examples of writing to a SD card on the MSP430?

also with the SD card sheild it will be necessary in order to do proper write support to have some way to buffer 512 bytes at a time otherwise anything that was on the block previously would be erased. currently there are only two options about write support that dont need a 512 byte buffer:

A) overwrite a empty pre-made container file's space

B) save to a subdirectory, erase all other entrys in there and write one new file in there and write to a sector of empty space in the FAT (if avilable)

 

I've still to work out how to write to the SD card a byte at a time through SPI as the MSP cant buffer a whole sector. I'm gonna look into some kind of ram chip or something that could do this mabey try and draw up something that could be useful to the SD booster pack developer people.

 

might be worth a shot to try and do this in assembly or RTSC or something to save on flash space so all the value line chips can do the FAT16 thing as it's only just above the 2K flash limit on most of the value line chips at the moment.

Share this post


Link to post
Share on other sites

I'd most certainly as well be interested in byte to byte write support. Let us know what you find out! Regarding memory space, the new launchpads ship with the G2553 which has 16KB of flash memory space. Considering this is becoming a very common value line chip I wouldn't worry too much about the 2kb msp430s. Overall, i'd just be nice to get something to work =)

 

 

I'm looking into write support at the moment, dose anyone know any examples of writing to a SD card on the MSP430?

also with the SD card sheild it will be necessary in order to do proper write support to have some way to buffer 512 bytes at a time otherwise anything that was on the block previously would be erased. currently there are only two options about write support that dont need a 512 byte buffer:

A) overwrite a empty pre-made container file's space

B) save to a subdirectory, erase all other entrys in there and write one new file in there and write to a sector of empty space in the FAT (if avilable)

 

I've still to work out how to write to the SD card a byte at a time through SPI as the MSP cant buffer a whole sector. I'm gonna look into some kind of ram chip or something that could do this mabey try and draw up something that could be useful to the SD booster pack developer people.

 

might be worth a shot to try and do this in assembly or RTSC or something to save on flash space so all the value line chips can do the FAT16 thing as it's only just above the 2K flash limit on most of the value line chips at the moment.

Share this post


Link to post
Share on other sites

I don't know why, but my microSD died, I used microSD to SD adapter, double checked everything, but no success. Then I removed it, and non of readers detect it anymore.

Share this post


Link to post
Share on other sites

you should check where you plugged in each of the wires on the SD card and also the voltge you was feeding your launchpad, not every SD card can handle the max 3.6 volts that the MSP430 can. I've never run it above 3V myself. with a micro-SD I think they use a lot less voltage and can go as low as 1.8V. it's porbably likely you've killed your card, before you get another just check how You've got it all wired up and make sure you got a capcitor on your SD card beetween Vcc and ground.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...