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)
Figure 3-47. OTA System Service Configuration in MCC
  • 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:

Table 3-25. OTA Services
Option/CommandInputDescription
SYS_RNWF_OTA_ENABLEBuffer of 4096 (to align with DFU max write size) bytesEnable OTA service and opens a TCP tunnel to receive the OTA server and Image details
SYS_RNWF_OTA_SET_CALLBACKCallback handler Register callback function for the OTA service to report the status
SYS_RNWF_OTA_DFU_INITNoneGenerates the DFU pattern and places the RNWF module in firmware update mode
SYS_RNWF_OTA_DFU_WRITEchunk_addr, chunk_size, chunk_ptrWrites the given chunk into the RNWF module. Max chunk size can be 4096 bytes.
SYS_RNWF_OTA_DFU_ERASEchunk_addr, chunk_size, chunk_ptrErases the provided size of memory (chunk_ptr can be NULL)
The following table captures the OTA Callback event codes and event data:
Table 3-26. OTA Event Codes
EventResponse ComponentDescription
SYS_RNWF_EVENT_DWLD_STARTTotal size of the image file to be downloadedGiven image file download has started
SYS_RNWF_EVENT_DWLD_DONETotal size of downloaded Image fileFirmware download process completed, the application can initialize the DFU and start flle
SYS_RNWF_EVENT_FILE_CHUNKchunk_addr, chunk_size, chunk_ptrReceived image file chunk, the received data chunk should be saved in non-volatile memory
SYS_RNWF_EVENT_DWLD_FAILNoneFirmware download failed

The following figure illustrates the OTA process.

Figure 3-48. OTA Process
The data types used for the OTA service are provided below: