2011-05-25 03:34:13     Compilation of AD73322 in uclinux 2009 for BF531 and BF533

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

2011-05-25 03:34:13     Compilation of AD73322 in uclinux 2009 for BF531 and BF533

Shyam sundar (INDIA)

Message: 100826   

 

Hello world,

 

I am getting the following error when I am trying to add the ad73322 driver in the uclinux 2009 distribution for the custom board BF531 which is similar to stampkit BF533. Irrespective of whether I choose BF533 or BF531 I do get the following error. But when I choose BF537 it gets compiled ! What could be the problem?

 

 

 

LD      drivers/watchdog/built-in.o

  LD      drivers/built-in.o

  CC      sound/sound_core.o

  LD      sound/soundcore.o

  LD      sound/arm/built-in.o

  CC      sound/blackfin/ad73322.o

In file included from sound/blackfin/ad73322.c:50:

include/sound/driver.h:1:2: warning: #warning "This file is deprecated"

sound/blackfin/ad73322.c: In function ‘snd_ad73322_play_pre’:

sound/blackfin/ad73322.c:292: warning: unused variable ‘index’

sound/blackfin/ad73322.c: In function ‘snd_ad73322_cap_pre’:

sound/blackfin/ad73322.c:323: warning: unused variable ‘index’

sound/blackfin/ad73322.c: In function ‘snd_ad73322_probe’:

sound/blackfin/ad73322.c:838: error: implicit declaration of function ‘bfin_read_PORT_MUX’

sound/blackfin/ad73322.c:839: error: implicit declaration of function ‘bfin_write_PORT_MUX’

sound/blackfin/ad73322.c:840: error: implicit declaration of function ‘bfin_write_PORTG_FER’

make[4]: *** [sound/blackfin/ad73322.o] Error 1

make[3]: *** [sound/blackfin] Error 2

make[2]: *** [sound] Error 2

make[2]: Leaving directory `/root/Desktop/DWAS_DEVELOPMENT/DWAS_531/uclinuxdist-2009R1/linux-2.6.x'

make[1]: *** [linux] Error 1

make[1]: Leaving directory `/root/Desktop/DWAS_DEVELOPMENT/DWAS_531/uclinuxdist-2009R1'

make: *** [single] Error 2

QuoteReplyEditDelete

 

 

2011-05-25 07:58:44     Re: Compilation of AD73322 in uclinux 2009 for BF531 and BF533

Mike Frysinger (UNITED STATES)

Message: 100834   

 

pretty sure this is already fixed in 2010R1.  either upgrade your distro or refer to the newer tree to figure things out.

QuoteReplyEditDelete

 

 

2011-05-26 05:54:31     Re: Compilation of AD73322 in uclinux 2009 for BF531 and BF533

Shyam sundar (INDIA)

Message: 100869   

 

Hello Mike,

 

I have tried using the 2010R1. It gives the same error when I try to use any sport other than sport0.

QuoteReplyEditDelete

 

 

2011-05-26 11:41:54     Re: Compilation of AD73322 in uclinux 2009 for BF531 and BF533

Mike Frysinger (UNITED STATES)

Message: 100874   

 

ive fixed the code in trunk and the 2010R1 branch

QuoteReplyEditDelete

 

 

2011-06-02 02:33:45     Re: Compilation of AD73322 in uclinux 2009 for BF531 and BF533

Shyam sundar (INDIA)

Message: 100972   

 

Thanks Mike !

 

I do have a small issue. If i want to record for a duration of about 5 seconds, it is getting recorded for 40 seconds.

 

The sport clock was 256 khz, frame sync was 16 khz and master clock for the ad73322 was 2.048 Mhz.

 

I did face the same problem when I tried to play a 800Hz tone which was sampled at 8Khz for a duration of 30 seconds. Itgot played for 240 seconds. There is a factor of 8x. Can I know where I am wrong?

 

root:/> arecord -v -D plughw:0,6 -d 5 -f S16_LE -c 1 -r 8000 -t wav test.wav

snd_ad73322_cap_open

Recording WAVE 'test.wav' : Signed 16 bit Little Endian, Rate 8000 Hz, Mono

snd_ad73322_hw_params

Plug PCM: Hardware PCM crd 0 'Analog Devices AD73322' device 6 subdevice 0

Its setup is:

  stream       : CAPTURE

snd_ad73322_startup is called

cmd:start

  access       : RW_INTERLEAVED

  format       : S16_LE

  subformat    : STD

  channels     : 1

  rate         : 8000

  exact rate   : 8000 (8000/1)

  msbits       : 16

  buffer_size  : 4000

  period_size  : 1000

  period_time  : 125000

  tstamp_mode  : NONE

  period_step  : 1

  avail_min    : 1000

  period_event : 0

  start_threshold  : 1

  stop_threshold   : 4000

  silence_threshold: 0

  silence_size : 0

  boundary     : 2097152000

snd_ad73322_stop is called

cmd:stop

snd_ad73322_hw_free

snd_ad73322_hw_free

snd_ad73322_cap_close

QuoteReplyEditDelete

 

 

2011-06-02 06:24:27     Re: Compilation of AD73322 in uclinux 2009 for BF531 and BF533

Shyam sundar (INDIA)

Message: 100978   

 

Oh looks like I need to define

 

#define NUM_DEVICES_CHAIN (8) as #define NUM_DEVICES_CHAIN (1) since I am using only one ad73322 chip!

 

Will try out and revert

QuoteReplyEditDelete

 

 

2011-06-02 12:06:08     Re: Compilation of AD73322 in uclinux 2009 for BF531 and BF533

Shyam sundar (INDIA)

Message: 100982   

 

Hello world,

 

I am not able to get the usage of the parameters input_gain and output_gain in the function call snd_ad73322_init.

 

When using a single ad73322 chip, do these parameters have any importance?

 

The following defintion should be sufficient,right?

 

#define NUM_DEVICES_CHAIN (2)

QuoteReplyEditDelete

 

 

2011-06-07 07:38:51     Re: Compilation of AD73322 in uclinux 2009 for BF531 and BF533

Shyam sundar (INDIA)

Message: 101049   

 

Hello world,

 

Can I please get any clue to use  single AD73322 chip?

 

I did made the following changes

 

#define NUM_DEVICES_CHAIN (2) in the ad73322.h file

 

ctrl_regs[0] = MCDIV(0) | SCDIV(0) | DIRATE(3);     in the ad73322.c file

 

With this config I tried to play a 800 Hz mono tone sampled at 8KHz (S16_LE).The play duration was 30 seconds  and this was tallying. But I was not able to see the DAC output. When REF point was probed it measured 0v indicating that codec didnt get configured. When I use NUM_DEVICES_CHAIN as 8, i do see the codec getting configured.

 

Can I know where I am going wrong?

QuoteReplyEditDelete

 

 

2011-06-07 07:40:18     Re: Compilation of AD73322 in uclinux 2009 for BF531 and BF533

Shyam sundar (INDIA)

Message: 101050   

 

Also I defined input_gain and output_gain as 0

QuoteReplyEditDelete

 

 

2011-06-08 04:58:17     Re: Compilation of AD73322 in uclinux 2009 for BF531 and BF533

Shyam sundar (INDIA)

Message: 101078   

 

Hello world,

 

In the snd_ad73322_configure function, I replaced the following line

 

            bfin_write_SPORT0_TX16(ctrl_buffer[8*i+j]);

 

with

 

            bfin_write_SPORT0_TX16(ctrl_buffer[NUM_DEVICES_CHAIN*i+j]);

 

After this change was done,I was able to configure the codec and I was able to use the single ad73322 chip for playing a single tone of 800Hz (S16_LE) sampled at 8KHz. I hope this patch might be useful.

 

Currently, I am having a problem with playing back the recorded file.

 

I gave the command

 

arecord --d 10 -f S16_LE -c 1 -r 8000 -t wav test.wav

 

When I gave the command aplay test.wav, I got error saying

 

snd_ad73322_err: error happened on sport

 

sport status error: ROVF

 

Any clue how to tackle this?

QuoteReplyEditDelete

 

 

2011-06-13 03:42:38     Re: Compilation of AD73322 in uclinux 2009 for BF531 and BF533

Shyam sundar (INDIA)

Message: 101226   

 

Hello world,

 

These were the final changes I modified for the single AD73322 chip to work with BF531

 

Modification in ad73322.h file

 

#define NUM_DEVICES_CHAIN (2)

 

Modifications in ad73322.c file

 

In the get_cap_slotindex function

 

I replaced

 

    int slot_index = 6;  

    switch (index) {

        case 0:

            slot_index = 6;

            break;

        case 1:

            slot_index = 7;

            break;

        case 2:

            slot_index = 4;

            break;

        case 3:

            slot_index = 5;

            break;

        case 4:

            slot_index = 2;

            break;

        case 5:

            slot_index = 3;

            break;

        case 6:

            slot_index = 0;

            break;

        case 7:

            slot_index = 1;

            break;

    }

    return slot_index;

 

with

 

    int slot_index;

    slot_index = (NUM_DEVICES_CHAIN-(index+1));

    return(slot_index);

 

In the snd_ad73322_configure function

 

I replaced

 

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

        for (j=0; j<NUM_DEVICES_CHAIN; j++) {

            bfin_write_SPORT_TX16(ctrl_buffer[8*i+j]);

        }

with

 

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

        for (j=0; j<NUM_DEVICES_CHAIN; j++) {

            bfin_write_SPORT_TX16(ctrl_buffer[NUM_DEVICES_CHAIN*i+j]);

        }

 

The master clock to the codec was 2.048 MHz,so for playing audio files sampled at 8Khz and recording samples at 8kbps I used the following config for control B register

 

MCDIV(0) | SCDIV(0) | DIRATE(3);

Attachments

    Outcomes