8.1 DFU Utility
The DFU utility is a python based tool, it supports the erase and write operations on
RNWF02 module’s Flash memory. It also enables
modification of image sequence number and source address in the header section. The
DFU utility is available in the RNWF product page: rnwf_utilities_vX.X.X
(
rnwf_utilities_vX.X.X\dfu
).Hardware and Software Dependencies
Following are the dependencies of the tool.
- Hardware
- RNWF02 module
- FTDI Cable
- Software
- Operating System
Drivers:
- For Windows:
- For Linux
(Ubuntu):
- Linux
loads the Virtual COM port (VCP) driver by default,
During the process the script will take care of
loading the appropriate driver D2XX/VCPNote: “sudo” permissions are required to run the script.
- For
more details about the D2XX driver installation,
refer to the FTDI Drivers
Installation Guide for
Linux
$ tar zxvf libftd2xx-x86_64-1.4.27.tgz $ sudo cp -r release/build/lib* /usr/local/lib $ cd /usr/local/lib/ $ sudo ln -s libftd2xx.so.1.4.27 libftd2xx.so $ sudo chmod 0755 libftd2xx.so.1.4.27 $ sudo ldconfig /usr/local/lib/
- Linux
loads the Virtual COM port (VCP) driver by default,
During the process the script will take care of
loading the appropriate driver D2XX/VCP
- Python 3
- ftd2xx==1.3.2
- pyserial==3.5
- Operating System
Drivers:
Hardware Setup
The RNWF02 module exposes following pins to
perform DFU.
RNWF02 Module | Pin | Description |
---|---|---|
MCLR_N | 4 | Master clear Reset, active-low |
DFU_Rx/Strap1/PB0 | 26 | DFU pattern clock/UART Rx |
DFU_Tx/Strap2/PB1 | 10 | DFU pattern data/UART Tx |
RNWF02 Add On Board
The RNWF02 Add On Board design has interconnected
UART1_Tx to PB1/DFU_Tx and UART1_Rx with PB0_Rx to enable both Mission mode and DFU
operation over the single UART interface
Note:
- The customer hardware design can adopt single interface, only if the UART lines can be multiplexed as a GPIO to trigger the DFU pattern
- While performing the DFU, the module must be powered through the mikroBUS interface (in other words, Host Companion Mode)
The DFU utility simplifies the dependencies installation by providing a requirement file with all the necessary python modules.
Before running the DFU utility, navigate to
rnwf_utilities_vX.X.X\dfu
and install all the requirements
using the following python
command>python -m pip install -r requirements.txt
Following is the DFU utility command syntax:
> python do_dfu.py [-h] [-b BIN_FILES BIN_FILES | -e ERASE [ERASE ...]] [-s SEQ_NUM] [-p PORT] [-v] options: -h, --help show this help message and exit -b BIN_FILES BIN_FILES Write option: Erase and write binary file to hexadecimal starting address or section (low, high, file-system). -e ERASE [ERASE ...] Erase option: Provide either the hexadecimal starting address and whole number of 4096 byte pages to erase, or just the section to erase (low, high, file-system). -s SEQ_NUM Modifies image sequence number. Example format: -s 0xffeeddcc -p PORT, -port PORT User specific serial number of the FTDIport, else autodetect mechanism will be used. -v, -verbose
Following section provides the command examples for flashing and erasing the different image partitions
Update Single/Combined Image
Single Image update will Flash both Image1 and Image2 partitions along with
the File system (certificate store). The partition can be specified as low or by its
starting address
(0x60000000).
python do_dfu.py -b test_binaries/network_controller.X.production.bootable.bin 0x60000000
Update OTA Image
The OTA Image only include the header and firmware image and does not include
the File-System. The OTA Image can be updated in Image1 (Low) partition or Image2
(High)
partition
python do_dfu.py -b test_binaries/network_controller.X.production_dfu_ota.bootable.bin lowIn order to update the sequence number of the given firmware image -s option can be used as follows:-
do_dfu.py -b test_binaries/network_controller.X.production_dfu_ota.bootable.bin low -s 0xffffffc0
Erase Partition
The DFU utility is flexible to erase only the given partition of the Flash map. The
-e option is used and either low (Image1) or high (Image2) can be erased. The erase
option is useful to switch the bootable image from other partition of the Flash
map.
python do_dfu.py -e high