bananapi-zero-ubuntu-base-minimal icon indicating copy to clipboard operation
bananapi-zero-ubuntu-base-minimal copied to clipboard

Kernel 5.3.1 and bluetooth

Open Bahir opened this issue 4 years ago • 66 comments

Board: BPI M2 Zero.

I'm trying to setup bluetooth. The same command worked fine with 4.20.17

brcm_patchram_plus -d --patchram /lib/firmware/ap6212/bcm43438a1.hcd --enable_hci --bd_addr b8:27:eb:b7:f9:60 --no2bytes --tosleep 5000 /dev/ttyS1

With 5.3.1 it produced infinite output

writing 01 03 0c 00 writing 01 03 0c 00 writing 01 03 0c 00 writing 01 03 0c 00 writing 01 03 0c 00

And is not finished with "Done setting line discpline"

Bahir avatar Sep 24 '19 07:09 Bahir

I will have a look at it when possible. I think brcm_patchram_plus should not be needed or dtb is with the wrong configuration.

avafinger avatar Sep 24 '19 12:09 avafinger

ok, i just gave it a new try, firmware (bt) is missing for the mainline and not to mention that HDMI is broken. I will need more time to find the fix In case you want to search for the bt firmware and put it in the right place, attached is the correct BT dtb configuration. (but HDMI is broken).

bpi-m2-zero-v4.dtb_5.3.1.tar.gz copy it to /boot and overwrite the old dtb.

[  471.282066] Bluetooth: hci0: command 0x1003 tx timeout
[  473.362081] Bluetooth: hci0: command 0x1001 tx timeout
[  475.442152] Bluetooth: hci0: command 0x1009 tx timeout
[  481.282173] Bluetooth: hci0: command 0x1003 tx timeout
[  483.362299] Bluetooth: hci0: command 0x1001 tx timeout
[  485.442222] Bluetooth: hci0: command 0x1009 tx timeout
[  489.714481] Bluetooth: BNEP (Ethernet Emulation) ver 1.3
[  489.714496] Bluetooth: BNEP filters: protocol multicast
[  489.714527] Bluetooth: BNEP socket layer initialized
[  523.043304] random: crng init done
[  523.043356] random: 7 urandom warning(s) missed due to ratelimiting

avafinger avatar Sep 24 '19 14:09 avafinger

Bluetooth and HDMI fixed. No need to patchram for 5.3.1. I will push the changes asap.

ubuntu@bpi-m2z:~$ uname -ra
Linux bpi-m2z 5.3.1 #2 SMP Tue Sep 24 18:23:12 -03 2019 armv7l armv7l armv7l GNU/Linux
ubuntu@bpi-m2z:~$ rfkill list
0: hci0: Bluetooth
	Soft blocked: no
	Hard blocked: no
1: phy0: Wireless LAN
	Soft blocked: no
	Hard blocked: no
ubuntu@bpi-m2z:~$ hcitool devi
Devices:
	hci0	AA:AA:AA:AA:AA:AA
ubuntu@bpi-m2z:~$ 

avafinger avatar Sep 24 '19 23:09 avafinger

Here is the fix: https://github.com/avafinger/bananapi-zero-ubuntu-base-minimal/releases/tag/v2.2

avafinger avatar Sep 25 '19 00:09 avafinger

Thank you all is good except...

bluetoothd: Can't open input device: No such file or directory (2)
bluetoothd: AVRCP: failed to init uinput for 00:16:44:FD:6B:A0

Looks like uinput kernel module missing.

Device Drivers  --->
   Input device support  --->
      [*]   Miscellaneous devices  --->
         <M>   User level driver support

Could you please make this module?

Bahir avatar Sep 25 '19 16:09 Bahir

done. rootfs_modules_5.3.1.tar.gz

Install with: sudo tar -xvpzf rootfs_modules_5.3.1.tar.gz -C / --numeric-ow

avafinger avatar Sep 25 '19 18:09 avafinger

I have played with BT and unfortunately, there is some issue. I think we have to use the patchram, the old way.

Here is my failed attempt to connect to a JBL speaker and Phone:

 bluetoothctl -a
[NEW] Controller CC:B8:A8:A9:E5:67 bpi-m2z [default]
Agent registered
[bluetooth]# power on
Changing power on succeeded
[bluetooth]# agent on
Agent is already registered
[bluetooth]# default-agent
Default agent request successful
[bluetooth]# scan on
Discovery started
[CHG] Controller CC:B8:A8:A9:E5:67 Discovering: yes
[NEW] Device 8E:06:78:D2:E1:3C CHARGE3
[NEW] Device 00:17:CA:F7:38:18 00-17-CA-F7-38-18
[CHG] Device 00:17:CA:F7:38:18 LegacyPairing: no
[CHG] Device 00:17:CA:F7:38:18 Name: Haier HW-W910
[CHG] Device 00:17:CA:F7:38:18 Alias: Haier HW-W910
[bluetooth]# scan off
[CHG] Device 00:17:CA:F7:38:18 RSSI is nil
[CHG] Device 8E:06:78:D2:E1:3C RSSI is nil
Discovery stopped
[CHG] Controller CC:B8:A8:A9:E5:67 Discovering: no
[bluetooth]# trust 8E:06:78:D2:E1:3C 
[CHG] Device 8E:06:78:D2:E1:3C Trusted: yes
Changing 8E:06:78:D2:E1:3C trust succeeded
[bluetooth]# pair 8E:06:78:D2:E1:3C 
Attempting to pair with 8E:06:78:D2:E1:3C
[CHG] Device 8E:06:78:D2:E1:3C Connected: yes
[CHG] Device 8E:06:78:D2:E1:3C UUIDs: 0000110b-0000-1000-8000-00805f9b34fb
[CHG] Device 8E:06:78:D2:E1:3C UUIDs: 0000110e-0000-1000-8000-00805f9b34fb
[CHG] Device 8E:06:78:D2:E1:3C UUIDs: 0000111e-0000-1000-8000-00805f9b34fb
[CHG] Device 8E:06:78:D2:E1:3C Paired: yes
Pairing successful
[CHG] Device 8E:06:78:D2:E1:3C Connected: no
[bluetooth]# connect 8E:06:78:D2:E1:3C 
Attempting to connect to 8E:06:78:D2:E1:3C
Failed to connect: org.bluez.Error.Failed
[bluetooth]# connect 8E:06:78:D2:E1:3C 
Attempting to connect to 8E:06:78:D2:E1:3C
Failed to connect: org.bluez.Error.Failed
[bluetooth]# devices
Device 8E:06:78:D2:E1:3C CHARGE3
Device 00:17:CA:F7:38:18 Haier HW-W910
[bluetooth]# trust 00:17:CA:F7:38:18 
[CHG] Device 00:17:CA:F7:38:18 Trusted: yes
Changing 00:17:CA:F7:38:18 trust succeeded
[bluetooth]# pair 00:17:CA:F7:38:18
Attempting to pair with 00:17:CA:F7:38:18
[CHG] Device 00:17:CA:F7:38:18 Connected: yes
Request confirmation
[agent] Confirm passkey 750807 (yes/no): yes
[Haier HW-W910]# connect 00:17:CA:F7:38:18
Attempting to connect to 00:17:CA:F7:38:18
Failed to pair: org.bluez.Error.AuthenticationFailed
Failed to connect: org.bluez.Error.Failed
[CHG] Device 00:17:CA:F7:38:18 Connected: no

The connect fail. Something is missing. i made sure pulseaudio was running.

avafinger avatar Oct 05 '19 00:10 avafinger

Mine is good with connection and pairing but I can't make it work with sound playing.

[    6.837977] brcmfmac: brcmf_fw_alloc_request: using brcm/brcmfmac43430-sdio for chip BCM43430/1
[    6.870887] brcmfmac mmc1:0001:1: Direct firmware load for brcm/brcmfmac43430-sdio.sinovoip,bananapi zero.txt failed with error -2
[    6.882750] brcmfmac mmc1:0001:1: Falling back to sysfs fallback for: brcm/brcmfmac43430-sdio.sinovoip,bananapi zero.txt
[    6.990811] Bluetooth: Core ver 2.22
[    6.999210] Bluetooth: HCI device and connection manager initialized
[    6.999245] Bluetooth: HCI socket layer initialized
[    7.010583] Bluetooth: L2CAP socket layer initialized
[    7.015775] Bluetooth: SCO socket layer initialized
[    7.038011] Bluetooth: HCI UART driver ver 2.3
[    7.044249] Bluetooth: HCI UART protocol H4 registered
[    7.049571] Bluetooth: HCI UART protocol BCSP registered
[    7.054926] Bluetooth: HCI UART protocol ATH3K registered
[    7.060629] Bluetooth: HCI UART protocol Intel registered
[    7.067018] Bluetooth: HCI UART protocol Broadcom registered
[    7.074003] Bluetooth: HCI UART protocol AG6XX registered
[    7.113685] Bluetooth: RFCOMM TTY layer initialized
[    7.118605] Bluetooth: RFCOMM socket layer initialized
[    7.123879] Bluetooth: RFCOMM ver 1.11
[    7.247370] Bluetooth: hci0: BCM: chip id 94
[    7.260078] Bluetooth: hci0: BCM: features 0x2e
[    7.288210] Bluetooth: hci0: BCM43430A1
[    7.292895] Bluetooth: hci0: BCM43430A1 (001.002.009) build 0000
[    9.260053] brcmfmac: brcmf_fw_alloc_request: using brcm/brcmfmac43430-sdio for chip BCM43430/1
[    9.993284] brcmfmac: brcmf_c_preinit_dcmds: Firmware: BCM43430/1 wl0: Oct 23 2017 03:55:53 version 7.45.98.38 (r674442 CY) FWID 01-e58d219f
[   11.034933] Bluetooth: hci0: BCM43430A1 (001.002.009) build 0106
[   15.722882] Bluetooth: BNEP (Ethernet Emulation) ver 1.3
[   15.722896] Bluetooth: BNEP filters: protocol multicast
[   15.722926] Bluetooth: BNEP socket layer initialized
root@bpi-m2z:~# rfkill list all
0: hci0: Bluetooth
	Soft blocked: no
	Hard blocked: no
