Forum Discussion

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

Question about sample rate of audio codec WM8731 on DE2

hi, everyone.

I have read code from the DE2 I2Sound Demonstration and compared with WM7831 datasheet. Everything is quite clear, except the setting of sample rate.

According to the datasheet, when using sample rate of 48 khz, mclk frequency is required to be 12.288 mhz.

http://hahoangthach.googlepages.com/sample.jpg

but the demonstration provides the clock of 25 mhz ( 50/2 AUD_XCK pin). I have also check the configure of CLKIDIV2 in sampling control register, core clock is also MCLK ( not divided by 2 ).

Could you please explain me why ?? Because I intend to use the sample rate of 44.1 Khz and don't know what frequency for MCLK.

http://hahoangthach.googlepages.com/sample2.jpg

15 Replies

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

    Hi friend, don't worry I've fixed the problem.

    I run the program from the NIOS 2 IDE and works !

    Thank you so much
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    hi everyone,

    I'm trying to transmit audio data with wireless devices, I take a look on the DE1_i2sound project on DE1 cd, I saw that AUD_DACLRCK pin assigned to AUD_ADCDAT pin if I assign AUD_DACLRCK to input of my wireless tranciever and assign AUD_ADCDAT to my receiver will that work? or should I work on I2C controller?
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    --- Quote Start ---

    hi everyone,

    I'm trying to transmit audio data with wireless devices, I take a look on the DE1_i2sound project on DE1 cd, I saw that AUD_DACLRCK pin assigned to AUD_ADCDAT pin if I assign AUD_DACLRCK to input of my wireless tranciever and assign AUD_ADCDAT to my receiver will that work? or should I work on I2C controller?

    --- Quote End ---

    I dont know about DE1_i2sound on DE1 cd, but I think it is the same with one on DE2. In i2sound Demo, it doesnt matter what AUD_ADCDAT is assigned to, it just simply configures the WM8731 codec so that line input from mic is connected to speaker ( by pass or side tone mode - i dont remember :p ).

    It is not clear about your project, whether DE1 is source or sink. If you want DE1 could play sound from other devices via wireless, make sure that devices line-out is transmitted to AUD_ADCDAT. You also need information such as sampling frequency, bits per sample to generate correctly BCLK, AUD_DACLRCK ....etc.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Chào anh !

    Tôi vừa mới bắt đầu tìm hiểu về DE1 của Altera . Chủ đề là thiết kế một game trên DE1 . Tôi đang vướng mắc về phần audio codec của WM8731 . Không biết anh có phiền khi chỉ dẫn cho tôi về phần này không ? Như là tôi sẽ bắt đầu từ đâu và làm những cái gì ? Cảm ơn anh !

    Nguyễn Văn Hiến

    mrnguyenhien@gmail.com
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    --- Quote Start ---

    It's divided by 4, not by 2. The output clock changes state every second pulse of the input clock. So the full cycle is every four incoming clock pulses. Simulate it for better understanding.

    Also, as you can see in the table, it doesn't have to be 12.288 MHz. It can also be 18.432 MHz. It depends on the BOSR bit.

    Instead of using a divided clock, you can use a PLL to get a clock closer to the nominal value.

    --- Quote End ---

    Hi,

    I'm trying to configure WM8731 Codec on DE2 board as an ADC. But i have no idea how the whole thing works. I'd like to pump in music through WM8731 Codec, and pass the music signal to FPGA (I have designed a LPF and program in cyclone II), then obtain the filtered music signal through WM8731 Codec again. The purpose that using WM8731 Codec is just to demo the audio signal filtering process in real time. I'd like to disable the filtering function that provided by WM8731 Codec. Other than configuring WM8731 Codec, i will need another file for configuring i2c so that WM8731 Codec can communicate with FPGA (cyclone II) ? Am i rite? My filter is designed to have sampling frequency of 10Khz, what frequency should i use for master clock?

    Please guide me through this. If possible, i'd like to have a copy of codes as reference. I'm just a beginner. Your help will be appreciated :)