6.1.5.2.2 Running the Application
- Mount the AVR128DB48 Curiosity Nano host board, the Serial Flash board and the RNWF11 Add On Board on Curiosity Nano base board at respective headers. For more details about the board placement in the Curiosity Nano base, refer to the Figure 6-1.
- Connect the debugger USB port on the AVR128DB48 Curiosity Nano board to computer using a micro USB cable.
- Change the configuration. There are two options
to change the configuration:
- Option 1: Change the configuration
manually in the code.
- Open the code in MPLAB IDE v6.00 or
higher and add Home AP and device information in the application code.
- In
rnwf_app.h
, add Wi-Fi configurations inHOME_AP_SSID
,HOME_AP_PASSPHRASE
,HOME_AP_SECURITY
. - In
rnwf_ota_service.h
,OTA_CONF_PORT
can be set if the port number at which OTA service runs needs to be changed.
- In
- Open the code in MPLAB IDE v6.00 or
higher and add Home AP and device information in the application code.
- Option 2: Change the configuration via
MCC Melody.
- For more details about Wi-Fi
configurations, refer Figure 3-5.
- The following fields can be
configured via MCC Melody Wi-Fi settings:
- SSID
- Security Type
- Passphrase
- The following fields can be
configured via MCC Melody Wi-Fi settings:
- Refer Figure 3-8 to understand how to make OTA configuration changes.
- The following fields can be
configured via MCC Melody OTA configuration settings:
- OTA Tunnel Port
- The following fields can be
configured via MCC Melody OTA configuration settings:
- Refer to the Appendix A.4 - Merging Manual Changes Into Regenerated Code to understand how to merge code upon regeneration.
- For more details about Wi-Fi
configurations, refer Figure 3-5.
- Option 1: Change the configuration
manually in the code.
- Save the changes and then build and program the project.
- Connect to the “USB to UART” COM port and
configure the serial settings as follows:
- Baud – 115200
- Data – 8 Bits
- Parity – None
- Stop – 1 Bit
- Flow Control – None
- The board boots up and connects to Home-AP,
as per the configurations given in step 3. After the successful Wi-Fi connection, the device
opens up a TCP tunnel and wait for the OTA server and firmware image details from the
configurator tool. In the first boot up, the device read the RNWF11 module firmware image and copies it to the SPI flash factory image
partition as the SPI flash partitions are empty. SPI flash memory have three partitions:
- Factory image partition
- 1st image partition
- 2nd image partition
These partition images are used for fail-safe recovery mechanism. In case the OTA firmware upgrade fails and corrupts RNWF11 program flash, the images stored in these partitions can be used for recovery. The fail-safe mechanism is implemented inrnwf_app.c
Note: The RN firmware image is copied to the SPI flash factory partition in the first boot as the SPI flash partition is empty. If the user wants to re-initialize the SPI flash and copy the RN firmware to factory partition again, user can press and hold PB2 button for 10 second on the AVR128DB48 Curiosity Nano host board to erase the SPI flash. - Two example sample firmware binaries are
available in the
./ota_demo/tools
folder.Following are two image types:at_cmd_app_rtos.X.production.ota.bin
– the image which contain the default FLFS contents. The FLFS contents include the certificates and keys for secure connection.at_cmd_app_rtos.X.production.without_flfs.ota.bin
– the image which do not contain the FLFS contents. This image is used when the user prefer to retain the FLFS contents after DFU is performed.
Start a python HTTP server using the following command.
- Run the python OTA configurator tool from
the
./ota_demo/tools
folder, as illustrated in the following figure. - Now the device creates a HTTP link with the OTA server and starts downloading the image file.
- After successfully downloading the image, the DFU is triggered, and firmware is flashed into the RNWF11 module.
- Upon successful DFU, the host will Reset and print the RNWF11 module’s new firmware information.