Skip to content
View in the app

A better way to browse. Learn more.

Armbian Community Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Bluetooth doesn't appear after boot very often in Orange Pi 2W

Featured Replies

I've got Orange Pi 2W board and installed Debian 12 Home Assistant image to it (image link). There is a huge problem with it. Very often there is no bluetooth module appeared in system. I need to reboot system for 10-15 timer to make it work. What can be a reason?

I attached 2 boot logs (with good BT appears and no BT appears), I hope it will help to find out the issue.

 

boot_log_bt_good_02.zip

boot_log_bt_bad_02.zip

Hi,

 

without owning this board, chatgpt is pointing out to an initialisation issue of the bluetooth system caused by the GPIO pin not being correctly handled at boot.

 [    6.024062] WCN: marlin chip en dummy pull up -- need manually set GPIO 

The correct solution would be to handle the init in the dtb file, but you can try the following systemd initialisation as a workaround to see if it works.

 

Create (as root) the following service file /etc/systemd/system/bt-gpio.service with the contents:

[Unit]
Description=Enable GPIO for Bluetooth chip
Before=bluetooth.service

[Service]
Type=oneshot
ExecStart=/bin/sh -c 'echo 225 > /sys/class/gpio/export || true; echo out > /sys/class/gpio/gpio225/direction; echo 1 > /sys/class/gpio/gpio225/value'

[Install]
WantedBy=multi-user.target

Then enable it (as root):

systemctl daemon-reexec
systemctl daemon-reload
systemctl enable bt-gpio.service

Reboot and check if the bluetooth starts correctly. Post the boot log if it does not.

 

  • Author
user@orangepizero2w:~$ systemctl status bt-gpio.service
× bt-gpio.service - Enable GPIO for Bluetooth chip
     Loaded: loaded (/etc/systemd/system/bt-gpio.service; enabled; preset: enabled)
     Active: failed (Result: exit-code) since Tue 2025-06-10 23:18:23 +03; 11h ago
    Process: 489 ExecStart=/bin/sh -c echo 225 > /sys/class/gpio/export || true; echo out > /sys/class/gpio/gpio225/direction; echo 1 > /sys/class/gpio/gpio225/value (code=exited, status=2)
   Main PID: 489 (code=exited, status=2)
        CPU: 5ms

jun 10 23:18:23 orangepizero2w systemd[1]: Starting bt-gpio.service - Enable GPIO for Bluetooth chip...
jun 10 23:18:23 orangepizero2w sh[489]: /bin/sh: 1: echo: echo: I/O error
jun 10 23:18:23 orangepizero2w sh[489]: /bin/sh: 1: cannot create /sys/class/gpio/gpio225/direction: Directory nonexistent
jun 10 23:18:23 orangepizero2w sh[489]: /bin/sh: 1: cannot create /sys/class/gpio/gpio225/value: Directory nonexistent
jun 10 23:18:23 orangepizero2w systemd[1]: bt-gpio.service: Main process exited, code=exited, status=2/INVALIDARGUMENT
jun 10 23:18:23 orangepizero2w systemd[1]: bt-gpio.service: Failed with result 'exit-code'.
jun 10 23:18:23 orangepizero2w systemd[1]: Failed to start bt-gpio.service - Enable GPIO for Bluetooth chip.

 

Also I attached boot log which is connected to that "systemctl status bt-gpio.service" command.

 

bt_fail_boot_log_3.txt

 

 

When the board was boot correctly (BT is working fine) the output looks the same:

user@orangepizero2w:~$ systemctl status bt-gpio.service
× bt-gpio.service - Enable GPIO for Bluetooth chip
     Loaded: loaded (/etc/systemd/system/bt-gpio.service; enabled; preset: enabled)
     Active: failed (Result: exit-code) since Wed 2025-06-11 11:04:21 +03; 1min 30s ago
    Process: 492 ExecStart=/bin/sh -c echo 225 > /sys/class/gpio/export || true; echo out > /sys/class/gpio/gpio225/direction; echo 1 > /sys/class/gpio/gpio225/value (code=exited, status=2)
   Main PID: 492 (code=exited, status=2)
        CPU: 5ms

jun 11 11:04:21 orangepizero2w systemd[1]: Starting bt-gpio.service - Enable GPIO for Bluetooth chip...
jun 11 11:04:21 orangepizero2w sh[492]: /bin/sh: 1: echo: echo: I/O error
jun 11 11:04:21 orangepizero2w sh[492]: /bin/sh: 1: cannot create /sys/class/gpio/gpio225/direction: Directory nonexistent
jun 11 11:04:21 orangepizero2w sh[492]: /bin/sh: 1: cannot create /sys/class/gpio/gpio225/value: Directory nonexistent
jun 11 11:04:21 orangepizero2w systemd[1]: bt-gpio.service: Main process exited, code=exited, status=2/INVALIDARGUMENT
jun 11 11:04:21 orangepizero2w systemd[1]: bt-gpio.service: Failed with result 'exit-code'.
jun 11 11:04:21 orangepizero2w systemd[1]: Failed to start bt-gpio.service - Enable GPIO for Bluetooth chip.

 

Ok,

 

if you want we can try one more thing. According to AI, the correct way to always enable the bluetooth is to do it via a custom overlay, which is not done.

 

First, remove the bt-gpio.service, it does not help:

sudo sytemctl disable bt-gpio.service
sudo rm /etc/systemd/system/bt-gpio.service
sudo systemctl daemon-reload 

 

Then, create the custom overlay file /boot/overlay-user/bt_enable_ph1.dts with the following content:

/dts-v1/;
/plugin/;

&pio {
    bt_en_pin: bt_en_pin {
        pins = "PH1";
        function = "gpio_out";
        bias-pull-up;
        output-high;
    };
};

&uart0 {
    pinctrl-names = "default";
    pinctrl-0 = <&uart0_pins>;
    status = "okay";
};

&wcn_bt {
    compatible = "wcn,bt";
    uart = <&uart0>;
    enable-gpios = <&pio 7 1 GPIO_ACTIVE_HIGH>;  // PH1 = GPIO 225
    status = "okay";
};

Then we can try to compile and install it:

sudo armbian-add-overlay /boot/overlay-user/bt_enable_ph1.dts

Then activate it in /boot/armbianEnv.txt, add the following line:

user_overlays=bt_enable_ph1

If all works well try to reboot and see what happens.

 

  • Author
sudo armbian-add-overlay /boot/overlay-user/bt_enable_ph1.dts
Compiling the overlay
Error: /boot/overlay-user/bt_enable_ph1.dts:22.30-31 syntax error
FATAL ERROR: Unable to parse input tree
Error compiling the overlay

 

Unfortunately, I didn't understand what the error is.

Ok, replace the contents of the dts file with this:

/dts-v1/;
/plugin/;

/ {
    fragment@0 {
        target = <&pio>;
        __overlay__ {
            bt_enable_pin: bt_enable_pin {
                pins = "PH1";
                function = "gpio_out";
                bias-pull-up;
                output-high;
            };
        };
    };
};

And try again the steps

Ok,

 

create a new dts /boot/overlay-user/bt_enable_full.dts

 

/dts-v1/;
/plugin/;

&pio {
    bt_en_pin: bt_en_pin {
        pins = "PH1";
        function = "gpio_out";
        bias-pull-up;
        output-high;
    };

    bt_wake_pin: bt_wake_pin {
        pins = "PH0";
        function = "gpio_in";
        bias-pull-up;
    };
};

&{/soc} {
    wcn_bt: wcn_bt@0 {
        compatible = "wcn,bt";
        status = "okay";
        enable-gpios = <&pio 7 1 GPIO_ACTIVE_HIGH>; // PH1 = GPIO225
        wake-gpios = <&pio 7 0 GPIO_ACTIVE_HIGH>;   // PH0 = GPIO224 (if connected)
    };
};

And compile it:

sudo armbian-add-overlay /boot/overlay-user/bt_enable_full.dts

Then enable it in /boot/armbianEnv.txt

user_overlays=bt_enable_full

See if there's an improvement on boot.

  • Author
sudo armbian-add-overlay /boot/overlay-user/bt_enable_full.dts
Compiling the overlay
Error: /boot/overlay-user/bt_enable_full.dts:23.34-35 syntax error
FATAL ERROR: Unable to parse input tree
Error compiling the overlay

 

 Ok, I guess the problem was in "GPIO_ACTIVE_HIGH" macros. So I changed them to "1". File has compiled and I begun to test the board.

Two times in row the board booted ok, but next time BT has failed.

Ok, try with this dts file /boot/overlay-user/bt_enable_clean.dts

/dts-v1/;
/plugin/;

&pio {
    bt_en_pin: bt_en_pin {
        pins = "PH1";                  // GPIO225
        function = "gpio_out";
        bias-pull-up;
        drive-strength = <20>;
        output-high;
    };
};

Compile it:

sudo armbian-add-overlay /boot/overlay-user/bt_enable_clean.dts

and enable it in /boot/armbianEnv.txt

user_overlays=bt_enable_clean

Then see if better on reboot.

  • Author

4 of 5 times works well then failed.

 

bt_boot_fail_05.txt

 

Could you explaint it to me what you suggest to do?

As I see you tried to set logic level on PH1 pin on CPU. In accordance with schematic this pin is connected to debug UART (RX) signal and doesn't affect on wireless chip. So I don't understand what you try to do.

One more thing is BT and WiFi are in one chip, WiFi works well every time. As I understand the issue doesn't affect the chip itself otherwise WiFi wouldn't work either.

The actions in the dts for setting the GPIO pin  are is based on the boot log line.

marlin chip en dummy pull up -- need manually set GPIO

 

You can check the whole discussion here and the reasoning

https://chatgpt.com/share/68466d15-e5bc-8013-b200-17ae7f7c89fc

 

However, After your last answer, Chatgpt suggests this is not really the issue, but a delayed initialisation would help.

When the bt fails to initialise, try the following:

 

sudo hciattach /dev/ttyS0 any 115200 flow
sudo hciconfig hci0 up

If this works, you can put this in a service to run at every boot.

You can try yourself to continue the above conversation with chatgpt and see if you find the final solution. Then you can post it here.

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...

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.