-
Notifications
You must be signed in to change notification settings - Fork 26
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
DFU trigger interface not recognized in composite device. #116
Comments
Hi @markrages , I am not up to date with the SDK, but I don't see that nrf_dfu_trigger_usb_init() call which should happen right after app_usbd_init(). Also change NRF_DFU_TRIGGER_USB_INTERFACE_NUM to 0, just to be sure. The nRFConnect ecosystem is strict in its expectation about the USB VID/PID and interface order for a good reason (mostly because of windows drivers...) and this is not a concern for the SDK examples. If this doesn't work, please send the complete |
@bencefr OK, I did that, but no change. When I click on the device it puts this message in the error log: I am using the PID/VID unchanged from the cdc_acm demo: Here is the output of |
Please also try to change the USB product ID to: Have you also used this package or its rules? https://github.com/NordicSemiconductor/nrf-udev |
@markrages , I also found that you need to set the CDC_ACM*INTERFACE numbers to 1 higher in nrf_main.c, since the 0th interface is now the trigger. With this setup it works for me, however I still find the behaviour of Programmer app a bit of hit and miss, at least you can reload and try again. |
Ah, in
So if I increase the CDC_ACM*INTERFACE numbers, I should set this to This fixes the error I noted above. Now nRF Connect Programmer finds the device, but has an error after programming it. Here is the output of |
According to
|
One more data point: If I comment out this line:
Then the composite device is just one serial port and the DFU trigger interface, and it works 100% reliably in nRF Connect. It also works if I comment the other class_append. It appears that having two serial ports is the issue. |
OK, not quite 100%. The following sequence triggers an error:
This gives error Full log: 2019-03-28T17_52_22.136Z-log.txt |
I have found a few more things in the firmware code that should be changed for the 59 device: In sdk_config.h please change the power configuration:
This changes the lsusb output Self powered to Bus powered. In nrf_main.c add these functions:
And invoke them just before nrf_drv_clock_init() like this:
Now you need to know that I am not an embedded developer, so I don't understand these functions. Once upon a time I hunted these in order to make the RSSI reference application work with the dongle, which has the firmware source here: https://github.com/NordicSemiconductor/pc-nrfconnect-rssi/tree/master/fw/src/rssi_cdc_acm I know that on Windows modified code works quite well, however it does produce the LIBUSB error after resetting to application mode, since the Windows driver bundled by nRFConnect maps only 1 serialport to libusb, so the 2nd will trigger this issue. I also suggest to use the dongle in the RSSI app, which will load the RSSI fw on it, and you can compare the expected libusb output. |
I believe the voltage is good because the dongle would not work as a debugger otherwise: it has no other power source.
I believe the reset is good because |
Updated |
Can you point me to some documentation for this? I am not very familiar with libusb. |
Libusb is a cross platform library that provides a generic access to USB devices. Since nRFConnect aims to be cross platform, it was a natural choice to use. On Linux and macOS it works out of the box, but on Windows it requires libusb enabled filter drivers, and because of the nature of Windows drivers every device with a specific VID/PID and interface layout needs to have some .inf file that tells the OS which driver to use. |
I consider this issue solved, feel free to reopen if needed. |
The issue is not solved. Triggering still doesn't work when there are two serial ports. (I am not allowed to reopen this issue) |
@markrages , do you use Linux in a virtual box/vmware or something similar? |
No, just plain Linux. |
Since I am not able to reproduce the issue with or without your firmware, I must ask further details. Do you use USB hub or chain of hubs? The enumeration by nRFConnect depends on both USB and serialport enumeration and I recall seeing the latter not reporting serial numbers in some cases. This might be due to timing. I just installed a clean Ubuntu 18.04 LTS on a fairly low spec and old notebook. By dmesg device reconnection on this setup happens in less than 500 ms, and even seems to be faster via a powered hub. Also for the record, please describe your system/distribution/versions... |
I have tried two systems. System #1 is a Lenovo T450s laptop. There are no hubs or other USB devices. The dongle is plugged into the side.
System #2 is a Dell desktop of 2014 vintage. The dongle is plugged into a USB hub with many other devices.
|
Background
Here is a hex file compiled from https://github.com/markrages/blackmagic/tree/nRF52840/src/platforms/nRF52840 :
blackmagic_example.zip (hexfile zipped for Gihub reasons -- this is not a DFU package zip.)
The firmware presents two CDC_ACM serial ports and the DFU Trigger interface as a USB composite device. It is compiled for nRF52840 Dongle (PCA10059)
When I load the hex file with nRF Connect, it works, and allows me to debug other targets using the nRF52840 Dongle.
Bug description
After the file is loaded, the trigger interface is not recognized by nRF Connect Programmer:
What I would expect
nRF Connect Programmer should see the DFU trigger interface and not require the reset button to be pressed on the nRF52840 Dongle.
More information
Partial
lsusb -v
output:nrfutil dfu
works. Theusbdfu
target in https://github.com/markrages/blackmagic/blob/nRF52840/Makefile will reload the firmware over DFU, without requiring to press the reset button on the Dongle.The text was updated successfully, but these errors were encountered: