1 1
ot8

rk3399-bluetooth.service is still present in "systemctl list-jobs"

Recommended Posts

After bootup I get

 

# systemd-analyze
Bootup is not yet finished. Please try again later.

 

# systemctl list-jobs
JOB UNIT                                 TYPE  STATE
142 systemd-update-utmp-runlevel.service start waiting
114 rk3399-bluetooth.service             start running  
  1 multi-user.target                    start waiting

 

If I stop rk3399-bluetooth.service everything completes and list-jobs is clean, but then bluetooth stops working. I've tried a few things in the rk3399-bluetooth unit file but so far I've not been able to find a way to make systemd happy and finish cleanly.

 

By the way, in the service file it uses "--use_baudrate_for_downloade", typo and should be "--use_baudrate_for_download"

 

Share this post


Link to post
Share on other sites
(edited)

Hello.


I've Radxa Rock Pi 4 SBC.

 

I've tried several latest Armbian Buster images with 5.x kernel and never got bluetooth working.

 

I've tested your propose on Armbian_20.02.0-rc1_Rockpi-4b_buster_current_5.4.14_desktop...

 

On 1/27/2020 at 3:27 PM, ot8 said:

By the way, in the service file it uses "--use_baudrate_for_downloade", typo and should be "--use_baudrate_for_download"

 

 

... bluetooth doesn't work and I've got a flood in Rock Pi 4 syslog

...
Jan 30 20:10:30 rockpi brcm_patchram_plus_rk3399[1089]: 01 03 0c 00
Jan 30 20:10:34 rockpi brcm_patchram_plus_rk3399[1089]: writing
Jan 30 20:10:34 rockpi brcm_patchram_plus_rk3399[1089]: 01 03 0c 00
Jan 30 20:10:38 rockpi brcm_patchram_plus_rk3399[1089]: writing
Jan 30 20:10:38 rockpi brcm_patchram_plus_rk3399[1089]: 01 03 0c 00
Jan 30 20:10:42 rockpi brcm_patchram_plus_rk3399[1089]: writing
Jan 30 20:10:42 rockpi brcm_patchram_plus_rk3399[1089]: 01 03 0c 00
....

 

There're also interesting bluetooth related messages in Rock Pi 4 syslog:

...
Jan 30 19:41:41 localhost systemd[1]: Starting Bluetooth Rockpi...

...
Jan 30 19:41:50 localhost systemd[1]: Condition check resulted in Bluetooth service being skipped.
Jan 30 19:41:50 localhost brcm_patchram_plus_rk3399[1089]: writing
Jan 30 19:41:50 localhost brcm_patchram_plus_rk3399[1089]: 01 03 0c 00
Jan 30 19:41:54 localhost brcm_patchram_plus_rk3399[1089]: writing
Jan 30 19:41:54 localhost brcm_patchram_plus_rk3399[1089]: 01 03 0c 00

...

Jan 30 19:45:10 localhost dbus-daemon[803]: [system] Activating via systemd: service name='org.bluez' unit='dbus-org.bluez.service' requested by ':1.44' (uid=1000 pid=1830 comm="/usr/lib/chromium/chromium --disable-smooth-scroll")
Jan 30 19:45:10 localhost systemd[1]: Condition check resulted in Bluetooth service being skipped.

...

 

Edited by TRS-80
put in some code fences for clarity

Share this post


Link to post
Share on other sites
18 minutes ago, sergvpurik said:

... bluetooth doesn't work and I've got a flood in Rock Pi 4 syslog

I didn't have time and enough interest in Bluetooth to pursue a solution but one thing I have noticed with 5.x kernels on all rk3399 boards I own is that Bluetooth's firmware is correctly patched after cold boot / power on but not after a reboot.

Share this post


Link to post
Share on other sites

Looks like the typo "--use_baudrate_for_downloade" is used to skip this brcm_patchram_plus_rk3399 option.

I've tried to use brcm_patchram_plus_rk3399 without "--use_baudrate_for_downloade". I did power OFF/ON.

 

Jan 31 19:28:46 localhost systemd[1]: Starting Bluetooth Rockpi...
...
Jan 31 19:28:46 localhost brcm_patchram_plus_rk3399[1126]: proc_resetwriting
Jan 31 19:28:46 localhost brcm_patchram_plus_rk3399[1126]: 01 03 0c 00
Jan 31 19:28:46 localhost kernel: [   86.277578] ttyS0 - failed to request DMA
...
Jan 31 19:28:46 localhost brcm_patchram_plus_rk3399[1126]: received 7
Jan 31 19:28:46 localhost brcm_patchram_plus_rk3399[1126]: 04 0e 04 01 03 0c 00
Jan 31 19:28:46 localhost brcm_patchram_plus_rk3399[1126]: writing
...
Here're many "writing" and "received X" messages mixed with HEX dumps.
...
Jan 31 19:28:50 localhost brcm_patchram_plus_rk3399[1126]: Done setting baudrate
Jan 31 19:28:50 localhost kernel: [   90.111432] Bluetooth: Core ver 2.22
Jan 31 19:28:50 localhost kernel: [   90.111479] NET: Registered protocol family 31
Jan 31 19:28:50 localhost kernel: [   90.111481] Bluetooth: HCI device and connection manager initialized
Jan 31 19:28:50 localhost kernel: [   90.111491] Bluetooth: HCI socket layer initialized
Jan 31 19:28:50 localhost kernel: [   90.111495] Bluetooth: L2CAP socket layer initialized
Jan 31 19:28:50 localhost kernel: [   90.111503] Bluetooth: SCO socket layer initialized
Jan 31 19:28:50 localhost brcm_patchram_plus_rk3399[1126]: Can't set hci protocol
Jan 31 19:28:50 localhost kernel: [   90.119645] Bluetooth: HCI UART driver ver 2.3
...
Jan 31 19:28:55 localhost systemd[1]: Starting Bluetooth service...
Jan 31 19:28:55 localhost bluetoothd[1729]: Bluetooth daemon 5.50
Jan 31 19:28:55 localhost dbus-daemon[779]: [system] Successfully activated service 'org.bluez'
Jan 31 19:28:55 localhost systemd[1]: Started Bluetooth service.
Jan 31 19:28:55 localhost bluetoothd[1729]: Starting SDP server
Jan 31 19:28:56 localhost bluetoothd[1729]: kernel lacks bnep-protocol support
Jan 31 19:28:56 localhost bluetoothd[1729]: System does not support network plugin
Jan 31 19:28:56 localhost bluetoothd[1729]: Bluetooth management interface 1.14 initialized
Jan 31 19:28:56 localhost NetworkManager[806]: <info>  [1580498936.0221] bluez: use BlueZ version 5

  

... and no bluetooth.

hciconfig doesn't show any device.

 

 I found there isn't any selected HCI protocol in /proc/config.gz.

#
# Bluetooth device drivers
#
# CONFIG_BT_HCIBTUSB is not set
# CONFIG_BT_HCIBTSDIO is not set
CONFIG_BT_HCIUART=m
# CONFIG_BT_HCIUART_H4 is not set
# CONFIG_BT_HCIUART_BCSP is not set
# CONFIG_BT_HCIUART_ATH3K is not set
# CONFIG_BT_HCIUART_INTEL is not set
# CONFIG_BT_HCIUART_AG6XX is not set
# CONFIG_BT_HCIBCM203X is not set
# CONFIG_BT_HCIBPA10X is not set
# CONFIG_BT_HCIBFUSB is not set
# CONFIG_BT_HCIVHCI is not set
# CONFIG_BT_MRVL is not set
CONFIG_BT_MTKSDIO=m
# end of Bluetooth device drivers

It looks similar to Raspberry Pi bluetooth problem ( https://github.com/raspberrypi/linux/issues/2479 ).

And the solution was enabling CONFIG_SERIAL_DEV_BUS=m, CONFIG_BT_HCIUART_SERDEV=y, CONFIG_BT_HCIUART_BCM=y options.

Share this post


Link to post
Share on other sites

What I ended up doing for NanoPC T4 is disable the systemd service and in rc.local:

/usr/bin/brcm_patchram_plus_rk3399 --enable_hci --no2bytes \
  --use_baudrate_for_download --tosleep 200000 --baudrate 1500000 \
  --enable_lpm --patchram /lib/firmware/brcm/BCM4345C5.hcd /dev/ttyS0 &

 

> ... bluetooth doesn't work and I've got a flood in Rock Pi 4 syslog

 

The --enable_lpm stops the flood and allows it to more-or-less complete.

 

FWIW I haven't yet seen an Armbian 5.x kernel where both wifi and bluetooth actually worked on the T4, but I haven't tried 5.x since I started messing around with brcm_patchram so maybe ... 

 

Share this post


Link to post
Share on other sites

I've built Armbain (5.4.17-rockchip64) from sources with additing the next options CONFIG_BT_HCIUART_SERDEV=y,  CONFIG_BT_HCIUART_H4=y, CONFIG_BT_HCIUART_BCM=y to linux-rockchip64-current.config.

And bluetooth is working.
 

brcm_patchram_plus_rk3399[1446]: Done setting baudrate
Feb  3 20:28:32 localhost kernel: [   99.787745] Bluetooth: Core ver 2.22
Feb  3 20:28:32 localhost kernel: [   99.787784] NET: Registered protocol family 31
Feb  3 20:28:32 localhost kernel: [   99.787787] Bluetooth: HCI device and connection manager initialized
Feb  3 20:28:32 localhost kernel: [   99.787797] Bluetooth: HCI socket layer initialized
Feb  3 20:28:32 localhost kernel: [   99.787802] Bluetooth: L2CAP socket layer initialized
Feb  3 20:28:32 localhost kernel: [   99.787809] Bluetooth: SCO socket layer initialized
Feb  3 20:28:32 localhost kernel: [   99.800667] Bluetooth: HCI UART driver ver 2.3
Feb  3 20:28:32 localhost kernel: [   99.800672] Bluetooth: HCI UART protocol H4 registered
Feb  3 20:28:32 localhost kernel: [   99.800829] Bluetooth: HCI UART protocol Broadcom registered
Feb  3 20:28:32 localhost brcm_patchram_plus_rk3399[1446]: Done setting line discpline
Feb  3 20:28:32 localhost systemd[1]: Starting Load/Save RF Kill Switch Status...
Feb  3 20:28:32 localhost systemd[1]: Starting Bluetooth service...
Feb  3 20:28:32 localhost systemd[1]: Started Load/Save RF Kill Switch Status.
rock@rockpi:~$ hciconfig 
hci0:	Type: Primary  Bus: UART
	BD Address: 43:45:C5:00:1F:AC  ACL MTU: 1021:8  SCO MTU: 64:1
	UP RUNNING 
	RX bytes:1186 acl:0 sco:0 events:77 errors:0
	TX bytes:3609 acl:0 sco:0 commands:71 errors:0

rock@rockpi:~$ sudo hcitool lescan
LE Scan ...
D8:2D:27:A6:53:45 (unknown)
D8:2D:27:A6:53:45 Mi Smart Band 4
F8:D8:37:3D:17:75 (unknown)
F8:D8:37:3D:17:75 Mi Smart Band 4

... but only after a cold boot, as @piter75 said.

 

Who knows what is a right way to make changes in Armbian sources to fix Linux kernel options for Rock Pi 4?
I want to make pull request.

Share this post


Link to post
Share on other sites
55 minutes ago, sergvpurik said:

Who knows what is a right way to make changes in Armbian sources to fix Linux kernel options for Rock Pi 4?
I want to make pull request.

I would add the mentioned options to kernel config, built the kernel, copied resulting ".config" file over "linux-rockchip64-current.config" and then commit it.

It would be great to do the same with "dev" kernel (which is now 5.5.y in Armbian's master) in the same PR for feature parity :) 

Share this post


Link to post
Share on other sites
3 hours ago, sergvpurik said:

Who knows what is a right way to make changes in Armbian sources to fix Linux kernel options for Rock Pi 4?

IMO the easiest way is ./compile.sh KERNEL_CONFIGURE=yes make your changes when menuconfig pops up and you get your new config in output/config after compilation. It's even named the way it should be.. :)

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
1 1