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

Entering DFU mode switches port number

When switching the dongle into DFU mode, it changes the serial port number when running in windows. 

Both the bootloader and the application sets up the USB and calls the app_usbd_serial_num_generate();

As I read the doc I expected the usb to keep its port number when going into dfu mode. Is this a windows 

feature or am I doing something wrong ? 

/Jimmy

Parents
  • Hi Jimmy, 

    the bootloader and the application is using different vendor ID (VID) and Product ID(PID), so Windows will enumerate them as different COM ports. This is done by design by Noridc so that the nRF Connect apps can differentiate between devices in bootloader mode and say the nRF Connectivity FW.

    Best regards

    Bjørn

  • Can I load the sample bootloader on to the nRF52840 Dongle nRF5_SDK\examples\dfu\secure_bootloader\pca10056_usb

    with out changes ore are there any changes needed ? 

    Guessing the board type needs to change from BOARD_10056 to BOARD_10059 any thing else ? 

  • Hi Jimmy, 

    No, I do not think you should need to make any other changes than changing the board file. Note the example uses a Debug public key, so if you want to test DFU with  your own images you need to generate a new private and public key, replace the public key to the example and then create signed firmware images, see the Testing section in the docs. 

    Best regards

    Bjørn

  • I built the secure bootsample with the board type changed and added my own public key then run the following:

    ```

    nrfutil pkg generate --hw-version 52 --sd-req 0 --application-version 4 --application ./ZigBee/nRF52840/pca10059/mbr/ses/Output/Release/Exe/test_zigbee_coordinator_pca10059.hex --key-file ./SecureBootloader/test_nordic_bootloader_priv.pem --app-boot-validation VALIDATE_GENERATED_SHA256 test_usb_fw.zip

    nrfutil pkg generate --hw-version 52 --sd-req 0 --bootloader-version 2 --bootloader ./SecureBootloader/pca10056_usb/ses/Output/Release/Exe/test_secure_bootloader_usb_mbr_pca10056.hex --key-file ./SecureBootloader/test_nordic_bootloader_priv.pem --app-boot-validation VALIDATE_GENERATED_SHA256 test_bootloader_usb_fw.zip

    nrfutil settings generate --family NRF52840 --application ./ZigBee/nRF52840/pca10059/mbr/ses/Output/Release/Exe/test_zigbee_coordinator_pca10059.hex  --application-version 3 --bootloader-version 2 --bl-settings-version 2 --app-boot-validation VALIDATE_GENERATED_SHA256 --key-file ./SecureBootloader/test_nordic_bootloader_priv.pem bootload_setting.hex

    ```

    How do I get the bootloader_setting.hex on to the nrf 52840 Dongel ? the documentation refers to nrfproj but that only works if I have a debugger. 

    This is what I get if I ignore the settings file and flash the file directly.

    ```

    nrfutil dfu usb-serial -pkg ./test_bootloader_usb_fw.zip -p /dev/ttyS11
    2019-02-22 09:32:41,671 Using board at serial port: /dev/ttyS11
    Traceback (most recent call last):
      File "/usr/local/bin/nrfutil", line 11, in <module>
        load_entry_point('nrfutil==5.0.0', 'console_scripts', 'nrfutil')()
      File "/home/kappen/.local/lib/python2.7/site-packages/click/core.py", line 764, in __call__
        return self.main(*args, **kwargs)
      File "/home/kappen/.local/lib/python2.7/site-packages/click/core.py", line 717, in main
        rv = self.invoke(ctx)
      File "/home/kappen/.local/lib/python2.7/site-packages/click/core.py", line 1137, in invoke
        return _process_result(sub_ctx.command.invoke(sub_ctx))
      File "/home/kappen/.local/lib/python2.7/site-packages/click/core.py", line 1137, in invoke
        return _process_result(sub_ctx.command.invoke(sub_ctx))
      File "/home/kappen/.local/lib/python2.7/site-packages/click/core.py", line 956, in invoke
        return ctx.invoke(self.callback, **ctx.params)
      File "/home/kappen/.local/lib/python2.7/site-packages/click/core.py", line 555, in invoke
        return callback(*args, **kwargs)
      File "/usr/local/lib/python2.7/dist-packages/nrfutil-5.0.0-py2.7.egg/nordicsemi/__main__.py", line 989, in usb_serial
        do_serial(package, port, connect_delay, flow_control, packet_receipt_notification, baud_rate, serial_number, False)
      File "/usr/local/lib/python2.7/dist-packages/nrfutil-5.0.0-py2.7.egg/nordicsemi/__main__.py", line 952, in do_serial
        dfu.dfu_send_images()
      File "/usr/local/lib/python2.7/dist-packages/nrfutil-5.0.0-py2.7.egg/nordicsemi/dfu/dfu.py", line 125, in dfu_send_images
        self._dfu_send_image(self.manifest.bootloader)
      File "/usr/local/lib/python2.7/dist-packages/nrfutil-5.0.0-py2.7.egg/nordicsemi/dfu/dfu.py", line 97, in _dfu_send_image
        self.dfu_transport.send_init_packet(data)
      File "/usr/local/lib/python2.7/dist-packages/nrfutil-5.0.0-py2.7.egg/nordicsemi/dfu/dfu_transport_serial.py", line 256, in send_init_packet
        self.__execute()
      File "/usr/local/lib/python2.7/dist-packages/nrfutil-5.0.0-py2.7.egg/nordicsemi/dfu/dfu_transport_serial.py", line 416, in __execute
        self.__get_response(DfuTransportSerial.OP_CODE['Execute'])
      File "/usr/local/lib/python2.7/dist-packages/nrfutil-5.0.0-py2.7.egg/nordicsemi/dfu/dfu_transport_serial.py", line 500, in __get_response
        get_dict_key(DfuTransport.RES_CODE, resp[2])))
    pc_ble_driver_py.exceptions.NordicSemiException: Response Code InvalidObject

    ```

    Flashing thrue nRF Connect gives error message

    DFU failed: Error message for known extended error code for DFU target: The init packet does not contain a signature. This bootloader requires DFU updates to be signed.

  • Hi Jimmy, 

    the nRF52840 Dongle is preprogrammed with the Open Bootloader with DFU example, which requires a signed image 

    The private key that the public key in the preprogrammed Open Bootloader on the dongle is not distributed. So in order to update the bootloader on the nRF52840 Dongle you actually do need a programmer. 

    Best regards

    Bjørn

Reply Children
Related