05-19-2011 08:54 AM
I have a strange problem with the AD1981B codec on Virtex5 board.
I had to create a simple audio controller for onboard codec. Codec gets audio from line in and microphone and then send this signal to headphones mixed together. Codec sends audio data to controller by AC-Link sdata in and back to codec by stream sdata_out.
I have written a controller in VHDL for controlling the codec and clock signal is provided by codec. That all is working well except the fact that the codec will not react to commands written to its control registers as expected. Ie the codec will not mute inputs outputs when needed.
For example in order to mute headphones i gave the following command ; X"048000"; meaning HP volume control register 04 should have value 8000 (each digit represents 4 bits in binary). The register itself is 16 bits. Meaning that bit 15 of that register is 1 wich should mute headphones but that did not happen. Sound was still coming trough. I have tried the same for line in, mic in and PCM out but with similar results.
I have read back the values of configured registers and they were all as i expected them to be meaning that configuration data was written to registers correctly.
I have disconnected then bitstream from controller to codec and after that codec was still processing audio meaning that audio had to leak trough inside the codec. But at this time streams line in, mic in and PCM out to the mixer were all muted.
The datasheet i used is from the manufacturer's AnalogDevices site so it also should be accurate.
Has someone had similar problems as i am running out of ideas.
05-23-2011 11:55 AM
A little update.
I have been trying to track down the issue and now it has changed so that the codec will react to register reads but it will not update register value when writing. Timing has been tested by simulation and it can be seen that data sent by controller is valid and sent correctly.
To make matters more interesting then the i have found a few registers that the codec will not even let to read, it is register 1C.
Codec does not go to anykind of power saving mode.
I am starting to suspect that the codec is faulty and at the moment trying to find another Virtex 5 to test the design.
05-28-2011 05:23 AM
Hello, and sorry for my english.
Three days ago I start working with at91sam9m10 and ad1981b, use keil and examples for at91sam9m10ek.
1. Codec don`t work on 24.576 MHz clock, but work on external XTL_IN clock (I use programmable clock from sam9).
That because codec start work in test mode.
from "AC ‘97 Component Specification":
AC ‘97 has two test modes. One is for ATE in circuit test and the other is for vendor-specific tests. All AC-link
signals are normally low through the trailing edge of RESET#. When coming out of RESET, an AC ‘97 Codec
enters the ATE in circuit test mode if SDATA_OUT is sampled high at the trailing edge of RESET#, and enters the
vendor-specific test mode if SYNC is sampled high at the trailing edge of RESET#.
These cases will not occur during typical operating conditions.
Regardless of the test mode, the AC ‘97 Controller must issue a cold reset to resume normal operation of the AC ‘97
I add executing "cold reset" before initialization controller peripheral and codec start work with 24.576 MHz clock.
2. Codec will not update register value when writing.
In included file ad1981b.h:
#define AD1981B_CMD(cmd, data) (((cmd < 16) & AT91C_AC97C_CADDR) | data)
That macros don`t work properly, and I change it on AC97C_WriteCodec() function by replacing:
AC97C_Transfer(AC97C_CODEC_TRANSFER, (unsigned char *) pInitBuffer_ad1981, 11, 0, 0);
command = AD1981B_CMD(AD1981B_REC_SEL, 0x0505);
AC97C_Transfer(AC97C_CODEC_TRANSFER, (unsigned char *) &command, 1, 0, 0);
In PlayRecord() and StartRecordind() functions I replace "7000" on "0x7000".
06-18-2011 03:56 PM
Thank you for your reply.
I have managed to solve this problem. The issue was caused by instability of reset signal for AD1981B. For some reason ChipScope showed it only once and after that was showing as if the reset signal was stable. I corrected the instability problem and AD1981B started working and responding normally.