Forum Discussion

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

WM8731 line-in to line-out question

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.

11 Replies

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

    --- 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