How can I run the nrf52832 bluetooth mesh Device Firmware Upgrade example.

Hi Nordic,

 

I don’t know if the question I asked is stupid, but it does bother me for a long time.

Q1 - Can I use uart(serial) interface to update Firmware (including bootloader, software or application) for bluetooth mesh?

Q2 - How to make nrf52832 enter DFU mode without pressing button. For example, send an opcode to nrf52832 to let him enter DFU mode.

Q3 - Error of mesh DFU example.

In order to understand mesh DFU, I did this example "Configuring and performing DFU over Mesh", but I encountered the following problems during the step of "Transferring the DFU archive over serial with nRF Util"

Can you help me to solve this problem? 

 

Here are my steps, 

Among them, I skipped step 5 "Flash the first application on all devices" because I couldn't find the file build/examples/dfu/dfu_nrf52832_xxAA_s132_7.2.0.hex and I saw the instructions of Note, so I skipped this step, I don't know if there will be a problem.

### gen private key
leo@leo-work:~/Nordic_bluetooth_52832/nRF5-SDK-for-Mesh$ nrfutil keys --gen-key private_key.txt
leo@leo-work:~/Nordic_bluetooth_52832/nRF5-SDK-for-Mesh$ cat private_key.txt
-----BEGIN EC PRIVATE KEY-----
MHcCAQEEILXfxLpB931VNYw8nD3YTEKeucq0YMU4JyHUHWSGftTQoAoGCCqGSM49
AwEHoUQDQgAE+KhRYcdMjpsfdyYNo0c3rY4XxYj7YjQ9vlZTP2NAKauWj7YUU40Y
VriixdEk88IX78T0K9ZzRZ50JWFTfngp6A==
-----END EC PRIVATE KEY-----

### gen public key
leo@leo-work:~/Nordic_bluetooth_52832/nRF5-SDK-for-Mesh$ nrfutil keys --show-vk hex private_key.txt 
Verification key Qx: f8a85161c74c8e9b1f77260da34737ad8e17c588fb62343dbe56533f634029ab
Verification key Qy: 968fb614538d1856b8a2c5d124f3c217efc4f42bd673459e742561537e7829e8

### copy Qx and Qy to bootloader_config_default.json
leo@leo-work:~/Nordic_bluetooth_52832/nRF5-SDK-for-Mesh$ vim tools/dfu/bootloader_config_default.json
leo@leo-work:~/Nordic_bluetooth_52832/nRF5-SDK-for-Mesh$ cat tools/dfu/bootloader_config_default.json
{
    "bootloader_config": {
        "bootloader_id": 1,
        "bootloader_version": 1,
        "company_id": 89,
        "application_id": 1,
        "application_version": 1,
        "public_key":
        "f8a85161c74c8e9b1f77260da34737ad8e17c588fb62343dbe56533f634029ab968fb614538d1856b8a2c5d124f3c217efc4f42bd673459e742561537e7829e8"
    }
}

### Step 1: Generate a DFU file with nRF Util
leo@leo-work:~/Nordic_bluetooth_52832/nRF5-SDK-for-Mesh$ nrfutil dfu genpkg --application bin/blinky/blinky_nrf52832_xxAA_s132_7.2.0.hex --company-id 0x00000089 --application-id 1 --application-version 2 --key-file private_key.txt --sd-req 0x00CB --mesh dfu_test.zip
Key file was given, setting DFU version to 0.8
Zip created at dfu_test.zip

### Step 2: Generate a HEX version of device page
leo@leo-work:~/Nordic_bluetooth_52832/nRF5-SDK-for-Mesh/tools/dfu$ python device_page_generator.py -d nrf52832_xxAA -sd "s132_7.2.0"
Wrote device page for nrf52832_xxAA with the s132_7.2.0 SoftDevice to bin/device_page_nrf52832_xxAA_s132_7.2.0.hex.

### Step 3: Erase chip memory and flash SoftDevice on all devices
leo@leo-work:~/Nordic_bluetooth_52832/nRF5-SDK-for-Mesh$ nrfjprog --program bin/softdevice/s132_nrf52_7.2.0_softdevice.hex --chiperase
Parsing image file.
Applying system reset.
Verified OK.

### Step 4: Flash the serial bootloader on all devices
leo@leo-work:~/Nordic_bluetooth_52832/nRF5-SDK-for-Mesh$ nrfjprog --program bin/bootloader/gccarmemb/mesh_bootloader_serial_gccarmemb_nrf52832_xxAA.hex 
Parsing image file.
Applying system reset.
Verified OK.

### Step 6: Flash the device page on all devices and reset the device
leo@leo-work:~/Nordic_bluetooth_52832/nRF5-SDK-for-Mesh$ nrfjprog --program tools/dfu/bin/device_page_nrf52832_xxAA_s132_7.2.0.hex 
Parsing image file.
Applying system reset.
Verified OK.

leo@leo-work:~/Nordic_bluetooth_52832/nRF5-SDK-for-Mesh$ nrfjprog --reset
Applying system reset.
Run.

### Transferring the DFU archive over serial with nRF Util
leo@leo-work:~/Nordic_bluetooth_52832/nRF5-SDK-for-Mesh$ ls /dev/ttyACM1 
/dev/ttyACM1
leo@leo-work:~/Nordic_bluetooth_52832/nRF5-SDK-for-Mesh$ nrfutil dfu serial -pkg dfu_test.zip -p /dev/ttyACM1 -b 115200 -fc --mesh
Upgrading target on /dev/ttyACM1 with DFU package /home/leo/Nordic_bluetooth_52832/nRF5-SDK-for-Mesh/dfu_test.zip. Flow control is enabled.


Failed to upgrade target. Error is: Device returned status code ERROR_INVALID_PARAMETER (133) on a DFU data packet.

Possible causes:
- bootloader, SoftDevice or application on target does not match the requirements in the DFU package.
- baud rate or flow control is not the same as in the target bootloader.
- target is not in DFU mode. If using the SDK examples, press Button 4 and RESET and release both to enter DFU mode.
- if the error is ERROR_BUSY at the beginning of the DFU process,increase the value of PAGE_ERASE_TIME_MAX by few milliseconds.

 

My environment is as follows:

One computer and one NRF52832-DK are connected with usb cable.

Operating System: Ubuntu18.04

nRF5 SDK for Mesh v5.0.0

nRF5 SDK v17.0.2

SoftDevice : SoftDevice S132 version 7.2.0

board: PCA10040.

Python version: Python 2.7.17 and Python 3.6.9

nrfutil tool version: 0.3.0.0

nrfjprog version: 10.15.0 external

 

Thanks in advance.

Leo Lin.

Parents Reply Children
Related