-
Notifications
You must be signed in to change notification settings - Fork 21
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
Repeated connection to NRF52 fails with NrfError.rpc_h5_transport_state #75
Comments
Thanks for reporting, this is an issue I've known about for awhile but never formally opened a ticket for it. The issue is that when the device is closed, the micro is reset to ensure no more bluetooth activity after that point. With the USB-based firmware images, the USB device goes away completely and has to be re-enumerated before opening again, so a delay is needed between close and open. Using serial-based firmware images with the nordic dev kit don't seem to have this issue. The delay amount I found depends on the OS and other factors, so baking in a delay on either open or close is non-ideal and some form of retry mechanism is likely required. A simple workaround for now is to sleep between open and close which is what I do for my integrated tests here |
added a reconnect feature in open that also reruns __init__ added wait_for_nrf52_to_restart to prevent the use of long delays. The device is scanned with libusb added libusb to requirements
Hi, I implemented a possible fix for the issue. Its a retry loop with a scanner for the nrf52 dongle based on libusb to not use a long delay. If its ok I would create a pullrequest. Please let me know if you have any further suggestions. regards |
Hi |
Check my comment with #103 providing a script that may help improve the situation with the nRF52840-Dongle (PCA10059). Adjusted to the original example code in this #75 ticket, it would look like:
Still adding the requirement for pyserial 3.5 of course. The output on my Linux test machine with the nRF52840-Dongle looks like:
|
Script to reproduce the issue:
Second open() raises
pc_ble_driver_py.exceptions.NordicSemiException: Failed to open. Error code: NrfError.rpc_h5_transport_state
.Package versions:
NRF52 dongle firmare:
connectivity_4.1.2_usb_with_s132_5.1.0.hex
frompc-ble-driver-py
package.The text was updated successfully, but these errors were encountered: