This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

One-way (SCO?) audio from headset <--> wl1271

Other Parts Discussed in Thread: WL1271

When using a Bluetooth headset (Samsung HM3700) with a Broadcom USB Bluetooth dongle (vid:0x0a5c pid:0x2198) I can successfully get bi-directional audio working (Bluez 4.98) once I have paired with the headset. However, when using the "TiWi-R2" (WL1271), I am only capable of receiving audio (to the headset spk) with the microphone seemingly not working at all. Looking at HCICONFIG, it would seem that I am not receiving any 'SCO' data ?!

Not being familiar with the WL1271, perhaps someone knows what may be responsible.

$ cat /etc/asound.conf

# conf

pcm.!bluetooth {
   type bluetooth
   device 04:18:0F:CD:86:4B
   profile voice
}

$ cat /etc/bluetooth/audio.conf

# Configuration file for the audio service

[General]
Enable=Socket,Source,Sink,Headset
Disable=Media,Gateway,Control

# Switch to master role for incoming connections (defaults to true)
#Master=true

# SCO routing. Either PCM or HCI (in which case audio is routed to/from ALSA)
# Defaults to HCI
#SCORouting=PCM

# Automatically connect both A2DP and HFP/HSP profiles for incoming
# AutoConnect=true

# Headset interface specific options (i.e. options which affect how the audio
# service interacts with remote headset devices)
[Headset]

# Set to true to support HFP, false means only HSP is supported
# Defaults to true
HFP=true

# Maximum number of connected HSP/HFP devices per adapter. Defaults to 1
MaxConnected=1

# Set to true to enable use of fast connectable mode (faster page scanning)
FastConnectable=false

#[A2DP]
#SBCSources=1
#MPEG12Sources=0

## simple bluetooth audio test

$ arecord -D plug:bluetooth -f S16_LE -r 8000 audioTest.wav
$ aplay   -D plug:bluetooth -f S16_LE -r 8000 audioTest.wav

## bluetooth spk test

$ cat /dev/urandom | aplay -D plug:bluetooth -f S16_LE -r 8000

## bluetooth mic test

$ arecord -D plug:bluetooth -f S16_LE -r 8000 | aplay -D plughw:0,1

## bluetooth firmware patch

root@VOCALDEV:/opt# md5sum /lib/firmware/TIInit_7.2.31.bts
b2655f34bf0f27e14883d16cab8af42a /lib/firmware/TIInit_7.2.31.bts

## USB DONGLE

root@VOCALDEV:/opt# hciconfig
hci0: Type: BR/EDR Bus: USB
BD Address: 00:02:72:C5:70:85 ACL MTU: 1021:8 SCO MTU: 64:1
UP RUNNING PSCAN
RX bytes:2812040 acl:62 sco:55061 events:129 errors:0
TX bytes:51216 acl:98 sco:7125 commands:83 errors:0

## WL1271

root@VOCALDEV:/opt# hciconfig
hci0: Type: BR/EDR Bus: UART
BD Address: 00:18:2F:A8:55:A3 ACL MTU: 1021:4 SCO MTU: 180:4
UP RUNNING PSCAN
RX bytes:5999 acl:88 sco:0 events:203 errors:0 <----- NOTE this is 0 ?!
TX bytes:322316 acl:98 sco:6125 commands:70 errors:0

## full wl1271 bluetooth example

root@DM8168SRV:~# ifconfig wlan0 up
ti8168_wl12xx_set_power(on)
wl1271: firmware booted (Rev 6.3.3.0.79)
wl1271: Driver version: R4_SP2_02_03
root@DM8168SRV:~# echo 1 > /sys/class/gpio/gpio18/value
root@DM8168SRV:~# hciattach /dev/ttyO1 texas 3000000
Found a Texas Instruments' chip!
Firmware file : /lib/firmware/TIInit_7.2.31.bts
Loaded BTS script version 1
texas: changing baud rate to 3000000, flow control to 1
Bluetooth: Core ver 2.16
NET: Registered protocol family 31
Bluetooth: HCI device and connection manager initialized
Bluetooth: HCI socket layer initialized
Bluetooth: L2CAP socket layer initialized
Bluetooth: SCO socket layer initialized
Bluetooth: HCI UART driver ver 2.2
Bluetooth: HCI H4 protocol initialized
Bluetooth: HCI BCSP protocol initialized
Bluetooth: HCILL protocol initialized
Bluetooth: BNEP (Ethernet Emulation) ver 1.3
Bluetooth: BNEP filters: protocol multicast
Bluetooth: RFCOMM TTY layer initialized
Bluetooth: RFCOMM socket layer initialized
Bluetooth: RFCOMM ver 1.11
Device setup complete
root@DM8168SRV:~#
root@DM8168SRV:~# hciconfig
hci0: Type: BR/EDR Bus: UART
BD Address: 00:18:2F:A8:55:A3 ACL MTU: 1021:4 SCO MTU: 180:4
UP RUNNING PSCAN
RX bytes:900 acl:0 sco:0 events:37 errors:0
TX bytes:705 acl:0 sco:0 commands:37 errors:0

