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?

Parents
  • Hi June, 

    You can have a look at this case: https://devzone.nordicsemi.com/f/nordic-q-a/35431/dfu-over-ble-and-usb

    I have an example for SDK v15.2 there. To find how to enter DFU bootloader mode from application, please study the ble_app_buttonless_dfu example. Check function enter_bootloader() and then ble_dfu_buttonless_bootloader_start_prepare(). The GPREGRET register is written before the application reset and enter bootloader. 

  • Hi Hung Bui,

    I have added the serial_dfu code with reference to this routine, and now I have a few questions:

    1、Does uart need flow control during serial dfu? I am currently turning off serial port flow control because my hardware does not have two pins for flow control

    2、In normal application operation, in addition to the buttonless method, I can also enter the upgrade mode by pressing the button. After pressing the button, I performed the following operations:

    err_code = sd_power_gpregret_clr(0, 0xffffffff);
    VERIFY_SUCCESS(err_code);
    
    err_code = sd_power_gpregret_set(0, BOOTLOADER_DFU_START);
    VERIFY_SUCCESS(err_code);
    
    // Signal that DFU mode is to be enter to the power management module
    nrf_pwr_mgmt_shutdown(NRF_PWR_MGMT_SHUTDOWN_GOTO_DFU);

    Is this correct?

    3、After entering the upgrade mode, what nrfutil command is used to upgrade the zip package into the chip?

  • Hi Hung Bui,

    When the hardware enters dfu mode and executes the 

    nrfutil dfu serial -pkg production_DFU.zip -p COM13
      command, serial_dfu still does not work.

    The following is the error result returned

    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

  • 1. I have ensured that the pc-nrfutil-master version is the latest (6.0.1)
    2. The serial port baud rate has been changed to 9600, HWFC false
    3. I also tried to change dfu_transport_serial.py in pc-nrfutil-master \ nordicsemi \ dfu. The changes made are as follows

    DEFAULT_BAUD_RATE = 9600
    DEFAULT_FLOW_CONTROL = False

    And executed 

    python setup.py build
    and reinstalled 
    python setup.py install

Reply
  • 1. I have ensured that the pc-nrfutil-master version is the latest (6.0.1)
    2. The serial port baud rate has been changed to 9600, HWFC false
    3. I also tried to change dfu_transport_serial.py in pc-nrfutil-master \ nordicsemi \ dfu. The changes made are as follows

    DEFAULT_BAUD_RATE = 9600
    DEFAULT_FLOW_CONTROL = False

    And executed 

    python setup.py build
    and reinstalled 
    python setup.py install

Children
No Data
Related