You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+24-22Lines changed: 24 additions & 22 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,17 +7,18 @@ I've made some substantial changes to the code from the original repo, mainly:
7
7
* Add support for the new secure bootloader from NRF SDK 12
8
8
9
9
## What does it do?
10
-
This is a Python program that uses gatttool (provided with the Linux BlueZ driver) to achieve Device Firmware Updates (DFU) to a Nordic Semiconductor nRF51/52 device via Bluetooth Low Energy (BLE).
10
+
11
+
This is a Python program that uses `gatttool` (provided with the Linux BlueZ driver) to achieve Over The Air (OTA) Device Firmware Updates (DFU) to a Nordic Semiconductor nRF5 (either nRF51 or nRF52) device via Bluetooth Low Energy (BLE).
11
12
12
13
### Main features:
13
14
14
15
* Perform OTA DFU to an nRF5 peripheral without an external USB BLE dongle.
15
16
* Ability to detect if the peripheral is running in application mode or bootloader, and automatically switch if needed (buttonless).
16
17
* Support for both Legacy (SDK <= 11) and Secure (SDK >= 12) bootloader.
17
18
18
-
Before using this utility the nRF peripheral device needs to be programmed with a DFU bootloader (see Nordic Semiconductor documentation/examples for instructions on that).
19
+
Before using this utility the nRF5 peripheral device needs to be programmed with a DFU bootloader (see Nordic Semiconductor documentation/examples for instructions on that).
19
20
20
-
This project assumes you are developing and deploying to Linux system. Astronomer80 has repos for similar applications for [Windows](https://github.com/astronomer80/nrf52_bledfu_win) and [Mac OS X](https://github.com/astronomer80/nrf52_bledfu_mac).
21
+
This project assumes you are developing on and deploying to a Linux system. Astronomer80 has repos for similar applications for [Windows](https://github.com/astronomer80/nrf52_bledfu_win) and [Mac OS X](https://github.com/astronomer80/nrf52_bledfu_mac).
21
22
22
23
## Prerequisites
23
24
@@ -27,9 +28,10 @@ This project assumes you are developing and deploying to Linux system. Astronome
27
28
* Python `intelhex` module (available via pip)
28
29
29
30
## Firmware Build Requirement
30
-
* Your nRF5 peripheral firmware build method will produce a firmware file ending with either `*.hex` or `*.bin`.
31
+
32
+
* Your nRF5 peripheral firmware build method will produce a firmware file ending with either `*.hex` or `*.bin`.
31
33
* Your nRF5 firmware build method will produce an Init file ending with `.dat`.
32
-
* The Nordic naming convention is `application.bin` and `application.dat`, but this utility will accept any names.
34
+
* The typical naming convention is `application.bin` and `application.dat`, but this utility will accept other names.
33
35
34
36
## Generating init files
35
37
@@ -38,10 +40,10 @@ This project assumes you are developing and deploying to Linux system. Astronome
38
40
Use the `gen_dat` application (you need to compile it with `gcc gen_dat.c -o gen_dat` on first run) to generate a `.dat` file from your `.bin` file. Example:
39
41
40
42
./gen_dat application.bin application.dat
41
-
42
-
Note: The `gen_dat` utility expects a `.bin` file input, so you'll get CRC errors during DFU using a `.dat` file generated from a `.hex` file.
43
43
44
-
An alternative is to use `nrfutil` from Nordic Semi, but I've found this method to be easier. You may need to edit the `gen_dat` source to fit your specific application.
44
+
Note: The `gen_dat` utility expects a `.bin` file input, so you'll get Cyclic Redundancy Check (CRC) errors during DFU using a `.dat` file generated from a `.hex` file.
45
+
46
+
An alternative is to use `nrfutil` from Nordic Semiconductor, but I've found this method to be easier. You may need to edit the `gen_dat` source to fit your specific application.
45
47
46
48
### Secure bootloader
47
49
@@ -51,34 +53,34 @@ Note: I've had problems with the pip version of `nrfutil`. I recommend [installi
51
53
52
54
## Usage
53
55
54
-
There are two ways to specify firmware files for this utility. Either by specifying both the `.hex` or `.bin` file with the `.dat` file, or more easily by the `.zip` file, which contains both the hex and dat files.
56
+
There are two ways to specify firmware files for this utility. Either by specifying both the `.hex` or `.bin` file with the `.dat` file, or more easily by the `.zip` file, which contains both the hex and dat files.
57
+
55
58
The new `.zip` file form is encouraged by Nordic, but the older hex/bin + dat file methods should still work.
56
59
57
60
## Usage Examples
58
61
59
62
> sudo ./dfu.py -f ~/application.hex -d ~/application.dat -a CD:E3:4A:47:1C:E4
60
63
61
-
or
64
+
or:
62
65
63
-
> sudo ./dfu.py -z ~/application.zip -a CD:E3:4A:47:1C:E4
66
+
> sudo ./dfu.py -z ~/application.zip -a CD:E3:4A:47:1C:E4
64
67
65
-
To figure out the address of DfuTarg do a `hcitool lescan` -
68
+
You can use the `hcitool lescan` to figure out the address of a DFU target, for example:
66
69
67
-
$ sudo hcitool -i hci0 lescan
68
-
LE Scan ...
69
-
CD:E3:4A:47:1C:E4 <TARGET_NAME>
70
-
CD:E3:4A:47:1C:E4 (unknown)
70
+
$ sudo hcitool -i hci0 lescan
71
+
LE Scan ...
72
+
CD:E3:4A:47:1C:E4 <TARGET_NAME>
73
+
CD:E3:4A:47:1C:E4 (unknown)
71
74
72
75
73
-
Example Output
74
-
------------------------
75
-
76
+
## Example Output
77
+
76
78
================================
77
79
== ==
78
80
== DFU Server ==
79
81
== ==
80
82
================================
81
-
83
+
82
84
Sending file application.bin to CD:E3:4A:47:1C:E4
83
85
bin array size: 60788
84
86
Checking DFU State...
@@ -90,14 +92,14 @@ Example Output
90
92
Waiting for INIT DFU notification
91
93
Begin DFU
92
94
Progress: |xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx| 100.0% Complete (60788 of 60788 bytes)
93
-
95
+
94
96
Upload complete in 0 minutes and 14 seconds
95
97
segments sent: 3040
96
98
Waiting for DFU complete notification
97
99
Waiting for Firmware Validation notification
98
100
Activate and reset
99
101
DFU Server done
100
-
102
+
101
103
## TODO:
102
104
103
105
* Implement link-loss procedure for Legacy Controller.
0 commit comments