AnsweredAssumed Answered

IMX8 Mini Bluetooth A2DP

Question asked by Elise Becam on Sep 16, 2019
Latest reply on Sep 19, 2019 by Diego Adrian Cuevas

Hello,

 

I am using IMX8 Mini EVK and I try to play music using Bluetooth AD2P.

 


So far, I am able to pair and connect to my Bluetooth speaker.

 

Output of bluetoothctl:
[BAM Headset 00013]# info 20:71:9B:10:00:13
Device 20:71:9B:10:00:13 (public)
    Name: BAM Headset 00013
    Alias: BAM Headset 00013
    Class: 0x00240418
    Icon: audio-card
    Paired: yes
    Trusted: yes
    Blocked: no
    Connected: yes
    LegacyPairing: no
    UUID: Serial Port               (00001101-0000-1000-8000-00805f9b34fb)
    UUID: Audio Sink                (0000110b-0000-1000-8000-00805f9b34fb)
    UUID: A/V Remote Control Target (0000110c-0000-1000-8000-00805f9b34fb)
    UUID: A/V Remote Control        (0000110e-0000-1000-8000-00805f9b34fb)
    UUID: Handsfree                 (0000111e-0000-1000-8000-00805f9b34fb)
    UUID: PnP Information           (00001200-0000-1000-8000-00805f9b34fb)
    Modalias: bluetooth:v000Fp0401d0001

 

I tested the speaker with my Ubuntu laptop and it is working well in AD2P mode.

 

I launched pulseaudio in system mode and I can see from the logs that bluetooth modules are loaded:
# pulseaudio -vvvv --system
...
I: [pulseaudio] module.c: Loaded "module-bluez5-discover" (index: #11; argument: "").
D: [pulseaudio] module.c: Checking for existence of '/usr/lib/pulse-11.1/modules/module-bluez4-discover.so': failure
I: [pulseaudio] module.c: Loaded "module-bluetooth-discover" (index: #10; argument: "").
I: [pulseaudio] module.c: Loaded "module-bluetooth-policy" (index: #12; argument: "").
I: [pulseaudio] module.c: Loaded "module-switch-on-connect" (index: #13; argument: "").
D: [pulseaudio] main.c: Got org.pulseaudio.Server!
I: [pulseaudio] main.c: Daemon startup complete.
....

 

The Bluetooth sound card is detected correctly under pulseaudio:
# pactl list cards
Card #1
    Name: bluez_card.20_71_9B_10_00_13
    Driver: module-bluez5-device.c
    Owner Module: 16
    Properties:
        device.description = "BAM Headset 00013"
        device.string = "20:71:9B:10:00:13"
        device.api = "bluez"
        device.class = "sound"
        device.bus = "bluetooth"
        device.form_factor = "headphone"
        bluez.path = "/org/bluez/hci0/dev_20_71_9B_10_00_13"
        bluez.class = "0x240418"
        bluez.alias = "BAM Headset 00013"
        device.icon_name = "audio-headphones-bluetooth"
    Profiles:
        a2dp_sink: High Fidelity Playback (A2DP Sink) (sinks: 1, sources: 0, priority: 10, available: yes)
        headset_head_unit: Headset Head Unit (HSP/HFP) (sinks: 1, sources: 1, priority: 20, available: no)
        off: Off (sinks: 0, sources: 0, priority: 0, available: yes)
    Active Profile: a2dp_sink
    Ports:
        headphone-output: Headphone (priority: 0, latency offset: 0 usec, available)
            Part of profile(s): a2dp_sink, headset_head_unit
        headphone-input: Bluetooth Input (priority: 0, latency offset: 0 usec, not available)
            Part of profile(s): headset_head_unit
            
            
# pactl list sinks
Sink #5
    State: IDLE
    Name: bluez_sink.20_71_9B_10_00_13.a2dp_sink
    Description: BAM Headset 00013
    Driver: module-bluez5-device.c
    Sample Specification: s16le 2ch 48000Hz
    Channel Map: front-left,front-right
    Owner Module: 18
    Mute: no
    Volume: front-left: 65536 / 100% / 0.00 dB,   front-right: 65536 / 100% / 0.00 dB
            balance 0.00
    Base Volume: 65536 / 100% / 0.00 dB
    Monitor Source: bluez_sink.20_71_9B_10_00_13.a2dp_sink.monitor
    Latency: 43009 usec, configured 38333 usec
    Flags: HARDWARE DECIBEL_VOLUME LATENCY
    Properties:
        bluetooth.protocol = "a2dp_sink"
        device.description = "BAM Headset 00013"
        device.string = "20:71:9B:10:00:13"
        device.api = "bluez"
        device.class = "sound"
        device.bus = "bluetooth"
        device.form_factor = "headphone"
        bluez.path = "/org/bluez/hci0/dev_20_71_9B_10_00_13"
        bluez.class = "0x240418"
        bluez.alias = "BAM Headset 00013"
        device.icon_name = "audio-headphones-bluetooth"
    Ports:
        headphone-output: Headphone (priority: 0, available)
    Active Port: headphone-output
    Formats:
        pcm

 


Trouble appear when I try to play a file.
Here is the command launched to play a 1kHz tone:
# paplay -v /usr/share/soundcard-test-config/tone_1000.wav
Opening a playback stream with sample specification 's16le 2ch 48000Hz' and channel map 'front-left,front-right'.
Connection established.
Stream successfully created.
Buffer metrics: maxlength=4194304, tlength=384000, prebuf=380164, minreq=3840
Using sample spec 's16le 2ch 48000Hz', channel map 'front-left,front-right'.
Connected to device bluez_sink.20_71_9B_10_00_13.a2dp_sink (index: 1, suspended: no).
Stream started.
Playback stream drained.y: 5517 usec.           
Draining connection to server.

 


Below are the logs of pulseaudio -vvvv --system:
D: [pulseaudio] sink-input.c: Negotiated format: pcm, format.sample_format = "\"s16le\""  format.rate = "48000"  format.channels = "2"  format.channel_map = "\"front-left,front-right\""
I: [pulseaudio] sink-input.c: Trying to change sample rate
D: [pulseaudio] module-suspend-on-idle.c: Sink bluez_sink.20_71_9B_10_00_13.a2dp_sink becomes busy, resuming.
D: [pulseaudio] resampler.c: Resampler:
D: [pulseaudio] resampler.c:   rate 48000 -> 44100 (method ffmpeg)
D: [pulseaudio] resampler.c:   format s16le -> s16le (intermediate s16le)
D: [pulseaudio] resampler.c:   channels 2 -> 2 (resampling 2)
D: [pulseaudio] memblockq.c: memblockq requested: maxlength=33554432, tlength=0, base=4, prebuf=0, minreq=1 maxrewind=0
D: [pulseaudio] memblockq.c: memblockq sanitized: maxlength=33554432, tlength=33554432, base=4, prebuf=0, minreq=4 maxrewind=0
I: [pulseaudio] sink-input.c: Created input 0 "/usr/share/soundcard-test-config/tone_1000.wav" on bluez_sink.20_71_9B_10_00_13.a2dp_sink with sample spec s16le 2ch 48000Hz and channel map front-left,front-right
I: [pulseaudio] sink-input.c:     media.format = "WAV (Microsoft)"
I: [pulseaudio] sink-input.c:     application.name = "paplay"
I: [pulseaudio] sink-input.c:     media.name = "/usr/share/soundcard-test-config/tone_1000.wav"
I: [pulseaudio] sink-input.c:     native-protocol.peer = "UNIX socket client"
I: [pulseaudio] sink-input.c:     native-protocol.version = "32"
I: [pulseaudio] sink-input.c:     application.process.id = "3791"
I: [pulseaudio] sink-input.c:     application.process.user = "root"
I: [pulseaudio] sink-input.c:     application.process.host = "imx8mmevk"
I: [pulseaudio] sink-input.c:     application.process.binary = "pacat"
I: [pulseaudio] sink-input.c:     application.language = "C"
I: [pulseaudio] sink-input.c:     application.process.machine_id = "95dd73e1a8bd4e43ad491e0a02f38899"
I: [pulseaudio] sink-input.c:     module-stream-restore.id = "sink-input-by-application-name:paplay"
I: [pulseaudio] protocol-native.c: Requested tlength=2000.00 ms, minreq=20.00 ms
D: [pulseaudio] protocol-native.c: Traditional mode enabled, modifying sink usec only for compat with minreq.
D: [pulseaudio] protocol-native.c: Requested latency=1960.00 ms, Received latency=39.51 ms
D: [pulseaudio] memblockq.c: memblockq requested: maxlength=4194304, tlength=384000, base=4, prebuf=380164, minreq=3840 maxrewind=0
D: [pulseaudio] memblockq.c: memblockq sanitized: maxlength=4194304, tlength=384000, base=4, prebuf=380164, minreq=3840 maxrewind=0
I: [pulseaudio] protocol-native.c: Final latency 2039.51 ms = 1960.00 ms + 2*20.00 ms + 39.51 ms
I: [pulseaudio] module-stream-restore.c: Storing volume/mute/device for stream sink-input-by-application-name:paplay.
D: [pulseaudio] protocol-dbus.c: Interface org.PulseAudio.Ext.StreamRestore1.RestoreEntry added for object /org/pulseaudio/stream_restore1/entry1
D: [bluetooth] protocol-native.c: Requesting rewind due to end of underrun.
W: [bluetooth] module-bluez5-device.c: Skipping 28873 us (= 5092 bytes) in audio stream
D: [bluetooth] module-bluez5-device.c: Bitpool has changed to 48
W: [bluetooth] module-bluez5-device.c: Skipping 273889 us (= 48312 bytes) in audio stream
D: [bluetooth] module-bluez5-device.c: Bitpool has changed to 43
W: [bluetooth] module-bluez5-device.c: Skipping 100358 us (= 17700 bytes) in audio stream
D: [bluetooth] module-bluez5-device.c: Bitpool has changed to 38
W: [bluetooth] module-bluez5-device.c: Skipping 506565 us (= 89356 bytes) in audio stream
D: [bluetooth] memblock.c: Memory block too large for pool: 89356 > 65536
D: [bluetooth] module-bluez5-device.c: Bitpool has changed to 33
W: [bluetooth] module-bluez5-device.c: Skipping 450721 us (= 79504 bytes) in audio stream
D: [bluetooth] memblock.c: Memory block too large for pool: 79504 > 65536
D: [bluetooth] module-bluez5-device.c: Bitpool has changed to 32
W: [bluetooth] module-bluez5-device.c: Skipping 448194 us (= 79060 bytes) in audio stream
D: [bluetooth] memblock.c: Memory block too large for pool: 79060 > 65536
W: [bluetooth] module-bluez5-device.c: Skipping 450855 us (= 79528 bytes) in audio stream
D: [bluetooth] memblock.c: Memory block too large for pool: 79528 > 65536
W: [bluetooth] module-bluez5-device.c: Skipping 452899 us (= 79888 bytes) in audio stream
D: [bluetooth] memblock.c: Memory block too large for pool: 79888 > 65536
W: [bluetooth] module-bluez5-device.c: Skipping 397041 us (= 70036 bytes) in audio stream
D: [bluetooth] memblock.c: Memory block too large for pool: 70036 > 65536
W: [bluetooth] module-bluez5-device.c: Skipping 429440 us (= 75752 bytes) in audio stream
D: [bluetooth] memblock.c: Memory block too large for pool: 75752 > 65536
W: [bluetooth] module-bluez5-device.c: Skipping 462023 us (= 81500 bytes) in audio stream
D: [bluetooth] memblock.c: Memory block too large for pool: 81500 > 65536
W: [bluetooth] module-bluez5-device.c: Skipping 453250 us (= 79952 bytes) in audio stream
D: [bluetooth] memblock.c: Memory block too large for pool: 79952 > 65536
W: [bluetooth] module-bluez5-device.c: Skipping 370121 us (= 65288 bytes) in audio stream
W: [bluetooth] module-bluez5-device.c: Skipping 435722 us (= 76860 bytes) in audio stream
D: [bluetooth] memblock.c: Memory block too large for pool: 76860 > 65536
W: [bluetooth] module-bluez5-device.c: Skipping 410607 us (= 72428 bytes) in audio stream
D: [bluetooth] memblock.c: Memory block too large for pool: 72428 > 65536
W: [bluetooth] module-bluez5-device.c: Skipping 440766 us (= 77748 bytes) in audio stream
D: [bluetooth] memblock.c: Memory block too large for pool: 77748 > 65536
W: [bluetooth] module-bluez5-device.c: Skipping 458204 us (= 80824 bytes) in audio stream
D: [bluetooth] memblock.c: Memory block too large for pool: 80824 > 65536
I: [pulseaudio] module-stream-restore.c: Synced.
W: [bluetooth] module-bluez5-device.c: Skipping 450733 us (= 79508 bytes) in audio stream
D: [bluetooth] memblock.c: Memory block too large for pool: 79508 > 65536
W: [bluetooth] module-bluez5-device.c: Skipping 441875 us (= 77944 bytes) in audio stream
D: [bluetooth] memblock.c: Memory block too large for pool: 77944 > 65536
W: [bluetooth] module-bluez5-device.c: Skipping 382041 us (= 67392 bytes) in audio stream
D: [bluetooth] memblock.c: Memory block too large for pool: 67392 > 65536
W: [bluetooth] module-bluez5-device.c: Skipping 453100 us (= 79924 bytes) in audio stream
D: [bluetooth] memblock.c: Memory block too large for pool: 79924 > 65536
W: [bluetooth] module-bluez5-device.c: Skipping 467110 us (= 82396 bytes) in audio stream
D: [bluetooth] memblock.c: Memory block too large for pool: 82396 > 65536
W: [bluetooth] module-bluez5-device.c: Skipping 429388 us (= 75744 bytes) in audio stream
D: [bluetooth] memblock.c: Memory block too large for pool: 75744 > 65536
W: [bluetooth] module-bluez5-device.c: Skipping 453252 us (= 79952 bytes) in audio stream
D: [bluetooth] memblock.c: Memory block too large for pool: 79952 > 65536
W: [bluetooth] module-bluez5-device.c: Skipping 415780 us (= 73340 bytes) in audio stream
D: [bluetooth] memblock.c: Memory block too large for pool: 73340 > 65536
W: [bluetooth] module-bluez5-device.c: Skipping 428072 us (= 75508 bytes) in audio stream
D: [bluetooth] memblock.c: Memory block too large for pool: 75508 > 65536
W: [bluetooth] module-bluez5-device.c: Skipping 450703 us (= 79504 bytes) in audio stream
D: [bluetooth] memblock.c: Memory block too large for pool: 79504 > 65536
W: [bluetooth] module-bluez5-device.c: Skipping 466999 us (= 82376 bytes) in audio stream
D: [bluetooth] memblock.c: Memory block too large for pool: 82376 > 65536
W: [bluetooth] module-bluez5-device.c: Skipping 450588 us (= 79480 bytes) in audio stream
D: [bluetooth] memblock.c: Memory block too large for pool: 79480 > 65536
W: [bluetooth] module-bluez5-device.c: Skipping 385765 us (= 68048 bytes) in audio stream
D: [bluetooth] memblock.c: Memory block too large for pool: 68048 > 65536
W: [bluetooth] module-bluez5-device.c: Skipping 443201 us (= 78180 bytes) in audio stream
D: [bluetooth] memblock.c: Memory block too large for pool: 78180 > 65536
W: [bluetooth] module-bluez5-device.c: Skipping 450698 us (= 79500 bytes) in audio stream
D: [bluetooth] memblock.c: Memory block too large for pool: 79500 > 65536
W: [bluetooth] module-bluez5-device.c: Skipping 453122 us (= 79928 bytes) in audio stream
D: [bluetooth] memblock.c: Memory block too large for pool: 79928 > 65536
W: [bluetooth] module-bluez5-device.c: Skipping 452083 us (= 79744 bytes) in audio stream
D: [bluetooth] memblock.c: Memory block too large for pool: 79744 > 65536
W: [bluetooth] module-bluez5-device.c: Skipping 410774 us (= 72460 bytes) in audio stream
D: [bluetooth] memblock.c: Memory block too large for pool: 72460 > 65536
W: [bluetooth] module-bluez5-device.c: Skipping 428039 us (= 75504 bytes) in audio stream
D: [bluetooth] memblock.c: Memory block too large for pool: 75504 > 65536
W: [bluetooth] module-bluez5-device.c: Skipping 454423 us (= 80160 bytes) in audio stream
D: [bluetooth] memblock.c: Memory block too large for pool: 80160 > 65536
W: [bluetooth] module-bluez5-device.c: Skipping 373923 us (= 65960 bytes) in audio stream
D: [bluetooth] memblock.c: Memory block too large for pool: 65960 > 65536
W: [bluetooth] module-bluez5-device.c: Skipping 453201 us (= 79944 bytes) in audio stream
D: [bluetooth] memblock.c: Memory block too large for pool: 79944 > 65536
W: [bluetooth] module-bluez5-device.c: Skipping 453272 us (= 79956 bytes) in audio stream
D: [bluetooth] memblock.c: Memory block too large for pool: 79956 > 65536
W: [bluetooth] module-bluez5-device.c: Skipping 389529 us (= 68712 bytes) in audio stream
D: [bluetooth] memblock.c: Memory block too large for pool: 68712 > 65536
W: [bluetooth] module-bluez5-device.c: Skipping 453024 us (= 79912 bytes) in audio stream
D: [bluetooth] memblock.c: Memory block too large for pool: 79912 > 65536
W: [bluetooth] module-bluez5-device.c: Skipping 448205 us (= 79060 bytes) in audio stream
D: [bluetooth] memblock.c: Memory block too large for pool: 79060 > 65536
W: [bluetooth] module-bluez5-device.c: Skipping 455692 us (= 80384 bytes) in audio stream
D: [bluetooth] memblock.c: Memory block too large for pool: 80384 > 65536
W: [bluetooth] module-bluez5-device.c: Skipping 428277 us (= 75548 bytes) in audio stream
D: [bluetooth] memblock.c: Memory block too large for pool: 75548 > 65536
W: [bluetooth] module-bluez5-device.c: Skipping 410727 us (= 72452 bytes) in audio stream
D: [bluetooth] memblock.c: Memory block too large for pool: 72452 > 65536
W: [bluetooth] module-bluez5-device.c: Skipping 450585 us (= 79480 bytes) in audio stream
D: [bluetooth] memblock.c: Memory block too large for pool: 79480 > 65536
W: [bluetooth] module-bluez5-device.c: Skipping 453285 us (= 79956 bytes) in audio stream
D: [bluetooth] memblock.c: Memory block too large for pool: 79956 > 65536
W: [bluetooth] module-bluez5-device.c: Skipping 445720 us (= 78624 bytes) in audio stream
D: [bluetooth] memblock.c: Memory block too large for pool: 78624 > 65536
W: [bluetooth] module-bluez5-device.c: Skipping 453124 us (= 79928 bytes) in audio stream
D: [bluetooth] memblock.c: Memory block too large for pool: 79928 > 65536
W: [bluetooth] module-bluez5-device.c: Skipping 19310 us (= 3404 bytes) in audio stream
W: [bluetooth] module-bluez5-device.c: Skipping 86867 us (= 15320 bytes) in audio stream
W: [bluetooth] module-bluez5-device.c: Skipping 86820 us (= 15312 bytes) in audio stream
W: [bluetooth] module-bluez5-device.c: Skipping 86770 us (= 15304 bytes) in audio stream
W: [bluetooth] module-bluez5-device.c: Skipping 86776 us (= 15304 bytes) in audio stream
W: [bluetooth] module-bluez5-device.c: Skipping 19261 us (= 3396 bytes) in audio stream
W: [bluetooth] module-bluez5-device.c: Skipping 98109 us (= 17304 bytes) in audio stream
W: [bluetooth] module-bluez5-device.c: Skipping 90700 us (= 15996 bytes) in audio stream
W: [bluetooth] module-bluez5-device.c: Skipping 61578 us (= 10860 bytes) in audio stream
W: [bluetooth] module-bluez5-device.c: Skipping 86757 us (= 15300 bytes) in audio stream
W: [bluetooth] module-bluez5-device.c: Skipping 44234 us (= 7800 bytes) in audio stream
W: [bluetooth] module-bluez5-device.c: Skipping 61976 us (= 10932 bytes) in audio stream
D: [bluetooth] protocol-native.c: Implicit drain of '/usr/share/soundcard-test-config/tone_1000.wav'
D: [bluetooth] protocol-native.c: Drain acknowledged of '/usr/share/soundcard-test-config/tone_1000.wav'
I: [pulseaudio] sink-input.c: Freeing input 0 "/usr/share/soundcard-test-config/tone_1000.wav"
I: [pulseaudio] client.c: Freed 2 "paplay"
I: [pulseaudio] protocol-native.c: Connection died.
W: [bluetooth] module-bluez5-device.c: Skipping 86604 us (= 15276 bytes) in audio stream
W: [bluetooth] module-bluez5-device.c: Skipping 86885 us (= 15324 bytes) in audio stream
W: [bluetooth] module-bluez5-device.c: Skipping 86767 us (= 15304 bytes) in audio stream
W: [bluetooth] module-bluez5-device.c: Skipping 44380 us (= 7828 bytes) in audio stream
W: [bluetooth] module-bluez5-device.c: Skipping 63056 us (= 11120 bytes) in audio stream
W: [bluetooth] module-bluez5-device.c: Skipping 86867 us (= 15320 bytes) in audio stream
W: [bluetooth] module-bluez5-device.c: Skipping 86612 us (= 15276 bytes) in audio stream

 

 

 

There is no audio coming out the Bluetooth speaker and after a few minutes I hear crackling audio coming from my Bluetooth speaker.

 

I turn on logs for the bluetoothd service by passing the -d option to the command line but I don't see logs that can help me.

 


Do you have any idea what could cause those issue ? Is there some pulseaudio configurations that could fix it ?

 

Thanks for your help !

Outcomes