Jump to main content

##

# 3.8 WINC1500 Socket Mode Demo Applications

This example project demonstrates the WINC1500 applications of WiFi in Socket mode.

## Description

This project has WiFi example applications of WINC1500 . The user can configure the WiFi parameters and select the required example application through command.

## Downloading and building the application

To download or clone this application from Github, go to the top level of the repository

Path of the application within the repository is , wireless_apps_winc1500/apps/wifi_socket_demos/firmware

To build the application, refer to the following table and open the project using its IDE.

Project Name | Description
--- | ---
sam_e54_xpro_winc1500.X | MPLABX project for SAME54 Xplained Pro Evaluation Kit and WINC1500 Xplained pro
sam_d21_xpro_winc1500.X | MPLABX project for SAMD21 Xplained Pro Evaluation Kit and WINC1500 Xplained pro
sam_e54_xpro_winc1500_freertos.X | MPLABX project for SAME54 Xplained Pro Evaluation Kit and WINC1500 Xplained pro using FreeRTOS
sam_a5d27_som1_winc1500.X | MPLABX project for SAMA5D27 and WINC1500 WiFi 7 Click board
pic32mz_ef_curiosity_v2_winc1500.X | MPLABX project for PIC32MZ EF 2.0 curiosity board and WINC1500 Xplained pro

## Setting up SAMXXX Xplained Pro board

- Connect the Debug USB port on the SAMXXX Xplained Pro board to the computer using a micro USB cable

- Connect the WINC1500 Xplained pro on the EXT1 header of SAMXXX Xplained Pro board

## Setting up PIC32MZ EF 2.0 Curiosity board

- Connect the Debug USB port on the PIC32MZ EF 2.0 Curiosity board to the computer using a micro USB cable

- Connect the WINC1500 Xplained pro on the EXT1 header of PIC32MZ EF 2.0 Curiosity board

## Setting up SAMA5D27-SOM1-EK1 Evaluation Kit

- Connect the WINC1500 WiFi 7 Click board to the MBus1 connector.

- Connect the USB port (J10) on SOM1-Ek1 board to the computer using micro USB cable.

### Addtional hardware required

- SD Card with FAT32 file system

### Setting up the SD Card

- Copy the boot loader binary( boot.bin) from "firmware\at91bootstrap_sam_a5d27_som1_ek.X\binaries" onto the SD card

- Copy the application (harmony.bin) from "firmware/sam_a5d27_som1_winc1500.X/dist/sam_a5d27_som1_winc1500/production" onto the SD card, available after a successful build of the application

### Setting up the board

- Insert the SD card into SDMMC slot (J12).

- Connect the Debug USB port on the board to the computer using a micro USB cable.

## Running the Application

1. Build and program the application project using its respective IDE. ( This step is not applicable for the host SAMA5D27.The application will load from SD card.)

2. Open the Terminal application (Ex.:Tera term) on the computer

3. 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

4. Use WiFi commands to configure WiFi parameters and use application commands to select the example application.

WiFi Commands Details

Command | Details | Example
--- | --- | ---
wifi help | Wi-Fi Service help command | wifi help
wifi set <bootmode> <ssid_name> <auth_type> <pwd> <username/index> | Set Wi-Fi Configuration for Station(STA) mode or Access Point (AP) mode | wifi set 2 DEMO_AP 2 12345678
wifi get | Get Wi-Fi Configuration | wifi get

Wi-Fi command parameters information

Parameter | Sub Parameter
--- | ---
bootmode | 1- Access point(AP) mode.2- Station(STA) mode.
ssid_name | SSID name
authtype(Security type) | 1 - OPEN Mode. 2 - WPAPSK mode. 3 - WEP mode. 5 - 802.1x authentication MSCHAPV2 mode.
pwd(password) | Password/passphrase
username/index | Username if authtype is 802.1x authentication MSCHAPV2 or Key Index if the authtype is WEP.

Application command parameters information

Command | Details | Example
--- | --- | ---
appdemo help | Application Service help command | appdemo help
appdemo start <demo_id> | Select and start an application demo | appdemo start 1
appdemo get | Get the ID of currently running application demo | appdemo get
appdemo stop | Stop the currently running application demo | appdemo stop

Application command parameters information

Parameter | Sub Parameter
--- | ---
demo_ID | 1 - WiFi station mode/Access point mode demo. 7 - OTA Demo. 8 - SSL Demo. 9 - Ping Demo. 10 - Iperf demo. 11 - SNTP demo. 18 - MQTT Demo. 19 - Certificate download via OTA Demo.

List of Applications

Application | Description
--- | ---
WiFi station mode/Access point mode demo | Demonstartes the Station Mode or Access Point(AP) mode of WINC1500
OTA Demo | Demonstrates OTA firmware upgrade
SSL Demo | Demonstrates TCP SSL Client application
Ping Demo | Demonstrates the Ping test
Iperf Demo | Demonstrates the iperf application
SNTP Demo | Demonstrates how to retrieve time information from the time server
MQTT Demo | Demonstrates MQTT Application
WiFi Provisioning Demo | Demonstartes the WiFi provisioning application
Certificate download via OTA Demo | Demonstartes Certificate download via OTA application

### Steps to isolate/copy individual application(s) from the demo

If the user wants to isolate an application, follow the below mentioned steps

For example, the user wants to create an SNTP demo in Socket mode.

1. The SNTP demo uses the WiFi functionalities to get connected with the network. So copy the files " app_wifi.c" and " app_wifi.h " from the path "wireless_apps_winc1500/apps/wifi_bypass_demos/firmware/src " or "wireless_apps_winc1500/apps/wifi_socket_demos/firmware/src" to "src" folder of the new demo project. Then add these files to the project.

2. Now user should copy and add the SNTP application files "app_sntp.c" and "app_sntp.h" from the path "wireless_apps_winc1500/apps/wifi_bypass_demos/firmware/src " or "wireless_apps_winc1500/apps/wifi_socket_demos/firmware/src" to the "src folder of the new demo project.

3. The "app.c" and "app.h" files need to be copied by the user. These files integrate the SNTP application and WiFi functionalities. Copy and add these two files from the same "src" path to the "src" folder of the new demo project.

4. In "app.c", within "APP_Initialize()" function, initialize the sntp application by calling " APP_SntpInitialize(APPWiFiCallback)".

5. In "app.c" file, make sure that, " APP_WiFiTasks(wdrvHandle)" is getting called from the " APP_STATE_WDRV_OPEN " state of " APP_Tasks() " state machine.

6. In the same state machine " APP_Tasks() ", within the state " APP_STATE_WDRV_APP_LOOP " , call the sntp application state machine "APP_SntpTasks(handle)".

7. Now follow the steps mentioned in the SNTP demo document to run the SNTP demo using "wifi", "sntp" and "appdemo" commands.

Similarly, for any application demo, take the required application files along with WiFi files and "app" files to create the demo.

Note:

1. User has to make sure the project path does not exceed windows path limit.

2. User should reset the device before switching the application.