2009-03-17 14:51:57     use AD1854 with AD1836

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

2009-03-17 14:51:57     use AD1854 with AD1836

damien OLLIVE (UNITED STATES)

Message: 71136   

 

hi,

 

i need your advise to tell me if i am on the write way to do what i want and if yes how to solve my problem.

 

i am on a custom board witch is close to the BF537 stamp board design.

 

 

 

i want to run an audio output, i use an AD1854 link to the sport0

 

i use it in mode I2S

 

So i think that i don't need to use the SPI control. do i?

 

 

 

root:/> modprobe snd-ad1836

openfb

snd_ad1836_probe

snd_ad1836_pcm

pcm

configure

snd_ad1836_configure

root:/> modprobe snd-pcm-oss

 

root:/> ls -l /proc/asound/ad1836/

-r--r--r--    1 root     root            0 Mar 17 12:44 id

-rw-r--r--    1 root     root            0 Mar 17 12:44 oss_mixer

dr-xr-xr-x    3 root     root            0 Mar 17 12:44 pcm0c

dr-xr-xr-x    3 root     root            0 Mar 17 12:44 pcm0p

-rw-r--r--    1 root     root            0 Mar 17 12:44 registers

root:/> lsmod

Module                  Size  Used by

snd_pcm_oss            39104  0

snd_mixer_oss          11872  1 snd_pcm_oss

snd_ad1836             16168  0

snd_pcm                55876  2 snd_pcm_oss,snd_ad1836

snd_page_alloc          4616  1 snd_pcm

snd_timer              15076  1 snd_pcm

snd                    35892  5 snd_pcm_oss,snd_mixer_oss,snd_ad1836,snd_pcm,snd_timer

root:/>

 

 

 

when i try

 

root:/> tone

snd_ad1836_playback_open

snd_ad1836_capture_open

snd_ad1836_hw_params

snd_ad1836_hw_params

snd_ad1836_hw_params

snd_ad1836_hw_params

snd_ad1836_hw_params

snd_ad1836_hw_params

TONE: generating sine wave at 1000 Hz...

snd_ad1836_playback_prepare channels:2, period_bytes:0x2000, periods:8

playback_copy: src 0232c000, pos 0, count 400

snd_ad1836_playback_trigger

playback cmd:start

playback_copy: src 0232c000, pos 400, count 400

playback_copy: src 0232c000, pos 800, count 400

playback_copy: src 0232c000, pos c00, count 400

playback_copy: src 0232c000, pos 1000, count 400

playback_copy: src 0232c000, pos 1400, count 400

playback_copy: src 0232c000, pos 1800, count 400

playback_copy: src 0232c000, pos 1c00, count 400

playback_copy: src 0232c000, pos 0, count 3

snd_ad1836_playback_trigger

playback cmd:stop

snd_ad1836_hw_free

snd_ad1836_playback_close

snd_ad1836_hw_free

snd_ad1836_capture_close

root:/>

 

i don't hear any noise

 

and same thing for the mp3play

 

root:/> mp3play marshort.mp3

snd_ad1836_playback_open

marshort.mp3s MPEG1-III (85857 ms)nd_ad1836_hw_params

 

snd_ad1836_hw_params

snd_ad1836_hw_params

snd_ad1836_playback_prepare channels:2, period_bytes:0x1168, periods:8

playback_copy: src 016fa000, pos 0, count 22d

snd_ad1836_playback_trigger

playback cmd:start

playback_copy: src 016fa000, pos 22d, count 22d

playback_copy: src 016fa000, pos 45a, count 22d

playback_copy: src 016fa000, pos 687, count 22d

playback_copy: src 016fa000, pos 8b4, count 22d

playback_copy: src 016fa000, pos ae1, count 22d

playback_copy: src 016fa000, pos d0e, count 22d

playback_copy: src 016fa000, pos f3b, count 22d

playback_copy: src 016fa000, pos 0, count 3

snd_ad1836_playback_trigger

playback cmd:stop

snd_ad1836_hw_free

snd_ad1836_playback_close

root:/>

 

 

i have a scope on the the Sport 0 ( and the spi line) and nothing happen

 

 

 

do you have an idea of what can i change?

 

 

 

thanks

QuoteReplyEditDelete

 

 

2009-03-17 14:54:42     Re: use AD1854 with AD1836 driver

damien OLLIVE (UNITED STATES)

Message: 71137   

 

i use the AD1836 driver, i think it's close of my chip if i just use the ouput

QuoteReplyEditDelete

 

 

2009-03-18 14:03:32     Re: use AD1854 with AD1836 driver

damien OLLIVE (UNITED STATES)

Message: 71212   

 

My problem looks to come from the Sport, it's the first time i use it so maibe i haven't enable something

 

I have tried to test the sport by the ad73311 driver and the sport test of the distribution juste to know if he works but that don't works

 

during the boot:

 

Advanced Linux Sound Architecture Driver Version 1.0.12rc1 (Thu Jun 22 13:55:50 2006 UTC).

snd_ad73311_startup is called

snd_ad73311_stop is called

dma_alloc_init: dma_page @ 0x023d8000 - 256 pages at 0x03f00000

ALSA device list:

  #0: Analog Devices AD73311L at PF4 SPORT0 rx/tx dma 3/4 err irq 45

TCP cubic registered

NET: Registered protocol family 1

NET: Registered protocol family 17

rtc-bfin rtc-bfin: setting the system clock to 2009-03-18 09:50:45 (1237369845)

Freeing unused kernel memory: 23972k freed

 

 

root:/> ./sport_test -r marshort.mp3

Unable to request sport tx irq

Failed to open /dev/sport0

 

 

 

i don't understand where is the problem with my sport.

 

So i will try to write a sport driver bymyself without any audio part.

 

but if you have an idea about my problem on the ad1836 driver to use the ad1854 chip for the output and without any input.

 

Do you think i have to deseable some part of the driver because he want to communicate by SPI to the chip and i don't use it (i2s mode)

QuoteReplyEditDelete

 

 

2009-03-18 14:27:00     Re: use AD1854 with AD1836 driver

Mike Frysinger (UNITED STATES)

Message: 71214   

 

sport_test operates on the generic sport driver.  if you've assigned an ALSA codec to the sport, then you cant use the generic sport driver at the same time.

QuoteReplyEditDelete

 

 

2009-03-18 14:58:02     Re: use AD1854 with AD1836 driver

damien OLLIVE (UNITED STATES)

Message: 71222   

 

thanks for ur reply

 

 

 

the sport test looks like to work with the ALSA codec of ad73311

 

in the source code you have it :

 

    /* IOCTL to enable ad73311 */

    if (ioctl (sport, ENABLE_AD73311, 1) < 0) {

        fprintf(stderr, "failed to enable ad73311 \n");

        close (sport);

        return -1;

    }

 

 

 

and in this doc : http://docs.blackfin.uclinux.org/doku.php?id=linux-kernel:drivers:ad1836

 

This sample application can send a wave file to ad73311 sound card by runing command “sport_test -t sample.wav”

 

I understand that i need the ALSA ad73311

 

i have try without and my kernel reboot when i lunch the test (because of the watchdog i think).

 

 

 

I have this config for the codec, do i need something else to enable the sport?

 

│ │                                     <*> Advanced Linux Sound

  │ │                                     < >   Sequencer support

  │ │                                     <*>   OSS Mixer API                                                                                 

  │ │                                     <*>   OSS PCM (digital audio)

  │ │                                     [*]     OSS PCM (digital audio) API - Include plugin system

  │ │                                     [ ]   Dynamic device file minor numbers

  │ │                                     [*]   Support old ALSA API 

  │ │                                     [*]   Verbose procfs contents 

  │ │                                     [ ]   Verbose printk                                                                               

  │ │                                     [ ]   Debug                                                                                     

  │ │                                           Generic devices  --->                                                                           

  │ │                                           ALSA Blackfin devices  --->                                                                

  │ │                                           System on Chip audio support  --->        

 

 

 

│ │                                     <*> AD1836 Audio support for BF53x                      

  │ │                                           Interface between Blackfin and AD1836 (I2S interface)  --->    

  │ │                                     [ ] Support setting for linphone:16 bits 8k mono mode in driver

  │ │                                     (0) Blackfin Audio SPORT port  │

  │ │                                     (4) Blackfin Audio SPI channel selection bit

  │ │                                     < > AD73311L Audio support for BF53x

  │ │                                     < > Cascaded AD73322 Audio support for BF53x (NEW)    

 

 

 

i have try with and without the Blackfin BF53x SPORT support.

 

 

QuoteReplyEditDelete

 

 

2009-03-19 03:36:15     Re: use AD1854 with AD1836 driver

Mike Frysinger (UNITED STATES)

Message: 71232   

 

why are you looking at the AD73311 at all if you dont actually have that codec ?  the sport test in question is specific to the AD73311.

QuoteReplyEditDelete

 

 

2009-03-19 10:22:50     Re: use AD1854 with AD1836 driver

damien OLLIVE (UNITED STATES)

Message: 71268   

 

hi,

 

that was the basic test for the sport give us in the distribution, so i have tried it and expected to see something on the sport port, but i haven't any signal. maibe stupid but that could maibe give me an information about what is wrong

 

i try to found where my problem come from.

 

(in case there is some issue with i use a lq035 tft-lcd driver and an ad7846 touchscreen driver)

 

I haven't the right hardware too for the AD1836 driver but the wiki tell that should work with the ad1854 if i just want an output, is it possible than the driver don't start the communication because he don't detect the ad1836 and don't return any error?

 

have you an idea why the driver run without error the program start (tone or mp3play), do some playback_copy looks like working well but there isn't any signal on the sport0 ?

 

thanks

QuoteReplyEditDelete

 

 

2009-03-19 11:30:46     Re: use AD1854 with AD1836 driver

damien OLLIVE (UNITED STATES)

Message: 71272   

 

The driver maibe don't work without change on the BF537 board

 

http://blackfin.uclinux.org/gf/project/uclinux-dist/forum/?action=ForumBrowse&forum_id=39&thread_id=2230&_forum_action=ForumMessageBrowse

 

do i have to remove the SPI part to the driver?

QuoteReplyEditDelete

 

 

2009-03-19 18:18:41     Re: use AD1854 with AD1836 driver

Mike Frysinger (UNITED STATES)

Message: 71284   

 

that page is specific to the BF537 EZKIT and it's outdated.  the AD1854 can be driven on that board by using the AD1836 in pure I2S mode.  SPI control is not supported.

QuoteReplyEditDelete

 

 

2009-03-19 18:20:39     Re: use AD1854 with AD1836 driver

Mike Frysinger (UNITED STATES)

Message: 71285   

 

like i already said, you cant use the generic sport test and the alsa driver at the same time.  pick one or the other.

 

stop looking at the ad73311 pieces.  they only toggle GPIO pins specific to that board.

QuoteReplyEditDelete

 

 

2009-03-20 06:23:18     Re: use AD1854 with AD1836 driver

Cliff Cai (CHINA)

Message: 71300   

 

According to the AD1854 data sheet,the SPI can be tied LO,if you use hardware way to configure the codec.

 

So make sure that if the codec has been configured properly by hardware,or need to control it through SPI.

 

 

 

Cliff

 

 

QuoteReplyEditDelete

 

 

2009-03-20 09:31:10     Re: use AD1854 with AD1836 driver

damien OLLIVE (UNITED STATES)

Message: 71307   

 

yes i agree for the ad73311 i have just tried it one time to see if i can learn something with it.

 

 

 

i have written my own test prog with the basique sport driver (char/bfinsport) and i have found the problem, i have some signal now on the sport and some noise on the audio output i still have to work on it but that better.

 

So the problem (i think) was that the sport is a slave in all the audio driver, and in my hardware i don't create any CLK to it.

 

when i configure it like that, the Sport works

 

config.mode = I2S_MODE;

config.lsb_first = 0;

config.data_indep = 0;

config.fsync = 1;

config.act_low = 1;

config.late_fsync = 1;

config.tckfe = 0;

