FPGA, SoC, And CPLD Boards And Kits
FPGA Evaluation and Development Kits
5915 Discussions

WM8731 line-in to line-out question

Altera_Forum
Honored Contributor II
1,920 Views

Hey, 

 

Did a search on the forums and couldn't find anything related to this topic. Hopefully, not a repost. Anyway, the setup: DE1 board with W8731L codec. I am pretty sure I have it configured correctly, my register settings are shown below: 

-- 

i2cControllerData <= X"34"&i2cData;  

-- data to be sent to audio code obtained via a MUX 

-- the select bits for the MUX are obtained by a mini FSM 

-- the 16-bit value for each setting can be found 

-- in table 29 and 30 on pp. 46-50 of the audio codec datasheet 

-- (on the DE1 system CD) 

with muxSelect select 

i2cData <= X"001F" when 0, -- Left input volume is maximum 

X"021F" when 1, -- Right input volume is maximum 

X"047F" when 2, -- Left output volume is maximum 

X"067F" when 3, -- Right output volume is maximum 

X"0812" when 4, -- No sidetone, DAC: on, disable mic,  

X"0A06" when 5, -- deemphasis to 48 KHz 

X"0C00" when 6, -- all on 

X"0E01" when 7, -- MSB first, left-justified, slave mode 

X"1002" when 8, -- 384 fs oversampling 

X"1201" when 9, -- activate 

X"ABCD" when others; -- should never occur 

-- 

 

But, the moment I send the master clock to the chip, my line-in gets connected to my line-out. I am pretty sure I disabled bypass mode. I checked if my description above is working by turning off the DAC, it does turn off and I don't hear anything. But once I turn on the DAC and send the master clock, my line-in gets connected to my line-out. The only obvious way to turn off the codec is to disable the master clock. I am not even reading from or writing to the ADC and DAC data registers. 

 

Any ideas as to why my line-in is getting connected my line-out by "default"? Checked datasheet for codec, DE1 User's manual etc., nothing obvious. Pretty sure I am overlooking something, don't know what. 

 

Thanks. 

 

Bart 

 

PS: Attached two cell-phone shots from my logic analyzer. The first one shows the X"34001F" being transmitted correctly and the codec acknowledging transfer. The next pic. shows all 10 data packets on the i2c bus. So, I am pretty sure the timing is also correct.
0 Kudos
11 Replies
Altera_Forum
Honored Contributor II
715 Views

Are you sure, that you didn't connect a loopback from ADCDAT to DACDAT?

0 Kudos
Altera_Forum
Honored Contributor II
715 Views

 

--- Quote Start ---  

Are you sure, that you didn't connect a loopback from ADCDAT to DACDAT? 

--- Quote End ---  

 

 

Yup, pretty sure I didn't connect a loopback. Anyway, its no biggie, just interesting behavior. I did get the audio codec to properly with loopback, pure tune out etc. 

 

Bart
0 Kudos
Altera_Forum
Honored Contributor II
715 Views

i need audio codec in VHDL for altera de2 board

0 Kudos
Altera_Forum
Honored Contributor II
715 Views

 

--- Quote Start ---  

i need audio codec in VHDL for altera de2 board 

--- Quote End ---  

 

 

 

Hello, I need reference of audio codec in VHDL for altera DE2 board as well. Anyone can help?  

Your help will be much appreciated :)
0 Kudos
Altera_Forum
Honored Contributor II
715 Views

The reference design that we have for the DE1 board : 

 

http://myweb.msoe.edu/muthuswamy/digitalsystemsdesign/ee3921/audio/vhdl/ 

 

also works for the DE2 board because it is the same audio codec on both boards. You just have to correctly re-assign the top-level pin assignments. 

 

Good luck. 

 

Bart
0 Kudos
Altera_Forum
Honored Contributor II
715 Views

Hi, 

 

Thanks for sending the link. Will look through it and will need your help again if i have problem 'digesting' the code :) 

Appreciate your help ! Thanks again :) 

 

Regards 

HJ.C
0 Kudos
Altera_Forum
Honored Contributor II
715 Views

 

--- Quote Start ---  

The reference design that we have for the DE1 board : 

 

http://myweb.msoe.edu/muthuswamy/digitalsystemsdesign/ee3921/audio/vhdl/ 

 

also works for the DE2 board because it is the same audio codec on both boards. You just have to correctly re-assign the top-level pin assignments. 

 

Good luck. 

 

Bart 

--- Quote End ---  

 

 

Hi, 

 

Could i have the reference code (in VHDL) again?  

Thank you very much :) 

 

HJ.C
0 Kudos
Altera_Forum
Honored Contributor II
715 Views

thanks Bart

0 Kudos
Altera_Forum
Honored Contributor II
715 Views

 

--- Quote Start ---  

thanks Bart 

--- Quote End ---  

 

 

Hey, 

 

Unfortunately, the website has been removed and it will take me a couple of weeks to get the new site up since I am traveling. BUT I have attached the source and documentation to this thread. Again note that the design is for the DE1 board. 

 

Good luck. 

 

Bart
0 Kudos
Altera_Forum
Honored Contributor II
715 Views

Thank you so much :) 

I will try to understand the code and ask question if i encounter problems. Thanks once again !
0 Kudos
Altera_Forum
Honored Contributor II
715 Views

 

--- Quote Start ---  

Hey, 

 

Unfortunately, the website has been removed and it will take me a couple of weeks to get the new site up since I am traveling. BUT I have attached the source and documentation to this thread. Again note that the design is for the DE1 board. 

 

Good luck. 

 

Bart 

--- Quote End ---  

 

 

Hi Bart, thanks for quick reply :) I’m designing my own LPF Using Hamming window with passband edge of 0.5Khz, sampling frequency of 10Khz. I want to demonstrate a real time filtering on audio signal on Altera’s DE2 board. To achieve that, i need to input music signal to audio codec (WM8731) through line-in input, route the signal to FPGA (my filter is downloaded in it) for signal filtering purpose and then obtained the filtered music signal out from line-out of audio codec.  

 

I have some questions on configuring the codec chip.  

 

Problems Encountered (Wolfson Audio Codec) 

(1) Register : R1, R2, R3, R4 for Left Line In, Right Line In, Left Headphone out, Right Headphone Out respectively.  

Is it good if i set the volume control to the default value?  

 

(2) Register R5 ((Digital Audio Path Control) 

I’m using my own LPF with passband edge at 0.5Khz, sampling frequency of 10Khz (downloaded to the FPGA-cycloneII). In this case, should I disable the high pass filter that wolfson codec provides? If it should be disabled, the de-emphasis control should be disabled too?  

(Based on WM8731 datasheet page55, Figure 54) 

 

Thanks a lot for you kind help :D
0 Kudos
Reply