1: phy0: Wireless LAN
	Soft blocked: no
	Hard blocked: no
root@bpi-m2z:~# hciconfig -a
hci0:	Type: Primary  Bus: UART
	BD Address: 8C:F7:10:4B:29:08  ACL MTU: 1021:8  SCO MTU: 64:1
	UP RUNNING PSCAN
	RX bytes:4300 acl:29 sco:0 events:289 errors:0
	TX bytes:37453 acl:30 sco:0 commands:253 errors:0
	Features: 0xbf 0xfe 0xcf 0xfe 0xdb 0xff 0x7b 0x87
	Packet type: DM1 DM3 DM5 DH1 DH3 DH5 HV1 HV2 HV3
	Link policy: RSWITCH SNIFF
	Link mode: SLAVE ACCEPT
	Name: 'bpi-m2z'
	Class: 0x200000
	Service Classes: Audio
	Device Class: Miscellaneous,
	HCI Version: 4.0 (0x6)  Revision: 0x6a
	LMP Version: 4.0 (0x6)  Subversion: 0x2209
	Manufacturer: Broadcom Corporation (15)
root@bpi-m2z:~# pulseaudio --start

Oct  5 13:43:59 bpi-m2z bluetoothd[463]: Endpoint registered: sender=:1.62 path=/MediaEndpoint/A2DPSource/VENDOR/LDAC
Oct  5 13:43:59 bpi-m2z bluetoothd[463]: Endpoint registered: sender=:1.62 path=/MediaEndpoint/A2DPSource/VENDOR/APTXHD
Oct  5 13:43:59 bpi-m2z bluetoothd[463]: Endpoint registered: sender=:1.62 path=/MediaEndpoint/A2DPSource/VENDOR/APTX
Oct  5 13:43:59 bpi-m2z bluetoothd[463]: Endpoint registered: sender=:1.62 path=/MediaEndpoint/A2DPSource/AAC
Oct  5 13:43:59 bpi-m2z bluetoothd[463]: Endpoint registered: sender=:1.62 path=/MediaEndpoint/A2DPSource/SBC
Oct  5 13:43:59 bpi-m2z bluetoothd[463]: Endpoint registered: sender=:1.62 path=/MediaEndpoint/A2DPSink/VENDOR/APTXHD
Oct  5 13:43:59 bpi-m2z bluetoothd[463]: Endpoint registered: sender=:1.62 path=/MediaEndpoint/A2DPSink/VENDOR/APTX
Oct  5 13:43:59 bpi-m2z bluetoothd[463]: Endpoint registered: sender=:1.62 path=/MediaEndpoint/A2DPSink/AAC
Oct  5 13:43:59 bpi-m2z bluetoothd[463]: Endpoint registered: sender=:1.62 path=/MediaEndpoint/A2DPSink/SBC
root@bpi-m2z:~# bluetoothctl
Agent registered
[bluetooth]# list
Controller 8C:F7:10:4B:29:08 bpi-m2z [default]
[bluetooth]# connect FC:A8:9A:68:8D:4A
Attempting to connect to FC:A8:9A:68:8D:4A
Failed to connect: org.bluez.Error.Failed
[bluetooth]# quit
root@bpi-m2z:~# bluetoothctl
Agent registered
[bluetooth]# list
Controller 8C:F7:10:4B:29:08 bpi-m2z [default]
[bluetooth]# connect FC:A8:9A:68:8D:4A
Attempting to connect to FC:A8:9A:68:8D:4A
[CHG] Device FC:A8:9A:68:8D:4A Connected: yes
Connection successful
[JBL E45BT]# info
Device FC:A8:9A:68:8D:4A (public)
	Name: JBL E45BT
	Alias: JBL E45BT
	Class: 0x00240404
	Icon: audio-card
	Paired: yes
	Trusted: yes
	Blocked: no
	Connected: yes
	LegacyPairing: no
	UUID: Headset                   (00001108-0000-1000-8000-00805f9b34fb)
	UUID: Audio Sink                (0000110b-0000-1000-8000-00805f9b34fb)
	UUID: A/V Remote Control Target (0000110c-0000-1000-8000-00805f9b34fb)
	UUID: Advanced Audio Distribu.. (0000110d-0000-1000-8000-00805f9b34fb)
	UUID: A/V Remote Control        (0000110e-0000-1000-8000-00805f9b34fb)
	UUID: Handsfree                 (0000111e-0000-1000-8000-00805f9b34fb)
[CHG] Device FC:A8:9A:68:8D:4A ServicesResolved: yes
Oct  5 13:48:31 bpi-m2z bluetoothd[463]: /org/bluez/hci0/dev_FC_A8_9A_68_8D_4A/fd0: fd(26) ready
Oct  5 13:48:31 bpi-m2z kernel: [75185.512490] input: FC:A8:9A:68:8D:4A as /devices/virtual/input/input7

