[#6077] AD183X fails to detect on BF561-EZKIT

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

[#6077] AD183X fails to detect on BF561-EZKIT

Submitted By: Stephen Lombard

Open Date

2010-06-27 03:52:14    

Priority:

Medium     Assignee:

Barry Song

Status:

Open     Fixed In Release:

N/A

Found In Release:

2010R1     Release:

Category:

N/A     Board:

EZKIT Lite

Processor:

ALL     Silicon Revision:

bf561-0.3

Is this bug repeatable?:

Yes     Resolution:

Fixed

Uboot version or rev.:

u-boot-2010.03     Toolchain version or rev.:

latest trunk

App binary format:

FDPIC     

Summary: AD183X fails to detect on BF561-EZKIT

Details:

 

Have tried all combinations to get AD183X to detect on BF561-EZKIT (AD1836A).

 

linux-2.6.x/arch/blackfin/mach-bf561/boards/ezkit.c:

 

static struct spi_board_info bfin_spi_board_info[] __initdata = {

#if defined(CONFIG_SND_BF5XX_SOC_AD183X) \

        || defined(CONFIG_SND_BF5XX_SOC_AD183X_MODULE)

        {

                .modalias = "ad183x",

                .max_speed_hz = 3125000,     /* max spi clock (SCK) speed in HZ */

                .bus_num = 0,

                .chip_select = 4,

                .platform_data = "ad1836", /* only includes chip name for the moment */

                .controller_data = &ad1836_spi_chip_info,

                .mode = SPI_MODE_3,

        },

         

#endif  

 

From debug it seems that SPORT0 and/or TDM is not being initialised.

 

Please let me know what I can do to help you.

 

Follow-ups

 

--- Mike Frysinger                                           2010-06-27 03:58:18

please post your kernel .config file as well as the full boot log

 

--- Stephen Lombard                                          2010-06-27 06:53:06

Mike,

 

Thank you.  Files are attached.  There's also a dmesg capture showing the

progress after the modprobe.

 

--- Barry Song                                               2010-06-28 04:09:01

Have you added

#if defined(CONFIG_SND_BF5XX_TDM) || defined(CONFIG_SND_BF5XX_TDM_MODULE)

static struct platform_device bfin_tdm = {

        .name = "bfin-tdm",

        .id = CONFIG_SND_BF5XX_SPORT_NUM,

        /* TODO: add platform data here */

};

#endif

 

static struct platform_device *stamp_devices[] __initdata = {

 

+ &bfin_tdm,

 

}

in the board file?

-barry

 

--- Barry Song                                               2010-06-28 04:39:21

Audio platform info added in the trunk head.

-barry

 

--- Stephen Lombard                                          2010-06-28 05:36:13

Sweet! It's getting better and after the changes the chip now detects.

 

However it doesn't make any audio.  I've attached a new boot log, dmesg and

/proc interrupts.

 

After using the 'tone' application you'll see that /proc/interrupts show 0 for

SPORT TX, SPORT RX and SPORT Err.

 

Whether this helps or not it seems that dma rx and tx numbers, and irq in the

new_dmesg file are different to that of what they were in 2009RC1.  There it

used to report:

 

ALSA device list:

  #0: AD1836 at PF4 SPORT0 rx/tx dma 3/4 err irq 45

 

-- Stephen.

 

--- Barry Song                                               2010-06-28 05:56:11

Are you sure your hardware is connected right? Notice spi chip_select (4) and

sport port.

-barry

 

--- Stephen Lombard                                          2010-06-28 06:08:20

Yes as far as I can tell.  Audio works (for the most part) in 2009RC1 using the

documented switch settings and what not from the wiki.

 

In 2009RC1 I can run 'tone', 'aplay' and 'mplayer' without issues using the

same hardware and settings.

 

-- Stephen.

 

--- Stephen Lombard                                          2010-06-28 07:35:13

The following mods need to be made to the board config file as well, else the

chip does not detect again:

 

#if defined(CONFIG_SND_BF5XX_SOC_AD183X) \

        || defined(CONFIG_SND_BF5XX_SOC_AD183X_MODULE)

        {

                .modalias = "ad183x",

                .max_speed_hz = 3125000,     /* max spi clock (SCK) speed in HZ

*/

                .bus_num = 0,

                .chip_select = 4,

                .platform_data = "ad1836", /* only includes chip name

for the moment */

                .controller_data = &ad1836_spi_chip_info,

+                .mode = SPI_MODE_3,

        },

#endif

 

--- Stephen Lombard                                          2010-06-30 11:00:44

Any update on the issue with rx/tx dma being 12/13 and irq 13 instead of the old

values of 3/4 irq 45?

 

Shall I create a new bug request?

 

I just cleaned out the config and started again and it's still doing the same:

 

dma rx:12 tx:13, err irq:13, regs:ffc00800

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

asoc: AD183X <-> bf5xx-tdm mapping ok

ALSA device list:

  #0: bf5xx_ad183x (AD183X)

TCP cubic registered

NET: Registered protocol family 17

eth0: link down

eth0: link up, 100Mbps, full-duplex, lpa 0xCDE1

IP-Config: Complete:

     device=eth0, addr=10.10.10.115, mask=255.255.255.0, gw=10.10.10.154,

     host=whatbox-rm561, domain=, nis-domain=(none),

     bootserver=10.10.10.2, rootserver=10.10.10.2, rootpath=

Freeing unused kernel memory: 5544k freed

root:/> tone

TONE: generating sine wave at 1000 Hz...

ERROR: write(/dev/dsp) failed, errno=5

 

--- Barry Song                                               2010-06-30 23:03:45

I don't think you provide right information.

For bf537, 3/4 are DMA rx/tx channels of SPORT0:

#define CH_SPORT0_RX            3

#define CH_SPORT0_TX            4

 

For bf561,

#define CH_SPORT0_RX            12

#define CH_SPORT0_TX            13

That's not a problem.

 

And bf561-ezkit need a transfer board to connect with ad1836, did you design a

board?

-barry

 

 

--- Stephen Lombard                                          2010-07-01 04:42:32

I have the Analog Devices BF561-EZKIT.  The BF561-EZKIT has on-board AD1836

connected directly to SPORT0 and PF4. 

 

--- Barry Song                                               2010-07-02 01:49:16

I have repeated what you said. AD1836 can't work on bf561. I think the jumper

setting is:

SW4.5  OFF

SW4.6  OFF

 

-barry

 

--- Stephen Lombard                                          2010-07-02 05:42:40

Thank you so much for your persistence Barry, much appreciated.

 

Yes I can confirm that SW4.5 is OFF and SW4.6 is OFF as per the Wiki.  In

actual fact all switches are set as per the Wiki for the BF561-EZKIT.

 

I have tonight worked with both kernels 2.6.34-ADI-2010R1-pre-svn8961 and

2.6.28.10-ADI-2009R1.1.

 

The AD1836 works on the BF561-EZKIT on kernel 2.6.28.10-ADI-2009R1.1 in TDM

mode and i2s when SW4.5 and SW4.6 is ON.  To keep this example consistent I used

only TDM mode and took the readings after using 'tone' application.

 

Below are the results:

 

2.6.28.10-ADI-2009R1.1:

 

root:/> more /proc/dma

12: SPORT RX Data

13: SPORT TX Data

17: BFIN_UART_RX

18: BFIN_UART_TX

24: Blackfin dma_memcpy

25: Blackfin dma_memcpy

root:/>

 

root:/> more /proc/interrupts

  6:      89850      CORE  Blackfin CoreTimer

13:          0      INTN  SPORT error

30:          0      INTN  SPORT RX Data

31:       2270      INTN  SPORT TX Data

35:          0      INTN  BFIN_UART_RX

36:      13154      INTN  BFIN_UART_TX

82:        151      GPIO  eth0

NMI:          0      CORE  Non Maskable Interrupt

Err:          0

root:/>

 

2.6.34-ADI-2010R1-pre-svn8961:

 

root:/> more /proc/interrupts

  6:     552048      CORE  Blackfin CoreTimer

13:          0      INTN  SPORT err

30:          0      INTN  SPORT RX Data

31:          0      INTN  SPORT TX Data

35:          0      INTN  BFIN_UART_RX

36:      11112      INTN  BFIN_UART_TX

82:       1319      GPIO  eth0

NMI:          0      CORE  Non Maskable Interrupt

Err:          0

root:/>

 

root:/> more /proc/dma

12: SPORT RX Data

13: SPORT TX Data

17: BFIN_UART_RX

18: BFIN_UART_TX

24: Blackfin dma_memcpy

25: Blackfin dma_memcpy

root:/>

 

All this proves is that with the same switch settings on the BF561-EZKIT the

AD1836 works in 2.6.28.10-ADI-2009R1.1 at least, but I can appreciate that the

architecture has changed somewhat in the new 2.6.34-ADI-2010R1-pre-svn8961.

 

Unfortunately my logic analyzer is in the shop for repair and calibration so I

can't test to see if the BF561 is actually writing on SPORT0, but from what I

can tell it doesn't seem to be the case.

 

--Stephen

 

--- Barry Song                                               2010-07-06 03:28:03

Fixed. There is a gpio to control the reset of ad1836 on bf561, its value is 0,

which stops ad1836 work normally. request this interrupt, and set it to 1.

-barry

 

--- Robin Getz                                               2010-07-06 04:08:59

Barry:

 

I'm not an ASoC expert - but do we want to put platform specific things (like

PCB reset control) in the driver? (trunk/sound/soc/blackfin/bf5xx-ad183x.c)?

Shouldn't that be as platform agnostic as possible?

 

Doesn't it really belong in arch/blackfin/mach-bf561/boards/ezkit.c?

 

-Robin

 

--- Barry Song                                               2010-07-06 04:20:03

I think there has been a discussion with long discussion about this. Current

ASoC lets machine drivers care about the board-related features.

-Barry

 

--- Stephen Lombard                                          2010-07-06 19:39:21

I can confirm that /proc/interrupts now shows the SPORT ticking over nicely,

however there is a new problem.

 

There is no sound coming out of the DAC's, or any sound being recorded from the

ADC's.

 

I have ensured that mixer settings are correct and switches are correct.

 

'vrec' and 'arecord' make blank audio files (there is a tone generator

connected to the ADC and 'tone' generates silence.

 

-- Stephen

 

--- Barry Song                                               2010-07-07 23:14:49

Sorry. My fault. I have moved gpio setting to board init, which seems to make

more sense and also fix this issue.

-barry

 

--- Stephen Lombard                                          2010-07-08 09:10:45

Awesome Barry!  I can confirm that the AD1836 on the BF561-EZKIT is now making

sound in TDM mode (I haven't tested AC97).

 

There is one more problem thought - TUVF errors are very frequent using 'tone',

'aplay' etc.

 

I've traced the error to:

 

#define PCM_BUFFER_MAX  0x8000

#define FRAGMENT_SIZE_MIN  (4*1024)

 

in "bf5xx-tdm-pcm.c"

 

The buffers seem to be too small and contradictory to the ac97 and i2s buffers

which is set at 0x20000.

 

Personally I've tried increasing it to 0x10000 and have dramatically reduced

the TUVF errors so perhaps you can confirm that the buffers are too small in

your tests?

 

-- Stephen

 

 

 

    Files

    Changes

    Commits

    Dependencies

    Duplicates

    Associations

    Tags

 

File Name     File Type     File Size     Posted By

proc_interrupts.txt    text/plain    452    Stephen Lombard

dmesg.txt    text/plain    10066    Stephen Lombard

bootlog.txt    text/plain    7188    Stephen Lombard

config    application/xml    32840    Stephen Lombard

config.txt    text/plain    32840    Stephen Lombard

new_dmesg.txt    text/plain    10772    Stephen Lombard

new_bootlog.txt    text/plain    5770    Stephen Lombard

Outcomes