root@DM8168SRV:~# hcitool scan
Scanning ...
04:18:0F:CD:86:4B HM3700
CC:6E:A1:D3:6D:94 Roku Player

root@DM8168SRV:~# hciconfig
hci0: Type: BR/EDR Bus: UART
BD Address: 00:18:2F:A8:55:A3 ACL MTU: 1021:4 SCO MTU: 180:4
UP RUNNING PSCAN
RX bytes:2265 acl:14 sco:0 events:76 errors:0
TX bytes:1136 acl:15 sco:0 commands:47 errors:0

-- Leon Kok | VOCAL Technologies

PS: While there seems to have been no progress, this seems similar to the issue seen on page 2 of http://e2e.ti.com/support/low_power_rf/f/307/t/85657.aspx

  • Hi Leon, 

    I believe you have a PCM integration issue. SCO data is transmitted over PCM interface, and you probably have some mis-alignment in the configuration between the host and the chipset.  

  • Good Morning Matan,

    Thank you for your response, perhaps you could clarify somewhat?

    I'm at a loss as to why only one-way audio is heard as my understanding is that it is also 'SCO' data right?

    Looking at (the default)  '/etc/bluetooth/audio.conf'  I see the following which would imply that 'SCO' data is handled via 'HCI' (vs PCM?) 

    # SCO routing. Either PCM or HCI (in which case audio is routed to/from ALSA)
    # Defaults to HCI
    #SCORouting=PCM

    That said, this morning I 'switched' it to PCM (as below) with no audio working at all! Using the very same config, I plugged in the USB dongle confirm that USB-bluetooth audio still works.

    # SCO routing. Either PCM or HCI (in which case audio is routed to/from ALSA)
    # Defaults to HCI
    SCORouting=PCM

    Also, in the forum link I provided at the end of my first post, someone mentioned some 'custom hci commands' might need to be written to the TiWi-R2 device. Might you know of some documentation on these commands? Is there a way to 'reset' the device to a known state?

    -- Leon Kok | VOCAL Technologies

  • Hi Leon, 

    I am not sure why it is not working for you over HCI, and where is the problem there. 

    As for PCM option - you need to configure the PCM interface, (clock, Framesync, etc'). This can be done in vendor-specific HCI commands, or by editing the BTS. 

    The BTS editor needs to be licensed from TI or the editing can be done for you through 3rd parties (such as integrity-project)

  • We have used below hci commands, and enabled the audio code in the BT module,
    Now we are able to get the I2s clock output from the BT Module, but there is no I2S data coming out of the Device even after playback/record is initiated via bluetooth stack (here bluez).

    So Is there any other HCI VS command, that needs to be called specifically in sequence before playback/record via PCM?

    Enable Audio Routing via PCM in BT Module

    HCI_VS_Write_CODEC_Config (0xFD06)106

    $ hcitool cmd 0x3f 0x106 0x0 0x8 0x0 0x40 0x1F 0x0 0x0 0x1 0x0 0x0 0x0 0x0 0x10 0x0 0x1 0x0 0x0 0x10 0x0 0x1 0x0 0x1 0x0 0x10 0x0 0x11 0x0 0x0 0x10 0x0 0x11 0x0 0x1 0x0


    HCI_VS_Write_CODEC_Config_Enhanced (0xFD07) 107

    $ hcitool cmd 0x3f 0x107 0 0 0 0 0 0 0 0 2 0 0 0 0 0 0 0 0 0 2 0 0 0 0 0 0 0


    HCI_VS_Write_SCO_Configuration (0xFE10)

    $ hcitool cmd 0x3f 0x210 0x0 0x0 0x0 0x0 0x0



    HCI_VS_A3DP_Codec_Configuration (0xFD8E)

    $ hcitool cmd 0x3f 0x18e 0x0 0x04 0x1 0x0 0x0 0x4 0x4 0x0 0x00 0x00 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0
  • Hi,

    We will track this latest query as part of e2e.ti.com/.../1420546

    Regards,
    Gigi Joseph.