[#5398] sound quality is not good in linphone test of ad1836 when call from board to PC

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

[#5398] sound quality is not good in linphone test of ad1836 when call from board to PC

Submitted By: Vivi Li

Open Date

2009-07-27 06:29:18     Close Date

2009-08-19 23:20:01


Medium     Assignee:

Barry Song


Closed     Fixed In Release:


Found In Release:

N/A     Release:


Audio     Board:



BF537     Silicon Revision:

Is this bug repeatable?:

Yes     Resolution:


Uboot version or rev.:

    Toolchain version or rev.:


App binary format:


Summary: sound quality is not good in linphone test of ad1836 when call from board to PC



In linphone test for ad1836 on bf537-stamp, call from board to PC, the sound quality is not good and there is a lot of noise in the background.


5.1 Channels also has this problem.



Linux version (test@uclinux72-bf537-stamp-elf) (gcc version 4.1.2 (ADI svn)) #142 Sat Jul 25 23:31:9

bootconsole [early_shadow0] enabled

bootconsole [early_BFuart0] enabled

early printk enabled on early_BFuart0

Warning: limiting memory to 56MB due to hardware anomaly 05000263

Board Memory: 64MB

Kernel Managed Memory: 64MB

Memory map:

  fixedcode = 0x00000400-0x00000490

  text      = 0x00001000-0x00104730

  rodata    = 0x00104730-0x00155530

  bss       = 0x00156000-0x00167720

  data      = 0x00167720-0x00178000

    stack   = 0x00176000-0x00178000

  init      = 0x00178000-0x00a4c000

  available = 0x00a4c000-0x037ff000

  DMA Zone  = 0x03e00000-0x04000000

Hardware Trace Active and Enabled

Boot Mode: 0

Reset caused by Software reset

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

Compiled for ADSP-BF537 Rev 0.2

Blackfin Linux support by http://blackfin.uclinux.org/

Processor Speed: 500 MHz core clock and 125 MHz System Clock

NOMPU: setting up cplb tables

Instruction Cache Enabled for CPU0

Data Cache Enabled for CPU0 (write-back)

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

Kernel command line: root=/dev/mtdblock0 rw clkin_hz=25000000 earlyprintk=serial,uart0,57600 console=ttyBF0,57600 ip=

Configuring Blackfin Priority Driven Interrupts

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

console handover:boot [early_BFuart0] boot [early_shadow0]  -> real [ttyBF0]

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

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

Memory available: 46228k/65536k RAM, (9040k init code, 1037k kernel code, 463k data, 2048k dma, 6720k reserved)

Calibrating delay loop... 995.32 BogoMIPS (lpj=1990656)

Security Framework initialized

Mount-cache hash table entries: 512

Blackfin Scratchpad data SRAM: 4 KB

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

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

Blackfin L1 Instruction SRAM: 48 KB (37 KB free)

net_namespace: 288 bytes

NET: Registered protocol family 16

Blackfin DMA Controller

stamp_init(): registering device resources

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

NET: Registered protocol family 1

msgmni has been set to 90

io scheduler noop registered

io scheduler anticipatory registered (default)

io scheduler cfq registered

Serial: Blackfin serial driver

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

brd: module loaded

bfin_mii_bus: probed

bfin_mac: attached PHY driver [SMSC LAN83C185] (mii_bus:phy_addr=0:01, irq=-1, mdc_clk=2500000Hz(mdc_div=24)@sclk=125MHz)

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

bfin-spi bfin-spi.0: Blackfin on-chip SPI Controller Driver, Version 1.0, regs_base@ffc00500, dma channel@7

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

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

TCP cubic registered

NET: Registered protocol family 17

rtc-bfin rtc-bfin: setting system clock to 1970-01-01 00:49:08 UTC (2948)

IP-Config: Gateway not on directly connected network.

Freeing unused kernel memory: 9040k freed

dma_alloc_init: dma_page @ 0x00a48000 - 512 pages at 0x03e00000


        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|            - http://blackfin.uclinux.org/

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

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

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


Have a lot of fun...



BusyBox v1.13.4 (2009-07-25 23:23:39 GMT) built-in shell (msh)

Enter 'help' for a list of built-in commands.


root:/> PHY: 0:01 - Link is Up - 100/Full


root:/> version

kernel:    Linux release, build #142 Sat Jul 25 23:31:47 GMT 2009

toolchain: bfin-linux-uclibc-gcc release gcc version 4.1.2 (ADI svn)

user-dist: release svn-8583, build #2703 Sat Jul 25 23:30:02 GMT 2009

root:/>  modprobe snd-pcm-oss; modprobe snd-ad1836

root:/> route add -net default gw

root:/> route

Kernel IP routing table

Destination     Gateway         Genmask         Flags Metric Ref    Use Iface      *        U     0      0        0 eth0

default         UG    0      0        0 eth0


root:/> linphonec

NLS disabled.


Warning: video is disabled in linphonec.


linphonec> call sip:test@

Contacting sip:test@

linphonec> linphonec> Connected.






--- Barry Song                                               2009-07-28 01:04:47

It's an analog issue, but not a digital issue. If sound quality is bad, pull out

the mic to ad1836, and pull in again, the sound will be normal. In the whole

pull process, DMA and driver aren't involved at all. It's really strange pulling

out/in can fix the sound quality.

Let me check whether we can set more suitable values to ADC_CTRLx registers to

fix the problem.



--- Michael Hennerich                                        2009-07-28 03:51:07



I think I can explain what you are seeing.

The MIC input stage on the AD1836 audio card has a fairly large DC blocking


Since the input stage of the external OP-Amp MIC amplifier is very high

impedance. The voltage across the capacitor will drift. (to prevent this, there

should have been a 50 - 100kOHM resistor to ground)


Now when you remove the plug. The connector terminals will be connected to

ground - inside the connector block. This will discharge the DC blocking

capacitor - and things will sound much better then.




--- Barry Song                                               2009-07-28 05:33:44

Ok. I have tested linphone on several codecs(ad1836,ad1980,ad1938), all have

same problem.

And the problem is caused by speex. If disable speex and enable PCMU, the sound

quality is reliable and good in linphone. And for speex, the VBR makes sound

quality much worse.

If disable VBR of speex, sound quality is also reliable and good. So maybe it

isn't a bug, but a performance issue of speex.

Do we need to make the following change in speex to "fix" this


Index: lib/speex/Makefile


--- lib/speex/Makefile  (revision 8539)

+++ lib/speex/Makefile  (working copy)

@@ -3,8 +3,8 @@


        --without-ogg \

        --enable-blackfin-asm \

-       --enable-fixed-point


+       --enable-fixed-point \

+       --disable-vbr

include $(ROOTDIR)/tools/autotools.mk









--- Barry Song                                               2009-07-28 05:48:35

Hi Michael,

Thanks for your tips. I misunderstood it be an analog/hardware issue. In fact,

it is an algorithm issue.

The process of pull out/in happens to trigger the VBR change in speex(from mute

to having data), then makes the sound better for a while. After a while, the

bitrate begins to decrease, the sound quality becomes bad again. After pulling

out/in mic(or pause/resume the MP3-player to input mic) again, sound becomes

better for a while.

Maybe it is just the character of voice? Voice shows many mute and unmute in

fact. So using a mp3-player output to connect the mic to test linphone quality

is maybe not a right way. After all, the music is not same with voice.





--- Robin Getz                                               2009-07-28 07:13:35

IF it is a bug in the VBR code - we need to report it upstream - and fix it --

not disable the feature.


It might be interesting to see how SPEEX_SET_VBR_QUALITY effects things?




--- Barry Song                                               2009-08-02 23:21:04

By 1.2beta3, speex still has some problems in VBR for non-floating platform

according to its release comment. Sending a mail to speex-dev@xiph.org to get

the current status.



Speex 1.2beta3 is out

December 11, 2007

The most obvious change in this release is that all the non-codec components

(preprocessor, echo cancellation, jitter buffer) have been moved to a new

libspeexdsp library. Other changes include a new jitter buffer algorithm and

resampler improvements/fixes. This is also the first release where libspeex can

be built without any floating point support. To do this, the float compatibility

API must be disabled (--disable-float-api or DISABLE_FLOAT_API) and the VBR

feature must be disabled (--disable-vbr or DISABLE_VBR).


--- Sonic Zhang                                              2009-08-03 03:08:06

If so, I think we should disable vbr in 2009R1 release. But, on SVN trunk, we

can wait to see if this is fixed in future version of speex.


--- Vivi Li                                                  2009-08-20 04:20:35

OK now. Close it.












File Name     File Type     File Size     Posted By

config.linphone_ad1836    application/octet-stream    32709    Vivi Li

config.linphone_ad1836_5.1    application/octet-stream    32709    Vivi Li