This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Enable connectable advertising and scan role simultaneously using nRF connect SDK

Hi,

I am using NCS v1.3.0 for nRF9160. How to enable both scanner and advertiser roles simultaneously?

Currently even I enable both, HCI LE set random address failing with command disallowed error.

Parents
  • I have loaded hci_uart into nrf9160dk_nrf52840.

    I have added below in ncs\zephyr\samples\bluetooth\scan_adv 

    1. child_secure_partition_manager.conf

    CONFIG_SPM_NRF_UARTE2_NS=y

    2. nrf9160dk_nrf9160ns.overlay

    / {
    	chosen {
    		zephyr,bt-uart=&uart2;
    	};
    };
    
    &uart2 {
    	compatible = "nordic,nrf-uarte";
    	current-speed = <1000000>;
    	status = "okay";
    	tx-pin = <18>;
    	rx-pin = <17>;
    	rts-pin = <21>;
    	cts-pin = <19>;
    };
    

    I have modified prj.conf as

    CONFIG_BT=y
    CONFIG_BT_BROADCASTER=y
    CONFIG_BT_OBSERVER=y
    CONFIG_BT_DEBUG_LOG=y
    CONFIG_BT_H4=y
    CONFIG_BT_WAIT_NOP=y
    CONFIG_BT_CENTRAL=y
    CONFIG_BT_GATT_CLIENT=y
    CONFIG_BT_GATT_DM=y
    CONFIG_BT_SCAN=y
    CONFIG_BT_SCAN_FILTER_ENABLE=y
    CONFIG_BT_SCAN_UUID_CNT=2
    
    CONFIG_UART_2_NRF_FLOW_CONTROL=y
    CONFIG_UART_INTERRUPT_DRIVEN=y
    CONFIG_BT_SMP=y
    
    
    # Enable the BLE modules from NCS
    CONFIG_BT_GATT_NUS_C=y
    CONFIG_BT_MAX_CONN=10
    CONFIG_BT_MAX_PAIRED=2
    CONFIG_BT_ID_MAX=2
    CONFIG_BT_PERIPHERAL=y
    
    

    In main.c I replaced BT_LE_ADV_NCONN with BT_LE_ADV_CONN and I observed following prints in LTE link monitor

    Advertising failed to start (err -5)
    
    
    
    
    bt_hci_core: opcode 0x0000 pool id 6 pool 0x200205ec != &hci_cmd_pool 0x200205c4
    bt_hci_core: ECC HCI commands not available
    bt_hci_core: Identity: d8:56:51:0d:97:1b (random)
    bt_hci_core: HCI: version 5.2 (0x0b) revision 0x0000, manufacturer 0x05f1
    bt_hci_core: LMP: version 5.2 (0x0b) subver 0xffff
    bt_hci_core: opcode 0x2005 status 0x0c

    Please tell me what I am doing wrong.

Reply
  • I have loaded hci_uart into nrf9160dk_nrf52840.

    I have added below in ncs\zephyr\samples\bluetooth\scan_adv 

    1. child_secure_partition_manager.conf

    CONFIG_SPM_NRF_UARTE2_NS=y

    2. nrf9160dk_nrf9160ns.overlay

    / {
    	chosen {
    		zephyr,bt-uart=&uart2;
    	};
    };
    
    &uart2 {
    	compatible = "nordic,nrf-uarte";
    	current-speed = <1000000>;
    	status = "okay";
    	tx-pin = <18>;
    	rx-pin = <17>;
    	rts-pin = <21>;
    	cts-pin = <19>;
    };
    

    I have modified prj.conf as

    CONFIG_BT=y
    CONFIG_BT_BROADCASTER=y
    CONFIG_BT_OBSERVER=y
    CONFIG_BT_DEBUG_LOG=y
    CONFIG_BT_H4=y
    CONFIG_BT_WAIT_NOP=y
    CONFIG_BT_CENTRAL=y
    CONFIG_BT_GATT_CLIENT=y
    CONFIG_BT_GATT_DM=y
    CONFIG_BT_SCAN=y
    CONFIG_BT_SCAN_FILTER_ENABLE=y
    CONFIG_BT_SCAN_UUID_CNT=2
    
    CONFIG_UART_2_NRF_FLOW_CONTROL=y
    CONFIG_UART_INTERRUPT_DRIVEN=y
    CONFIG_BT_SMP=y
    
    
    # Enable the BLE modules from NCS
    CONFIG_BT_GATT_NUS_C=y
    CONFIG_BT_MAX_CONN=10
    CONFIG_BT_MAX_PAIRED=2
    CONFIG_BT_ID_MAX=2
    CONFIG_BT_PERIPHERAL=y
    
    

    In main.c I replaced BT_LE_ADV_NCONN with BT_LE_ADV_CONN and I observed following prints in LTE link monitor

    Advertising failed to start (err -5)
    
    
    
    
    bt_hci_core: opcode 0x0000 pool id 6 pool 0x200205ec != &hci_cmd_pool 0x200205c4
    bt_hci_core: ECC HCI commands not available
    bt_hci_core: Identity: d8:56:51:0d:97:1b (random)
    bt_hci_core: HCI: version 5.2 (0x0b) revision 0x0000, manufacturer 0x05f1
    bt_hci_core: LMP: version 5.2 (0x0b) subver 0xffff
    bt_hci_core: opcode 0x2005 status 0x0c

    Please tell me what I am doing wrong.

Children
Related