So, all seems OK in logs but... But, when I try to play something via this BT connection I either receive broken sound in headset (it is what expected but very dirty one) or connection is interrupted.

root@bpi-m2z:~# paplay /usr/share/sounds/alsa/Front_Center.wav
Connection failure: Connection terminated
Stream error: Connection terminated

And pulseaudio process also goes down.

Also, I noticed that when I activate something with BT (pulseaduio, bluetoothctl) the WIFI connection sometimes interrupts responding (strange delays when i type in ssh console). And sometimes I need to restart ssh session at all after I activated BT.

And, the same is for 4.20.17 and for 5.3.1 so I have an idea that something is wrong with firmware or sdio.txt.

Here are mine I use.

root@bpi-m2z:/lib/firmware/brcm# ls -lA
lrwxrwxrwx 1 root   root       15 Sep 25 14:06 BCM43430A1.hcd -> BRCM43438A1.hcd
lrwxrwxrwx 1 root   root       35 Sep 25 01:16 BRCM43438A1.hcd -> /lib/firmware/ap6212/bcm43438a1.hcd
lrwxrwxrwx 1 root   root       31 Oct  4 16:30 brcmfmac43430-sdio.bin -> brcmfmac43430-sdio.bin.20190923
-rw-rw-r-- 1 root   root   388739 Sep 23 14:23 brcmfmac43430-sdio.bin.20190923
lrwxrwxrwx 1 root   root       27 Oct  4 16:11 brcmfmac43430-sdio.txt -> brcmfmac43430-sdio.txt.orig
-rw------- 1 root   root      979 Nov 28  2017 brcmfmac43430-sdio.txt.orig
root@bpi-m2z:/lib/firmware/ap6212# ls -lA
-rw-rw-r-- 1 root root  38630 Dec  3  2017 bcm43438a0.hcd
-rw-r--r-- 1 root root  33376 Sep 24 20:32 bcm43438a1.hcd
-rw-r--r-- 1 root root     62 Jun 28  2018 config.txt
-rw-rw-r-- 1 root root 336323 Dec  3  2017 fw_bcm43438a0.bin
-rw-rw-r-- 1 root root 309352 Dec  3  2017 fw_bcm43438a0_apsta.bin
lrwxrwxrwx 1 root root     17 Sep 24 09:59 fw_bcm43438a0_p2p.bin -> fw_bcm43438a0.bin
-rw-rw-r-- 1 root root 374608 Dec  3  2017 fw_bcm43438a1.bin
-rw-rw-r-- 1 root root 374608 Dec  3  2017 fw_bcm43438a1_apsta.bin
-rw-rw-r-- 1 root root 374608 Dec  3  2017 fw_bcm43438a1_apsta.bin.orig
-rw-r--r-- 1 root root 374608 Sep 24 20:33 fw_bcm43438a1_p2p.bin
-rw-rw-r-- 1 root root    902 Dec  3  2017 nvram.txt
-rw-rw-r-- 1 root root    902 Dec  3  2017 nvram.txt.orig
-rw-r--r-- 1 root root    979 Jun 28  2018 nvram_ap6212.txt
-rw-r--r-- 1 root root    979 Mar  1  2017 nvram_ap6212a.txt
root@bpi-m2z:/lib/firmware/brcm# cat brcmfmac43430-sdio.txt
#AP6212_NVRAM_V1.0.1_20160606
# 2.4 GHz, 20 MHz BW mode

# The following parameter values are just placeholders, need to be updated.
manfid=0x2d0
prodid=0x0726
vendid=0x14e4
devid=0x43e2
boardtype=0x0726
boardrev=0x1101
boardnum=22
macaddr=00:90:4c:c5:12:38
sromrev=11
boardflags=0x00404201
xtalfreq=26000
nocrc=1
ag0=255
aa2g=1
ccode=ALL

pa0itssit=0x20
extpagain2g=0

#PA parameters for 2.4GHz, measured at CHIP OUTPUT
pa2ga0=-168,7161,-820
AvVmid_c0=0x0,0xc8
cckpwroffset0=5

# PPR params
maxp2ga0=90
txpwrbckof=6
cckbw202gpo=0x5555
legofdmbw202gpo=0x77777777
mcsbw202gpo=0xaaaaaaaa

# OFDM IIR :
ofdmdigfilttype=7
# PAPD mode:
papdmode=2

il0macaddr=00:90:4c:c5:12:38
wl0id=0x431b

#OOB parameters
hostwake=0x40
hostrdy=0x41
usbrdy=0x03
usbrdydelay=100
deadman_to=0xffffffff
# muxenab: 0x1 for UART enable, 0x10 for Host awake
muxenab=0x10
# CLDO PWM voltage settings - 0x4 - 1.1 volt
#cldo_pwm=0x4
glitch_based_crsmin=1

Bahir avatar Oct 05 '19 10:10 Bahir

Interesting. I could see the first time you tried to connect failed. And the next attempt was a success. I can't remember where I got the firmware from... My attempt:

