Forum Discussion
Altera_Forum
Honored Contributor
12 years agoI'm not aware of the specifics of the DE1 demo you refer to. However, a few simple questions will help identify what exists in that project that may help you. I will say that, if you are new to Verilog - as you suggest, this solution may become quite involved.
Firstly, and most importantly, are you hoping to create audio files on the SD, that can be read by another device - such as a PC? If so, you will need a file system on the SD card that the other device will recognise. So, you will 'need' a Nios processor running an operating system (OS) capable of creating a new file system or working with an existing one, already on the SD card. Note: I highlight 'need' in respect of the Nios processor. You could consider managing a file system without but we're then heading to a further level of complexity that someone new to verilog, I'd suggest, might be best avoiding. Whereas, Nios code for creating and managing a file system all exists within Eclipse for you to use. So, having created the file system you will need to write software to read in the samples from the audio CODEC, create (in a RAM local to Nios) the file you wish to store and finally have the OS write the file to the file system on the SD card. Keep it simple here. WAV files are straightforward. However, if you're after MP3 then we're opening another level of complexity, specifically in the way the compression is implemented. Assuming you do not need to go this route and you are simply trying, as you originally suggested, to save the raw audio data to the SD card, then this can be done entirely in your own code and doesn't need a Nios, OS or file system. Without the file system you're moving the complexity of recovering the audio data to the device that needs to read it. This may simply be the same DE1 platform but is equally possible on a PC or Linux machine. In this case we're heading back to the simplified 3 stage answer I originally gave. I don't know what help the DE1 demo will offer you in this respect but I would hope it implements the low level physical interfaces (phys) to the audio CODEC and SD card for you to use. That should make things a great deal simpler for you. Read in the audio samples from the CODEC, format them in a way you see fit and write them, using the SPI interface, to the SD card. Finally, SD card interface protocols. Yes, SD cards support a nibble (4-bit) wide interface that is, simplistically, 4 times faster than the original SPI (1-bit) interface that they supported. However, again, the 4-bit interface is far more involved. Details of this interface are available from the SD card consortium - details which you'd be required to buy. I somewhat doubt the DE1 demo project implements this protocol, preferring the single bit SPI protocol. This is simple by comparison and more than sufficient for the purposes of storing audio data or managing the file system discussed. Cheers, Alex