Sorry, you need to enable JavaScript to visit this website.

Playing with the ADAU1761 audio codec

Unsolved
17 posts / 0 new
hamster's picture
hamster
Junior(0)
Playing with the ADAU1761 audio codec

I've been attempting to use the ADAU1761 chip, just using I2S audio stream generated by the PL section.

After a bit of playing I've at least got a 440Hz tone out of one channel of the headphones, so I'm slowly getting there.

I'm working towards at least a I2S loopback for playing with digital filters (e.g. Line In -> I2S -> PL -> I2S -> Line Out + Headphones).

Anyhow, in the spirit of release early, release often you can find the source at http://hamsterworks.co.nz/mediawiki/index.php/Zedboard_Audio

hamster's picture
hamster
Junior(0)
Fix for both audio channels.

Hi again, just realised why audio is in one channel - the write to register 0x401F should be going to 0x401E.

Will test and update the archive later today.

hamster's picture
hamster
Junior(0)
Getting somewhere.

I've found some time to play, and now have an updated version that implements the full LineIn => ADC => I2S => Zynq's PL => I2S => DAC => Headphone.

So I can now start to play around with DSP filters for audio within the PL - I can just plug my iPod into Line In and listen to the result on the Headphone socket or using the Line Out

hamster's picture
hamster
Junior(0)
Finally got something useful.

Project now complete. LineIn / filters in Zynq's fabric / Headphone Out.

Overall gain should be about 0db, but haven't metered it.

Filter can be selected by SW0 and SW1, and are either
- Straight through
- 8 point moving average (6kHz low pass)
- 16 point moving average (3kHz low pass)
- 32 point moving average (1.5kHz low pass)

Warning - The design cuts straight between filters, so you will hear loud switching noise at full volume. So take you ear-buds out when playing with the switches

http://hamsterworks.co.nz/mediawiki/index.php/Zedboard_Audio

hamster's picture
hamster
Junior(0)
Much better version uploaded.

I've added the following enhancements:
- Full 24-bit per channel samples are used
- Codec mute is turned on when switching filters, reducing painful pops.
- All the messy hardware specific bits are wrapped into one component.

fzivkovi's picture
fzivkovi
Junior(0)
I'd like to give it a try

Hello,
How would I set up your project to see it work? I've got a zedboard and am using Vivado. I would guess that I import the vhdl and c code, somewhere along the line I'd need to setup a lot of other variables?
Clearly I'm a beginner.
Thank you very much for any help!

Qoya's picture
Qoya
Junior(0)
A little help about implementation

Hello hamster,
I read your very good tutorial. Although it helped me a lot to unterstand basics, I'd like a little help about how to set up the audio codec whith Vivado. So far, I think that I have to use both PS and PL to do the trick. PL (a .vhdl file) to tell how the I2S signal have to be processed and PS to configure the codec with a .c code file. I guess that there are a lot ow ways to do this but could this method be right ? As you can guess, I'm a little bit confused about the mechanism more than the details :-)

Thank you for your help

duane's picture
duane
Junior(0)
No CPU interface?

Hmm - looking at the VHDL - (and I'm not vhdl/verilog guy) - the VHDL seems to be standalone, and does not have an interface the processor can access. Is that correct?

I'm looking for a memory access port, where I can control the I2C signal and write IIS audio data - I don't see that.

Thanks.

abhijeetb89's picture
abhijeetb89
Junior(0)
Configuration of Audio Codec

Hello hamster,

I am beginner for zedbaord.

I am trying to execute your project "Zedboard dsp base project.zip". But I did not get any output on headphone.

There is file "i3c2program" which is configuration file for codec. But I do not know how to use this file. Will it automatically get configured once I do synthesis, generate programming file and program zedboard.

Thanks.

hamster's picture
hamster
Junior(0)
Sorry for the slow reply.

Hi, Been away on holiday.

1) Yes - it is a PL only design - jsut to test the codec. If anybody wants to adapt it to interface with the PS, support VDMA, write a linux driver and so on then you will need to do a lot of work.

The I3C2 program is already included - it is used to generate a script for a I2C state machine/controller that does the actual work - see http://hamsterworks.co.nz/mediawiki/index.php/I3C2

So if you do connect up the I2C port to the PS, the script will give you a starting point for register settings required to configure the codec to send/receive I2S.

Mike

crkim's picture
crkim
Junior(0)
Question about compiler

Hello,

I compiled your enhanced version of i3c2program using assembler.c linked at your site, but it dose not worked. Actually, I try to check out assembler since I'd like to change configuration registers by modifying your i2c3program. Could you let me know how to get expected output files(coe, vhd)?

Thanks

Chorong Kim

abhijeetb89's picture
abhijeetb89
Junior(0)
Unable to hear sound

Hi hamster,

Thank you for reply. I programmed zedboard but only humming is coming out and not what I speak in microphone. When I select different filters, I can notice the reduced noise. It means filter part is working. Can you suggest some solution?

Thanks again.

hamster's picture
hamster
Junior(0)
As a test source....

IIRC I was just using an iPod plugged into 'Line In' - if you have a look on the Zedboard's schematics the 'Line In' is the Codec's "AUX" signal, and the Mic In is connected to the Codec's 'Line In'

abhijeetb89's picture
abhijeetb89
Junior(0)
configuring codec as 16 bits

Hi hamster,
I want to configure codec as 16 bit codec. For that do I need to change any register setting? Or do I have to change clock frequency? In datasheet I could see that at different number of clocks, we get different number of bits. For example, for 16 bit data it is given as 16 clocks.

Can you suggest any solution?

Thanks in advance.

aurojyoti's picture
aurojyoti
Junior(0)
Gain is too low

We tested the code and at first we couldn't hear anything. But we could hear some hissing sounds when blowing into the mic. The solution is to increase the gain of input as well as the volume of playback by using the registers.

Thanks a lot for the tutorial! We were lost without this.

mariooook's picture
mariooook
Junior(0)
Does anyone know, how to

Does anyone know, how to change the registers for using the MIC Input or how to increase the gain of the input like the user did in the post before?
 

JFoster's picture
JFoster
Moderator(49)
Hello mariooook,

Hello mariooook,

Please post this question over at the analod devices forum since it is about their product.

https://ez.analog.com/

--Josh