-
Notifications
You must be signed in to change notification settings - Fork 6.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
sample hci_usb fails with zephyr 2.2.0 (worked with zephyr 2.1.0) #23866
Comments
I do not have nrf52840_mdk with me but I've checked that with nrf52840_pca10056 and everything works as expected.
in the sample's prj.conf file |
Sure, here are the logs from v2.2.0 with debug turned on.
*** Booting Zephyr OS build zephyr-v2.2.0 ***
Bluetooth over USB sample
Unfortunately this doesn’t tell us much. Anything else I can turn on?
I took a look at the MDK schematic and the pca10056 schematic. The biggest difference I see between the two boards (at least as far as the nrf52840 goes) is the USB from the processor to the host PC goes through a hub on the NRF board, whereas on the pca10056 the connection is direct to the processor.
The hub chip used on the MDK is of course not called out on the schematic (just the generic name “USB 2.0 Hub”). I can’t go into the office to use the microscope read the part number off the chip, so the part number of the hub will have to remain an unknown for now. I suspect the hub is whatever is cheapest, possibly Microchip USB2422T/MJ.
I wonder if you use an external USB 2.0 hub between your computer and the pca10056 if you will see the same issue?
Lawrence King
Principal Developer
+1(416)627-7302
From: eobalski <notifications@github.com>
Sent: Tuesday, March 31, 2020 4:26 AM
To: zephyrproject-rtos/zephyr <zephyr@noreply.github.com>
Cc: Lawrence King <lawrence.king@irdeto.com>; Author <author@noreply.github.com>
Subject: Re: [zephyrproject-rtos/zephyr] sample hci_usb fails with zephyr 2.2.0 (worked with zephyr 2.1.0) (#23866)
I do not have nrf52840_mdk with me but I've checked that with nrf52840_pca10056 and everything works as expected.
Could You please check what is the log output to console by the sample?
You can add DBG logs by adding the line in prj.conf:
CONFIG_USB_DEVICE_LOG_LEVEL_DBG=y
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub<#23866 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AOG3YIEL5Q5VYUZ27OCPLUDRKGSJBANCNFSM4LVBPLCA>.
|
Yes, I am using USB hub, this should work without any difference. Ok, from log's I can tell that the USB HW on nrf was successfully powered on, otherwise You would see
I've edited the comment in regards of additional logs. Could You please try to add:
to the samples
|
Here you go…
*** Booting Zephyr OS build zephyr-v2.2.0 ***
Bluetooth over USB sample
[00:00:00.000,000] <dbg> usb_descriptor.ascii7_to_utf16le: char F : 46, idx 10 -> 21
--- 36 messages dropped ---
[00:00:00.000,000] <dbg> usb_descriptor.ascii7_to_utf16le: char 3 : 33, idx 9 -> 19
[00:00:00.000,000] <dbg> usb_descriptor.ascii7_to_utf16le: char B : 42, idx 8 -> 17
[00:00:00.000,000] <dbg> usb_descriptor.ascii7_to_utf16le: char A : 41, idx 7 -> 15
[00:00:00.000,000] <dbg> usb_descriptor.ascii7_to_utf16le: char 2 : 32, idx 6 -> 13
[00:00:00.000,000] <dbg> usb_descriptor.ascii7_to_utf16le: char A : 41, idx 5 -> 11
[00:00:00.000,000] <dbg> usb_descriptor.ascii7_to_utf16le: char 1 : 31, idx 4 -> 9
[00:00:00.000,000] <dbg> usb_descriptor.ascii7_to_utf16le: char B : 42, idx 3 -> 7
[00:00:00.000,000] <dbg> usb_descriptor.ascii7_to_utf16le: char 8 : 38, idx 2 -> 5
[00:00:00.000,000] <dbg> usb_descriptor.ascii7_to_utf16le: char 5 : 35, idx 1 -> 3
[00:00:00.000,000] <dbg> usb_descriptor.ascii7_to_utf16le: char B : 42, idx 0 -> 1
[00:00:00.003,723] <dbg> usb_bluetooth.bluetooth_init: Initialization
[00:00:00.003,906] <inf> bt_hci_raw: Bluetooth enabled in RAW mode
[00:00:00.003,936] <dbg> usb_bluetooth.hci_rx_thread: Start USB Bluetooth thread
[00:00:00.003,997] <dbg> usb_device.usb_enable: lock usb_enable_lock mutex
[00:00:00.004,272] <dbg> usb_device.composite_setup_ep_cb: set cb, ep: 0x81
[00:00:00.004,272] <dbg> usb_device.composite_setup_ep_cb: set cb, ep: 0x1
[00:00:00.004,302] <dbg> usb_device.composite_setup_ep_cb: set cb, ep: 0x82
[00:00:00.004,302] <dbg> usb_device.usb_enable: unlock usb_enable_lock mutex
[00:00:00.005,218] <dbg> usb_bluetooth.bluetooth_status_cb: USB device connected
[00:00:00.008,331] <dbg> usb_bluetooth.bluetooth_status_cb: USB device suspended
[00:00:00.107,452] <dbg> usb_bluetooth.bluetooth_status_cb: USB device resumed
[00:00:00.107,482] <dbg> usb_bluetooth.bluetooth_status_cb: USB device reset detected
[00:00:00.155,090] <dbg> usb_device.usb_handle_control_transfer: ep 0x00, status 0x00
[00:00:00.155,120] <dbg> usb_device.custom_handler: bRequest 0x6, wIndex 0x0
[00:00:00.155,120] <dbg> usb_device.usb_handle_std_device_req: REQ_GET_DESCRIPTOR
[00:00:00.155,212] <dbg> usb_device.usb_handle_control_transfer: ep 0x80, status 0x02
--- 18 messages dropped ---
[00:00:00.216,217] <dbg> usb_device.custom_handler: bRequest 0x6, wIndex 0x409
[00:00:00.216,217] <dbg> usb_device.usb_handle_std_device_req: REQ_GET_DESCRIPTOR
[00:00:00.216,308] <dbg> usb_device.usb_handle_control_transfer: ep 0x80, status 0x02
[00:00:00.216,430] <dbg> usb_device.usb_handle_control_transfer: ep 0x00, status 0x00
[00:00:00.216,461] <dbg> usb_device.custom_handler: bRequest 0x6, wIndex 0x0
[00:00:00.216,461] <dbg> usb_device.usb_handle_std_device_req: REQ_GET_DESCRIPTOR
[00:00:00.216,491] <dbg> usb_device.usb_get_descriptor: Desc 600 not found!
[00:00:00.216,491] <dbg> usb_device.usb_handle_request: Handler Error 0
[00:00:00.216,491] <dbg> usb_device.usb_print_setup: Setup: 80 6 600 0 a
[00:00:00.216,491] <dbg> usb_device.usb_handle_control_transfer: usb_handle_request failed
[00:00:00.217,346] <dbg> usb_device.usb_handle_control_transfer: ep 0x00, status 0x00
[00:00:00.217,407] <dbg> usb_device.custom_handler: bRequest 0x6, wIndex 0x0
[00:00:00.217,407] <dbg> usb_device.usb_handle_std_device_req: REQ_GET_DESCRIPTOR
[00:00:00.217,559] <dbg> usb_device.usb_handle_control_transfer: ep 0x80, status 0x02
[00:00:00.217,651] <dbg> usb_device.usb_handle_control_transfer: ep 0x00, status 0x00
[00:00:00.217,712] <dbg> usb_device.custom_handler: bRequest 0x6, wIndex 0x0
[00:00:00.217,712] <dbg> usb_device.usb_handle_std_device_req: REQ_GET_DESCRIPTOR
[00:00:00.217,834] <dbg> usb_device.usb_handle_control_transfer: ep 0x80, status 0x02
[00:00:00.217,987] <dbg> usb_device.usb_handle_control_transfer: ep 0x00, status 0x00
[00:00:00.218,017] <dbg> usb_device.custom_handler: bRequest 0x6, wIndex 0x409
[00:00:00.218,048] <dbg> usb_device.usb_handle_std_device_req: REQ_GET_DESCRIPTOR
[00:00:00.218,200] <dbg> usb_device.usb_handle_control_transfer: ep 0x80, status 0x02
[00:00:00.218,353] <dbg> usb_device.usb_handle_control_transfer: ep 0x00, status 0x00
[00:00:00.218,414] <dbg> usb_device.custom_handler: bRequest 0x6, wIndex 0x409
[00:00:00.218,414] <dbg> usb_device.usb_handle_std_device_req: REQ_GET_DESCRIPTOR
[00:00:00.218,536] <dbg> usb_device.usb_handle_control_transfer: ep 0x80, status 0x02
[00:00:00.218,688] <dbg> usb_device.usb_handle_control_transfer: ep 0x00, status 0x00
[00:00:00.218,750] <dbg> usb_device.custom_handler: bRequest 0x6, wIndex 0x409
[00:00:00.218,750] <dbg> usb_device.usb_handle_std_device_req: REQ_GET_DESCRIPTOR
[00:00:00.218,933] <dbg> usb_device.usb_handle_control_transfer: ep 0x80, status 0x02
[00:00:00.224,456] <dbg> usb_bluetooth.bluetooth_status_cb: USB device suspended
Hopefully you don’t need the dropped messages…
Lawrence King
Principal Developer
+1(416)627-7302
From: eobalski <notifications@github.com>
Sent: Tuesday, March 31, 2020 9:18 AM
To: zephyrproject-rtos/zephyr <zephyr@noreply.github.com>
Cc: Lawrence King <lawrence.king@irdeto.com>; Author <author@noreply.github.com>
Subject: Re: [zephyrproject-rtos/zephyr] sample hci_usb fails with zephyr 2.2.0 (worked with zephyr 2.1.0) (#23866)
Yes, I am using USB hub, this should work without any difference. Ok, from log's I can tell that the USB HW on nrf was successfully powered on, otherwise You would see
Failed to enable USB
I've edited the comment in regards of additional logs. Could You please try to add:
CONFIG_LOG=y
CONFIG_USB_DEVICE_LOG_LEVEL_DBG=y
to the samples prj.conf and see the log output? Previously I forgot to add the CONFIG_LOG (sorry about that) line that's why it does not outputs anything more despite this:
*** Booting Zephyr OS build zephyr-v2.2.0 ***
Bluetooth over USB sample
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub<#23866 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AOG3YIBRFYZXILST22ZH2NDRKHUQZANCNFSM4LVBPLCA>.
|
I don't know how I got this closed. Oops... |
@lawrence-king I think we need to separate two things here: I just tested both Zephyr 2.1.0 and 2.2.0 with the following results:
That's because I already have a Bluetooth adapter in my Windows machine, and it doesn't support two active.
My suspicion here is that Windows 10 does not like single-mode adapters, and probably requires a dual-mode one. On Linux: Works fine out of the box:
|
When you say "works correctly on Windows" what do you mean exactly? You can actually use it with the Windows built-in Bluetooth stack? Because I just tried that and it doesn't seem to work. |
I use the exact same setup except I use VMWare Workstation and I do not have the same problem. From VirtualBox or VMWare you can select explicitly where a USB device is to be connected: and then: |
In my setup (Win10/VirtualBox/Linux) I can use the v2.1.0 hci_usb adapter from the Linux VM to successfully do over the air updates to a nrf52840 based Zephyr board. With Zephyr v2.2.0 I am unable to connect the usb_hci adapter to the Linux VM, and Win10 gives the same error 10 you are seeing. The BT adapter is not visible to VirtualBox. VirtualBox has similar settings to the ones you are showing for VMWare. My laptop (Lenovo T480s) has a built-in BT adapter, it is up and running all the time, I don't need to disable it. Turning off the built-in adapter makes no difference (other than my external mouse and keyboard stops working) If there is anything else I can try to help resolve this, please let me know. |
Right, but when you plug in a v2.1.0 hci_usb adapter and don't direct it to the VM, what do you see in Device Manager? I see the following: Which basically means that Windows cannot use it anyway. I just want to make sure that with v2.1.0, when it works in your Linux VM, Windows does not however know how to use it.
That is very strange. If Windows sees it then I do not understand why VirtualBox doesn't. VirtualBox and VMWare intercept the device very low in the USB stack, so the fact that Windows doesn't know what to do with a particular device should have nothing to do with the VM being able to use it or know. i.e. a device for which you have no driver on Windows should still work fine when redirected to the VM if Linux supports it. |
With Zephyr v2.2.0 I see exactly what you see With Zephyr v2.1.0 I see this: of course windows then blue-screens If I actually try to use the device, but it is in good enough shape that Windows is happy to hand it over to VirtualBox/Linux where it works great. Here is the Log from the v2.1.0 device as it starts up, windows probes it, hands it over to VirtualBox and Linux starts it up. |
OK, I am puzzled because even with zephyr v2.1.0 I see the same error on my side, whereas as you say in your case it actually manages to start up the controller, which contradicts my theory about it being single mode preventing Windows from using it, and also not sure why it doesn't fail given that you already have a Bluetooth adapter and a second one should fail.
Can you tell me how exactly you are sharing the device between Windows and VirtualBox? On VMWare there are two ways of doing that: This is not a good idea at all because then VMWare inserts itself at the HCI level and complicates things quite a bit
This removes the device from Windows completely and lets Linux take full control. This should work regardless of whether the device has been correctly configured by Windows or not (i.e. even with the failure I see in Device Manager I am still able to use this option to redirect the device to the VM and use it there without problems). If you are using something similar to 1. please try 2. instead. |
@lawrence-king I just investigated a bit with @anangl who uses VirtualBox as well, he uses VirtualBox 6.0.18. We tested the hci_usb sample in Zephyr 2.1.0. |
Hi Charles: In VirtualBox I am taking the whole device, not trying to share. I had tried sharing the BT adapter that is built into the machine (an Intel BT chip) but I was unable to do the one thing I wanted which was push new OTA images to my Zephyr devices. So I took an MDK, built the Zephyr v2.1.0 hci-usb image, loaded it onto a nfr52840_mdk board and it worked perfectly. My coworker who uses a MAC did the same thing and we are both capable of downloading images to the systems. All was great, I was happy. (I haven't checked with my co-worker to see if v2.2.0 works on a MAC). Then I upgraded my product to v2.2.0 and repeated all of the steps for building my app (made changes for the GPIO APIs), and went to test the OTA feature. This is where I ran into trouble and reported a bug. I have a work around, I will leave the update dongle at v2.1.0 so this isn't a show stopper for me. My other than this my product works great with Zephyr v2.2.0. Thanks to the entire Zephyr team for a great product. However it seems to me that if the hci_usb sample is truly a "Generic Bluetooth Dongle" it should work under Windows, not just Linux. I may well change over to VMWare, but this is just a different workaround for the underlying problem. |
hci_usb really is not a "Generic Bluetooth Dongle" because Generic Bluetooth dongles always support dual-mode (BR/EDR + BLE), whereas hci_usb only supports BLE. The whole point is that I see no issue with VMWare doing exactly what you are doing: virtualizing the dongle and using it from the VM, so the fact that it works with another virtualization solution makes me think this is actually an issue with VirtualBox and not with hci_usb. The fact that it works for you with VB on 2.1.0 might be due to some circumstances that cannot be replicated by us (as I said, I tried VB today with no success on both 2.1.0 and 2.2.0). |
Reverting 281c7cb seems to fix the problem according to @lawrence-king, but that is very confusing because |
Closing since this is currently only attributable to VirtualBox, and not Zephyr itself. |
I'd like to add here, that I'm also experiencing strange non-working behaviour when passing-through my nrf52840 USB dongle running zephyr into a qemu/KVM virtual-machine (running linux, same debian version as hypervisor). dmesg on hypervisor says:
lsusb on VM says:
|
Describe the bug
The sample zephyrproject/zephyr/samples/bluetooth/hci_usb/ fails to operate as expected when built with Zephyr v2.2.0. It works exactly as expected when built with Zephyr v2.1.0.
To Reproduce
Steps to reproduce the behaviour:
Can't get device info: No such device
Expected behavior
The hciconfig command should complete without an error message. When the same sample is built with Zephyr v2.1.0 it works as hci0 perfectly. To test this, repeat the above steps except checkout v2.1.0.
Impact
I have not yet tested my other Bluetooth code using kernel v2.2.0, but the fact that a 'simple' sample doesn't work makes me nervous.
Screenshots or console output
Environment (please complete the following information):
note the v2.1.0 hci_usb works correctly on both Windows and linux.
The v2.2.0 hci_usb does not work on either Windows or Linux. On Windows the error is:
although I have no idea what code 10 means.
Additional context
The text was updated successfully, but these errors were encountered: