2010-08-31 20:05:23     SSM2602 on the BF518-EZBRD

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

2010-08-31 20:05:23     SSM2602 on the BF518-EZBRD

Patrick Doyle (UNITED STATES)

Message: 92980   


Can anybody point me in the right direction for bringing up audio (via the SSM2602 codec) on the BF518-EZBRD?  I thought it might be as easy as following https://docs.blackfin.uclinux.org/doku.php?id=linux-kernel:drivers:ssm2602 and perhaps adding an entry in i2c table in ezbrd.c.


But that doesn't seem to work for me.  I found this thread:   blackfin.uclinux.org/gf/project/uclinux-dist/forum/?_forum_action=ForumMessageBrowse&thread_id=38671&action=ForumBrowse, which indicates that somebody else has done (or at least tried) this before.


For some reason, the board ships with the DIP switches set up for an SPI interface to the codec instead of an I2C interface.  I've changed the switches to support the I2C interface, but I'm left wondering if perhaps it is known that the I2C interface to the codec doesn't work on my rev 0.2 board.


Is there some way I can peek and poke (I'm showing my age here) registers on the codec via the I2C interface from userland?  (i.e. cat into or from something like /sysfs/devices/i2c/codec)


I'd appreciate any tips anybody would like to toss out to me.  In the mean time, I'll keep plodding along myself.


Oh yeah... "that doesn't seem to work for me" means, I don't see any boards or cards listed in /proc/asound and there is no /dev/dsp.






2010-08-31 21:54:36     Re: SSM2602 on the BF518-EZBRD

Aaron Wu (CHINA)

Message: 92981   


Could you post your kernel booting up log?




2010-09-01 07:22:45     Re: SSM2602 on the BF518-EZBRD

Patrick Doyle (UNITED STATES)

Message: 93016   


Here's the boot log.  I tried compiling everything into the kernel instead of loading them as modules, and that didn't seem to help.




## Booting kernel from Legacy Image at 01000000 ...

   Image Name:   bf518-

   Created:      2010-09-01   0:58:11 UTC

   Image Type:   Blackfin Linux Kernel Image (gzip compressed)

   Data Size:    4027517 Bytes =  3.8 MB

   Load Address: 00001000

   Entry Point:  001c79ec

   Verifying Checksum ... OK

   Uncompressing Kernel Image ... OK

Starting Kernel at = 001c79ec                                                 

Linux version (wpd@Ubuntu) (gcc version 4.1.2 (ADI svn)) #28 Tue Aug 31 20:58:00 EDT 2010

register early platform devices                                               

bootconsole [early_shadow0] enabled                                           

bootconsole [early_BFuart0] enabled                                           

early printk enabled on early_BFuart0                                         

Board Memory: 64MB                                                            

Kernel Managed Memory: 64MB                                                   

Memory map:                                                                   

  fixedcode = 0x00000400-0x00000490                                           

  text      = 0x00001000-0x001345d0                                           

  rodata    = 0x001345d0-0x0019b648                                           

  bss       = 0x0019c000-0x001acd98                                           

  data      = 0x001acd98-0x001be000                                           

    stack   = 0x001bc000-0x001be000                                           

  init      = 0x001be000-0x00784000                                           

  available = 0x00784000-0x03f00000                                           

  DMA Zone  = 0x03f00000-0x04000000                                           

Hardware Trace Active and Enabled                                             

Boot Mode: 3                                                                  

Reset caused by Software reset                                                

Blackfin support (C) 2004-2010 Analog Devices, Inc.                           

Compiled for ADSP-BF518 Rev 0.0                                               

Blackfin Linux support by   blackfin.uclinux.org/                        

Processor Speed: 400 MHz core clock and 80 MHz System Clock                   

NOMPU: setting up cplb tables                                                 

Instruction Cache Enabled for CPU0                                            

  External memory: cacheable in instruction cache                             

Data Cache Enabled for CPU0                                                   

  External memory: cacheable (write-back) in data cache                       

Built 1 zonelists in Zone order, mobility grouping off.  Total pages: 16002   

Kernel command line: root=/dev/mtdblock0 rw clkin_hz=25000000 earlyprintk=serial

,uart0,57600 console=ttyBF0,57600 ip=


PID hash table entries: 256 (order: -2, 1024 bytes)                           

Dentry cache hash table entries: 8192 (order: 3, 32768 bytes)                 

Inode-cache hash table entries: 4096 (order: 2, 16384 bytes)                  

Memory available: 56248k/65536k RAM, (5912k init code, 1229k kernel code, 551k d

ata, 1024k dma, 572k reserved)                                                

Hierarchical RCU implementation.                                              


Configuring Blackfin Priority Driven Interrupts                               

console [ttyBF0] enabled, bootconsole disabled                                

console [ttyBF0] enabled, bootconsole disabled                                

Calibrating delay loop... 794.62 BogoMIPS (lpj=1589248)                       

Security Framework initialized                                                

Mount-cache hash table entries: 512                                           

Blackfin Scratchpad data SRAM: 4 KB                                           

Blackfin L1 Data A SRAM: 16 KB (16 KB free)                                   

Blackfin L1 Data B SRAM: 16 KB (16 KB free)                                   

Blackfin L1 Instruction SRAM: 32 KB (26 KB free)                              

NET: Registered protocol family 16                                            

Blackfin DMA Controller                                                       

ezbrd_init(): registering device resources                                    

bio: create slab <bio-0> at 0                                                 

bfin-spi bfin-spi.0: Blackfin on-chip SPI Controller Driver, Version 1.0, regs_b

ase@ffc00500, dma channel@7                                                   

bfin-spi bfin-spi.1: Blackfin on-chip SPI Controller Driver, Version 1.0, regs_b

ase@ffc03400, dma channel@5                                                   

i2c-bfin-twi i2c-bfin-twi.0: Blackfin BF5xx on-chip I2C TWI Contoller, regs_base


Advanced Linux Sound Architecture Driver Version                    

NET: Registered protocol family 2                                             

IP route cache hash table entries: 1024 (order: 0, 4096 bytes)                

TCP established hash table entries: 2048 (order: 2, 16384 bytes)              

TCP bind hash table entries: 2048 (order: 1, 8192 bytes)                      

TCP: Hash tables configured (established 2048 bind 2048)                      

TCP reno registered                                                           

UDP hash table entries: 256 (order: 0, 4096 bytes)                            

UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)                       

