2008-08-04 18:11:25     AD1938

Document created by Aaronwu Employee on Aug 7, 2013
Version 1Show Document
  • View in full screen mode

2008-08-04 18:11:25     AD1938

Guillaume Duteil (FRANCE)

Message: 59893   

 

Good afternoon,

 

 

 

We are planing to set up a sound gateway based on a BF537 and AD1938 audio controllers.

 

We have the BF537 stamp and the ez audio extender.

 

The uClinux blackfin distribution contains only drivers for AD1836, and Analog Device only delivers drivers for VisualDSP.

 

Does anybody have a AD1938 working with a BF537 under uClinux ?

 

 

 

Thank you in advance,

 

 

 

Regards,

 

 

 

Guizmo

TranslateQuoteReplyEditDelete

 

 

2008-08-04 21:57:37     Re: AD1938

Mike Frysinger (UNITED STATES)

Message: 59895   

 

Linux supports more than just AD1836, but the AD1938 is not one of the supported or tested codecs.  there currently are no plans to develop a driver for it either ...

QuoteReplyEditDelete

 

 

2008-08-22 14:20:48     Re: AD1938

Steve Strobel (UNITED STATES)

Message: 60926   

 

> Does anybody have a AD1938 working with a BF537 under uClinux ?

 

I do.  I emailed it directly to Mr. Duteil a few weeks ago, but I thought I should attach it here for the sake of someone that might search for it later.  See the file "misc notes.txt" for more info about the driver.

 

Steve

 

ad1938 codec driver and notes.zip

QuoteReplyEditDelete

 

 

2009-06-02 06:25:34     Re: AD1938

Barry Song (CHINA)

Message: 75016   

 

I tried some different configuration for DAC and ADC LRCLK/BCLK polarity, and played the simple tone created by sina(). There is always noise.

I can compeletly control the SPORT as I hope, and the DMA transfer is right too. At the up timing diagram, the channel 2 is FS, channel 3 is clk, channel 1 is TX data. The polarity of channel 2/3 and delay from 2 to 1(data) can all be controlled, in almost all combinations of AD1938 polarity and sdata delay setting, there is always noise.

 

Did you eliminate the noise at last ? Can you tell me your way?

QuoteReplyEditDelete

 

 

2009-06-02 10:37:27     Re: AD1938

Steve Strobel (UNITED STATES)

Message: 75025   

 

We had quite a little trouble with the TDM_CLK output from the AD1938 (pin 22) driving the SPORT clock input on the BF537 (ball B15, PJ6).  We messed with various values of series termination resistors, small caps to ground to filter off noise, etc.  Even when we found a combination that didn't cause the audio to slip channels, it often "crackled" some.

 

We got it to work reliably by adding a SN74LVC1G08 buffer on that signal near the codec.  The signal looked pretty good on a scope even without that buffer, but it helped nonetheless.  Some time later we found item 24 in the silicon anomaly list which is titled "05000265 - Sensitivity to Noise with Slow Input Edge Rates on External SPORT TX and RX clocks".  With the understanding that slow clock edges are the root of the problem, it would probably have been better to put the buffer close to the Blackfin.

 

If you are using Rev 0.3 or later BF537 parts, there might be another option.  Item 39 on that same list (05000305 - New Feature:  Additional Hysteresis on SPORT Input Pins) notes that by setting bit 15 of the PLL_CTL register, you can improve the "immunity to noise on the input pins of the SPORT".  I haven't tried that yet, but I suspect that it would eliminate the need for the buffer in our design (for PCBs loaded with newer BF537s).

 

Steve

QuoteReplyEditDelete

 

 

2009-06-02 13:02:40     Re: AD1938

Steve Strobel (UNITED STATES)

Message: 75027   

 

Attached is an updated version of the AD1938 driver.  There are several changes, including:

 

    The filenames have now been changed from AD1836 (the original driver that I modified) to AD1938...

    The original driver does not support multiple instances, but there is now a "second" version of the driver that can be enabled to support a second AD1938 chip on another SPORT interface.

    The zip file now has the files in subdirectories corresponding to where they belong in the uClinux tree.

 

The driver files are still rather messy, as I partially converted all of the AD1836 code, but only finished and tested the new code for the SPORT (not i2c) interface and the single substream option.  If the other code was deleted it would look a lot better, but I thought leaving it might be helpful for someone that needed to add support for those options.

 

Note that the "second" driver will work only if the original driver is also used (I think the code to reset the codecs is disabled in the second instance).  Actually, that part of the code will probably need to be ported to work on a different target.  I think we used a pin on an output latch, but it could be changed to use a GPIO line selectable through the config system.

 

Also note that when I enabled the second instance, snd_pcm_hw_params() started returning -12, which snd_strerror() interprets as "Cannot allocate memory".  The solution (thanks to Mike Frysinger) is to change the Uncached SDRAM region from 1MB to 2MB.  For the history of adding the second instance and figuring out the DMA problem, see the thread http://blackfin.uclinux.org/gf/project/uclinux-dist/forum/?action=ForumBrowse&forum_id=39&_forum_thread_total=100&_forum_thread_page=2&_forum_action=ForumMessageBrowse&thread_id=33425

 

Steve

 

 

AD1938 Driver and Notes.zip

QuoteReplyEditDelete

 

 

2009-06-03 02:43:38     Re: AD1938

Barry Song (CHINA)

Message: 75048   

 

Using the following configration, the noise will disappear without any hardware workaround.

 

        /* set ad1938 to 8 channel AUX ADC mode, 16bit, 48000Hz */

        ad1938_spi_write(AD1938_DAC_CTRL0, 0x40);

        ad1938_spi_write(AD1938_DAC_CTRL1, 0x84);

        ad1938_spi_write(AD1938_DAC_CTRL2, 0x1A);

        ad1938_spi_write(AD1938_ADC_CTRL0, 0x3E);

        ad1938_spi_write(AD1938_ADC_CTRL1, 0x43);

        ad1938_spi_write(AD1938_ADC_CTRL2, 0x6f);

        ad1938_spi_write(AD1938_PLL_CLK_CTRL0, 0x9C);

        ad1938_spi_write(AD1938_PLL_CLK_CTRL1, 0x04);

Several key options are:

 

1.Invert BCLK of DAC_CTRL, with sdata delay of DAC_CTRL0 as 1

 

2.set ADC_CTRL1 as ADC AUX mode and latch in mid cycle

 

3.Set ADC_CTRL2 :driver out on rising edge, left high

 

The timing diagram is like:

 

QuoteReplyEditDelete

 

 

2009-06-03 04:26:13     Re: AD1938

Barry Song (CHINA)

Message: 75077   

 

After start-up ADC in AD1938_ADC_CTRL0, I use applications to test record, and record-play loopback, there is no noise too.

QuoteReplyEditDelete

 

 

2009-07-31 19:01:34     Re: AD1938

Steve Strobel (UNITED STATES)

Message: 78265   

 

For anyone searching this thread, it looks like Barry's driver got posted to the ALSA-Devel mailling list (alsa-devel@alsa-project.org) on Thu, 16 Jul 2009.

Outcomes