5.2.1 DFU Utility

The DFU utility is a python-based tool that supports erase and write operations on the WILCS02 Module’s Flash memory. It also enables modification of image sequence number and source address in the header section. For more details on the DFU utility, go to “RNWF/WILCS02/WINCS02 Device Firmware and File Upload Tools” on the Global Regulatory Certified, Wi-Fi Link Controller Module With SPI/SDIO Interface, Secure Boot and PCB Antenna (WILCS02PE).
Figure 5-4. DFU Utitlity Path

To use the DFU utility, the user needs to meet certain hardware and software requirements. The following are the hardware and software requirements:

Hardware

The following are the hardware requirements:

Software

The following are the operating system requirements:
  • For Windows: FTDI D2XX Direct Driver for Windows.
  • For Linux (Ubuntu): The Linux operating system loads the Virtual COM Port (VCP) driver (by default), during the process the script takes care of loading the appropriate driver D2XX/VCP.
    Note: sudo permissions are required to run the script.

Python 3

  • ftd2xx==1.3.2
  • pyserial==3.5

Hardware Setup for DFU

The WILCS02 Module exposes the following pins to perform DFU. To perform the DFU on the WILCS02 Module, the user needs to set up the hardware as follows:

Table 5-2.  WILCS02 Module Pin Descriptions for DFU
WILCS02 ModulePinDescription
MCLR_N4Master Clear Reset (MCLR)
DFU_Rx/Strap1/PB010DFU pattern clock/UART Rx
DFU_Tx/Strap2/PB126DFU pattern data/UART Tx

WILCS02-SD Board

The WILCS02-SD Board exposes the DFU pins to the jumper (J103, J104 and J207). The following table details the connection between the FTDI cable and the WILCS02-SD board when performing the DFU.
Figure 5-5. FTDI Cable Connection with the WILCS02-SD Board
Note: While performing the DFU, the module must be powered through the USB debug connector (J200) on the WILCS02-SD Board.
Table 5-3. 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

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
The 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

Update Over-the-air (OTA) Image

The following section provides command examples for flashing and erasing the different image partitions.
Figure 5-6. Update Firmware Image
The OTA image can be updated in the image1 (Low) partition or image2 (High) partition.
python do_dfu.py -b wilcs02_firmware_vx.x.x_ea/rio0_wifi_firmware.bin low
To update the sequence number of the given firmware image, use the -s option as follows:
python do_dfu.py -b wilcs02_firmware_vx.x.x_ea/rio0_wifi_firmware.bin low -s 0xffffffc0

Erase Partition

The DFU utility is flexible to erase only the given partition of the Flash map. Use the -e option to erase either low (image1) or high (image2). The erase option is useful to switch the bootable image from other partitions of the Flash map.
python do_dfu.py -e high
Figure 5-7. Erase Partition