sudo bt-device -c 8E:06:78:D2:E1:3C
Connecting to: 8E:06:78:D2:E1:3C
Error: GDBus.Error:org.bluez.Error.AlreadyExists: Already Exists
ubuntu@bpi-m2z:~$ sudo bt-device -c 8E:06:78:D2:E1:3C
Connecting to: 8E:06:78:D2:E1:3C
Error: GDBus.Error:org.bluez.Error.AlreadyExists: Already Exists
ubuntu@bpi-m2z:~$ sudo bluetoothctl
[NEW] Controller CC:B8:A8:A9:E5:67 bpi-m2z [default]
[NEW] Device 8E:06:78:D2:E1:3C CHARGE3
[bluetooth]# remove 8E:06:78:D2:E1:3C
[DEL] Device 8E:06:78:D2:E1:3C CHARGE3
Device has been removed
[bluetooth]# exit
[DEL] Controller CC:B8:A8:A9:E5:67 bpi-m2z [default]
ubuntu@bpi-m2z:~$ sudo bt-device -c 8E:06:78:D2:E1:3C
Connecting to: 8E:06:78:D2:E1:3C
Error: Device not found.
ubuntu@bpi-m2z:~$ sudo bt-device -l 8E:06:78:D2:E1:3C
No devices found
ubuntu@bpi-m2z:~$ sudo bt-device -l                  
No devices found
ubuntu@bpi-m2z:~$ sudo bluetoothctl
[NEW] Controller CC:B8:A8:A9:E5:67 bpi-m2z [default]
[bluetooth]# power on
Changing power on succeeded
[bluetooth]# agent on
Agent registered
[bluetooth]# default-agent
Default agent request successful
[bluetooth]# scan on
Discovery started
[CHG] Controller CC:B8:A8:A9:E5:67 Discovering: yes
[NEW] Device 8E:06:78:D2:E1:3C CHARGE3
[bluetooth]# scan off
[CHG] Device 8E:06:78:D2:E1:3C RSSI is nil
Discovery stopped
[CHG] Controller CC:B8:A8:A9:E5:67 Discovering: no
[bluetooth]# quit
Agent unregistered
[DEL] Controller CC:B8:A8:A9:E5:67 bpi-m2z [default]
ubuntu@bpi-m2z:~$ sudo bluetoothctl
[NEW] Controller CC:B8:A8:A9:E5:67 bpi-m2z [default]
[NEW] Device 8E:06:78:D2:E1:3C CHARGE3
[bluetooth]# quit
[DEL] Controller CC:B8:A8:A9:E5:67 bpi-m2z [default]

Then:

ubuntu@bpi-m2z:~$ sudo bt-device -c 8E:06:78:D2:E1:3C
Connecting to: 8E:06:78:D2:E1:3C
Done

I read somewhere you must have the device listed here in order to play sound, i need to find this info, but i think is a pulse configuration.

ubuntu@bpi-m2z:~$ rfkill list
0: hci0: Bluetooth
	Soft blocked: no
	Hard blocked: no
1: phy0: Wireless LAN
	Soft blocked: no
	Hard blocked: no

Play audio to HDMI

ubuntu@bpi-m2z:~$ sudo aplay -D sysdefault:CARD=1 /usr/share/sounds/alsa/Front_Left.wav 
Home directory not accessible: Permission denied
Playing WAVE '/usr/share/sounds/alsa/Front_Left.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Mono

your command

ubuntu@bpi-m2z:~$ paplay /usr/share/sounds/alsa/Front_Center.wav
ubuntu@bpi-m2z:~$ ps -e|grep pulse
  873 ?        00:00:00 pulseaudio
ubuntu@bpi-m2z:~$ paplay /usr/share/sounds/alsa/Front_Center.wav
ubuntu@bpi-m2z:~$ ps -e|grep pulse
  873 ?        00:00:00 pulseaudio

So, i think the problem is the right pulse configuration that must be done to make a link to the hw be available. Still, we need to investigate.

Configuration for mainline:

cat /etc/asound.conf
pcm.!default {
    type plug
    slave {
        pcm "hw:1,0"
    }
}
		
ctl.!default {
   type hw
   card 1
} 

avafinger avatar Oct 05 '19 13:10 avafinger

@Bahir Can you try to use this firmware or see the differences? Try the full stack.

https://github.com/RPi-Distro/firmware-nonfree/blob/master/brcm/brcmfmac43430-sdio.txt

avafinger avatar Oct 05 '19 13:10 avafinger

Interesting. I could see the first time you tried to connect failed. And the next attempt was a success. That's because of I forgot to run pulseaudio first time :-)

With this: https://github.com/RPi-Distro/firmware-nonfree/blob/master/brcm/brcmfmac43430-sdio.txt

  1. WIFI stopped to work at all (not associates with AP)
  2. BT the same things

Bahir avatar Oct 05 '19 13:10 Bahir

Did you get all files from https://github.com/RPi-Distro/firmware-nonfree/tree/master/brcm or just the brcmfmac43430-sdio.txt ?

avafinger avatar Oct 05 '19 13:10 avafinger

Yes I've got all of the files. It does not work only if I replace my brcmfmac43430-sdio.txt with the one from there.

Bahir avatar Oct 05 '19 13:10 Bahir

Restore the previous firmware and try this and check any improvement on wlan:

cd /lib/firmware/brcm/
sudo ln -sf brcmfmac43430-sdio.txt "brcmfmac43430-sdio.sinovoip,bananapi zero.txt"
sync
sudo reboot

avafinger avatar Oct 05 '19 15:10 avafinger

That was exactly my configuration (long quotes story I posted today).

My file brcmfmac43430-sdio.txt points to brcmfmac43430-sdio.txt.orig that is the copy of brcmfmac43430-sdio.sinovoip,bananapi zero.txt.

I posted the content of the file brcmfmac43430-sdio.txt and you can check it in the last quote. It is the same as brcmfmac43430-sdio.sinovoip,bananapi zero.txt.

So, what do you suggest is my original configuration and it has no luck.

Bahir avatar Oct 05 '19 15:10 Bahir

Not exactly the same:

[ 6.870887] brcmfmac mmc1:0001:1: Direct firmware load for brcm/brcmfmac43430-sdio.sinovoip,bananapi zero.txt failed with error -2

with the symlink there will be a direct firmware load and can have different behavior than the fallback, that was a hope.

avafinger avatar Oct 05 '19 15:10 avafinger

Just for information, i just repeated the exact same instructions with another board (not bpi-m2z) and i confirm the paplay /usr/share/sounds/alsa/Front_Center.wav is enough to play sound in the CHARGE3. No need for the device to be shown in rfkill list.

Update info TESTED WITH KERNEL 4.4 AND I WILL CHECK WITH 5.3

Anyway, you can install hcidump and run it in the second instance of ssh and monitor the messages during play and try to get a clue where it breaks. You are still ahead of me.

Maybe you can re-install pulse and Bluez and bt tools, and check again until i find out why i can't connect..

avafinger avatar Oct 05 '19 16:10 avafinger

I changed it as you suggested (made symlinks) now dmesg is

[    6.488202] brcmfmac: brcmf_fw_alloc_request: using brcm/brcmfmac43430-sdio for chip BCM43430/1
[    6.580235] Bluetooth: Core ver 2.22
[    6.591334] Bluetooth: HCI device and connection manager initialized
[    6.598184] Bluetooth: HCI socket layer initialized
[    6.604680] Bluetooth: L2CAP socket layer initialized
[    6.609834] Bluetooth: SCO socket layer initialized
[    6.632913] Bluetooth: HCI UART driver ver 2.3
[    6.637435] Bluetooth: HCI UART protocol H4 registered
[    6.642622] Bluetooth: HCI UART protocol BCSP registered
[    6.647936] Bluetooth: HCI UART protocol ATH3K registered
[    6.659153] Bluetooth: HCI UART protocol Intel registered
[    6.665010] Bluetooth: HCI UART protocol Broadcom registered
[    6.672983] Bluetooth: HCI UART protocol AG6XX registered
[    6.710676] Bluetooth: RFCOMM TTY layer initialized
[    6.716213] Bluetooth: RFCOMM socket layer initialized
[    6.716384] Bluetooth: RFCOMM ver 1.11
[    6.766892] brcmfmac: brcmf_fw_alloc_request: using brcm/brcmfmac43430-sdio for chip BCM43430/1
[    6.954734] Bluetooth: hci0: BCM: chip id 94
[    6.969026] Bluetooth: hci0: BCM: features 0x2e
[    7.004613] Bluetooth: hci0: BCM43430A1
[    7.010604] Bluetooth: hci0: BCM43430A1 (001.002.009) build 0000
[    8.780413] brcmfmac: brcmf_c_preinit_dcmds: Firmware: BCM43430/1 wl0: Oct 23 2017 03:55:53 version 7.45.98.38 (r674442 CY) FWID 01-e58d219f
[   11.354717] Bluetooth: hci0: BCM43430A1 (001.002.009) build 0106
[   16.136176] Bluetooth: BNEP (Ethernet Emulation) ver 1.3
[   16.136190] Bluetooth: BNEP filters: protocol multicast
[   16.136219] Bluetooth: BNEP socket layer initialized

But the behavoiur is the same

  1. Strange freezes in network when i activate BT. BTW with 4.20.17 before rampatch were no such freezes but sure they do appear after patchram.
  2. Pulseaudio works bad (dirty sound or it crashes itself)
root@bpi-m2z:~# aplay -D pulse /usr/share/sounds/alsa/Front_Center.wav
Playing WAVE '/usr/share/sounds/alsa/Front_Center.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Mono
aplay: pcm_write:2053: write error: Input/output error
root@bpi-m2z:~# paplay /usr/share/sounds/alsa/Front_Center.wav
Connection failure: Connection terminated
Stream error: Connection terminated

Also, I tried to install fresh bluez (5.51 from git) and bluez-alsa plugin (https://github.com/Arkq/bluez-alsa) With this plugin we do no need to run pulseaudio. The progress is that with bluez-alsa there no crashes (so there no need to run hcidump) but sound played so dirty as well as with pulseaudio.

Seems like firmware issue or bluez issue.

Bahir avatar Oct 05 '19 16:10 Bahir

FYI, i have the same problem with the other board (that had kernel 4.4 and speaker works with BT) now running kernel 5.3.1. Since both Images (bpi-m2z and the other board) are build from scratch for the kernel 5.3.1 some configuration might be missing (in my case).

avafinger avatar Oct 05 '19 18:10 avafinger

@Bahir Do you have /etc/bluetooth/audio.conf and configured? [General] Enable=Source,Sink,Media,Socket

avafinger avatar Oct 05 '19 19:10 avafinger

Sometimes i see this: Enable=Source,Sink,Media,Socket,Gateway,Control

avafinger avatar Oct 05 '19 19:10 avafinger

@Bahir After some configurations and installations..... I get the sound coming out from the BT speaker now, playing Front_Center is almost clear but in slow motion, something like Froooooonnnnt Ceeeeeenter.

Pulse is still running after several play commands: paplay /usr/share/sounds/alsa/Front_Center.wav and aplay -D pulse /usr/share/sounds/alsa/Front_Center.wav

The CHARGE3 battery is very low, could be this.... Just turned off now. So there is hope...

avafinger avatar Oct 06 '19 00:10 avafinger

Forgot to mention i am using eth0 , wlan0 is connected to a second network but not in use.

ubuntu@bpi-m2z:~$ ifconfig
eth0      Link encap:Ethernet  HWaddr 66:81:e7:d5:09:ae  
          inet addr:192.168.254.100  Bcast:192.168.255.255  Mask:255.255.0.0
          inet6 addr: fe80::6481:e7ff:fed5:9ae/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:1800 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1282 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:155648 (155.6 KB)  TX bytes:225122 (225.1 KB)
          Interrupt:39 

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:80 errors:0 dropped:0 overruns:0 frame:0
          TX packets:80 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:5920 (5.9 KB)  TX bytes:5920 (5.9 KB)

wlan0     Link encap:Ethernet  HWaddr cc:b8:a8:a9:e5:66  
          inet addr:192.168.254.102  Bcast:192.168.255.255  Mask:255.255.0.0
          inet6 addr: fe80::ceb8:a8ff:fea9:e566/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:33 errors:0 dropped:0 overruns:0 frame:0
          TX packets:23 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:2291 (2.2 KB)  TX bytes:3058 (3.0 KB)

ubuntu@bpi-m2z:~$ 

avafinger avatar Oct 06 '19 00:10 avafinger

@Bahir After some configurations and installations..... I get the sound coming out from the BT speaker now, playing Front_Center is almost clear but in slow motion, something like Froooooonnnnt Ceeeeeenter.

Mine is the same effect but with some distortion (like Matrix sound). As for me it not depends on battery level. What about my /etc/bluetooth/audio.conf. It is. This section contains general options [General] Enable=Source,Sink,Media,Socket

Bahir avatar Oct 06 '19 09:10 Bahir

Also, I noticed that when I activate something with BT (pulseaduio, bluetoothctl) the WIFI connection sometimes interrupts responding (strange delays when i type in ssh console). And sometimes I need to restart ssh session at all after I activated BT.

Ok, i am now testing with wlan0. BT plays most of the time but sometimes very laggy. There must be a way to parametrize this or change this delay.

To fix the ssh issue you have, edit the fie /etc/network/interfaces and uncomment the two lines: #wireless-mode Managed #wireless-power off

If there isn't a way to change this lag (BT) i will try to create Ubuntu EON Image if that is possible with armhf. No time frame for this.

avafinger avatar Oct 06 '19 14:10 avafinger

Small update. I just tried to play some mp3 and the sound is really bad, maybe similar to what you described.

I used sox sudo apt-get install sox libsox-fmt-all:

play music.mp3

I played this: https://www.soundhelix.com/examples/mp3/SoundHelix-Song-1.mp3

avafinger avatar Oct 06 '19 14:10 avafinger

Today I pushed an 8GB Image here: https://github.com/avafinger/bananapi-zero-ubuntu-base-minimal/releases/tag/v2.4

You still need to install ALSA, Bluetooth and then test the latest Bluez stack. So we can see if it has been fixed with the latest and cutting edge.

The Image is a bare minimum Image that can suit every need, Desktop side or Server side

avafinger avatar Oct 08 '19 22:10 avafinger

Install BT stack:

sudo apt-get update
sudo apt-get dist-upgrade
sudo apt-get install dialog alsa-utils libasound2 alsa-base
sudo apt-get install bluez bluez-tools libbluetooth-dev
sudo apt-get install pulseaudio pulseaudio-utils pavucontrol pulseaudio-module-bluetooth

then start configuring...

avafinger avatar Oct 09 '19 00:10 avafinger

Update. Playing aplay -D pulse /usr/share/sounds/alsa/Front_Center.wav is now fixed in Ubuntu 19.10 but playing mp3 audio no. I think must be a way to configure a2dp but did not find a way.... :(

pactl list cards | awk -v card="#2" -v ORS="\n" -v FS="\n" -v RS="" 'split($1,var," ")  var[1] ~ /Card/ && var[2] == card {print}'
Card #2
	Name: bluez_card.8E_06_78_D2_E1_3C
	Driver: module-bluez5-device.c
	Owner Module: 25
	Properties:
		device.description = "CHARGE3"
		device.string = "8E:06:78:D2:E1:3C"
		device.api = "bluez"
		device.class = "sound"
		device.bus = "bluetooth"
		device.form_factor = "headset"
		bluez.path = "/org/bluez/hci0/dev_8E_06_78_D2_E1_3C"
		bluez.class = "0x340404"
		bluez.alias = "CHARGE3"
		device.icon_name = "audio-headset-bluetooth"
		device.intended_roles = "phone"
	Profiles:
		a2dp_sink: High Fidelity Playback (A2DP Sink) (sinks: 1, sources: 0, priority: 40, available: yes)
		headset_head_unit: Headset Head Unit (HSP/HFP) (sinks: 1, sources: 1, priority: 30, available: no)
		off: Off (sinks: 0, sources: 0, priority: 0, available: yes)
	Active Profile: a2dp_sink
	Ports:
		headset-output: Headset (priority: 0, latency offset: 0 usec)
			Part of profile(s): a2dp_sink, headset_head_unit
		headset-input: Headset (priority: 0, latency offset: 0 usec, not available)
			Part of profile(s): headset_head_unit

avafinger avatar Oct 09 '19 13:10 avafinger

Hi!

I installed from scratch v.24 (Ubuntu 19.10/5.3.5) With bluetooth the same situation.

Mac-Pro:~ $ ssh [email protected]
Welcome to Ubuntu Eoan Ermine (development branch) (GNU/Linux 5.3.5 armv7l)

 * Documentation:  https://help.ubuntu.com
 * Management:     https://landscape.canonical.com
 * Support:        https://ubuntu.com/advantage

Last login: Fri Oct 11 14:54:30 2019 from 192.168.1.11
ubuntu@bpi-m2z:~$ bluetoothctl
Agent registered
[bluetooth]# connect FC:A8:9A:68:8D:4A
Attempting to connect to FC:A8:9A:68:8D:4A
[CHG] Device FC:A8:9A:68:8D:4A Connected: yes
Connection successful
[JBL E45BT]# info
Device FC:A8:9A:68:8D:4A (public)
	Name: JBL E45BT
	Alias: JBL E45BT
	Class: 0x00240404
	Icon: audio-card
	Paired: yes
	Trusted: no
	Blocked: no
	Connected: yes
	LegacyPairing: no
	UUID: Headset                   (00001108-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)
[CHG] Device FC:A8:9A:68:8D:4A ServicesResolved: yes
[JBL E45BT]# quit
ubuntu@bpi-m2z:~$ aplay -D pulse /usr/share/sounds/alsa/Front_Center.wav
Playing WAVE '/usr/share/sounds/alsa/Front_Center.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Mono
ubuntu@bpi-m2z:~$ aplay -D pulse /usr/share/sounds/alsa/Front_Center.wav
Playing WAVE '/usr/share/sounds/alsa/Front_Center.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Mono
aplay: pcm_write:2057: write error: Input/output error
ubuntu@bpi-m2z:~$

And the sound is played old way Frooooonnnttt....Ceeeeeenteeeer :-)

ubuntu@bpi-m2z:~$ pactl list cards | awk -v card="#2" -v ORS="\n" -v FS="\n" -v RS="" 'split($1,var," ")  var[1] ~ /Card/ && var[2] == card {print}'
Card #2
	Name: bluez_card.FC_A8_9A_68_8D_4A
	Driver: module-bluez5-device.c
	Owner Module: 25
	Properties:
		device.description = "JBL E45BT"
		device.string = "FC:A8:9A:68:8D:4A"
		device.api = "bluez"
		device.class = "sound"
		device.bus = "bluetooth"
		device.form_factor = "headset"
		bluez.path = "/org/bluez/hci0/dev_FC_A8_9A_68_8D_4A"
		bluez.class = "0x240404"
		bluez.alias = "JBL E45BT"
		device.icon_name = "audio-headset-bluetooth"
		device.intended_roles = "phone"
	Profiles:
		headset_head_unit: Headset Head Unit (HSP/HFP) (sinks: 1, sources: 1, priority: 30, available: yes)
		a2dp_sink: High Fidelity Playback (A2DP Sink) (sinks: 1, sources: 0, priority: 40, available: no)
		off: Off (sinks: 0, sources: 0, priority: 0, available: yes)
	Active Profile: headset_head_unit
	Ports:
		headset-output: Headset (priority: 0, latency offset: 0 usec)
			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

Bahir avatar Oct 11 '19 14:10 Bahir