config.sec_en = 0;

config.int_clk = 1;

config.serial_clk = 2000000;

config.fsync_clk = 20000;

config.data_format = NORM_FORMAT;

config.word_len = 8;

config.dma_enabled = 1;

 

 

 

about "the AD1854 can be driven on that board by using the AD1836 in pure I2S mode.  SPI control is not supported"

 

I have started to work on the audio like that but nothing happen on the sport, i think it's because the sport is in slave and i have to provide a extern CLK (that looks strange because the Ezkite haven't one and the wiki tell that should work like that on the Ezkite...)

 

the SPI part still run evenif i am in the I2S mode, that why i have asked you if i have to modify this driver and delete the SPI part?

 

So i will try to config the sport in the ad1836

QuoteReplyEditDelete

 

 

2009-03-20 12:12:06     Re: use AD1854 with AD1836 driver

damien OLLIVE (UNITED STATES)

Message: 71312   

 

thanks for your reply

 

 

 

i just think about something my hardware for the AD1854 is the same than the EZKIT bf537 i just have a difference in the audioreset is just connect to the reset of the BF537 and not to another GPIO like PF12, but is it useful in i2S mode?

 

thanks

QuoteReplyEditDelete

 

 

2009-03-23 12:28:52     Re: use AD1854 with AD1836 driver

damien OLLIVE (UNITED STATES)

Message: 71375   

 

hy,

 

I have start to modify the ad1836.c file to have a sound output with my ad1854.

 

First the sport doesn't create the serial clk and the fsclk so i have change it :

 

#elif defined(CONFIG_SND_BLACKFIN_AD1836_I2S)

 

static int snd_ad1836_configure(ad1836_t *chip)

{

...

#ifdef LINPHONE_SETTING

    /* Set word length to 16 bits */

    err = err || bf53x_sport_config_rx(sport, (RCKFE | RFSR), (RSFSE | 0xf), 0, 0);

    err = err || bf53x_sport_config_tx(sport, (TCKFE | TFSR), (TSFSE | 0xf), 0, 0);

#else

    /* Set word length to 24 bits */

//     err = err || bf53x_sport_config_rx(sport, (RCKFE | RFSR), (RSFSE | 0x17), 0, 0); old value

//     err = err || bf53x_sport_config_tx(sport, (TCKFE | TFSR), (TSFSE | 0x17), 0, 0);

 

 

    err = err || bf53x_sport_config_rx(sport, (RCKFE | RFSR | IRCLK | IRFS), (RSFSE | 0x17), 4, 128); //that give me an serial clock of 10MHz and a fsclk of 38kHz.

    err = err || bf53x_sport_config_tx(sport, (TCKFE | TFSR | ITCLK | ITFS), (TSFSE | 0x17), 4, 128);

 

the second problem with this driver was that the I2S mode need to have the data after the first clk in all the fram and this driver that start after some CLK so i have try to do that an modify that but i don't think that is the right way,

 

static int snd_ad1836_capture_copy(struct snd_pcm_substream *substream, int channel,

        snd_pcm_uframes_t pos, void *dst, snd_pcm_uframes_t count)

{

 

...

 

    while (i--) {

        /* The highest byte is invalid, remove it */

//        *(ldst + i) = *(lsrc + i + curr)<<8; //old code

        *(ldst + i) = *(lsrc + i + curr);

    }

 

    return 0;

}

 

now i have a sound with the tone application but not a nice output (no sinus, square ... in all the mode) with the mp3play it's worst i just have noise.

 

So if somebody know something on the audiodrivers and want to adapte this driver to a simple output or give me some advise, i still work on it.

 

thanks

QuoteReplyEditDelete

 

 

2009-03-24 22:22:27     Re: use AD1854 with AD1836 driver

Cliff Cai (CHINA)

Message: 71476   

 

You should modify snd_ad1836_playback_copy ,if needed.one more thing,if the codec has been configured to work in 24bit I2S mode?

 

 

 

Cliff

QuoteReplyEditDelete

 

 

2009-03-26 11:49:45     Re: use AD1854 with AD1836 driver

damien OLLIVE (UNITED STATES)

Message: 71611   

 

thanks for your help.

 

So you can use the ad1836 just in output you have to create your clk

 

3MHz for CLK and 48KHz for FSCLK, that is my config if somebody need it

 

    err = err || bf53x_sport_config_tx(ad1836->sport, (TCKFE | TFSR | ITCLK | ITFS), (TSFSE | 0x17), 15, 31);

 

the problem is the sound is really really slow. less than 1V

 

it's good if you want to use head phone but i have a speaker and it's ridiculus

 

in the tone program you can increase the mag value and have a correct sound but still not enouth to create an alarm for example in my application.

 

i haven't found yet how to increase the volume in the MP3 app.

 

I think i will have to amplify the signal or if you know an other way that could be great, (i haven't a lot of space in my layout)

 

 

 

thanks

QuoteReplyEditDelete

 

 

2009-03-26 13:01:55     Re: use AD1854 with AD1836 driver

damien OLLIVE (UNITED STATES)

Message: 71614   

 

Hi,

 

I have 3V peak to peak with the mag value to 255 when i play tone application.

 

the ad1854 should can give an 5V peak to peak.

 

do you know why i have just 3V?

 

 

 

i don't found how to increase the volume in the mp3play app

 

i have less than 1V peak to peak for this application, do you know how to increase it?

 

 

 

thanks

QuoteReplyEditDelete

 

 

2009-03-26 13:51:06     Re: use AD1854 with AD1836 driver

Robin Getz (UNITED STATES)

Message: 71615   

 

Damien:

 

I don't think it is 5V p-p at the output of the buffer. it is 5V at the output of the OUT[RL] pins. Where are you looking at the voltages?

 

http://www.analog.com/static/imported-files/eval_kit_manuals/ADSP-BF537_EZ-KIT_Lite_Manual_Rev_2_4.pdf

 

Are you looking at the input of the LMV722M or the output?

 

-Robin

QuoteReplyEditDelete

 

 

2009-03-26 13:57:06     Re: use AD1854 with AD1836 driver

Robin Getz (UNITED STATES)

Message: 71616   

 

The other thing I might check is if there is a voltage drop across FER2 (which supplies 5VA). - if it is only getting 4.5V - that is all that it will output.

 

-Robin

QuoteReplyEditDelete

 

 

2009-03-26 15:12:12     Re: use AD1854 with AD1836 driver

damien OLLIVE (UNITED STATES)

Message: 71626   

 

hi,

 

I have 3V peak peak in the output of the ad1854 and of the LM just for the LM the signal is center in 0 and for the AD1854 center in 2.5 so i have an highter value of 4V. my 5V analog is good so that why  i expected a highter value...

 

Do you know how to put the MP3play in full scale?

 

(And i have the same signal on the EZkite and my custom board)

QuoteReplyEditDelete

 

 

2009-03-26 21:05:06     Re: use AD1854 with AD1836 driver

Robin Getz (UNITED STATES)

Message: 71647   

 

Damien:

 

All the source code can do is put things out full scale to the DAC - since we don't support the ad1854 - only the 1836 - it is likely the mixer is not being programmed properly - since the I2C bus is not connected on the EZKit (did you look at the schematics?)

 

-Robin

 

 

QuoteReplyEditDelete

 

 

2009-03-26 23:21:45     Re: use AD1854 with AD1836 driver

Cliff Cai (CHINA)

Message: 71648   

 

I'm afraid that there is no software way to turn up the volume of AD1854.Since after reset the volume control bits are all 1(full scale).

 

 

 

Cliff

QuoteReplyEditDelete

 

 

2009-03-27 11:54:59     Re: use AD1854 with AD1836 driver

damien OLLIVE (UNITED STATES)

Message: 71701   

 

OK thanks,

 

i can't spend more time on it now, i have to work on the USB.

 

i have an output, not good for the mp3 but good to do an alarme so i let you know if i can found something about it later.

 

(i have add an amplifier in the output, so i have to make again my laout but ...)

 

 

 

Thanks Cliff Mike and Robin

Attachments

    Outcomes