Figure 6.14. Software Stack of the SD music player demonstration.
The audio chip should be configured before sending audio signal to the audio chip. The main program uses I2C protocol to configure the audio chip working in master mode, the audio interface as I2S with 16-bits per channel, and sampling rate according to the wave file content. In audio playing loop, the main program reads 512-byte audio data from the SD card, and then writes the data to DAC FIFO in the Audio Controller. Before writing the data to the FIFO, the program have to make sure the FIFO is not full. The design also mixes the audio signal from the microphone-in and line-in for the Karaoke-style effects by enabling the BYPASS and SITETONE functions in the audio chip.
Finally, users can obtain the status of the SD music player from the 2x16-LCD module, the 7 segment display and the LEDs. The top and bottom row of the LCD module will display the file name of the music that is playing on the DE2-70 board and the value of music volume, respectively. The 7 segments display will show how long the music file has been played. The LED will indicate the audio signal strength.
Demonstration Setup, File Locations, and Instructions
•Project directory: DE2_70_SD_Card_Audio_Player
•Bit stream used: DE2_70_SD_Card_Audio_Player.sof
•Nios II Workspace: DE2_70_SD_Card_Audio_Player\Software
•Format your SD card into FAT16 format
•Put the played wave files to the root directory of the SD card. The provided wave files must have a sample rate of either 96K, 48K, 44.1K, 32K, or 8K. Besides, the wave files must be stereo and 16 bits per channel. Also, the file name must be short filename.
•Load the bitstream into the FPGA on the
•Run the Nios II IDE under the workspace DE2_70_SD_Card_Audio_Playe\Software
•Connect a headset or speaker to the
82