School and work have really been consuming most of my life since September, but this past week or so I’ve found some time to pick up where I left off with the MP3 player.
My FAT16 driver is now working a bit better. I fixed a few annoying bugs and have updated my read method so that I can tell when I’m at the end of a file. I’ve been working on a newer version of the read method that is a bit more useful. Previously, in one method it would read the entire file and output the data directly to the LCD, 32 characters at a time (overwriting the previously read data every sector). This is nifty as a proof of concept but not really too useful.
Instead, I’m working on a new version of the read routine that reads a sector of the file, copies it to a user specified buffer, updates some indecies in the file structure, and then returns the total length of the data returned (which is always 512 bytes until the last chunk). So you call the read method multiple times until you’re at the end of the file. This will let me actually *use* the data instead of immediately throwing it away. I decided to use a second buffer (in addition to the physical layer buffer that stores data straight from the SD card) so that I don’t have to worry about overwriting data with future SD read requests. This isn’t so important now when I’m only doing one thing at a time, but in the final version I may want to be able to browse the SD card while playing an MP3 (for instance).
The MP3 decoder has been interfaced for a while, but I’m having a bit of difficulty configuring it. It requires a special sequence of writes to configure the decoder with details on the clock and other undocumented settings (over 2000 such writes). Right now I’m storing the file in the root directory of the SD card and will open the file, read its contents, and transfer it over to the decoder. Eventually I may just store this configuration data in ROM, but for now it’s a good opportunity to test my FAT driver. Once I’ve got the configuration file sent over, I’ll be able to send the RUN command and hopefully the decoder will start asking for data.
I’ve also been playing around with EAGLE a bit, drawing up my schematic and working on a PCB design. It’s really nowhere near ready yet, but I thought I’d mention it. I’ll post some images of the schematic and PCB layout in the next day or so.