Lab 4 - How to Integrate the WIxCS02 M.2 Wi-Fi® Module Card to an MPLAB® X IDE Project to Establish Wi-Fi Communication

Last modified by Microchip on 2025/07/07 14:44

Introduction

This guide outlines the process of integrating a WIxCS02 M.2 Wi-Fi® Module Card into an MPLAB® X IDE project using the SAM9X75 Early Access Curiosity Wireless Kit , which allows embedded systems to connect to wireless networks and enable cloud or local communication over standard protocols like TCP/IP, HTTP, or MQTT. This guide walks you through the steps required to interface an M.2 Wi-Fi module using Serial Peripheral Interface (SPI) with a SAM9X75 Curiosity Wireless Kit, and how to configure the necessary software components using MPLAB Harmony v3 and establish reliable Wi-Fi communication.

Whether you're building an Internet of Things (IoT) device, sensor hub, or connected appliance, understanding this integration process is essential for enabling wireless capabilities in your embedded project.

This application enables users to connect their device seamlessly to either a home or mobile Wi-Fi network, establishing internet connectivity. Once connected, the application communicates with a Simple Network Time Protocol (SNTP) server to retrieve the current date. The obtained time information is then accurately displayed on the serial console, allowing users or developers to monitor the synchronized system time in real-time.

Prerequisites

Follow steps mentioned below:

Add Project Graph and Develop an MPLAB Harmony Application

Follow the steps in Lab 1 and ensure you have cloned all the necessary libraries to create this thermostat MPLAB Harmony application.

Before continuing this lab, learn how to transmit the temperature value read from Temp&Hum13 Click boardTM by following Lab 3.

In this training module, you will learn how to connect to home or mobile Wi-Fi, read the current date from SNTP server and print it in the serial console.

Back to Top


The next step is to add WINCS02 drivers to the project graph. To do this, from the Device Resources pane, expand Wireless and add WINCS02.

Project graph

Back to Top


Now add a dependency for Timer by right-clicking on TMR and adding available satisfier as TC0 as shown in the accompanying image:

Add System Time to project graph

 

Back to Top


From the "SAM9X75-Curiosity User Guide", note that the M.2 WINCS02 SPI is interfaced to the SAM9X75 Curiosity board via FLEXCOM4 as shown in the accompanying image:
User Guide FLEXCOM reference

Back to Top


Now add a dependency to WINCS02 as FLEXCOM4. Right-click on WINCS02 and select  Available Satisfiers > FLEXCOM4 to add FLEXCOM4 to the Project Graph.
Add FLEXCOM4

 

Back to Top


Now add SYS_CONSOLE to the Project Graph to print system console messages as shown in the accompanying image:

Add System console

 

Back to Top


Now add RNWF WINCS Wi-Fi Service to the Project Graph as shown in the accompanying image:
RNWF WINCS Wi-Fi Service in the Project Graph

 

Back to Top


The next step is to configure the WINCS02 module added in the Project Graph.
Observe and verify the WINCS02 and FLEXCOM4 configurations are the same as in the accompanying image.

WINCS02 and FLEXCOM4 configurations

Back to Top


The next step is to configure the RNWF WINCS Wi-Fi service added in the Project Graph.
In this example, WINCS02 is configured to Station mode with the required Wi-fi access point as given below:

  • SSID: DEMO_AP
  • Security type: WPA2
  • Password: password
  • Auto Connect: enabled
  • Host: SAM9X75
  • Wi-Fi device: WINCS02
  • Interface Mode: SPI
  • Country Code: GEN
  • SNTP Server address: 162.159.200.1 (162.159.200.1 is a SNTP/NTP server IP operated by Cloudflare®)

Project Graph

Information

Refer to the "RNWF02 Application Developer's Guide" to learn about other Wi-Fi services, modes and configurations.

Back to Top


Add the pin configurations. To do this, go to Project Graph > Plugins > Pin Configuration.
Pin Config

Back to Top


For SAM9X75 Curiosity, WINCS02 is connected as follows:

WINCS02 is connection

Now, configure the pins as shown in the accompanying image:
Pin Configuration

1750225118626-924.png

Back to Top


Save and then click the Generate button. This will generate code for all the device resources that have been added in the Project Graph.
Device Resources added to the Project Graph

Back to Top


Up to this point you used MPLAB Code Configurator (MCC) to configure and generate code to initialize the device (SAMA9X75). All that is left is for you to do is to write the application code in the main.c and app.c file.

Documentation for each of the peripheral libraries or driver libraries can be accessed as follows:

Back to Top


In this example, you can learn how to connect to home or mobile Wi-Fi, read the Greenwich Mean Time from SNTP server and print it in the serial console.

See the example application source files

APIs used for this application are as follows:

  • SYS_WINCS_WIFI_CallbackHandler();
  • SYS_WINCS_WIFI_SrvCtrl
  • SYS_WINCS_SYSTEM_SrvCtrl();

Back to Top


Download and add the source file to the project as shown in the accompanying image:Source file

Similarly, add the header file as shown in the accompanying image:

Header file

Back to Top


The  app_wincs02_task should be called periodically to connect to Wi-Fi and to read date over SNTP server.  Refer to the sample app.c source files.

 

Back to Top


Now clean and build the code. Refer to the sample application project source files​.

Back to Top


To debug this application, follow steps 1-13 in Lab 7.

Run the application from the MPLAB X IDE.

Turn on the mobile hotspot/home Wi-Fi configured with
Username: DEMO_AP

Password : password.

The WINCS02 module will auto detect the Wi-Fi and read the time from the SNTP server and print the debug log.Debug log

Back to Top


To boot the application from microSD™ card follow the below steps:

Create harmony.bin file by following step 14 in Lab 7.

Now copy the generated harmony.bin file from your project directory and boot.bin file to the microSD card.

Insert the microSD card into the SD card J14 slot. Power the board on. Press the rest button (sw3) on the board.

Observe the output as mentioned in the previous step.

Back to Top

Summary

In this training, you developed, configured, and built an MPLAB Harmony v3 application that will connect to the mobile hotspot or home Wi-Fi and read the current date from the SNTP server for the SAM9X75 Curiosity Wireless Kit. 

Back to Top

Learn More

Back to Top