3.2.6.5 Wi-Fi OTA Service Interface
The OTA service role is to enable the module firmware update over the network link. The
OTA service has the HTTP based file download and RNWF11
Device Firmware Update (DFU) implementation. The OTA service open ups a TCP tunnel to
receive the OTA server and firmware image details. Any device (say PC or Mobile) in the
network can initiate the firmware download process. Once the OTA service receives all
the necessary details, it starts downloading the firmware image and reports each
downloaded chunk to user application over the callback. The user application needs to
store the firmware in the local memory. After the successful download the user
application can use the OTA service API's to flash new image into the RNWF11 module. The OTA service API call syntax is
provided
below:
SYS_RNWF_RESULT_t SYS_RNWF_OTA_SrvCtrl( SYS_RNWF_OTA_SERVICE_t request, void *input)
- OTA Tunnel Selection:Tunnel to receive the OTA server and Image details. Drop-down to select OTA Tunnel. Currently supports TCP only
- OTA Tunnel Port: Configure OTA server port
- OTA Callback Handler:Configure callback function name to handle OTA service events (for example, downloading firmware binary from OTA server, erasing RNWF Flash before programming it with newly downloaded firmware image from server and perform RNWF Reset/Reboot with new firmware image)
The following table provides the list of OTA services available:
Option/Command | Input | Description |
---|---|---|
SYS_RNWF_OTA_ENABLE | Buffer of 4096 (to align with DFU max write size) bytes | Enable OTA service and opens a TCP tunnel to receive the OTA server and Image details |
SYS_RNWF_OTA_SET_CALLBACK | Callback handler | Register callback function for the OTA service to report the status |
SYS_RNWF_OTA_DFU_INIT | None | Generates the DFU pattern and places the RNWF module in firmware update mode |
SYS_RNWF_OTA_DFU_WRITE | chunk_addr, chunk_size, chunk_ptr | Writes the given chunk into the RNWF module. Max chunk size can be 4096 bytes. |
SYS_RNWF_OTA_DFU_ERASE | chunk_addr, chunk_size, chunk_ptr | Erases the provided size of memory (chunk_ptr can be NULL) |
The following table captures the OTA Callback event codes and event data:
Event | Response Component | Description |
---|---|---|
SYS_RNWF_EVENT_DWLD_START | Total size of the image file to be downloaded | Given image file download has started |
SYS_RNWF_EVENT_DWLD_DONE | Total size of downloaded Image file | Firmware download process completed, the application can initialize the DFU and start flle |
SYS_RNWF_EVENT_FILE_CHUNK | chunk_addr, chunk_size, chunk_ptr | Received image file chunk, the received data chunk should be saved in non-volatile memory |
SYS_RNWF_EVENT_DWLD_FAIL | None | Firmware download failed |
The following figure illustrates the OTA process.
The data types used for the OTA service are provided below: