(Original) how to design an SD card WAV player? (SOC) (Quartus II)

Source: Internet
Author: User
Tags bmp image

Abstract
In the previous blog, we learned how to develop a hardware controller and add the software API to enable the Nios II software to effectively control the hardware, and enable the seven-segment provisioner from 0 to 100. Maybe the same student asked, "I want to allow seven display devices to grow from 0 to 100. I used hardware to develop the seven display devices, and the entire list of OpenGL programs could not exceed 50 lines, why is it necessary to use hardware design in the weekly chapter? We also want to learn more about the systems such as the system-based systems (systems) builder, aveon bus, and niosii, and increase the speed of reading and writing. The hardware architecture is also slower than the hardware architecture. The resources used by FPGA (LE) it's also much more hardware than the hacker !! 』

This lab is a typical example of hardware design. You will feel the power of hardware design.

Introduction
Use environment: Quartus II 8.1 + NiO II eds 8.1 + DE2-70 (Cyclone II ep2c70f896c6n)

These four labs were originally designed together, starting from 0, beginners are gradually familiar with Quartus II, systems builder, niosii eds, aveon bus slave, and aveon bus master.

(Original) how to build a system that can run μC/DE2-70 on the OS-II with the system? (SOC) (Quartus II)
(Original) how to design a seven-segment controller? (SOC) (Quartus II)
(Original) how to design an SD card WAV player? (SOC) (Quartus II)
(Original) how to design a digital photo frame? (SOC) (Quartus II)

(This tutorial is taken from the terasic tutorial CD and is not a personal design. I just want to modify it a little)

 

System Architecture

Hard part
Export lab3_files.7z de2_70_sd_card_audio_player into C: \ DE2-70

Step 1:
Add I2C

Added i2c_sclk and i2c_sdat.

In fact, it is only Pio

Step 2:
Add sdcard

(Demo how to insert an SD card)

In fact, it is only Pio

Step 3:
Join Audio Controller

Altera does not have an internal Audio Controller. Currently, the controller is provided by terasic,Note that the CLK is 18 MHz, which is different from the other week..

Audio Controller contains source code for research.

Step 4:
Add a 7-segment annotator

Altera does not have a 7-segment Internal Controller. Currently, the controller is provided by terasic. In fact, how does this controller and (original controller) Design a 7-segment internal controller? (SOC) (Quartus II) (Systems builder) (System Controller) (DE2-70) our own controllers are exactly the same.

Step 5:
FPGA builder generate
Quartus II
Programmer integrate FPGA

Simplified part

Step 6:
Import de2_70_sd_card_audio_player and de2_70_sd_card_audio_player_syslib_0

Import using the same methodDe2_70_sd_card_audio_player_syslib_0.

Step 7:
Modify main. c

Main. C/C

PendingChange 265 rows and 270 rows

  Bsuccess  =  Fat_fileopen (  &  Gwaveplay. hfile, pfilename );
If ( ! Bsuccess)
Demo_printf ( " Wave file open fail. \ n " );

If (Bsuccess ){
Bsuccess = Fat_fileread ( & Gwaveplay. hfile, gwaveplay. szbuf, wave_buf_size );

Fat_fileopen () and fat_fileread () are the APIS provided by fatfilesystem. H. These two functions are used to retrieve the wav files in the SD card.

Step 8:
Change GCC strongswan to release Mode

This is actually a big trick, and many people finally fail because this step is missing, which is not mentioned by either Altera or terasic.

Step 9:
Run as hardware

Lab3_wav1.7z1_lab3_wav2.7z: Put it on the SD card. If the success is completed, you will be able to hear the "" of "』.

Operation Method
Key1
: Volumn down
Key2: Volumn up
Key3: Next song
Key4: Repeat current song

The LED changes the size of the root audio.

Download the complete program
Lab3_files.7z (an unfinished semi-finished product can be completed step by step based on this article)
Lab3_wav1.7z (WAV runtime)
Lab3_wav2.7z (WAV runtime)
De2_70_sd_card_audio_player.7z (final result)

Question
(This is my homework for students at the time. If you are interested, you can do it yourself)

1. Switch GCC to debug mode. How can this problem be solved? And why does the debug mode have this result.

2. Use the hello μC/OS-II Project template of lab 1 to add μ c/OS-II to this example.

3. Can I use strong hardware to implement this example (I only use OpenGL instead of C )? Let's talk about your thoughts.

Conclusion
This lab is modified by the example de2_70_sd_card_audio_player of the DE2-70. Due to the large number of hardware Code, there is no one-to-one solution. Please study it on your own and focus on how to use it.Sdcarddriver. hAndFatfilesystem. hIn this example, the Digital Photo Frame of the next lab uses this technique to import the BMP image on the SD card to the LCD, make a digital photo frame.

See also

(Original) how to build a system that can run μC/DE2-70 on the OS-II with the system? (SOC) (Quartus II)
(Original) how to design a seven-segment controller? (SOC) (Quartus II)
(Original) how to design an SD card WAV player? (SOC) (Quartus II)
(Original) how to design a digital photo frame? (SOC) (Quartus II)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.