Atmel website | ARM Community | AVR freaks | Technical Support
Banner
 FAQ •  Search •  Register •  Login 

All times are UTC + 1 hour [ DST ]




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: Audio problem with I2C and WM8731 codec
PostPosted: Mon Jan 09, 2012 11:57 pm 
Offline

Joined: Sat Dec 31, 2011 5:14 pm
Posts: 1
Hi all,
I am working on a custom board based on AT91SAM9G20 to make working th audio section.
The hardware is like the EVB, connecting Wolfson WM8731 to SSC and I2C bus.
I was able to play something, but it doesn't work 100% of the times.
I see some error on I2C bus:
Code:
i2c-adapter i2c-0: wrote 2 bytes
i2c-adapter i2c-0: master_xfer[0] W, addr=0x1b, len=2
i2c-adapter i2c-0: i2c_outb: 0x36 A
i2c-adapter i2c-0: i2c_outb: 0x10 A
i2c-adapter i2c-0: i2c_outb: 0x23 A
i2c-adapter i2c-0: wrote 2 bytes
i2c-adapter i2c-0: master_xfer[0] W, addr=0x1b, len=2
i2c-adapter i2c-0: i2c_outb: 0x36 A
i2c-adapter i2c-0: i2c_outb: 0x0e A
i2c-adapter i2c-0: i2c_outb: 0x42 A
i2c-adapter i2c-0: wrote 2 bytes
atmel_ssc_hw_params: RCMR=00010721 RFMR=0000008f TCMR=00010702 TFMR=0000008f
atmel_ssc_dai: Starting clock
atmel_ssc_dai,hw_params: SSC initialized
WM8731 I2C Codec 0-001b: wm8731_pcm_prepare
i2c-adapter i2c-0: master_xfer[0] W, addr=0x1b, len=2
i2c-adapter i2c-0: i2c_outb: 0x36 A
i2c-adapter i2c-0: i2c_outb: 0x12 A
i2c-adapter i2c-0: i2c_outb: 0x01 A
i2c-adapter i2c-0: wrote 2 bytes
transmit enabled SSC_SR=0x000104cf
at91sam9g20ek_set_bias_level : level= 1 mclk_on=0
WM8731 I2C Codec 0-001b: wm8731_set_bias_level
i2c-adapter i2c-0: master_xfer[0] W, addr=0x1b, len=2
i2c-adapter i2c-0: i2c_outb: 0x36 NA
i2c-adapter i2c-0: i2c_outb: 0x36 NA
i2c-adapter i2c-0: i2c_outb: 0x36 A
i2c-adapter i2c-0: Used 3 tries to write to client at 0x1b: success
i2c-adapter i2c-0: i2c_outb: 0x0c NA
i2c-adapter i2c-0: sendbytes: NAK bailout.
i2c-adapter i2c-0: master_xfer[0] W, addr=0x1b, len=2
i2c-adapter i2c-0: i2c_outb: 0x36 NA
i2c-adapter i2c-0: i2c_outb: 0x36 NA
i2c-adapter i2c-0: i2c_outb: 0x36 NA
i2c-adapter i2c-0: i2c_outb: 0x36 NA
i2c-adapter i2c-0: NAK from device addr 0x1b msg #0
at91sam9g20ek_set_bias_level : level= 0 mclk_on=1
WM8731 I2C Codec 0-001b: wm8731_set_bias_level
WM8731 I2C Codec 0-001b: wm8731_mute: 0
i2c-adapter i2c-0: master_xfer[0] W, addr=0x1b, len=2
i2c-adapter i2c-0: i2c_outb: 0x36 NA
i2c-adapter i2c-0: i2c_outb: 0x36 A
i2c-adapter i2c-0: Used 2 tries to write to client at 0x1b: success
i2c-adapter i2c-0: i2c_outb: 0x0a A
i2c-adapter i2c-0: i2c_outb: 0x00 A
i2c-adapter i2c-0: wrote 2 bytes
ALSA sound/core/pcm_lib.c:1641: playback write error (DMA or IRQ trouble?)
WM8731 I2C Codec 0-001b: wm8731_mute: 1
i2c-adapter i2c-0: master_xfer[0] W, addr=0x1b, len=2
i2c-adapter i2c-0: i2c_outb: 0x36 A
i2c-adapter i2c-0: i2c_outb: 0x0a A
i2c-adapter i2c-0: i2c_outb: 0x08 NA
i2c-adapter i2c-0: sendbytes: NAK bailout.
atmel_ssc_shutdown: transmit disabled SSC_SR=0x000000c0
atmel_ssc_dau: Stopping clock
i2c-adapter i2c-0: master_xfer[0] W, addr=0x1b, len=2
i2c-adapter i2c-0: i2c_outb: 0x36 A
i2c-adapter i2c-0: i2c_outb: 0x12 NA
i2c-adapter i2c-0: sendbytes: NAK bailout.
pop wq checking: Playback status: inactive waiting: yes
at91sam9g20ek_set_bias_level : level= 1 mclk_on=1
WM8731 I2C Codec 0-001b: wm8731_set_bias_level
i2c-adapter i2c-0: master_xfer[0] W, addr=0x1b, len=2
i2c-adapter i2c-0: i2c_outb: 0x36 NA
i2c-adapter i2c-0: i2c_outb: 0x36 A
i2c-adapter i2c-0: Used 2 tries to write to client at 0x1b: success
i2c-adapter i2c-0: i2c_outb: 0x0c A
i2c-adapter i2c-0: i2c_outb: 0x57 NA
i2c-adapter i2c-0: sendbytes: NAK bailout.
i2c-adapter i2c-0: master_xfer[0] W, addr=0x1b, len=2
i2c-adapter i2c-0: i2c_outb: 0x36 NA
i2c-adapter i2c-0: i2c_outb: 0x36 NA
i2c-adapter i2c-0: i2c_outb: 0x36 NA
i2c-adapter i2c-0: i2c_outb: 0x36 NA
i2c-adapter i2c-0: NAK from device addr 0x1b msg #0
at91sam9g20ek_set_bias_level : level= 2 mclk_on=1
WM8731 I2C Codec 0-001b: wm8731_set_bias_level
i2c-adapter i2c-0: master_xfer[0] W, addr=0x1b, len=2
i2c-adapter i2c-0: i2c_outb: 0x36 NA
i2c-adapter i2c-0: i2c_outb: 0x36 NA
i2c-adapter i2c-0: i2c_outb: 0x36 NA
i2c-adapter i2c-0: i2c_outb: 0x36 NA
i2c-adapter i2c-0: NAK from device addr 0x1b msg #0
atmel_ssc_startup: SSC_SR=0x192
asoc: WM8731 <-> atmel-ssc0 info:
asoc: rate mask 0x6fe
asoc: min ch 1 max ch 2
asoc: min rate 8000 max rate 96000
i2c-adapter i2c-0: master_xfer[0] W, addr=0x1b, len=2
i2c-adapter i2c-0: i2c_outb: 0x36 NA
i2c-adapter i2c-0: i2c_outb: 0x36 NA
i2c-adapter i2c-0: i2c_outb: 0x36 NA
i2c-adapter i2c-0: i2c_outb: 0x36 NA
i2c-adapter i2c-0: NAK from device addr 0x1b msg #0


