Hi, I am working with IMX6ULL EVK.
Now I want start pulseaudio on bluetooth, I follow the examples in BlueZ5 and A2DP Sink on Freescale i.MX6Q/DL SabreSD or in Add tutorial: setting-up Bluetooth - PulseAudio by BertLindeman · Pull Request #24 · ev3dev/ev3dev.g... but I have problems.
Have you examples or a sequence of linux command to start pulseaudio on bluetooth in IMX6ULL EVK board ?
Regards,
Sergio D'Orazio.
Solved! Go to Solution.
Hi Diego,
The problem is the mtu dimension of my BT chip, it is 180 bytes.
I have solved the problem putting in /etc/pulse/default.pa this line
load-module module-bluetooth-discover autodetect_mtu=yes
and modifing the file backend-ofono.c , in the pulseaudio yocto module , the fixed mtu from 48 to 180.
(in this file there isn't autodetect_mtu manage and than I have fixed value set).
By.
Sergio.
Hello Diego,
my hardware bluetooth is cc2564 texas, but ,for example, the l2ping command work well and than I think my hardware module work.
This is my first experience with bluetooth and than I think that I need the correct sequence for software module configuration. I send you my module software version : Bluez v5.49 ,,, pulseaudio v11.1
I think I need the start correct sequence for this 2 modules.
Regard.
Sergio.
Hello,
Are you able to see the devices that you are willing to connect with bluetoothctl scan on? If yes, are you able to connect to that device?
Best regards,
Diego.
Hi Diego,
now I am working with my imx6ull and I want to send and receive audio from smartphone bluetooth or PC bluetooth or speaker bluetooth.
The actual situation is :
I need that the 3 configuration work well but for the moment I need work with smatphone.
I send you some trace.
I am seeing very strange service active on smartphone (sdptool browse <MAC SMARTPHONE>):
root@imx6ull14x14evk:~# sdptool browse BC:A5:8B:A3:8C:3A
Browsing BC:A5:8B:A3:8C:3A ...
Service RecHandle: 0x10000
Service Class ID List:
"Generic Attribute" (0x1801)
Protocol Descriptor List:
"L2CAP" (0x0100)
PSM: 31
"ATT" (0x0007)
uint16: 0x0001
uint16: 0x0003
Service RecHandle: 0x10001
Service Class ID List:
"Generic Access" (0x1800)
Protocol Descriptor List:
"L2CAP" (0x0100)
PSM: 31
"ATT" (0x0007)
uint16: 0x0014
uint16: 0x001a
Service Name: Headset Gateway
Service RecHandle: 0x10003
Service Class ID List:
"Headset Audio Gateway" (0x1112)
"Generic Audio" (0x1203)
Protocol Descriptor List:
"L2CAP" (0x0100)
"RFCOMM" (0x0003)
Channel: 2
Profile Descriptor List:
"Headset" (0x1108)
Version: 0x0102
Service Name: Handsfree Gateway
Service RecHandle: 0x10004
Service Class ID List:
"Handsfree Audio Gateway" (0x111f)
"Generic Audio" (0x1203)
Protocol Descriptor List:
"L2CAP" (0x0100)
"RFCOMM" (0x0003)
Channel: 3
Profile Descriptor List:
"Handsfree" (0x111e)
Version: 0x0107
Service Name: AV Remote Control Target
Service RecHandle: 0x10005
Service Class ID List:
"AV Remote Target" (0x110c)
Protocol Descriptor List:
"L2CAP" (0x0100)
PSM: 23
"AVCTP" (0x0017)
uint16: 0x0104
Profile Descriptor List:
"AV Remote" (0x110e)
Version: 0x0104
Service Name: Advanced Audio Source
Service RecHandle: 0x10006
Service Class ID List:
"Audio Source" (0x110a)
Protocol Descriptor List:
"L2CAP" (0x0100)
PSM: 25
"AVDTP" (0x0019)
uint16: 0x0103
Profile Descriptor List:
"Advanced Audio" (0x110d)
Version: 0x0103
Service RecHandle: 0x10007
Service Class ID List:
"AV Remote" (0x110e)
"AV Remote Controller" (0x110f)
Protocol Descriptor List:
"L2CAP" (0x0100)
PSM: 23
"AVCTP" (0x0017)
uint16: 0x0104
Profile Descriptor List:
"AV Remote" (0x110e)
Version: 0x0104
Service Name: Android Network Access Point
Service Description: NAP
Service RecHandle: 0x10008
Service Class ID List:
"Network Access Point" (0x1116)
Protocol Descriptor List:
"L2CAP" (0x0100)
PSM: 15
"BNEP" (0x000f)
Version: 0x0100
SEQ8: 0 6
Language Base Attr List:
code_ISO639: 0x656e
encoding: 0x6a
base_offset: 0x100
Profile Descriptor List:
"Network Access Point" (0x1116)
Version: 0x0100
Service Name: Android Network User
Service Description: PANU
Service RecHandle: 0x10009
Service Class ID List:
"PAN User" (0x1115)
Protocol Descriptor List:
"L2CAP" (0x0100)
PSM: 15
"BNEP" (0x000f)
Version: 0x0100
SEQ8: 0 6
Language Base Attr List:
code_ISO639: 0x656e
encoding: 0x6a
base_offset: 0x100
Profile Descriptor List:
"PAN User" (0x1115)
Version: 0x0100
Service Name: OBEX Phonebook Access Server
Service RecHandle: 0x1000a
Service Class ID List:
"Phonebook Access - PSE" (0x112f)
Protocol Descriptor List:
"L2CAP" (0x0100)
"RFCOMM" (0x0003)
Channel: 19
"OBEX" (0x0008)
Profile Descriptor List:
"Phonebook Access" (0x1130)
Version: 0x0102
Browsing BC:A5:8B:A3:8C:3A ...
Service Search failed: Invalid argument
Service Name: SMS/MMS
Service RecHandle: 0x1000b
Service Class ID List:
"Message Access - MAS" (0x1132)
Protocol Descriptor List:
"L2CAP" (0x0100)
"RFCOMM" (0x0003)
Channel: 4
"OBEX" (0x0008)
Profile Descriptor List:
"Message Access" (0x1134)
Version: 0x0102
Browsing BC:A5:8B:A3:8C:3A ...
Service Search failed: Invalid argument
Service Name: OBEX Object Push
Service RecHandle: 0x1000c
Service Class ID List:
"OBEX Object Push" (0x1105)
Protocol Descriptor List:
"L2CAP" (0x0100)
"RFCOMM" (0x0003)
Channel: 5
"OBEX" (0x0008)
Profile Descriptor List:
"OBEX Object Push" (0x1105)
Version: 0x0102
Browsing BC:A5:8B:A3:8C:3A ...
Service Search failed: Invalid argument
root@imx6ull14x14evk:~#
And you can see also "Service Search failed: Invalid argument", what means ?
IMX6 active service are :
root@imx6ull14x14evk:~# sdptool browse local
Browsing FF:FF:FF:00:00:00 ...
Service RecHandle: 0x10000
Service Class ID List:
"PnP Information" (0x1200)
Profile Descriptor List:
"PnP Information" (0x1200)
Version: 0x0103
Browsing FF:FF:FF:00:00:00 ...
Service Search failed: Invalid argument
Service Name: Handsfree
Service RecHandle: 0x10001
Service Class ID List:
"Handsfree" (0x111e)
"Generic Audio" (0x1203)
Protocol Descriptor List:
"L2CAP" (0x0100)
"RFCOMM" (0x0003)
Channel: 6
Profile Descriptor List:
"Handsfree" (0x111e)
Version: 0x0101
Service Name: Audio Source
Service RecHandle: 0x10002
Service Class ID List:
"Audio Source" (0x110a)
Protocol Descriptor List:
"L2CAP" (0x0100)
PSM: 25
"AVDTP" (0x0019)
uint16: 0x0103
Profile Descriptor List:
"Advanced Audio" (0x110d)
Version: 0x0103
Service Name: Audio Sink
Service RecHandle: 0x10003
Service Class ID List:
"Audio Sink" (0x110b)
Protocol Descriptor List:
"L2CAP" (0x0100)
PSM: 25
"AVDTP" (0x0019)
uint16: 0x0103
Profile Descriptor List:
"Advanced Audio" (0x110d)
Version: 0x0103
Service Name: Headset Voice gateway
Service RecHandle: 0x10004
Service Class ID List:
"Headset Audio Gateway" (0x1112)
"Generic Audio" (0x1203)
Protocol Descriptor List:
"L2CAP" (0x0100)
"RFCOMM" (0x0003)
Channel: 12
Profile Descriptor List:
"Headset" (0x1108)
Version: 0x0102
root@imx6ull14x14evk:~#
With this new information have you an idea for resolve my problems ?
Regards.
Sergio.
Hello,
Can you please verify if you have your card name with
pactl list cards
Furthermore, verify that the active profile is a2dp_sink. Otherwise, it will not reproduce any sound.
You should see something as below:
Card #3
Name: bluez_card.xx_xx_xx_xx_xx_xx #The xx is the MAC address of your Bluetooth device
Driver: module-bluez5-device.c
Owner Module: 23
Properties:
device.description = "xx" #Here you will find the name of your device.
device.string = "xx:xx:xx:xx:xx:xx" #This is also the MAC address of your Bluetooth device
device.api = "bluez"
device.class = "sound"
device.bus = "bluetooth"
device.form_factor = "headset"
bluez.path = "/org/bluez/hci0/dev_xx_xx_xx_xx_xx_xx" #This is also the MAC address of your Bluetooth device
bluez.class = "0x240404"
bluez.alias = "xx"
device.icon_name = "audio-headset-bluetooth"
device.intended_roles = "phone"
Profiles:
headset_head_unit: Headset Head Unit (HSP/HFP) (sinks: 1, sources: 1, priority: 20, available: yes)
a2dp_sink: High Fidelity Playback (A2DP Sink) (sinks: 1, sources: 0, priority: 10, available: yes)
off: Off (sinks: 0, sources: 0, priority: 0, available: yes)
Active Profile: a2dp_sink
Ports:
headset-output: Headset (priority: 0, latency offset: 1250000 usec, available)
Part of profile(s): headset_head_unit, a2dp_sink
headset-input: Headset (priority: 0, latency offset: 0 usec)
Part of profile(s): headset_head_unit
Best regards,
Diego.
Hi Diego,
now I am working well with profile a2dp_sink, but for a requirement of my system I must work with HFP profile.
Activating only this profile I see the card, the sink and source interface but they not work. In some forum I read that HFP profile not work with bluez5 and than I need "oFono" application.
Do you now this configuration ? Can you send me a script sequence for work with oFono ? Or any link that help me ?
Regards.
Sergio.
Hi Diego,
now work not very well , but work. The audio quality is bad.
I have must add this command at my script:
hcitool cmd 0x3F 0x0210 0x01 120 511 0xFF
oFono isn't necessary.
Regard. Thank you for all.
By Sergio.
Hello,
If you go to the /etc/pulse/daemon.conf where it says resample-method. Does equals to speex-float-3. If not, I suggest you change it to that.
Best regards,
Diego.
Hi Diego, I put your suggest in file but the result isn't change.
I tell you what happen:
pulseaudio see 2 audio interface : local interface (imx6 board microphone and headset connected at audio connector) and bluetooth interface. Both are :
Sample Specification: s16le 1ch 8000Hz Channel Map: mono
I want this configuration because I have customer specification.
Test 1 :
- on imx6 console play a .wav file on local interface
- on local headset the audio is perfect
Test 2 :
- on imx6 console play the same .wav file on bluetooth interface
- on remote bluetooth headset the audio is present but is very bad, incomprehensible words
Test 3:
-speak from remote bluetooth
-parecord on my imx6 test.wav
-paplay test.wav on bluetooth interface
-on the remote remote bluetooth I listen not very well but lissen, words comprehensible
-paplay test.wav on local interface
- on local headset the audio is present but is very bad, incomprehensible words
Test 4:
- make a loopback doing:
pactl load-module module-loopback source=x sink=y latency_msec=10
pactl load-module module-loopback source=z sink=k latency_msec=10
(where x,y,z,k are pulseaudio name interface)
-speak from remote bluetooth
-on the local headset the audio is present but is very bad, incomprehensible words
Why ? Seems the analog and bluetooth have different type of interface.
Where do I make a mistake ?
Can you halp me ?
Sergio.
Hello,
How are you attaching the UART connetion to the Bluez interface? Are you using hciattach? If yes, could you please pass me the command that you are using?
Best regards,
Diego.
My command is :
hciattach /dev/ttymxc1 texas 3000000
Sergio.
Could you please try with.
hciattach /dev/ttymxc1 texas 3000000 flow -b -t 120
Best regards,
Diego.
I have test your command , but the result not change, I have the same problem.
I explain better :
with the following command I listen perfect on local board imx6 headset:
root@imx6ull14x14evk:~# paplay -d alsa_output.platform-sound.analog-mono DataRe
layMode.wav -v
Opening a playback stream with sample specification 's16le 1ch 8000Hz' and channel map 'mono'.
Connection established.
Stream successfully created.
Buffer metrics: maxlength=4194304, tlength=32000, prebuf=31682, minreq=320
Using sample spec 's16le 1ch 8000Hz', channel map 'mono'.
Connected to device alsa_output.platform-sound.analog-mono (index: 0, suspended: no).
Stream started.
Stream underrun.
Playback stream drained.: 90221 usec.
Draining connection to server.
with the following command I listen bad on remote bluetooth headset:
root@imx6ull14x14evk:~# paplay -d bluez_sink.BC_A5_8B_A3_8C_3A.headset_audio_ga
teway DataRelayMode.wav -v
Opening a playback stream with sample specification 's16le 1ch 8000Hz' and channel map 'mono'.
Connection established.
Stream successfully created.
Buffer metrics: maxlength=4194304, tlength=32000, prebuf=31682, minreq=320
Using sample spec 's16le 1ch 8000Hz', channel map 'mono'.
Connected to device bluez_sink.BC_A5_8B_A3_8C_3A.headset_audio_gateway (index: 1, suspended: no).
Stream started.
Playback stream drained.: 135550 usec.
Draining connection to server.
root@imx6ull14x14evk:~#
How you can see the duration of bluetooth play (Playback stream drained) is more then local interface, why ?
Infact the voice on headset bluetooth is low speed.
I hope that my play report help you to resolve the problem.
Sergio.
Hello,
Could you please try the following:
# pactl set-card-profile <Your Bluez card name or number> a2dp_sink
# pactl set-card-profile <Your Bluez card name or number> hsp_sink
# pactl set-card-profile <Your Bluez card name or number> a2dp_sink
If that doesn't work. Please modify the resample method on the /etc/pulse/daemon.conf to trivial. Don´t forget to restart the pulseaudio service.
# pulseaudio -k
Hope this could solve your problem.
Best regards,
Diego.
Hi Diego,
bad news:
when I put your command I have this error:
root@imx6ull14x14evk:~# pactl set-card-profile bluez_sink.BC_A5_8B_A3_8C_3A.head
set_audio_gateway a2dp_sink
Failure: No such entity
My card is :
Card #1
Name: bluez_card.BC_A5_8B_A3_8C_3A
Driver: module-bluez5-device.c
Owner Module: 20
Properties:
device.description = "SDO Galaxy J6"
device.string = "BC:A5:8B:A3:8C:3A"
device.api = "bluez"
device.class = "sound"
device.bus = "bluetooth"
device.form_factor = "phone"
bluez.path = "/org/bluez/hci0/dev_BC_A5_8B_A3_8C_3A"
bluez.class = "0x5a020c"
bluez.alias = "SDO Galaxy J6"
device.icon_name = "audio-card-bluetooth"
Profiles:
a2dp_source: High Fidelity Capture (A2DP Source) (sinks: 0, sources: 1, priority: 10, availabl
e: no)
headset_audio_gateway: Headset Audio Gateway (HSP/HFP) (sinks: 1, sources: 1, priority: 20, av
ailable: yes)
off: Off (sinks: 0, sources: 0, priority: 0, available: yes)
Active Profile: off
Ports:
phone-output: Phone (priority: 0, latency offset: 0 usec)
Part of profile(s): headset_audio_gateway
phone-input: Phone (priority: 0, latency offset: 0 usec)
Part of profile(s): a2dp_source, headset_audio_gateway
I don't know why I have error !!!!! The card name is correct, if I put the number I have the same error.
Then I try the second test modify /etc/pulse/daemon.conf , I don't have errors but the output audio on bluetooth terminal is null. In the file now I have "resample-method = speex-float-3". What is the correct resample-method for HFP bluetooth stream with sample specification 's16le 1ch 8000Hz' and channel map 'mono' ?
In the card I have "headset_audio_gateway" profile , is it correct for my configuration ?
Sergio.
Hello,
In the card name try without the headset_audio_gateway. Just write:
# pactl set-card-profile bluez_sink.BC_A5_8B_A3_8C_3A a2dp_sink
Or
# pactl set-card-profile 1 a2dp_sink
Both options should work.
Best regards,
Diego.
Hello Diego,
on my board the command
# pactl set-card-profile 1 a2dp_sink
not work, the only command that work is :
# pactl set-card-profile 1 off
so it means that the parameter '1' is ok .
What is your suggestion now ?
Could my bluetooth chip need a special command like 'hcitool cmd xx xx xx xx xx' ?
Sergio.
Hello,
I do not know if the problem is the Bluetooth device that you are trying to set a connection. I have read that the newest version of Bluez has some problems with some Bluetooth devices. Could you please test with another device?
Best regards,
Diego.
Hi Diego,
for the moment I cannot test with another device.
Now I go on in two ways:
Can you have other suggestion ?
Sergio.
Hello,
I apologize for the delay. I suggest you put a trace to see the problem.
I am testing with bluez with the QCA Bluetooth module using the suggestions that I already made and the Bluetooth connection worked without a problem. Your problem seems to be related that your bluez audio card is not being recognized as an a2dp_sink source.
Best regards,
Diego.
Hi Diego,
The problem is the mtu dimension of my BT chip, it is 180 bytes.
I have solved the problem putting in /etc/pulse/default.pa this line
load-module module-bluetooth-discover autodetect_mtu=yes
and modifing the file backend-ofono.c , in the pulseaudio yocto module , the fixed mtu from 48 to 180.
(in this file there isn't autodetect_mtu manage and than I have fixed value set).
By.
Sergio.