The nRF52832 operates as a host in NCS 3.0.2

Hi,

I noticed that NCS has been updated to version 3.0.2. I now want to compile the beacon in host-only mode and make it work on the nRF52832, but I haven't succeeded so far.

I used the "beacon" example from the sample library as a base. My prj.conf is as follows:

CONFIG_BT=y  
CONFIG_LOG=y  
CONFIG_BT_DEVICE_NAME="Test beacon"  

CONFIG_BT_HCI=y  
CONFIG_BT_CTLR=n  
CONFIG_BT_H4=y  

My nrf52dk_nrf52832.overlay is as follows:

/ {  
    chosen {  
        zephyr,bt-hci = &uart0;  
        zephyr,bt-hci-uart = &uart0;  
        zephyr,bt-c2h-uart = &uart0;  
        zephyr,bt-uart = &uart0;  
    };  
};  

&uart0 {  
    status = "okay";  
    current-speed = <1000000>;  
    // hw-flow-control;  
};  

The compiler reports:

warning: BT_H4 (defined at drivers/bluetooth/hci/Kconfig:13) was assigned the value 'y' but got the
value 'n'. Check these unsatisfied dependencies: DT_HAS_ZEPHYR_BT_HCI_UART_ENABLED (=n). See
http://docs.zephyrproject.org/latest/kconfig.html#CONFIG_BT_H4 and/or look up BT_H4 in the
menuconfig/guiconfig interface. The Application Development Primer, Setting Configuration Values,
and Kconfig - Tips and Best Practices sections of the manual might be helpful too.

I believe I've already completed the configuration for DT_HAS_ZEPHYR_BT_HCI_UART_ENABLED, but I don't understand where the problem lies.

Additionally, since I'm using an nRF52833 as controller-only (with both boards having only one UART), I've noticed that even when I set CONFIG_LOG=n, the UART still outputs information. When I connect these two boards via UART for operation, this behavior affects normal system functionality. How should I address this issue? I'd like your recommendations.

Thanks,

Cookie_can

Parents
  • Hi,

    Can you share the serial output that looks like looging? That can give an indication on where it comes from. Logs are disabled with CONFIG_LOG=n as you have done, but there can be other things that write to serial as well (for instance printk). You may also want to delete some properties that I expect point to uart0 on your board, so perhaps expant your chosen like this:

    / {
        chosen {
            zephyr,bt-hci = &uart0;
            zephyr,bt-hci-uart = &uart0;
            zephyr,bt-c2h-uart = &uart0;
            zephyr,bt-uart = &uart0;
     		/delete-property/ zephyr,console;
    		/delete-property/ zephyr,shell-uart;
    		/delete-property/ zephyr,uart-mcumgr;
    		/delete-property/ zephyr,bt-mon-uart;
        };
    };

  • Using my existing configuration, the serial outputs the following logs:

    **** Booting nRF Connect SDK v3.0.2-89ba1294ac9b ***
    *** Using Zephyr OS v4.0.99-f791c49f492c ***
    Starting Beacon Demo
    Bluetooth init failed (err -1)
    

    I tried using the following prj.conf and overlay files to redirect log output to RTT, and it appears to have resolved the previous issue. Could there be any problems with this approach?

    # prj.conf:
    CONFIG_BT=y
    CONFIG_LOG=y
    CONFIG_BT_DEVICE_NAME="Test beacon"
    
    CONFIG_BT_HCI=y
    CONFIG_BT_CTLR=n
    CONFIG_BT_H4=y
    
    # Disable UART console (if still enabled)
    CONFIG_UART_CONSOLE=n  
    
    CONFIG_USE_SEGGER_RTT=y  
    CONFIG_RTT_CONSOLE=y  
    CONFIG_LOG_BACKEND_RTT=y  
    
    CONFIG_LOG_PRINTK=y  
    

    # nrf52dk_nrf52832.overlay:
    / {
        chosen {
            zephyr,bt-hci = &uart0;  
            zephyr,bt-hci-uart = &uart0;
            zephyr,bt-c2h-uart = &uart0;   
            zephyr,bt-uart = &uart0;  
        };
     };
    
     &uart0 {
    	status = "okay";
    	current-speed = <115200>;
    	// hw-flow-control;
    };
    

    I urgently need to know how to resolve the BT_H4 configuration failure issue mentioned in my original question. After my serial stopped outputting logs, it seems that the collaborative system between my nrf52832 (beacon_host_only) and nrf52833 (HCI_UART) is not performing its intended functions.

    Thanks,

    Cookie_can

  • Hi,

    That is good. Regarding BT_H4, the error about DT_HAS_ZEPHYR_BT_HCI_UART_ENABLED not being met indicate that "zephyr,bt-hci-uart" is not set in the devicetree. Are you missing this? (The nrf9160 device tree overlay from this sample application can be a good reference here, as this also acts as just a BT host).

    If you do not have any luck, can you upload the generated zephyr.dts from the build folder (<build_folder>/<application name>/zephyr/zephyr.dts)? If this lack bt_hci_uart we need to backtrack and look at your dts and overlay files more closely to understand why.

  • I found the solution in zephyr's documentation. The problem has been solved. Thank you!

Reply Children
No Data
Related