Microchip® Advanced Software Framework

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
WINC1500 Certificate Download through OTA (HTTPS) from Host for SAM4S XPlained Pro Documentation

Introduction

This example demonstrates how to connect to an HTTPS server and download a root/tls certificates using HTTPS client. Then sends the certificates to WINC SPI flash from host
It uses the following hardware:

  • the SAM Xplained Pro.
  • the WINC1500 on EXT1.

Main Files

  • main.c : WINC1500 Wi-Fi module, then download a certificate file using HTTPS client and then writes into WINC SPI flash.

Usage

  1. Configure below code in the main.h for AP information to be connected.
    * #define MAIN_WLAN_SSID "DEMO_AP"
    * #define MAIN_WLAN_PSK "12345678"
    *
  2. Provide HTTPS URL macro with partial URL (exclude the certificate .cer file name in the main.h file.
    * #define MAIN_HTTP_FILE_URL "https://192.168.43.34/"
    *
  3. Provide number of tls/root certificates .cer to be downloaded
  4. Provide certificate file name list in root_tls_certs_name
  5. Build the program and download it into the board.
  6. On the computer, open and configure a terminal application as following.
    * Baud Rate : 115200
    * Data : 8bit
    * Parity bit : none
    * Stop bit : 1bit
    * Flow control : none
    *
  7. Start the application.
  8. In the terminal window, the following text should appear:
* -- Certificate downloader via OTA (HTTPS) example --
* -- Compiled: xxx xx 2021 hh:mm:ss --
* (APP)(INFO)Chip ID xxxxxx
* (APP)(INFO)DriverVerInfo: 0xaaaaaaaa
* (APP)(INFO)Firmware ver : xx.x.x xxxxxx xxxxx
* (APP)(INFO)Firmware Build xxx xx xxxx xx:xx:xx
* (APP)(INFO)Firmware Min driver ver : xx.x.x
* (APP)(INFO)Driver ver: xx.x.x
* (APP)(INFO)Driver built at xxx xx xxxx xx:xx:xx
* main: connecting to WiFi AP DEMO_AP...
* wifi_cb: IP address is 192.168.43.210
* start_download: sending HTTP request...
* (APP)(INFO)Socket 0 session ID = 1
* http_client_callback: HTTP client socket connected.
* http_client_callback: request completed.
* http_client_callback: received response 200
* store_file_packet: received[804]
* store_file_packet_complete: file downloaded successfully.
* (APP)(INFO)Sock to delete <0>
* http_client_callback: disconnection reason:0
* >> De-init WINC device to enter into download mode
* (APP)(INFO)Chip ID 1503a0
* >> WINC entered into download mode
* ---> Start Certificate Upload on WINC
*
* >>>Found Certificate:
* >>>
*
* >Start erasing...
* Done
*
* > Writing the Root Certificate to SPI flash...
* --- Root Certificate written to SPI flash ---
*
*
* >>>Found Certificate:
* >>> AddTrust External CA Root
*
* >Start erasing...
* Done
*
* > Writing the Root Certificate to SPI flash...
* --- Root Certificate written to SPI flash ---
* >> All the certificates written
* main: please re-init WINC to start wifi operations.
*

Compilation Information

This software was written for the GNU GCC compiler using Atmel Studio 6.2 Other compilers may or may not work.

Contact Information

For further information, visit Microchip.