Firmware
Tuesday July 29th, 2008 12:48 PM

The microcontroller is driven by a program written in C using the C compiler from CCS. Some files have been created with different functions that control every process required to play an MP3 file. These files and their functions are described here.

VS1011e Driver

This source file contains almost every function needed to communicate with the MP3 decoder.
There are two different communication buses between the microcontroller and the MP3 decoder chip. The first one is an SPI bus used to send commands, like initialize the decoder, set the volume, etc. This bus is called XCS.
The other one is also an SPI bus in which MP3 data is sent to the MP3 decoder IC to start the decoding process. This bus is called XDCS.
In this file you can find functions created to control the communication in both buses. Some functions mimic the SPI protocol by software and some of them use the built in PIC’s SPI module.

The MP3 decoding process is as follow:

  1. SD memory is selected.
  2. We read the MP3 file position inside the SD memory using the FAT32 driver.
  3. The first sector from the MP3 file is obtained.
  4. A read command is sent to the SD memory with the sector obtained before.
  5. SD memory is deselected.
  6. Data bus from decoder chip is selected.
  7. Memory sends back MP3 data with every clock cycle made to the SPI bus and this data is “listened” by the data bus from the decoder chip because it is the selected device.
  8. Data bus from decoder chip is deselected.
  9. The next sector from the MP3 file is obtained.
  10. We go back to step 4 until every sector of the MP3 file is sent.

MMC Driver

This source file contains all the functions needed to establish a communication with an MMC/SD memory. Their main functions are the memory initialization process in SPI mode, and obtaining sectors from it.

FAT32 Driver

The MP3 player support data in FAT32 format. This file system from Microsoft is widely known and supported by many devices. Also, almost every existent operative system support reading and writing information in this format.
This source file contains functions that allow reading MP3 files from the FAT32 file system.

Downloads

The source code and other important files for the MP3 player building process could be found in the Downloads section.