- 
                Notifications
    
You must be signed in to change notification settings  - Fork 8.2k
 
Closed
Copy link
Labels
area: USBUniversal Serial BusUniversal Serial BusbugThe issue is a bug, or the PR is fixing a bugThe issue is a bug, or the PR is fixing a bugplatform: nRFNordic nRFxNordic nRFxpriority: lowLow impact/importance bugLow impact/importance bug
Description
Describe the bug
Whenever the USB DFU class (USB_DFU_CLASS) and the USB Bluetooth class (USB_DEVICE_BLUETOOTH) are both enabled, neither works correctly. I have tested DFU and Bluetooth separately and both work. DFU also works when the bluetooth kernel module is removed in Linux (via modprobe btusb).
Configuration (prj.conf)
CONFIG_STDOUT_CONSOLE=y
CONFIG_GPIO=y
CONFIG_SERIAL=y
CONFIG_UART_INTERRUPT_DRIVEN=y
CONFIG_CLOCK_CONTROL_NRF_K32SRC_RC=y
CONFIG_CLOCK_CONTROL_NRF_K32SRC_20PPM=y
CONFIG_BT=y
CONFIG_BT_HCI_RAW=y
CONFIG_BT_CTLR_TX_BUFFER_SIZE=251
CONFIG_BT_RX_BUF_LEN=258
CONFIG_BT_CTLR_DATA_LENGTH_MAX=251
CONFIG_USB=y
CONFIG_USB_DEVICE_STACK=y
CONFIG_USB_DFU_CLASS=y
CONFIG_USB_DEVICE_BLUETOOTH=y
CONFIG_FLASH=y
CONFIG_SOC_FLASH_NRF=y
CONFIG_BOOTLOADER_MCUBOOT=y
CONFIG_IMG_MANAGER=y
CONFIG_MCUBOOT_IMG_MANAGER=y
CONFIG_USB_DEVICE_VID=0x167f
CONFIG_USB_DEVICE_PID=0x3001
CONFIG_USB_DEVICE_MANUFACTURER="Company"
CONFIG_USB_DEVICE_PRODUCT="Product"
CONFIG_USB_DEVICE_SN="123abc"
To Reproduce
- source zephyr/zephyr/zephyr-env.sh
 - mkdir -p build/nrf52840_pca10056 && cd build/nrf52840_pca10056
 - cmake -GNinja -DBOARD=nrf52840_pca10056 -Dapp_VERSION_BUILD=9999 ../..
 - ninja
 - ~/repos/mcuboot/scripts/imgtool.py sign --key ~/repos/mcuboot/root-ec-p256.pem --header-size 0x200 --align 8 --version 1.2 -S 0x69000 ./zephyr/zephyr.hex signed-hello.hex
 - nrfjprog --family NRF52 --program signed-hello.hex --sectorerase
 - ~/repos/mcuboot/scripts/imgtool.py sign --key ~/repos/mcuboot/root-ec-p256.pem --header-size 0x200 --align 8 --version 1.2 -S 0x69000 ./zephyr/zephyr.bin signed-hello.bin
 - sudo dfu-util --alt 1 --download signed-hello.bin
 
Expected behavior
- sudo dfu-util --alt 1 --download signed-hello.bin
 
dfu-util 0.9
dfu-util: Invalid DFU suffix signature
dfu-util: A valid DFU suffix will be required in a future dfu-util release!!!
Opening DFU capable USB device...
ID 167f:3001
Run-time device DFU version 0110
Claiming USB DFU Interface...
Setting Alternate Setting #1 ...
Determining device status: state = dfuIDLE, status = 0
dfuIDLE, continuing
DFU mode device DFU version 0110
Device returned transfer size 64
Copying data from PC to DFU device
Download    [=========================] 100%        85970 bytes
Download done.
state(2) = dfuIDLE, status(0) = No error condition is present
Done!
- hciconfig
 
hci1:   Type: Primary  Bus: USB
        BD Address: 94:54:93:36:44:B8  ACL MTU: 251:7  SCO MTU: 0:0
        UP RUNNING
        RX bytes:233 acl:0 sco:0 events:19 errors:0
        TX bytes:120 acl:0 sco:0 commands:19 errors:0
Actual Behaviour
- sudo dfu-util --alt 1 --download signed-hello.bin
 
dfu-util 0.9
dfu-util: Invalid DFU suffix signature
dfu-util: A valid DFU suffix will be required in a future dfu-util release!!!
Opening DFU capable USB device...
ID 167f:3001
Run-time device DFU version 0110
Claiming USB DFU Runtime Interface...
dfu-util: Cannot claim interface 1: LIBUSB_ERROR_BUSY
- hciconfig
 
hci1:   Type: Primary  Bus: USB
        BD Address: 00:00:00:00:00:00  ACL MTU: 0:0  SCO MTU: 0:0
        DOWN INIT RUNNING 
        RX bytes:0 acl:0 sco:0 events:0 errors:0
        TX bytes:3 acl:0 sco:0 commands:1 errors:0
followed by
hci1:   Type: Primary  Bus: USB
        BD Address: 00:00:00:00:00:00  ACL MTU: 0:0  SCO MTU: 0:0
        DOWN 
        RX bytes:0 acl:0 sco:0 events:0 errors:0
        TX bytes:3 acl:0 sco:0 commands:1 errors:0
- hciconfig hci1 up
Can't init device hci1: Connection timed out (110) 
Impact
DFU cannot be used in applications which require Bluetooth HCI over USB.
Environment:
- Ubuntu 16.04 (host)
 - nRF52840 PCA10056 hw v. 1.1.0
 - Zephyr 1.14.0 (
cebe115) - Zephyr SDK 0.10.0
 - dfu-util 0.9 (modified for increased timeout during flash erase)
 - MCUboot (master, 
704b8ba) 
Metadata
Metadata
Assignees
Labels
area: USBUniversal Serial BusUniversal Serial BusbugThe issue is a bug, or the PR is fixing a bugThe issue is a bug, or the PR is fixing a bugplatform: nRFNordic nRFxNordic nRFxpriority: lowLow impact/importance bugLow impact/importance bug