This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

UART DFU hangs on Windows only for Application + Softdevice + Bootloader package

Hello,

I've build a small utility around https://github.com/NordicSemiconductor/pc-nrfutil which pretty much exposes some arguments and forces the device to update to enter bootloader. Very simple stuff around calling this and passing over to pc-nrfutil library

    if flow_control is None:
        flow_control = DfuTransportSerial.DEFAULT_FLOW_CONTROL
    if packet_receipt_notification is None:
        packet_receipt_notification = DfuTransportSerial.DEFAULT_PRN
    if baud_rate is None:
        baud_rate = DfuTransportSerial.DEFAULT_BAUD_RATE
    if ping is None:
        ping = False

    def update_progress(progress=0):
        global bytes_transferred, bytes_total
        bytes_transferred += progress
        if update_progress_fn != None:
            update_progress_fn(progress, bytes_transferred, bytes_total)

    logger.info("Using board at serial port: {}".format(port))
    serial_backend = DfuTransportSerial(com_port=str(port), baud_rate=baud_rate,
                    flow_control=flow_control, prn=packet_receipt_notification, do_ping=ping)
    serial_backend.register_events_callback(DfuEvent.PROGRESS_EVENT, update_progress)
    dfu = Dfu(zip_file_path = package, dfu_transport = serial_backend, connect_delay = connect_delay)

    bytes_total = dfu.dfu_get_total_size()
    update_start_fn(bytes_total)
    dfu.dfu_send_images()

Later the app is bundled into an Linux, OSX, Windows executables with pyinstaller. Generally everything works flawlessly since a few versions of  pc-nrfutil and so is the case for pc-nrfutil 6.1.0 for Linux and OSX... Not for windows though and not when the .zip packge to do DFU contains application + bootloader + softdevice. In such case, and only on windows, the process of updating freezes indefinitely after sending the SoftDevice+Bootloader image, sending application image never starts and the process is haniging there until cable is disconnected. The output from nrfutil library is the following

2020-07-29 13:42:39 LAPTOP-123 dfu[2856] INFO Using board at serial port: COM5
Starting DFU. Do not disconnect the device until it update is finished.
  0%|                                                                                                        | 0/284988 [00:00<?, ?b/s]2020-07-29 13:42:39 LAPTOP-123 nordicsemi.dfu.dfu[2856] INFO Sending SoftDevice+Bootloader image.
2020-07-29 13:43:12 LAPTOP-123 nordicsemi.dfu.dfu[2856] INFO Sending init packet...
2020-07-29 13:43:13 LAPTOP-123 nordicsemi.dfu.dfu[2856] INFO Sending firmware file...
 57%|##################################################3                                      | 161324/284988 [00:52<00:21, 5810.60b/s]2020-07-29 13:43:31 LAPTOP-123 nordicsemi.dfu.dfu[2856] INFO Image sent in 18.89273977279663s
2020-07-29 13:43:31 LAPTOP-123 nordicsemi.dfu.dfu[2856] INFO Sending Application image.

And it stays like that for minutes, i think i stopped it after 20min.

The issue doesn't always repeat and it might work or might fail without any repeatability. Happens only on Windows on multiple PC's, cables & devices. OSX and Linux works fine. Since the DFU package is always the same and tested i doubt that it has anything to do with the platform on which DFU is performed on.

Does someone maybe have an idea what to look for? The windows machine is pretty much clean, not much software installed except the necessary ones to work with Python and build the application built around pc-nrfutil so theres a low chance of some other utilities interfering with the USB-UART connection.

Parents Reply Children
No Data
Related