Spider Posted February 29, 2020 Posted February 29, 2020 Hello! I'm tryiing to make iBeacon scan service. But can't make Bluetooth work on OPi0+2H5. I'm using "Armbian_20.02.1_Orangepizeroplus2-h5_bionic_current_5.4.20_minimal.img" as OS, but no hci devices in system after start. I reded many topics from this forum and nothig helps me. Can't start BT Is BlueTooth part work on this board? Can I use it? I need only "lescan" functional.... 0 Quote
Spider Posted March 3, 2020 Author Posted March 3, 2020 :) Thx, for reply. But I finaly launch BT device. Next steps: 1. Disable uart1 overlay 2. copyed firmware for ap6212 from last broadcom package into /lib/firmware/bcm.... 3. modified ap6212-bluetooth - at start add: devmem2 0x1f00060 b 1 echo 10 > /sys/class/gpio/export echo out > /sys/class/gpio/gpio10/direction echo 0 > /sys/class/gpio/gpio10/value echo 1 > /sys/class/gpio/gpio10/value sleep 0.1 - at end add: (else after soft reboot wifi will not work) devmem2 0x1f00060 b 0 echo 10 > /sys/class/gpio/export echo out > /sys/class/gpio/gpio10/direction echo 0 > /sys/class/gpio/gpio10/value sleep 0.1 echo 10 > /sys/class/gpio/unexport sleep 0.1 0 Quote
happyzax Posted March 30, 2020 Posted March 30, 2020 Hi, could you elaborate on your fix? How do I disable the uart1 overlay Which firmware did you copy again? Thanks 0 Quote
Levent Erenler Posted April 27, 2020 Posted April 27, 2020 On 3/2/2020 at 10:49 PM, Spider said: Thx, for reply. But I finaly launch BT device. Next steps: 1. Disable uart1 overlay 2. copyed firmware for ap6212 from last broadcom package into /lib/firmware/bcm.... 3. modified ap6212-bluetooth - at start add: devmem2 0x1f00060 b 1 echo 10 > /sys/class/gpio/export echo out > /sys/class/gpio/gpio10/direction echo 0 > /sys/class/gpio/gpio10/value echo 1 > /sys/class/gpio/gpio10/value sleep 0.1 - at end add: (else after soft reboot wifi will not work) devmem2 0x1f00060 b 0 echo 10 > /sys/class/gpio/export echo out > /sys/class/gpio/gpio10/direction echo 0 > /sys/class/gpio/gpio10/value sleep 0.1 echo 10 > /sys/class/gpio/unexport sleep 0.1 Hi , i have a same problem with opiz+2 Mainline kernel 5.4.2x i could not find ap6212-bluetooth file (i did it before on legacy kernel), now i have only bluetooth file. I try to edit this file but nothing change. Could you a bit clear how to success with bluetooth. Thanks 0 Quote
Levent Erenler Posted April 29, 2020 Posted April 29, 2020 Bluetooth init success with Orange pi zero plus 2 Mainline kernel 5.4.28 i solve problem with these steps: 1) install bluetooth support from armbian-config 2) install devmem2 and compile if not installed wget http://free-electrons.com/pub/mirror/devmem2.c gcc ./devmem2.c mv ./a.out /usr/local/bin/devmem2 3) add modules bluetooth and hci_uart to /etc/modules 4) remove bluetooth service (we will add new script) update-rc.d bluetooth remove 5) remove blutooth init script (editing not worked for me) rm /etc/init.d/bluetooth 6) copy modified bluetooth init script file(ap6212) to /etc/init.d/ 7) edit permissions chmod +x /etc/init.d/ap6212 8) enable service script systemctl enable ap6212 9) reboot after reboot probably you will see your service succefully running systemctl status ap6212 ● ap6212.service - LSB: Start bluetooth daemons Loaded: loaded (/etc/init.d/ap6212; generated) Active: active (running) since Tue 2020-04-28 23:31:54 UTC; 38s ago Docs: man:systemd-sysv-generator(8) Process: 735 ExecStart=/etc/init.d/ap6212 start (code=exited, status=0/SUCCESS) Tasks: 1 (limit: 371) Memory: 4.2M CGroup: /system.slice/ap6212.service └─1071 /usr/sbin/bluetoothd Apr 28 23:31:51 orangepizeroplus2-h5 systemd[1]: Starting LSB: Start bluetooth daemons... Apr 28 23:31:54 orangepizeroplus2-h5 ap6212[735]: Starting Patch ap6212:/dev/mem opened. Apr 28 23:31:54 orangepizeroplus2-h5 ap6212[735]: Memory mapped at address 0xffff87107000. Apr 28 23:31:54 orangepizeroplus2-h5 ap6212[735]: Value at address 0x1F00060 (0xffff87107060): 0x0 Apr 28 23:31:54 orangepizeroplus2-h5 ap6212[735]: Written 0x1; readback 0x1 Apr 28 23:31:54 orangepizeroplus2-h5 ap6212[735]: Starting ap6212: bluetoothd. Apr 28 23:31:54 orangepizeroplus2-h5 systemd[1]: Started LSB: Start bluetooth daemons. Apr 28 23:31:54 orangepizeroplus2-h5 bluetoothd[1071]: Bluetooth daemon 5.50 Apr 28 23:31:54 orangepizeroplus2-h5 bluetoothd[1071]: Starting SDP server Apr 28 23:31:54 orangepizeroplus2-h5 bluetoothd[1071]: Bluetooth management interface 1.14 initialized Q: what is difference between ap6212 and bluetooth service init? A: added gpio controls Now you can attach uart with sucess hciattach /dev/ttyS1 any 115200 flow bdaddr 00:90:4c:c5:12:38 hciconfig hci0 up i could not change mac adress device always setup with AA:AA:AA:AA:AA:AA if you can please let me know. Thanks Save as ap6212 and copy to /etc/init.d/ #! /bin/sh ### BEGIN INIT INFO # Provides: ap6212 # Required-Start: $local_fs $syslog $remote_fs dbus # Required-Stop: $local_fs $syslog $remote_fs # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: Start bluetooth daemons ### END INIT INFO # # bluez Bluetooth subsystem starting and stopping # # originally from bluez's scripts/bluetooth.init # # Edd Dumbill <ejad@debian.org> # LSB 3.0 compilance and enhancements by Filippo Giunchedi <filippo@debian.org> # # Updated for bluez 4.7 by Mario Limonciello <mario_limonciello@dell.com> # Updated for bluez 5.5 by Nobuhiro Iwamatsu <iwamatsu@debian.org> # # Note: older daemons like dund pand hidd are now shipped inside the # bluez-compat package PATH=/sbin:/bin:/usr/sbin:/usr/bin DESC=ap6212 DAEMON=/usr/sbin/bluetoothd HCIATTACH=/usr/bin/hciattach HID2HCI_ENABLED=1 HID2HCI_UNDO=1 SDPTOOL=/usr/bin/sdptool # If you want to be ignore error of "org.freedesktop.hostname1", # please enable NOPLUGIN_OPTION. # NOPLUGIN_OPTION="--noplugin=hostname" NOPLUGIN_OPTION="" SSD_OPTIONS="--oknodo --quiet --exec $DAEMON -- $NOPLUGIN_OPTION" test -f $DAEMON || exit 0 # FIXME: any of the sourced files may fail if/with syntax errors test -f /etc/default/bluetooth && . /etc/default/bluetooth test -f /etc/default/rcS && . /etc/default/rcS . /lib/lsb/init-functions set -e # FIXME: this function is possibly a no-op run_sdptool() { # declaring IFS local in this function, removes the need to # save/restore it local IFS o test -x $SDPTOOL || return 1 # FIXME: where does SDPTOOL_OPTIONS come from? if ! test -z "$SDPTOOL_OPTIONS" ; then IFS=";" for o in $SDPTOOL_OPTIONS ; do #echo "execing $SDPTOOL $o" IFS=" " if [ "$VERBOSE" != no ]; then $SDPTOOL $o else $SDPTOOL $o >/dev/null 2>&1 fi done fi } hci_input() { log_progress_msg "switching to HID/HCI no longer done in init script, see /usr/share/doc/bluez/NEWS.Debian.gz" || : } fixstart() { log_daemon_msg "Starting Patch $DESC" /usr/local/bin/devmem2 0x1f00060 b 1 echo 10 > /sys/class/gpio/export echo out > /sys/class/gpio/gpio10/direction echo 0 > /sys/class/gpio/gpio10/value echo 1 > /sys/class/gpio/gpio10/value sleep 0.1 } fixstop() { # disable gpio pin, if not wifi not active on soft restart / reboot log_daemon_msg "Disable Patch $DESC" /usr/local/bin/devmem2 0x1f00060 b 0 echo 10 > /sys/class/gpio/export echo out > /sys/class/gpio/gpio10/direction echo 0 > /sys/class/gpio/gpio10/value sleep 0.1 echo 10 > /sys/class/gpio/unexport sleep 0.1 } alias enable_hci_input=hci_input alias disable_hci_input=hci_input alias enable_fix=fixstart alias disable_fix=fixstop case $1 in start) enable_fix log_daemon_msg "Starting $DESC" if test "$BLUETOOTH_ENABLED" = 0; then log_progress_msg "disabled. see /etc/default/bluetooth" log_end_msg 0 exit 0 fi start-stop-daemon --start --background $SSD_OPTIONS log_progress_msg "${DAEMON##*/}" run_sdptool || : if test "$HID2HCI_ENABLED" = 1; then enable_hci_input fi log_end_msg 0 ;; stop) disable_fix log_daemon_msg "Stopping $DESC" if test "$BLUETOOTH_ENABLED" = 0; then log_progress_msg "disabled." log_end_msg 0 exit 0 fi if test "$HID2HCI_UNDO" = 1; then disable_hci_input fi start-stop-daemon --stop $SSD_OPTIONS log_progress_msg "${DAEMON}" log_end_msg 0 ;; restart|force-reload) $0 stop sleep 1 $0 start ;; status) status_of_proc "$DAEMON" "$DESC" && exit 0 || exit $? ;; *) N=/etc/init.d/ap6212 echo "Usage: $N {start|stop|restart|force-reload|status}" >&2 exit 1 ;; esac exit 0 # vim:noet 0 Quote
Dan Walton Posted October 20, 2020 Posted October 20, 2020 On 4/28/2020 at 8:06 PM, Levent Erenler said: Bluetooth init success with Orange pi zero plus 2 Mainline kernel 5.4.28 I've followed the steps here on mainline kernel 5.8.5. $systemctl status ap6212 looks similar to yours. However $hcitool dev cannot find devices. I can't find my Bluetooth mac address. Any thoughts or help would be great! 0 Quote
Levent Erenler Posted October 20, 2020 Posted October 20, 2020 there was an issue about mac address when i was working on it. I dont have a setup to test with current kernel sorry 0 Quote
GSource Posted November 5, 2023 Posted November 5, 2023 I can confirm this still working in 2023, running the same board (Orange Pi Zero Plus 2 H5) and kernel 6.1.57-current-sunxi64. 0 Quote
JRD McLAREN Posted October 18 Posted October 18 (edited) Here is my actual working init script for bluetooth. It works on Armbian Linux 6.6.36-current-sunxi64 v23.8.1 Bookworm board is Orange Pi Zero Plus 2 H5 no additional dtb overlay is needed, no extra modules just install bluetooth support and devmem2 package - https://ubuntu.pkgs.org/22.04/ubuntu-universe-arm64/devmem2_0.0-0ubuntu2_arm64.deb.html then enable script via 'systemctl enable ap6212-bluetooth' and check /etc/default/ap6212 file ... ap6212-bluetooth Edited October 18 by JRD McLAREN 0 Quote
Recommended Posts
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.