Microchip® Advanced Software Framework

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
WINC1500 HTTP Downloader Example for SAMD21 XPlained Pro Documentation

Introduction

This example demonstrates how to connect to an HTTP server and download a file using HTTP client.
It uses the following hardware:

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

Main Files

  • main.c : Initialize the SD card and WINC1500 Wi-Fi module, then download a file using HTTP client.

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. Configure HTTP URL macro in the main.h file.
    * #define MAIN_HTTP_FILE_URL "http://www.microchip.com/Images/45093A-SmartConnectWINC1500_E_US_101014_web.pdf"
    *
  3. Build the program and download it into the board.
  4. 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
    *
  5. Start the application.
  6. In the terminal window, the following text should appear:
* -- HTTP file downloader example --
* -- SAMXXX_XPLAINED_PRO --
* -- Compiled: xxx xx xxxx xx:xx:xx --
*
* This example requires the AP to have internet access.
*
* init_storage: please plug an SD/MMC card in slot...
* init_storage: mounting SD card...
* init_storage: SD card mount OK.
* main: connecting to WiFi AP DEMO_AP...
* wifi_cb: IP address is 192.168.1.107
* start_download: sending HTTP request...
* resolve_cb: www.atmel.com IP address is 72.246.56.186
*
* http_client_callback: HTTP client socket connected.
* http_client_callback: request completed.
* http_client_callback: received response 200 data size 1147097
* store_file_packet: creating file [0:45093A-SmartConnectWINC1500_E_US_101014_web.pdf]
* store_file_packet: received[xxx], file size[1147097]
* ...
* store_file_packet: received[1147097], file size[1147097]
* store_file_packet: file downloaded successfully.
* main: please unplug the SD/MMC card.
* main: done.
*

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.