Forum Discussion

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

wm8731 AUDIO codec

Help !!!, Does anyone how to use the audio codec on 8731 with vhdl and without NIOS processor ? help me please, I need to generate a single tones with this codec.......:confused:

1 Reply

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

    Copy from a post of user trieutan ( my old nick :cool: )

    
    ROM= 16'h0c00; //power down
    ROM= 16'h0ec2; //master
    ROM= 16'h0838; //sound select
    ROM= 16'h1000; //mclk
    ROM= 16'h0017; //
    ROM= 16'h0217; //
    ROM= {8'h04,1'b0,vol}; //
    ROM= {8'h06,1'b0,vol}; //sound vol
    //ROM= 16'h1e00; //reset 
    ROM= 16'h1201;//active
    

    First and foremost you should understand the software control interface (using I2C). one write sequence require 3 bytes : 7-bit slave address ( 0x34 ), 1write bit ( 0 ), 7-bit register address, followed by 9-bit data.

    at page 46 of the datasheet, you could find Table 29:Mapping of Program Registers

    ROM[0]= 16'h0c00; //power down , R6 : enable power for all modules

    ROM[1]= 16'h0ec2; //master R7: used inverted BCLK, Master mode, I2S format, MSB-first left-1 justified

    I believe you could easily understand the rest of the configuration.

    After configuring WM8731, you need to activate it by this one

    ROM[`rom_size]= 16'h1201;//active

    btw, For the I2sound demonstration WM8731 is configured in the sidetone mode ( directly route from mic to headphone ). If you want to make the codec speak audio from PCM like wav file, you probably want to see the configuration in SDcard to music demonstration.