Microchip® Advanced Software Framework

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
WINC1500 Wi-Fi Serial Example for SAML21 XPlained Pro B Documentation

Introduction

This example demonstrates how to emulate a serial port between two devices. It reads input data from serial interface and sends it via Wi-Fi connection. The EDBG interface will print out messages you typed or received, hence simulating a chat application. To run this example you need to prepare two pairs of SAMD21 Xplained Pro board with WINC1500 extension (on EXT1 slot).

Main Files

  • main.c : Initialize device and USART interface. Create TCP sockets, send/receive messages and print out them on the EDBG interface.

Usage

  1. Configure below code in the main.h for AP to connect to.
    * #define MAIN_WLAN_SSID "DEMO_AP"
    * #define MAIN_WLAN_PSK "12345678"
    *
  2. Build the program and download it into each board.
  3. On the computer, open and configure a terminal application as the follows.
    * Baud Rate : 115200
    * Data : 8bit
    * Parity bit : none
    * Stop bit : 1bit
    * Flow control : none
    *
  4. Start the application.
  5. On the terminal window, the following text should appear:
    * -- WINC1500 Wi-Fi Serial example --
    * -- Compiled: xxx xx xxxx xx:xx:xx --
    * Wi-Fi connected.
    * Wi-Fi IP is xxx.xxx.xxx.xxx
    * socket_cb: bind success.
    * socket_cb: listen success.
    *
  6. Check IP address of each board and execute connection on one device by typing the below command on the terminal window with the other device's address. Use prefix "<<" to execute local commands.
    * <<connect xxx.xxx.xxx.xxx
    *
  7. If connected, the following text should appear:
    * [Local device]
    * Connecting to [xxx.xxx.xxx.xxx] ...
    * Socket connect success.
    *
    * [Remote device]
    * Socket accept success.
    *
  8. Type messages on the terminal window and you will see the sent/received messages.
  9. You can control LED on the remote device by typing the following command. Use prefix ">>" to execute remote commands.
    * >>control ledon
    * or
    * >>control ledoff
    *

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.