NET: Registered protocol family 1                                             

msgmni has been set to 109                                                    

io scheduler noop registered (default)                                        

bfin-otp: initialized                                                         

bfin-uart: Blackfin serial driver                                             

bfin-uart.0: ttyBF0 at MMIO 0xffc00400 (irq = 29) is a BFIN-UART              

brd: module loaded                                                            

bfin_mii_bus: probed                                                          

bfin_mac: attached PHY driver [Generic PHY] (mii_bus:phy_addr=0:03, irq=-1, mdc_


bfin_mac bfin_mac.0: Blackfin on-chip Ethernet MAC driver, Version 1.1        

rtc-bfin rtc-bfin: rtc core: registered rtc-bfin as rtc0                      

i2c /dev entries driver                                                       

bfin-wdt: initialized: timeout=20 sec (nowayout=0)                            

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

No device for DAI SSM2602                                                     

ALSA device list:                                                             

  No soundcards found.                                                        

TCP cubic registered                                                          

NET: Registered protocol family 17                                            

rtc-bfin rtc-bfin: setting system clock to 1970-01-01 09:43:59 UTC (35039)    

IP-Config: Gateway not on directly connected network.                         

Freeing unused kernel memory: 5912k freed                                     


        a8888b.           / Welcome to the uClinux distribution \             

       d888888b.         /       _     _                         \            

       8P"YP"Y88        /       | |   |_|            __  __ (TM)  |           

       8|o||o|88  _____/        | |    _ ____  _   _ \ \/ /       |           

       8'    .88       \        | |   | |  _ \| | | | \  /        |           

       8`._.' Y8.       \       | |__ | | | | | |_| | /  \        |           

      d/      `8b.       \      \____||_|_| |_|\____|/_/\_\       |           

     dP   .    Y8b.       \   For embedded processors including   |           

    d8:'  "  `::88b        \    the Analog Devices Blackfin      /            

   d8"         'Y88b        \___________________________________/             

  :8P    '      :888                                                          

   8a.   :     _a88P         For further information, check out:              

._/"Yaa_:   .| 88P|            -   blackfin.uclinux.org/                

\    YP"    `| 8P  `.          -   docs.blackfin.uclinux.org/           

/     \.___.d|    .'           -   www.uclinux.org/                     

`--..__)8888P`._.'  jgs/a:f    -   www.analog.com/blackfin              


Have a lot of fun...                                                          



BusyBox v1.16.2 (2010-08-31 20:52:53 EDT) hush - the humble shell             






2010-09-01 08:29:22     Re: SSM2602 on the BF518-EZBRD

Aaron Wu (CHINA)

Message: 93022   


Looks like the SSM2602 is not successfully probed, what's your I2C related code for SSM2602 like? have you assigned a correct i2c address for it.




2010-09-01 09:11:32     Re: SSM2602 on the BF518-EZBRD

Patrick Doyle (UNITED STATES)

Message: 93025   


Hi Aaron,


Thank you for your response.


I added:


#if defined(CONFIG_SND_SOC_SSM2602) || defined(CONFIG_SND_SOC_SSM2602_MODULE) 


                I2C_BOARD_INFO("ssm2602", 0x1b),                              




to arch/blackfin/mach-bf518/boards/ezbrd.c inside the bfin_i2c_board_info[] array.  I don't have the board in front of me right now, but I was able look around in /sys/devices/i2c/someplace and see an entry named "ssm2602".


From the data sheet and the switch settings, it seems to me that the device address is correct, but I was hoping to verify that by reading or writing a /dev or /sys file and seeing the codec wiggle.






2010-09-01 09:22:49     Re: SSM2602 on the BF518-EZBRD

Adam Rosenberg (UNITED STATES)

Message: 93026   


I had to shift the address 1 bit to the right to make my i2c device work because the BF537 register that holds the address only accepts 7 bits.  Maybe you need to do this also?






2010-09-01 09:35:23     Re: SSM2602 on the BF518-EZBRD

Patrick Doyle (UNITED STATES)

Message: 93027   


Thanks Adam,


I can try that.  But I'm a little skeptical, because the code I stuffed into ezbrd.c was copied directly from the bf527-ezkit code, which I have assumed works.


Uh oh... that could be my problem.  I used used the word "assume".  I don't have the hardware in front of me right now, but I can try shifting the address just to see what happens.






2010-09-01 12:08:54     Re: SSM2602 on the BF518-EZBRD

Mike Frysinger (UNITED STATES)

Message: 93038   


that statement isnt really true.  there is no defficiency in the Blackfin TWI/I2C driver -- it works exactly the same as any other.  your understanding of i2c "addresses" isnt entirely correct.  all I2C addresses are 7bit and then the 8th bit is to control read/write accesses.  but that bit has no meaning when specifying the slave address.  if anything, whatever i2c datasheet you're reading is wrong if it specified the "address" by including the 8th read/write bit in it.


please review the i2c spec:





2010-09-01 13:05:41     Re: SSM2602 on the BF518-EZBRD

Adam Rosenberg (UNITED STATES)

Message: 93040    Mike,


When you explain the I2C addresses that way it makes a lot more sense.

The Atmel AT24C512B documentation included the R/W bit as the LSB of

the address, which is what led to my confusion. Thank you for

clearing that up.






2010-09-03 11:43:12     Re: SSM2602 on the BF518-EZBRD

Patrick Doyle (UNITED STATES)

Message: 93115   


I haven't had any time on the hardware recently, but I have had some time to review the software and, at this point, I feel like I need to ask a few very basic questions:



Has anybody used the SSM2602 codec on the BF518-EZBRD?  If so, what rev board did you use; what rev software did you use; and what did you do to get it to work?


Has anybody used the SSM2602 codec on the BF527-EZKIT with a recent copy of the trunk?



I've been assuming that the answers are "no" and "yes", but I'd like to move out of the "assumption" stage and into the "known good hardware/software" stage?






2010-09-03 18:11:33     Re: SSM2602 on the BF518-EZBRD

Mike Frysinger (UNITED STATES)

Message: 93123   


if it isnt in the board's platform resources, then we most likely have not done anything with it.


$ grep 2602 arch/blackfin/mach-bf518/boards/*.c

<no hits>




2010-09-03 18:19:23     Re: SSM2602 on the BF518-EZBRD

Patrick Doyle (UNITED STATES)

Message: 93124   


That's what I assumed (there's that word again).  I was wondering more if anybody else on the list had been successful with it.  I did find at least one post where somebody else had worked with this.  (Well, I thought I had... I can't seem to find it right now).


I am more curious to learn if the SSM2602 works on the BF527-EZKIT board with the current(ish) version of trunk, since that's what I'm modeling my work on.


Actually, the only "modeling" I did, was to add 4 lines of code to the I2C array in ezbrd.c.  So I think I'd be interested in learning if the SSM2602 works with _any_ board with a current(ish) trunk.






2010-09-03 18:21:23     Re: SSM2602 on the BF518-EZBRD

Patrick Doyle (UNITED STATES)

Message: 93125   


There it is:








2010-09-03 18:39:58     Re: SSM2602 on the BF518-EZBRD

Mike Frysinger (UNITED STATES)

Message: 93126   


most of the work we've done against the bf527-ezkit (which is what the wiki).  sad that cliff didnt check in his work for the bf518-ezkit.




2010-09-05 23:39:07     Re: SSM2602 on the BF518-EZBRD

Sonic Zhang (CHINA)

Message: 93158   


Yes, SSM2602 driver on SVN trunk works well on bf527. But, you should connect it to sport1.




2010-09-06 00:24:38     Re: SSM2602 on the BF518-EZBRD

Mike Frysinger (UNITED STATES)

Message: 93160   


his point is that the bf518-ezbrd ships with a codec on it, so our platform resources should contain support for it


ive filed a tracker item for it here:





2010-09-06 07:23:44     Re: SSM2602 on the BF518-EZBRD

Patrick Doyle (UNITED STATES)

Message: 93177   


Actually, my point was to just verify that the codec did, indeed, work on some platform or another, as I have been unable to get it to work on the rev 0.2 BF518 board (which has a '2602 on it).


At this point, I should phrase "unable to get it to work" as "unable to get it to work without modifying code that is not specific to the BF518", which would lead me to believe that this wouldn't work on the BF527.


Sonic's response that he has verified the SSM2602 on the BF527 with the current version of trunk, tells me that I am still missing something fundamental here.


RIght now, I am confused about the requirements to register drivers vs devices, platoform drivers vs platform devices, snd_soc drivers vs snd_soc_devices, etc...


I added the following line of code to bf5xx_ssm2602_init() (in "bf5xx-ssm2602.c"):


        platform_device_register_simple("bfin-i2s", 0, 0, 0);



because it seemed to me that the bfin-i2s driver was never getting probed.


(I also disabled MMC support since the MMC pins are shared with the SPORT0 pins).






2010-09-06 10:54:20     Re: SSM2602 on the BF518-EZBRD

Mike Frysinger (UNITED STATES)

Message: 93183   


your platform resources need to declare everything.  if you're adding platform register calls to random drivers, it means your platform resources are incomplete.




2010-09-06 21:28:02     Re: SSM2602 on the BF518-EZBRD

Patrick Doyle (UNITED STATES)

Message: 93196   


Ah hah!


That was the missing link.  I missed that difference between the ezkit and the ezbrd files, hence my questions about "does this _really_ work on the ezkit?" -- I could not see how it would have worked without that device being registered.


Now, onto the next problem...


Any guesses as to why I get the following when I run the tone demo (with snd-pcm-oss loaded), I get the following output:


ALSA sound/core/pcm_lib.c:318: BUG: pcmC0D0p:0, pos = 32768, buffer size = 32768, period size = 2048


(This repeats as long as the demo is running, about once/second.)


I asked on the ALSA list and was encouraged to look at the dma complete servicing and wrapping things around to beginnings of buffers and such, which I'll go do.  But I'm getting tired of playing the tough guy who beats his head bloody against a brick wall, when a simple question directed at the right folks would save me hours of frustration.


So this time, I'll start with the question :-)






2010-09-07 04:01:00     Re: SSM2602 on the BF518-EZBRD

Michael Hennerich (GERMANY)

Message: 93218    > I asked on the ALSA list


This thread can be found here: