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

Upload application via BLE

Hi, I'm trying to create a PC Python script that upload an application on NRF52 via BLE.

I flashed the NRF52 with this S132/DFU/Application: nRF5_SDK_11.0.0_89a8197/examples/ble_peripheral/ble_app_hrs/pca10040/s132_with_dfu. (Application with DFU service)

I created a zip file that contains my application (a simple blink)app_blink_package1.zip

I tried the zip file using the Android App NRFToolbox and it works.

Now I want to upload the hex file nrf52832_xxaa_s132_blinky_500.hex (the same of the zip file) with the PC and BlueZ gatttool using this python script dfu_debug.py

But I can't switch to DFU mode using Gatttool.

I'm following this guide: https://infocenter.nordicsemi.com/index.jsp?topic=%2Fcom.nordic.infocenter.sdk52.v0.9.2%2Fbledfu_appswitching.html but I don't understand what is the command for this operation: "Next, you must write the value 01-XX (where XX is the code for the type of image, see DFU Control Point) to the DFU Control Point to start a DFU procedure" In the Android App NRFToolBox I saw this message on the logcat: (Sending Start DFU command (Op Code = 1, Upload Mode = 4) but I can't recreate it with gatttool.

I'm using this command to enable cccd: char-write-req 0x11 0100 but it replies fail

I tried also nRF5_SDK_11.0.0_89a8197/examples/dfu/bootloader/pca10040/dual_bank_ble_s132/armgcc that is only the DFU. In this way gatttool (via dfu_debug.py above) returns OK for each command, except for the last commands after sending the image file, and at the end of the procedure the application doesn't work. Here the log: log_blink.txt

Where is my mistake? Thanks.

Parents Reply
  • OK, looking the log from the Android nrfToolBox I modified my script in this way:

    • I read the DFU version with the command char-read-uuid 00001534-1212-efde-1523-785feabcd123. If the response is 01 00 the nrf52 has an application with DFU Service, if the response is 08 00 the nrf52 is already in DFU mode and you need to follow the DFU mode procedure.
    • Read the handles of UUID 0x2902, it replies in my case with handle 0x0b and 0x14.
    • Read the handles of UUID 00001531-1212-efde-1523-785feabcd123, it replies 0x13
    • Write the command char-write-req 0x14 01 to enable notifications
    • Write the command char-write-req 0x13 0104 to go in DFU mode (04 says that I want to upload an application)
    • Reconnect the board and follow the same procedure for DFU mode, I'll upload the new version to my github: github.com/.../ota-dfu-python
Children
No Data
Related