Lots of NAK are reported by codec. Once it reach this state any command sent will be replied with a NAK, so the only solution is to power on/off the board and restart the configuration.
The kernel is 2.6.30.

I tested also the new EVB AT91SAM9x5ek that use the same codec and a new kernel 2.6.39.
The audio is very bad and to have the audio working you must switch the master volume to unmute/mute.
A noise is in any case present.

Has anyone been able to get the audio section properly working?

On at91sam9g45ek EVB using another codec with AC97 everything works.

After this analisys I think that we can focus on the issue related to i2c communication between the micro and the codec through i2c.

Any comments or help is welcome.


Top
 Profile  
 
 Post subject: Re: Audio problem with I2C and WM8731 codec
PostPosted: Mon Jan 23, 2012 10:40 pm 
Offline

Joined: Mon Jan 23, 2012 6:43 pm
Posts: 7
Did you manage to solve NAK errors?


Top
 Profile  
 
 Post subject: Re: Audio problem with I2C and WM8731 codec
PostPosted: Tue Jan 24, 2012 7:23 pm 
Offline

Joined: Fri Jun 22, 2007 10:41 am
Posts: 10
I solved the issue increasing the pull-up resistor on the line. I had previously two 10K pullup.
On the i2C I have attacched an EEPROM and the audio codec.
Now seems work 95% of the time even if I saw some delay between SDA and SCL singnal and the NAK error.
I don't see at all the issue on the EVB, so I think it depends on the line impedence. I want to try to add a serial restor 33ohm on the line near the audio codec and near the eeprom to reduce cross-talk effects.

Hope it helps
Jaws


Top
 Profile  
 
 Post subject: Re: Audio problem with I2C and WM8731 codec
PostPosted: Tue Jan 24, 2012 11:56 pm 
Offline

Joined: Mon Jan 23, 2012 6:43 pm
Posts: 7
So it seems like it's hardware issue rather than software... I will think about it, thanks anyway :)


Top
 Profile  
 
 Post subject: Re: Audio problem with I2C and WM8731 codec
PostPosted: Mon Jan 30, 2012 5:54 pm 
Offline

Joined: Mon Jan 23, 2012 6:43 pm
Posts: 7
It's working!
Putting one pull-up resistor (10k) on SDIN line and one pull-up resistor (also 10k) on SCLK line was the solution!
Thanks for help! :)


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC + 1 hour [ DST ]


Who is online

Users browsing this forum: No registered users and 5 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: