5.1.1 DFU Utility

The DFU utility is a python-based tool, it supports the erase and write operations on WILCS02 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.
Figure 5-2. DFU Utility Path
Hardware and Software Dependencies

Following are the dependencies of the tool:

  • Hardware
  • 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/VCP
Note: “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
    $ 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/
    
  • Python 3
    • ftd2xx==1.3.2
    • pyserial==3.5

Hardware Setup

The WILCS02 module exposes the following pins to perform DFU.

Table 5-1. Pin Description
WILCS02 Module Pin Description
MCLR_N 4 Master Clear Reset, active -low
DFU_Rx/ Strap1/ PB0 10 DFU pattern clock/ UART Rx
DFU_Tx/ Strap2/ PB1 26 DFU pattern data/ UART Tx

WILCS02-SD Board

The WILCS02-SD Board expose the DFU pins to Jumper J103, J104 and J207.

The following table show the connection between the FTDI cable and the WILCS02-SD board when DFU is performed.

Table 5-2. FTDI UART Connection with WILCS02-SD Board
FTDI Cable (Color) WILCS02-SD Board
GND (Black) J104-3 (GND)
CTS# (Brown) J207 (MCLR_N)
VCC (Red) NC
TXD (Orange) J103-2 (Strap1/ PB0)
RXD (Yellow) J104-2 (Strap2/ PB1)
RTS# (Green) NC
Note: While performing the DFU, the module must be powered through the USB Debug Connector J200 on the WILCS02-SD Board.
Figure 5-3. DFU Setup

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

The following section provides command examples for flashing and erasing the different image partitions.

Update OTA Image
Figure 5-4. Update Firmware Image
The OTA Image can be updated in Image1 (Low) partition or Image2 (High) partition.
python do_dfu.py -b wilcs02_firmware_vx.x.x_ea/rio0_wifi_firmware.bin low
In order to update the sequence number of the given firmware image, -s option can be used as follows:
do_dfu.py -b wilcs02_firmware_vx.x.x_ea/rio0_wifi_firmware.bin low -s 0xffffffc0
Erase Partition
Figure 5-5. 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 partitions of the Flash map.

python do_dfu.py -e high