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

How to use only DFU and DFU_TRANSPORT without bootloader?

Hi,

I am using nRF52832 SOC along with SDK v15.2.0 with custom hardware, currently I have requirement to use DFU protocol in BLE application to get a FW of another sub system . I am trying to evaluate example codes provided in SDK, but most of the examples uses bootloader but actually I need only DFU and DFU_TRANSPORT, I want use DFU services within my ble application and use nrf DFU app to send subsystem FW. Is there is any possibility to use DFU and DFU_TRANSPORT without bootloader modules if there is any example code available in that use case. If any links or examples for that use case scenario would be appreciated.

Regards

Pradeep

Parents
  • Hi,

    Is the subsystem a different IC? I have made an example which uses the DFU modules in the application to receive the image. I think you can use this as a starting point, then implement your own code to transfer and active the image on subsystem (assuming it's external to the nRF). The example can be found here: https://devzone.nordicsemi.com/f/nordic-q-a/46994/background-dfu-application-source-code/187534#187534 

    Regards,

    Vidar

  • Hi  

    Thank you for prompt response,

    Is the subsystem a different IC?

    Yes its different IC, Our intention is to get image over BLE using DFU modules within BLE_APP FW and transmit to other IC over UART. Here we don't want to update FW of BLE_APP or SD or BL. 

    I trying to evaluate example provided as it is

    I tried to follow  the readme.docx at step 2. Run the “program_bl_sd_bl_settings” script to program the bootloader, Softdevice, and the bootloader settings which validates the application.

    I am getting following error while running program_bl_sd_bl_settings.bat 

    Note: The setup I'm using at my end

    1. Segger IDE

    2. Custom HW PCB based on Rigardo BMD 300 module.  

    3.Segger J-Link Debugger

    C:\Users\deepu\Desktop\nRF_SDK_15.3.0_background_dfu_3\examples\ble_peripheral\ble_app_hrs_w_serial_dfu>program_bl_sd_bl_settings.bat
    
    C:\Users\deepu\Desktop\nRF_SDK_15.3.0_background_dfu_3\examples\ble_peripheral\ble_app_hrs_w_serial_dfu>nrfutil settings generate --application pca10040\s132\ses\Output\Debug\Exe\ble_app_hrs_pca10040_s132.hex --family NRF52 --application-version 1 --bootloader-version 1 --bl-settings-version 2 settings.hex
    
    |===============================================================|
    |##      ##    ###    ########  ##    ## #### ##    ##  ######  |
    |##  ##  ##   ## ##   ##     ## ###   ##  ##  ###   ## ##    ## |
    |##  ##  ##  ##   ##  ##     ## ####  ##  ##  ####  ## ##       |
    |##  ##  ## ##     ## ########  ## ## ##  ##  ## ## ## ##   ####|
    |##  ##  ## ######### ##   ##   ##  ####  ##  ##  #### ##    ## |
    |##  ##  ## ##     ## ##    ##  ##   ###  ##  ##   ### ##    ## |
    | ###  ###  ##     ## ##     ## ##    ## #### ##    ##  ######  |
    |===============================================================|
    |You are generating a DFU settings page with backup page        |
    |included. This is only required for bootloaders from nRF SDK   |
    |15.1 and newer. If you want to skip backup page genetation,    |
    |use --no-backup option.                                        |
    |===============================================================|
    
    Traceback (most recent call last):
      File "nordicsemi\__main__.py", line 1133, in <module>
      File "site-packages\click\core.py", line 722, in __call__
      File "site-packages\click\core.py", line 697, in main
      File "site-packages\click\core.py", line 1066, in invoke
      File "site-packages\click\core.py", line 1066, in invoke
      File "site-packages\click\core.py", line 895, in invoke
      File "site-packages\click\core.py", line 535, in invoke
      File "nordicsemi\__main__.py", line 326, in generate
      File "nordicsemi\dfu\bl_dfu_sett.py", line 155, in generate
    pc_ble_driver_py.exceptions.NordicSemiException: Unknown bootloader settings version
    Failed to execute script __main__
    
    C:\Users\deepu\Desktop\nRF_SDK_15.3.0_background_dfu_3\examples\ble_peripheral\ble_app_hrs_w_serial_dfu>nrfjprog --program settings.hex --sectorerase -r
    ERROR: The --family option given with the command (or the default from nrfjprog.ini)
    ERROR: does not match the device connected.
    
    C:\Users\deepu\Desktop\nRF_SDK_15.3.0_background_dfu_3\examples\ble_peripheral\ble_app_hrs_w_serial_dfu>nrfjprog --program bootloader_hex/bootloader_w_softdevice.hex --sectorerase
    ERROR: The --family option given with the command (or the default from nrfjprog.ini)
    ERROR: does not match the device connected.
    
    C:\Users\deepu\Desktop\nRF_SDK_15.3.0_background_dfu_3\examples\ble_peripheral\ble_app_hrs_w_serial_dfu>

  • Hi,

    "pc_ble_driver_py.exceptions.NordicSemiException: Unknown bootloader settings version"

    I think it means that you have an older version of nrfutil. Try to update it through pip. We are currently on version 5.2.0, and you can check which you have installed by typing "nrfutil version".

    "C:\Users\deepu\Desktop\nRF_SDK_15.3.0_background_dfu_3\examples\ble_peripheral\ble_app_hrs_w_serial_dfu>nrfjprog --program settings.hex --sectorerase -r
    ERROR: The --family option given with the command (or the default from nrfjprog.ini)
    ERROR: does not match the device connected."

    Please try to specify the device family and make sure you are using a recent version of nrfjprog:

    >nrfjprog -f nrf52 --program settings.hex --sectorerase -r

Reply
  • Hi,

    "pc_ble_driver_py.exceptions.NordicSemiException: Unknown bootloader settings version"

    I think it means that you have an older version of nrfutil. Try to update it through pip. We are currently on version 5.2.0, and you can check which you have installed by typing "nrfutil version".

    "C:\Users\deepu\Desktop\nRF_SDK_15.3.0_background_dfu_3\examples\ble_peripheral\ble_app_hrs_w_serial_dfu>nrfjprog --program settings.hex --sectorerase -r
    ERROR: The --family option given with the command (or the default from nrfjprog.ini)
    ERROR: does not match the device connected."

    Please try to specify the device family and make sure you are using a recent version of nrfjprog:

    >nrfjprog -f nrf52 --program settings.hex --sectorerase -r

Children
  • Hi

    Thank for your reply, now I could able to flash ble_hrs_app firmware from nrf connect app.  

    But I am trying figure out where in code there is callback from dfu_transport can be given to application so that I can send FW image data to subsystem application  over UART but I am lost even after debugging couple times. 

    I would be very help if you could specify where I can call application for every for every FW image page received.

  • Hi,

    deepu301 said:
    But I am trying figure out where in code there is callback from dfu_transport can be given to application so that I can send FW image data to subsystem application  over UART but I am lost even after debugging couple times. 

    Do you have enough space in Bank 1 to store the entire image? Then you could wait for the NRF_DFU_EVT_DFU_COMPLETED before you transfer it to the subsystem. I think this approach will require fewer modifications of existing code. Size and address information of the image in bank 1 will be stored in the bootloader settings page. 

  • Hi  

    We don't enough space to store entire image it's a huge file of 300KB. So NRF_DFU_EVT_DFU_COMPLETED will not be that helpful but page by page callback  by nrf_transport would be useful so that I can store in RAM buffer and transfer over UART. 

    Is it possible with current nrf_transport module to achieve this, if not is there other way with minor modifications to  nrf_transport module

  • Hi,

    The default DFU handling is to store the image at bank 1, but it won't fit as you said. Maybe you can create a new nrf_dfu_flash implementation that emulates memory access to your subsystem. So instead of writing the image to bank 1 in internal flash, you write it directly to the external chip. 

    deepu301 said:
    We don't enough space to store entire image it's a huge file of 300KB. So NRF_DFU_EVT_DFU_COMPLETED will not be that helpful but page by page callback  by nrf_transport would be useful so that I can store in RAM buffer and transfer over UART. 

     It will require modification of the transport layer to trigger an event for this. You could monitor when the NRF_DFU_OP_OBJECT_EXECUTE command is sent for a data object.  

Related