Altera_Forum
Honored Contributor
15 years agoAudio Codec Problems DE2 Board
Hi,
I've been having some problems using the Audio Codec on the DE2 board. I've configured the board using I2C, to use the DAC at 8kHz sampling frequency, 16 bits sample size, to use Left-Justified output mode, and to be in Master mode (so I don't have to bother generating BCLK and DACLRC). To play samples through the audio codec, I first store LDATA (data for the left channel) in a register, and do the same with the RDATA. On the falling edge of BCLK, I shift LDATA if DACLRC is high, or I shift RDATA if DACLRC is low. My AUD_DAT either sends the MSB of LDATA or RDATA depending on if DACLRC is high or low. When I encounter a rising edge on DACLRC, I know that the current LDATA and RDATA has finished shifting, and I assert a signal which lets the outside world know that a new sample should be loaded into the LDATA and RDATA inputs. Once these inputs are loaded, I again begin the shifting process until the next rising edge of DACLRC. This process works for a simple ramp, where I feed LDATA and RDATA that simply start from 0x0000 and go to 0xFFFF. I've taken a few 8kHz .wav files, extracted the first non-header 2048 16-bit words with some simple C, and stored them in a ROM, and try to play new values. But whenever I do this, I just get garbage for sound. Am I doing something really wrong here?