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

How to add buttonless_dfu and serial_dfu functions at the same time.

Now the code in the application part has added the buttonless_dfu function, which has also been successfully implemented. But I ’m not familiar with serial_dfu, I don’t know how to continue to add serial_dfu function. And how to achieve coexistence of ble_dfu and serial_dfu in bootload code?

  • I just turned off HWFC, reduced the baud rate to 9600 and changed the baud rate in dfu_transport_serial.py and closed HWFC in pc-nrfutil-master \ nordicsemi \ dfu. Specific modifications are mentioned in detail above. Are there any errors in the changes I made?

  • When I used MSDDisable in JLink Commander to try to disable the mass storage device in the onboard debugger and reconnect the hardware, I noticed that the COM port has been changed to another one compared to before. At this time, under the premise of a baud rate of 9600, whether or not HWFC is used, everything is normal. When using HWFC and a baud rate of 115200, everything is normal.

  • But in the Ble_DFU and Serial_DFU fusion bootloader, Serial DFU will fail, no matter how much the baud rate value is selected, whether to use HWFC.

    The error message is as follows

    Traceback (most recent call last):
      File "D:\Application\Python38\Scripts\nrfutil-script.py", line 11, in <module>
        load_entry_point('nrfutil==6.0.1', 'console_scripts', 'nrfutil')()
      File "D:\Application\Python38\lib\site-packages\click-7.1.1-py3.8.egg\click\core.py", line 829, in __call__
        return self.main(*args, **kwargs)
      File "D:\Application\Python38\lib\site-packages\click-7.1.1-py3.8.egg\click\core.py", line 782, in main
        rv = self.invoke(ctx)
      File "D:\Application\Python38\lib\site-packages\click-7.1.1-py3.8.egg\click\core.py", line 1259, in invoke
        return _process_result(sub_ctx.command.invoke(sub_ctx))
      File "D:\Application\Python38\lib\site-packages\click-7.1.1-py3.8.egg\click\core.py", line 1259, in invoke
        return _process_result(sub_ctx.command.invoke(sub_ctx))
      File "D:\Application\Python38\lib\site-packages\click-7.1.1-py3.8.egg\click\core.py", line 1066, in invoke
        return ctx.invoke(self.callback, **ctx.params)
      File "D:\Application\Python38\lib\site-packages\click-7.1.1-py3.8.egg\click\core.py", line 610, in invoke
        return callback(*args, **kwargs)
      File "D:\Application\Python38\lib\site-packages\nrfutil-6.0.1-py3.8.egg\nordicsemi\__main__.py", line 1055, in serial
        do_serial(package, port, connect_delay, flow_control, packet_receipt_notification, baud_rate, serial_number, True,
      File "D:\Application\Python38\lib\site-packages\nrfutil-6.0.1-py3.8.egg\nordicsemi\__main__.py", line 970, in do_serial
        dfu.dfu_send_images()
      File "D:\Application\Python38\lib\site-packages\nrfutil-6.0.1-py3.8.egg\nordicsemi\dfu\dfu.py", line 127, in dfu_send_images
        self._dfu_send_image(self.manifest.application)
      File "D:\Application\Python38\lib\site-packages\nrfutil-6.0.1-py3.8.egg\nordicsemi\dfu\dfu.py", line 88, in _dfu_send_image
        self.dfu_transport.open()
      File "D:\Application\Python38\lib\site-packages\nrfutil-6.0.1-py3.8.egg\nordicsemi\dfu\dfu_transport_serial.py", line 217, in open
        self.__get_mtu()
      File "D:\Application\Python38\lib\site-packages\nrfutil-6.0.1-py3.8.egg\nordicsemi\dfu\dfu_transport_serial.py", line 364, in __get_mtu
        response = self.__get_response(DfuTransportSerial.OP_CODE['GetSerialMTU'])
      File "D:\Application\Python38\lib\site-packages\nrfutil-6.0.1-py3.8.egg\nordicsemi\dfu\dfu_transport_serial.py", line 504, in __get_response
        raise NordicSemiException('Response Code {}'.format(
    pc_ble_driver_py.exceptions.NordicSemiException: Response Code NotSupported

  • Hi June, 

    Could you test with a fresh copy of SDK v15.2  ? 
    You don't really need to modify the nrfutil, but can use the parameter when doing nrfutil dfu serial ... to select the flow control and data rate. 
    I just did a test here and it worked fine for me. 
    If you have the same UART pin as on the DK. You can try to test using the following bootloader hex file and .zip file. 

    bootloader.hex

    app_dfu_package.zip

    If you still having issue, please capture the RTT log (using RTT viewer)  and send us. 

  • Hi Hung,

    Yes, I also realized that select the flow control and data rate are possible when using nrfutil dfu serial ...  So I didn‘t modify nrfutil anymore.  

    Then refer to your routine, add serial_dfu to ble_dfu based on SDK 15.3.

    Maybe I didn't notice some details. Now it's more than 9pm here.

    Wait until tomorrow I will try it with your program.

    I will contact you if there is any problem.

Related