2009-06-15 15:25:47     BF537 ezkit lite & AD73322

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

2009-06-15 15:25:47     BF537 ezkit lite & AD73322

Adrien Cottenceau (CANADA)

Message: 75750   

 

I have a BF537 ezkite lite and a custom sound card on SPORT1 with 3 cascaded AD73322.

 

I'm using the Blackfin kernel driver AD73322,  with some changes:

 

- set the NUM_DEVICES_CHAIN parameter at 6 instead of 8 in AD73322.h

 

- change the set_cap_slotindex(int ) to return the real value (NUM_DEVICES_CHAIN - (index +1)) in AD73322.c

 

 

 

I'm able to record and play sound with ALSA tools (aplay, arecord), but sound is really bad. Frame miss? May i have to change some other stuff in the driver code?

 

May be in functions:

 

- snd_ad73322_cap_copy & snd_ad73322_play_copy :

 

[..]

 

    dst += start * 8;

    while (temp_count--) {

        *(dst + slot_index) = *isrc++;

        dst += 8;

    }

 

    if (temp2_count) {

        dst = (unsigned short *)chip->tx_dma_buf;

        while (temp2_count--) {

            *(dst + slot_index) = *isrc++;

            dst += 8;

        }

    }

 

[..]

 

 

- snd_ad73322_dma_rx & snd_ad73322_dma_tx:

 

[..]

 

for (index = 0; index < 8; index++) {

        sub_info = &ad73322->rx_substreams[index];

 

[..]

 

Why 8 instead of NUM_DEVICES_CHAIN?

 

Thanks for your help.

 

Adrien.

QuoteReplyEditDelete

 

 

2009-06-15 23:48:58     Re: BF537 ezkit lite & AD73322

Cliff Cai (CHINA)

Message: 75758   

 

Adrien,

 

1.if aplay works also badly independently or just arecord gets bad sound?

 

2.Sorry, this driver is for a customer board(with 4 AD73322) and may not work for other cases.These "8"s are very ugly and should be not correct for all cases, it seems some guy can get 1 AD73322 work with this driver(see the related threads in this forum).if possible you can contact him for details.

 

3.if NUM_DEVICES_CHAIN is 6 ,I'm afraid that there would be memory misalignment problem.since the memory size is power-of-2 one in the driver.

 

Cliff

QuoteReplyEditDelete

 

 

2009-06-16 01:20:48     Re: BF537 ezkit lite & AD73322

Cliff Cai (CHINA)

Message: 75761   

 

Adrien,

 

Please try the attached patch to see if it works for your case.

 

 

 

Cliff

 

ad73322.patch

QuoteReplyEditDelete

 

 

2009-06-17 17:02:08     Re: BF537 ezkit lite & AD73322

Adrien Cottenceau (CANADA)

Message: 75919   

 

Cliff,

 

Thanks for your prompt reply.

 

I have tried the patch you have provided.

 

Unfortunately, I'm not able to record or play sound with it. Probably due to a memory misalignment

 

 

 

Adrien.

QuoteReplyEditDelete

 

 

2009-06-18 14:09:38     Re: BF537 ezkit lite & AD73322

Adrien Cottenceau (CANADA)

Message: 75994   

 

Cliff,

 

I made tests with the patched driver. Now, i can record and play sound. But after a short time, i observe a problem with the sport driver.

 

 

 

root:/> arecord -f S16_LE -D plughw:0,0|aplay -f S16_LE -D plughw:0,0

 

Recording WAVE 'stdin' : Signed 16 bit Little Endian, Rate 8000 Hz, Mono

Playing WAVE 'stdin' : Signed 16 bit Little Endian, Rate 8000 Hz, Mono

overrun!!! (at least 4.147 ms long)

overrun!!! (at least 4.091 ms long)

rx dma is already stopped

sport status error: ROVF

snd_ad73322_sport_err: error happened on sport

rx dma is already stopped

sport status error: TUVF ROVF

snd_ad73322_sport_err: error happened on sport

rx dma is already stopped

sport status error: TUVF ROVF

snd_ad73322_sport_err: error happened on sport

rx dma is already stopped

sport status error: TUVF ROVF

snd_ad73322_sport_err: error happened on sport

rx dma is already stopped

 

[...]

 

 

Any idea of what cause the overrun and the sport error?

 

 

 

Adrien.

QuoteReplyEditDelete

 

 

2009-06-18 22:02:09     Re: BF537 ezkit lite & AD73322

Cliff Cai (CHINA)

Message: 76004   

 

Adrien,

 

would you try  adjusting values of some buffer sizes,such as AD73322_BUF_SZ,PCM_BUFFER_MAX,and FRAGMENT_SIZE_MIN.

 

 

 

Cliff

QuoteReplyEditDelete

 

 

2009-07-06 16:47:49     Re: BF537 ezkit lite & AD73322

Adrien Cottenceau (CANADA)

Message: 76833   

 

Cliff,

 

I've tried with different size of AD73322_BUF_SZ, PCM_BUFFER_MAX and FRAGMENT_SIZE_MIN, but still the same problem with the serial port:

 

 

 

snd_ad73322_sport_err: error happened on sport

rx dma is already stopped

sport status error: TUVF ROVF

snd_ad73322_sport_err: error happened on sport

rx dma is already stopped

sport status error: TUVF ROVF

snd_ad73322_sport_err: error happened on sport

rx dma is already stopped

sport status error: TUVF ROVF

snd_ad73322_sport_err: error happened on sport

 

 

 

 

[...]

 

Any other idea?

 

Thanks.

 

Adrien

QuoteReplyEditDelete

 

 

2009-07-06 22:39:45     Re: BF537 ezkit lite & AD73322

Robin Getz (UNITED STATES)

Message: 76836   

 

Adrien:

 

Just to make sure we are all looking at the same thing - you are using 2008R1.5 branch, 2009 branch, or trunk?

 

-Robin

QuoteReplyEditDelete

 

 

2009-07-07 10:36:40     Re: BF537 ezkit lite & AD73322

Adrien Cottenceau (CANADA)

Message: 76889   

 

I use the 2008R1.5-RC3 uClinux disitrib.

 

I have changed the ad73322.h file at ligne 128 & 129:

 

 

 

    substream_info_t    tx_substreams[8];

    substream_info_t    rx_substreams[8];

 

to

 

    substream_info_t    tx_substreams[NUM_DEVICES_CHAIN];

    substream_info_t    rx_substreams[NUM_DEVICES_CHAIN];

 

 

 

But still the same problem...

 

 

 

Adrien.

QuoteReplyEditDelete

 

 

2009-08-26 17:51:23     Re: BF537 ezkit lite & AD73322

Adrien Cottenceau (CANADA)

Message: 79246   

 

Hi everyone.

 

I was absent since a long time. Nobody found a solution for my memory alignement problem?

 

I decided to continue my project with 6 cascaded AD73322...

 

I m not very familliar with DMA on Linux.

 

So, if someone can explain me how to configure the DMA for this driver. (may be something to change in the Sport driver too?)

 

Thanks for your help!

QuoteReplyEditDelete

 

 

2009-08-26 17:55:11     Re: BF537 ezkit lite & AD73322

Adrien Cottenceau (CANADA)

Message: 79247   

 

Oups, 3 cascaded devices, not 6...

QuoteReplyEditDelete

 

 

2009-08-26 18:29:22     Re: BF537 ezkit lite & AD73322

Adrien Cottenceau (CANADA)

Message: 79248   

 

up

QuoteReplyEditDelete

 

 

2009-08-28 05:10:15     Re: BF537 ezkit lite & AD73322

Cliff Cai (CHINA)

Message: 79350   

 

Adrien,

 

>I made tests with the patched driver. Now, i can record and play sound. But after a short time, i observe a problem with the >sport driver.

 

if the record and play run normally before Sport gets wrong?

 

since the DMA_FRAME_BYTES is 12 in your case,then DMA_PERIOD_BYTES shoule be also a multiple of 12.otherwise the buffer will be misaligned.

 

Cliff

Attachments

Outcomes