Trying to see DongleBLE in linux with NCS

Hello,

I want to see my dongle BLE with command lsusb with NCS. I succed to see it with a FTDI USB to UART but i want to succed with only USB.

I succed only USB just with the old SDK connectivity by using a patch whitch came from pc-ble-driver. I tried to developp a pc-ble-driver version NCS with shell command but for commercialisation i can't have a FTDI on my board. can you help me ?

I use for my tests a dongle BLE nrf52840.

Regards,

Pierre-Yves

  • i need to have an access to file descriptor to send command

  • Hi,

     

    I want to see my dongle BLE with command lsusb with NCS. I succed to see it with a FTDI USB to UART but i want to succed with only USB.

    Sounds like you want to run USB CDC, which emulates a serial port.

    If you add a overlay, similar to this snippet, to your own board:

    https://github.com/nrfconnect/sdk-nrf/blob/v2.1.99-dev1/samples/bluetooth/peripheral_uart/usb.overlay#L7-L19

     

    It should enable USB and use USB CDC for the console as well.

     

    Kind regards,

    Håkon

  • Thanks you,

    With USB CDC  i succed to see my device /dev/ttyACM0 but i needed to suppress :

    / {
    chosen {
    zephyr,console = &cdc_acm_uart0;
    nordic,nus-uart = &cdc_acm_uart0;
    };

    };

    from overlay file to build.

    Now when i open my serial port with minicom i can'"t put command, cmmand shell are locked i don't know why...

    #
    # Copyright (c) 2020 Nordic Semiconductor
    #
    # SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
    #
    
    CONFIG_CONSOLE_HANDLER=y
    CONFIG_SHELL=y
    CONFIG_FLASH_SHELL=y
    
    #CONFIG_SERIAL = y
    CONFIG_KERNEL_SHELL=y
    CONFIG_DEVICE_SHELL=y
    
    CONFIG_DYNAMIC_INTERRUPTS=y
    
    CONFIG_NRFX_TIMER0=y
    
    # Enable the BT NUS shell
    CONFIG_SHELL_BT_NUS=y
    
    CONFIG_SHELL_BACKEND_SERIAL=y
    #CONFIG_SHELL_PROMPT_UART = n
    
    CONFIG_BT_SHELL=y
    CONFIG_BT_MAX_CONN=5
    CONFIG_MPSL=y
    #CONFIG_TEST=y
    #CONFIG_TEST_LOGGING_DEFAULTS=n
    CONFIG_BT=y
    CONFIG_BT_DEBUG_LOG=y
    CONFIG_BT_CENTRAL=y
    #CONFIG_BT_PERIPHERAL=y
    CONFIG_BT_PRIVACY=y 
    CONFIG_BT_SMP=y
    CONFIG_BT_SIGNING=y
    #CONFIG_BT_FIXED_PASSKEY=y
    #CONFIG_BT_ATT_PREPARE_COUNT=32
    
    CONFIG_BT_GATT_DM=y
    CONFIG_BT_GATT_CLIENT=y
    
    CONFIG_BT_L2CAP_DYNAMIC_CHANNEL=y
    
    #CONFIG_BT_TINYCRYPT_ECC=y
    
    #CONFIG_BT_SHELL=y
    CONFIG_BT_DEVICE_NAME="test shell"
    CONFIG_BT_DEVICE_NAME_DYNAMIC=y
    CONFIG_BT_L2CAP_TX_BUF_COUNT=10
    CONFIG_BT_CTLR_EXT_SCAN_FP=y
    
    CONFIG_BT_EATT=y
    CONFIG_BT_L2CAP_ECRED=y
    
    CONFIG_BT_GATT_DYNAMIC_DB=y
    #CONFIG_BT_HRS=y
    CONFIG_BT_FILTER_ACCEPT_LIST=y
    CONFIG_BT_REMOTE_INFO=y
    CONFIG_BT_REMOTE_VERSION=y
    CONFIG_BT_GATT_AUTO_DISCOVER_CCC=y
    
    CONFIG_BT_SETTINGS=y
    CONFIG_FLASH=y
    CONFIG_FLASH_PAGE_LAYOUT=y
    CONFIG_FLASH_MAP=y
    CONFIG_NVS=y
    CONFIG_SETTINGS=y
    CONFIG_BT_CTLR_PHY_CODED=y
    CONFIG_BT_CTLR_SYNC_PERIODIC=y
    
    CONFIG_BT_SCAN=y
    CONFIG_BT_SCAN_FILTER_ENABLE=y
    CONFIG_BT_SCAN_UUID_CNT=1
    
    
    
    CONFIG_BT_EXT_ADV=y
    CONFIG_BT_EXT_ADV_LEGACY_SUPPORT=y
    CONFIG_BT_PER_ADV=y
    CONFIG_BT_PER_ADV_SYNC=y
    
    CONFIG_BT_USER_DATA_LEN_UPDATE=y
    CONFIG_BT_AUTO_DATA_LEN_UPDATE=y
    
    CONFIG_BT_USER_PHY_UPDATE=y
    #CONFIG_BT_AUTO_PHY_UPDATE=y
    
    #CONFIG_BT_ISO_BROADCASTER=y
    #CONFIG_BT_ISO_SYNC_RECEIVER=y
    #CONFIG_BT_ISO_UNICAST=y
    
    
    #CONFIG_MAIN_STACK_SIZE=4096
    
    
    CONFIG_BT_CTLR_ADV_EXT=y
    CONFIG_BT_LL_SW_SPLIT=y
    CONFIG_BT_BROADCASTER=y
    CONFIG_BT_OBSERVER=y
    #CONFIG_DESKTOP_BLE_QOS_ENABLE=y
    CONFIG_BT_LL_SOFTDEVICE=y
    #CONFIG_QOS=y
    #CONFIG_ZERO_LATENCY_IRQS=y
    CONFIG_BT_CTLR_SDC_LLPM=y
    CONFIG_BT_CTLR_SDC_SCAN_BUFFER_COUNT= 20
    
    # Allow for large Bluetooth data packets.
    CONFIG_BT_L2CAP_TX_MTU=252
    #CONFIG_BT_BUF_ACL_RX_SIZE=256
    
    #CONFIG_BT_TINYCRYPT_ECC=n
    #CONFIG_BT_RX_STACK_SIZE=4096
    
    # Enable the Bluetooth (unauthenticated) and shell mcumgr transports.
    #CONFIG_MCUMGR=y
    #CONFIG_MCUMGR_SMP_BT=y
    #CONFIG_MCUMGR_SMP_BT_AUTHEN=n
    #CONFIG_BT_SMP_OOB_LEGACY_PAIR_ONLY=y
    #CONFIG_BT_SETTINGS_CCC_STORE_ON_WRITE=y
    #CONFIG_BT_SETTINGS_CCC_LAZY_LOADING=y
    
    #Debug
    #CONFIG_THREAD_NAME=y
    #CONFIG_RESET_ON_FATAL_ERROR=n
    CONFIG_KERNEL_MEM_POOL=y
    
    #CONFIG_SHELL_BT_NUS_RX_RING_BUFFER_SIZE=4096
    CONFIG_SHELL_BACKEND_SERIAL_RX_RING_BUFFER_SIZE=256
    CONFIG_SHELL_BACKEND_SERIAL_TX_RING_BUFFER_SIZE=128
    CONFIG_SHELL_PROMPT_UART=""
    
    # USB
    
    CONFIG_USB_DEVICE_STACK=y
    
    #CONFIG_USB_DEVICE_VID=0x1915
    #CONFIG_USB_DEVICE_PID=0x9100
    
    #CONFIG_USB_DEVICE_PID=0xc00a
    
    CONFIG_SERIAL=y
    CONFIG_UART_LINE_CTRL=y
    
    CONFIG_USB_DEVICE_MANUFACTURER="Nordic Semiconductor"
    CONFIG_USB_DEVICE_PRODUCT="nRF52 Connectivity"
    
    CONFIG_STDOUT_CONSOLE=y
    
    CONFIG_LOG=y
    CONFIG_USB_DRIVER_LOG_LEVEL_ERR=y
    CONFIG_USB_DEVICE_LOG_LEVEL_ERR=y
    
    CONFIG_UART_INTERRUPT_DRIVEN=y
    
    
    CONFIG_CONSOLE=y
    CONFIG_UART_CONSOLE=y
    
    
    CONFIG_SHELL_BACKEND_SERIAL_CHECK_DTR=y
    
    CONFIG_SHELL_BACKEND_SERIAL_INIT_PRIORITY=51

    Here there is my prj.conf

    And my main :

    void main(void)
    {
    
    	const struct device *dev;
    	uint32_t baudrate, dtr = 0U;
    	int ret;
    
    	dev = DEVICE_DT_GET_ONE(zephyr_cdc_acm_uart);
    
    	ret = usb_enable(NULL);
    		if (ret != 0) {
    		printk("Failed to enable USB");
    		return;
    	}
    
    
    	//ring_buf_init(&ringbuf, sizeof(ring_buffer), ring_buffer);
    
    
    	printk("Type \"help\" for supported commands.");
    	printk("Before any Bluetooth commands you must `bt init` to initialize"
    	       " the stack.\n");
    
    
    	while (!dtr) {
    		uart_line_ctrl_get(dev, UART_LINE_CTRL_DTR, &dtr);
    		k_sleep(K_MSEC(100));
    	}
    	printk("DTR set");
    
    
    
    		while (1) {
    
    
    	
    		k_sleep(K_SECONDS(1));
    
    		//k_sleep(K_MSEC(100));
    		}
    }
    

  • Hi,

     

    My apologies. This is the overlay for console and shell:

    / {
    	chosen {
    		zephyr,console = &cdc_acm_uart0;
    		zephyr,shell-uart = &cdc_acm_uart0;
    	};
    };
    
    &zephyr_udc0 {
    	cdc_acm_uart0: cdc_acm_uart0 {
    		compatible = "zephyr,cdc-acm-uart";
    		label = "CDC_ACM_0";
    	};
    };
    

     

    The added kconfig configuration needed is this:

    CONFIG_USB_DEVICE_STACK=y
    CONFIG_USB_DEVICE_PRODUCT="Zephyr USB shell sample"
    CONFIG_SHELL_BACKEND_SERIAL_CHECK_DTR=y
    CONFIG_UART_LINE_CTRL=y
    CONFIG_SHELL_BACKEND_SERIAL_INIT_PRIORITY=51
    

     

    Kind regards,

    Håkon

  • Hi thanks you, it works with Dongle BLE, but i have always one issue.

    Like i saied i try my code with dongle BLE and it's work. But i have a custom dongle that don't include reset button and then don't include also the open bootloarder. I can't see my cuistom device.

    The only difference beetween them is the open bootloader that is in the Dongle BLE, do you know how to include it in my code to have the programme ? i need tio include in it because i don't know why i can't access with programmer to my custom board....

Related