Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
12 years ago

DE1 saving audio into the SD card

Hi guys,

i am interested to know, how do i save some real time audio recording into the SD card with DE1.

Thank you and appreciate any help for you guys :D

9 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Simplistically:

    1) Configure the Audio CODEC via I2C

    2) Buffer the incoming ADC data samples in the FPGA

    3) Write the data to the SD card via an SPI interface.

    I suspect that may not offer you all the answers you're hoping for. For that (in this forum at least) you need to ask questions that are more targeted, with details as to what it is you're hoping to do...
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    I think you could also use another SD card protocol, but they are a bit more complicated than spi.

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    --- Quote Start ---

    Simplistically:

    1) Configure the Audio CODEC via I2C

    2) Buffer the incoming ADC data samples in the FPGA

    3) Write the data to the SD card via an SPI interface.

    I suspect that may not offer you all the answers you're hoping for. For that (in this forum at least) you need to ask questions that are more targeted, with details as to what it is you're hoping to do...

    --- Quote End ---

    Thanks for the reply a_x_h_75. Sorry for not making clear my question. Actually i am working on the current demo program that come with the DE1. (DE1_i2sound). It work exactly like a karaoke machine, but it doesn't have the feature of saving the audio data. What i want to do is to build on this current demo DE1_i2sound to have an option to save the audio file to the SD card. But i dont know how to do it, as i am very new to Altera and verilog. Any help will be deeply appreciated :D

    :D
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    --- Quote Start ---

    I think you could also use another SD card protocol, but they are a bit more complicated than spi.

    --- Quote End ---

    Thanks for the reply PietervanderStar.

    Do you mind explaining it in more details? I'm new with altera and verilog :(

    Thanks ! :D
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    sure no problem,

    apart from the SPI protocol the SD Card standard specifies a SD card 1-bit and an SD card 4 bit protocol. These are, as far as I know, more complicated, but faster. I found one or two IP-cores on open cores but I am trying to write one myself. And I can tell you it's complicated. you can find more about the protocols etc. here: https://www.sdcard.org/downloads/pls/
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    I'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
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    i use DE1 board i want to realize an audio project which i want to recorder my voice with the microphone in the sd card and then i want to listen to the voice which is recorder in the sd card

    please any help i want a code in vhdl

    i have a proposition that allows to speack in the mic and in the same time i listen to my self with the headphone . this part works very well i configure the audio codec via i2c and it works very well but i want to recorder the voice in the sd card if i press to key1 and then if i press key2 i listen to the voice from the sd card please i want some help

    this is my code

    ANY HELP
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Hi,

    i want to ask you if you have solved the problem and you can recording into SD CARD with de1 ??? if yes please could you help me
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    --- Quote Start ---

    Hi guys,

    i am interested to know, how do i save some real time audio recording into the SD card with DE1.

    Thank you and appreciate any help for you guys :D

    --- Quote End ---

    Hi,

    i want to ask you if you have solved the problem and you can recording into SD CARD with de1 ??? if yes please could you help m