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

Where is ble_dfu.py?

I found ble_dfu.py referenced in some posts to help automate the generation of an application.dat metadata file used (along with the application.hex file) to create the input to the DFU bootloader can use.

I can't seem to find it any more, however. Is there a place I can go to download it? GitHub? nordicsemi.com?

  • Really ? I can find it in all the SDKs I have on my machine

    find . -name ble_dfu.py -print
    ./nRF51_SDK_7.0.1/examples/dfu/ble_dfu_send_hex/dfu/ble_dfu.py
    ./nRF51_SDK_7.1.0/examples/dfu/ble_dfu_send_hex/dfu/ble_dfu.py  
    ./nRF51_SDK_7.2.0/examples/dfu/ble_dfu_send_hex/dfu/ble_dfu.py
    ./nrf51_sdk_v6_1_0_b2ec2e6/nrf51822/Board/nrf6310/device_firmware_updates/ble_dfu_send_hex/dfu/ble_dfu.py
    
  • The ble_dfu.py script you are referring to is the file in the SDK (as RK mentions)

    ./nRF51_SDK_7.2.0/examples/dfu/ble_dfu_send_hex/dfu/ble_dfu.py
    

    This is the same script that is used by Master Control Panel (Windows) to parse the hex file. However, what I think you are referring to is a modification to this script that saves the resulting .bin and .dat files to disk. This means that you can do a DFU through the windows version of MCP and then use the parsed files in the Android version of MCP, without having to go through the process of generating these files. (The generation process is described here: github.com/.../init packet handling)

    The modified ble_dfu.py file is posted in Stefans answer in this post. Under update 16.12.2014. Simply replace the ble_dfu.py file in MCP lib folder:

    \Nordic Semiconductor\Master Control Panel\3.7.1.8567\lib\dfu
    

    When you initiate a DFU through MCP an application.bin and an ini.dat file is saved to the root folder of MCP.

    The only thing that is added to the script are these lines:

    In _get_application_bin_array() :

    f = open("application.bin","wb+")
    f.write(bytearray(app_bin_array))
    f.close()
    

    And in dfu_send_image() :

    f = open("ini.dat","wb+")
    f.write(bytearray(init_packet))
    f.close()
    
  • Excellent. So it's in the SDK and NOT software delivered through a forum post such as this one, a Keil Software Pack, or through developer.nordicsemi.com, or nordicsemi.com, or GitHub.com. I hope that you can sympathize with how fragmented the delivery system/interface to nordic is, especially without any kind of support engineers in this region. A full search of my filesystem would also have helped, I agree.

  • It was in 7.1.0, but was removed in SDK 8.0.0.

    I hacked up the 7.1.0 version to add .zip file support, but was too lazy to add bonding support to it so it could do buttonless upgrades. I would have to manually put the device in bootloader and then use the python script to upload the firmware.

    The nice thing about ble_dfu_send_hex was with a few hacks it is significantly faster then the Android or iOS apps and would happily work with a 7.5ms connection interval.

Related