This document explains a step by step approach to create a WINC Socket mode project with SAME54 host.
The document demonstrates the creation of a demo on the SAM E54 Xplained Pro board with the ATWINC1500 XPRO board.
The SAME54 Xplained PRO contains a built-in programmer-debugger tool called Embedded Debugger (EDBG) which is used in this tutorial.
Following image shows the hardware setup.
Follow the below mwntioned steps to create the new WINC project in socket mode with SAME54 from scratch.
-
Under {local system H3 path}\wireless_apps_winc1500\apps, create a folder name for the project (Ex: sample_project).
-
Enter the full path including the newly created project folder.
-
Enter the Folder name and Project name and click on Next (To know about “Folder” and “Name” please click “Show visual Help” button).
-
Enter a Name for the config setting folder
-
select the Target device name
-
Click Finish.
-
Click Launch once Configuration Database Setup windows pops up.
MHC window and has three panes.
-
Available components: It lists all the components from downloaded packages.
-
Project Graph. It is where the user adds components from Available components
-
Configuration options. Each component in project graph can be configured using Configuration options.
User should select required components for creating WINC project.
The first component to enable is Core because core is the base component for many drivers and system components.
-
Go to Harmony in the Available components
-
Select core.
-
Drag and drop it in the Project Graph.
-
This will ask permission to activate Free RTOS. Since this project does not require free RTOS, click No.
-
Core component appears in the Project Graph as shown below.
This example uses SAME54 xplained pro board for host development board. Enable component SAM E54 Xplained Pro BSP.
WINC driver needs driver for its delay functionality and user can select the any timer for this. To enable Timer
-
Go to Harmony -> System Services
-
Select TIME
-
Drag and drop it in the Project Graph.
-
Right click on TMR in the TIME component
-
Go to Satisfiers and select TC3 (user can select any timer)
-
This adds TC3 connected with TIME
WINC device uses interrupt pin PB07. To configure PB07, EIC component must be enabled.
Pin PB07 belongs to external interrupt channel 7 so EIC channel 7 has to be enabled and configured.
-
Select EIC in the Project Graph
-
Please do the following changes in the Configuration Options:
-
Check Enable EIC channel4 box and expand EIC channel7 Configuration
-
Check Enable Interrupt box
-
Change Enable Interrupt7 Edge detection to Falling Edge detection
-
Virtual Console is used to send debug messages and to receive commands from user. Virtual console uses UART interface for communication. Host SAME54 uses pins PB24 and PB25 for UART interface to perform receive and transmit operation, respectively. These two pins belong to SERCOM2 of the host SAME54 device. For more information please refer section 5.4.2 (Virtual COM Port) of SAM E54 Xplained Pro User's Guide
To enable and configure Virtual COM port:
UART interface of SERCOM2 is used by CONSOLE.
-
Right click on the UART port of Instance 0 of the CONSOLE component.
-
Go to Satisfiers and select SERCOM2.
SERCOM2 appears in Project Graph connected with CONSOLE.
SERCOM2 uses PAD for data reception.
CONSOLE has a dependency on DEBUG and COMMAND component. To add DEBUG component
-
Right click on the SYS_CONSOLE interface of Instance 0 of the CONSOLE component.
-
Go to Consumers and select DEBUG
-
DEBUG component connected with CONSOLE appears in the Project Graph
-
Right click on the SYS_CONSOLE interface of Instance 0 of the CONSOLE component.
-
Go to Consumers and select COMMAND
-
COMMAND component connected with CONSOLE appears in the Project Graph
WINC communicates with host using SPI interface. So, to establish a SPI connection between WINC and host, three components are required. They are:
-
SPI Driver
-
SERCOM4 (Peripheral library)
-
WINC Driver
To enable SPI driver,
-
In the Available Components, go to Harmony -> Drivers.
-
Select SPI
-
Drag and drop it in the Project Graph
Connect SERCOM4 with SPI driver.
-
Right click on the SPI interface of Instance 0 of the SPI component.
-
Go to Satisfiers and select SERCOM4
SERCOM4 appears in Project Graph connected with SPI driver.
Enable DMA for SPI driver
-
Select instance 0 on SPI driver
-
Go to Configurations Options and enable Use DMA for Transmit and Receive
-
SERCOM4 uses PAD for data reception. change the SPI Data In Pad selection property to SERCOM PAD in the Configuration Options
-
Enable the property SPI Master Hardware Slave Select.
Enable WINC Driver in the project:
-
In the Available Components, go to Wireless
-
Select Driver -> WINC
-
Drag and drop it in the Project Graph.
-
Connect DRV_SPI interface of SPI interface 0 and WINC component
User has the option to select between WINC1500 and WINC3400 using the WINC Device configuration option.
Enable Interrupt for WINC:
WINC3400 BLE:
User can enable BLE option in WINC3400 as shown below.
This section summarizes the pin configuration requirement for MHC pin configuration component.
In MHC, user can do pin configuration with the help of below steps
The following window appears
The pin can be configured as shown below.
-
RESETN pin configuration: For WINC1500,
For WINC3400,
-
Interrupt pin configuration: For both WINC1500 and WINC3400,
-
Chip enable pin configuration: For both WINC1500 and WINC3400,
-
Go to PA27 of pin column
-
Change the function to GPIO
-
Name should be changed as “WDRV_WINC_CHIP_EN”
-
-
BLE pin configuration: This configuration only applicable for WINC3400,
-
Go to PA04 pin column
-
Change the function to SERCOM0_PAD0
-
Go to PA05 pin column
-
Change the function to SERCOM0_PAD1
-
Go to PA06 pin column
-
Change the function to SERCOM0_PAD2
-
Go to PA07 pin column
-
Change the function to SERCOM0_PAD3
-
SERCOM2 (COM Port) and SERCOM4 (SPI) pin configuration: For both WINC1500 and WINC3400,
-
Go to PB24 pin column
-
Change the function to SERCOM2_PAD1
-
Go to PB25 pin column
-
Change the function to SERCOM2_PAD0
-
Go to PB26 pin column
-
Change the function to SERCOM4_PAD1
-
Go to PB27 pin column
-
Change the function to SERCOM4_PAD0
-
Go to PB28 pin column
-
Change the function to SERCOM4_PAD2
-
Go to PB29 pin column
-
Change the function to SERCOM4_PAD3
-
To save the modifications
With above component and pin configuration in MHC, user has required peripheral libraries and drivers for application development. User can follow the API guidelines to develop the application or follow the below step to create simple application for getting started.
-
Go to the path {local system path}\wireless_apps_winc1500\apps{User project name}\firmware\src.
-
app.c
-
app.h
-
example.c
-
-
Replace the following files with the files available in the AP scan example project {local system path}\wireless_apps_winc1500\apps\ap_scan\firmware\src
-
As example.c file does not come with default project, create a new file called example.c under Source Files
-
Right click on Source Files
-
Select Add Existing Item
-
Go to {local system path}\wireless_apps_winc1500\apps{User project name}\firmware\src
-
Select example.c
-
In the file example.c, user can change the Home AP credentials.
To compile the project
After successful build make sure SAME54 XPRO is connected with local system.
Expected output
Note: If the user wants to create the project using the FrreRTOS, then follow the below mentioned steps.
To add FreeRTOS component