I. Introduction
This article describes the process of creating a simple Wi-Fi and Ethernet application on aPIC®32MX microcontroller using theMPLAB® Harmony software framework. The concept is equally applicable when you want to addWi-Fi® and/or Ethernet functionality to an existing PIC32 Harmony project.
What you will need
Software
| Tool | About | Installers | Installation Instructions | ||
|---|---|---|---|---|---|
| Windows | Linux | Mac OSX | |||
MPLAB® X Integrated Development Environment Version 4.0( Not Current Release) | | | | | |
MPLAB® XC32 C/C++ Compiler | | | | | |
![]() MPLAB Harmony Integrated Software Framework v2.04 | | | | | |
![]() MPLAB® Harmony Configurator (MHC) Plugin v2.0.4.0 | | | | | |
![]() Tera Term Terminal Emulator Communications Program | | | | | |
Hardware
| Tool | About | Purchase |
|---|---|---|
![]() PIC32MX795F512L Plug-in-Module | | |
![]() Explorer 16/32 Development Board You may use Explorer 16 as an alternative | | |
![]() WINC1500 PICTAIL™/PICTAIL PLUS Daughter Board Part Number: AC164156 | | |
![]() Fast 100 Mbps Ethernet PICtail Plus Daughter Board ENC624J600 10/100 Base-T Ethernet | | |
![]() PICtail™ Plus Expansion Board Part Number: AC240100 | | |
![]() MPLAB REAL ICE™ You may also use ICD3 or ICD4 | | |
Reference Documents
- Harmony Compiled HTML Help filehelp_harmony.chm (located atC:\microchip\harmony\v2_04\doc\
- PIC32MX795F512L 100-pin to 100-pin TQFP CAN-USB Plug-in Module (PIM) Information Sheet
- WINC1500 PICTAILTM/PICTAIL PLUS Daughter Board User’s Guide
- Fast 100 Mbps Ethernet PICtail™ Plus Daughter Board User’s Guide
- Explorer 16 Development Board User’s Guide
Alternate Development tools
If you do not have the specific tools listed above, you can study the process of configuring drivers in MHC as shown in this article and port it to other combinations of development tools. For example:
You can also use this article in combination with online help available on Microchip Developer Help (clickhere) and replace the Wi-Fi function with Ethernet. The Developer Help website contains a lot of interesting Harmony tutorials including peripherals and middleware.
II. Getting Started
You will implement a TCP server running on the PIC32 microcontroller which is connected to a local Wi-Fi network through WINC1500 module in Bypass mode (i.e. using Harmony TCP/IP Stack instead of the on-board WINC TCP/IP Stack). At present, the Harmony driver for WINC1500 is only supported withFreeRTOS™ to maintain the non-blocking behavior of Harmony framework. You will use the latest FreeRTOS version that is bundled with the Harmony installation. The “Application templates” feature in Harmony provides a good base to build custom applications. You will use the TCP server template to write your code. Once Wi-Fi is working, you will extend this project by adding the Ethernet function to it.
III. Using MPLAB® MHC plugin to import, configure modules and generate application templates
1
Create New Project
a
StartMPLAB X IDE and create a 'new project'.
b
Select '32-bit MPLAB Harmony Project'.
c
Complete the Harmony project details as shown in the image below.
You can keep the default Project Location in theapplications folder or set a desired one as shown below.
d
Enter an appropriate 'Configuration Name'.
If there is no target board available for your microcontroller, leave it blank. It is helpful for importing respective board support package.
e
Click on theFinish button to create a project which launches the MHC by default.
2
Configuring FreeRTOS
b
Expand the 'RTOS Configuration' tree:
- Set 'Tick rate (Hz)' to1000
- Set 'Minimal stack size' to512 bytes
- Set 'ISR stack size' to512 bytes
- Set 'Memory management type' toHeap 2
- Set 'Total heap size' to40960 bytes
The increased stack and heap sizes are to accommodate TCP/IP and Wi-Fi driver tasks.
Note that timer and clock speed options are locked to specified values. This indicates Timer 1 is used by FreeRTOS to manage ticks. Each module (drivers and system services) in MHC will contain its own RTOS configuration settings which will be addressed in following sections.
3
Setting FreeRTOS Application Task(s)
a
Under the MHC 'Options' tab, expand the 'Application Configuration' tree:
- Set the 'Number of Applications' to1
For now you are creating only one application.
b
Expand the 'Application 0 Configuration' tree:
- Set the 'Application Name' to something meaningful (for example:wnetcom)
This is your Wi-Fi network application.
- Enable 'Generate Application Code For Selected Harmony Components'
c
Expand TCPIP:
- Enable 'TCP Server: Transmit and Receive (same socket)'
If you want, change the TCP template parameters (port, text, etc.). Otherwise keep them as default.
If you are adding a new application to an existing project, make sure you increment the 'Number of Applications' number and select appropriate 'Application-‘n’-Configuration'.
d
Under 'Application 0 Configuration' expand 'RTOS Configuration':
- Set 'Task Priority' to2
- Enable 'Use Task Delay?' by checking the box
- Set 'Task Delay' to1
MHC will highlight a conflict at this point. You may notice grayed out modules in MHC. Ignore them for now. You will resolve them later.
5
Setting FreeRTOS System Task
a
Under the MPLAB Harmony Configurator 'Options' tab, expand the 'Harmony Framework Configuration' tree.
b
Expand the 'RTOS Configuration' tree:
- Set 'System Task Size' to 2048
- Set 'System Task Priority' to3
- Enable 'Use System Task Delay?' by checking the box
- Set 'System Task Delay' to1
At this point, you have configured a FreeRTOS system task and FreeRTOS application task.
To achieve consistency with the Harmony structure without RTOS (i.e. aSYS_Tasks() super loop), MHC will provide you a choice to include further driver tasks as a part of 'system task' or to be 'standalone task'. You will set drivers and systems services as part of 'system task' whereas Wi-Fi driver has to be run as 'standalone task'.
6
Debug and Reset System Services
The WINC1500 Wi-Fi driver uses the Debug system service to send logs to the console output.
a
Under 'Harmony Framework Configuration', expand 'System Services'.
MHC has interdependencies between modules. Enabling one module sometimes enables the dependent modules.
7
Command and Console System Service
For any embedded project, it is important to have a way of printing messages to the console for debugging purposes. For this project, you will use the Harmony Command and Console System Service to send messages to a host computer using the UART module. The Explorer 16 board features a UART communication interface (Refer to the Explorer 16 User’s Guide).
In the following steps, you will be configuring the corresponding UART driver to work with the console service.
c
Under 'Harmony Framework Configuration' expand 'Drivers'.
The 'Use USART Driver?' module should already be enabled because of the previous step.
d
Expand 'USART Driver Instance 0':
- Under 'RTOS Configuration (Instance 0)', 'Run This Driver Instance As' toCombined with System Tasks
- Set 'USART Module ID' toUSART_ID_2
This is because the Explorer 16 board UART2 is connected to the UART interface.
To complete UART driver configuration you will need to assign Tx/Rx pins for UART2 module. From the schematics(Refer to Explorer 16 User's Guide), note that U2RX is pin-49 (RF4) and U2TX is pin-50 (RF5).
Sometimes there may be a conflict with pin assignments. You will need to un-assign them from the pin table first.
You can right click on module name in Pin Table and isolate them for a better view as shown above.
To revert, right click on modulename>show> all.
8
Configuring TCP/IP Module:
a
Expand 'TCP/IP Stack' tree:
- 'Use TCP/IP Stack?' should already be enabled due to the TCP template configuration inStep 3.
b
Expand 'Use TCP\IP Stack?' tree:
- Under 'RTOS Configuration', set 'Run Library Tasks As' toCombined with System Tasks
c
Expand 'Network Configuration 0' tree:
- Set 'Interface' toWINC1500
- Enter a suitable 'Host Name' (for example:PIC32_WINC)
The TCP/IP Stack can support multiple network interfaces. For example, you can have a single Wi-Fi or simultaneous Ethernet and Wi-Fi interfaces defined here. For this article, you will only use one Wi-Fi instance.
Leave other network parameters for the TCP/IP Stack to configure since we use DHCP client to get valid IP address (if you want to use static IP, enter it here and disable DHCP client).
d
Under 'Network Configuration Start-up Flags', make sure that 'DNS Client Enabled on this Interface' is checked.
e
Enable 'Use ICMPv4 Server'
This will allow you to use the ping service.
f
The WINC1500 Wi-Fi driver uses Wi-Fi commands:
- Enable 'Use TCP/IP Commands':
- Check 'Enable Storage for Stack Commands'
- Check 'Enable Wi-Fi Related Commands'
9
Configuring Timer System Service and Timer Driver
At this point, you will need to configure corresponding drivers and services for the TCP/IP Stack. The TCP/IP Stack uses Timer System Service to keep track of all the timeout events. After looking at the Timer System Service, you will notice that it uses 'Timer Driver instance 0'. This means you will need to configure both Timer System Service and Timer Driver (which will be done in this Step). Also, since the PIC32 communicates to the WINC1500 module via an SPI interface on the Explorer 16 board, you need to configure two drivers:Wi-Fi (Step 10) andSPI (Step 12).
b
Under 'Harmony Framework Configuration':
- Expand 'Drivers'.
In Timer driver, MHC has detected a conflict. Expand it to see why.
10
Configuring Wi-Fi Driver
a
Under 'Drivers':
- Disable 'Use Internal Ethernet MAC Driver?' by unchecking the box
This is important because enabling the TCP module inStep 3 - Setting up FreeRTOS Application Task(s) enables the Ethernet driver by default. In order to use Wi-Fi, you must disable it for this project.
b
Under the 'Wi-Fi' driver:
- Enable 'Use Wi-Fi Driver?'
- Set 'Wi-Fi Device' toWINC1500
- Under 'RTOS Configuration', ensure that 'Run Wi-Fi Driver RTOS Task' is set toStandalone
- Ensure 'Wi-Fi Network Type' is set toInfrastructure which means you will connect the WINC1500 to an existing Wi-Fi network
- Enter the 'Wi-Fi SSID' in the space provided or indicated by<Your Wi-Fi Name> in the image below
- Set 'Wi-Fi Security Mode' to your security mode
- Enter the 'Wi-Fi WPA-PSK' or 'WPA2-PSK Pass Phrase' in the space provided or indicated by<Your Wi-Fi Password> in the image below
c
Set WINC1500 Pin Port Channels and Pin Bit Positions
You can determine the Pin Port Channels and Pin Bit Positions by examiningAppendix A-1. The WINC1500 to PIC32 connections are shown in the table below:
| WINC1500 pin | PIC32 Pin Port | PIC32 Pin Bit |
|---|---|---|
| Chip Enable | F | 1 |
| Reset | F | 0 |
| Interrupt | E | 8 (INT10) |
| SPI Clock | D | 10 (SCK1) |
| SPI Data IN | D | 0 (SDO1) |
| SPI Data OUT | C | 4 (SDI1) |
| SPI Slave Select | D | 9 (SS1) |
g
Go to the Harmony 'Pin Settings' tab and change 'Function' for pin number87 (RF0) and88 (RF1) toGPIO_OUT. These two pins areReset andChip Enable. You will set the SPI pins later inStep 12.
Note that you will be using theExternal Interrupt for Change Notification. This means you need to configureExternal Interrupt Service under 'System Services' (Step 11).
11
Setting External Interrupt System Services
a
Go toSystem Services > Interrupts:
- Enable 'Use External Interrupts?' by checking the box
External interrupts will be used by the Wi-Fi driver.
b
Ensure 'External Interrupt Instance 0' is enabled:
- Set 'External Interrupt Module ID' toINT_EXTERNAL_INT_SOURCE_1
This will connect the WINC1500 interrupt pin to the PIC32 INT1 pin.
- Enable 'Generate ISR Code?' :
- Set 'Interrupt Priority' toINT_PRIORITY_LEVEL3
- Set 'Interrupt Sub-priority' toINT_SUBPRIORITY_LEVEL1
- Set 'Polarity' toINT_EDGE_TRIGGER_FALLING
12
Configuring SPI Driver:
You will be using the SPI driver in interrupt mode.
You may see MHC showing SPI driver grayed out.
b
Under 'SPI Driver Instance 0':
- Set 'RTOS Configuration (Instance 0)' toCombined with System Tasks
- Set 'SPI Module ID' toSPI_ID_1
- Enable 'Driver Mode' by checking the 'Interrupt Mode' box (This should resolve the SPI issue.)
- Set 'Clock Mode' toDRV_SPI_CLOCK_MODE_IDLE_LOW_EDGE_FALL
- Set 'Dummy Byte Value' to0x00
13
Complete the MHC Configuration
a
Click on theGenerate Code button in the MHC toolbar.
b
Save the configuration in next popup window.
You will notice several source files and header files created in the project window.
- main.c file has the generic state machine while loop.
- wnetcom.c file is your application file where you will be writing and updating code.
All the variable and state names will be coherent with your application name defined inStep 3.
You can close MHC now. To re-open, set the project as Main Project and go toTools> Embedded > MHC
IV. Adding code to the application template
In this section you will write a simple LED toggle application which receives commands from the Tera Term terminal emulation program which acts as a TCP Client.
In thewnetcom.c file (underSource Files > app >), you will notice that MHC has generated a basic TCP server template for you. The three functions are:
- void WNETCOM_Initialize (void)
- void WNETCOM_Tasks (void)
- static void TCP_Server_TXRX_Task (void)
The basic flow of the project is as follows:
- Check if TCP/IP Stack is successfully initialized. Proceed after successful initialization.
- Check the number of available network interfaces. (in our case, it’s only 1: Wi-Fi)
- Wait till the interface receives a valid IP address from DHCP server.
- After receiving a valid IP, open a TCP server socket on the specified port.
- Wait for incoming connection from a TCP Client.
- After receiving a TCP Client connection, send the greeting “Hello Client!”
- Wait for any messages from the client and parse them. Toggle LED on Explorer 16 board if a valid message is received.
- Keep checking the connection continuously.
- Notify when the client disconnects.
- Go back to step (5).
API functions used are:
(You can read their description inC:\microchip\harmony\v2_04\doc\help_harmony.htm file)
- TCPIP_STACK_Status()
- TCPIP_STACK_NumberOfNetworksGet()
- TCPIP_STACK_IndexToNet()
- TCPIP_STACK_NetAddress()
- TCPIP_STACK_NetIsReady()
- TCPIP_TCP_ServerOpen()
- TCPIP_TCP_ArrayPut()
- TCPIP_TCP_GetIsReady()
- TCPIP_TCP_ArrayGet()
By referring to the code flow above and the API functions, analyze the application structure. Let’s start adding code to your application file. (Line numbers in the images are for reference only and may vary in your project).
2
IfTCPIP_STACK_Status() returns a negative value, notify user that TCP Stack Initialization has failed. You will use the console service API to send formatted strings to the serial terminal.
Make sure you put console print statements before state variable changes in code. Otherwise the logs may be confusing!
SYS_CONSOLE_PRINT("WNETCOM[%d]: TCP/IP stack initialization failed!\r\n", wnetcomData.state);5
At this point, the functionWNETCOM_Tasks() enters stateWNETCOM_STATE_SERVICE_TASKS where it is executingTCP_Server_TXRX_Task() continuously. This function maintains its own state machine to handle the TCP server.
In theWNETCOM_STATE_INIT state, set the TXRX state machine inWNETCOM_TCPIP_WAIT_FOR_IP after TCP/IP Stack state becomesSYS_STATUS_READY. Change the TXRX function code in theWNETCOM_TCPIP_WAIT_FOR_IP state as follows:
case WNETCOM_TCPIP_WAIT_FOR_IP: { // Check if the IP address of an interface has changed wnetcom_nNets = TCPIP_STACK_NumberOfNetworksGet(); for (i = 0; i < wnetcom_nNets; i++) { wnetcom_netH = TCPIP_STACK_IndexToNet(i); ipAddr.Val = TCPIP_STACK_NetAddress(wnetcom_netH); if (dwLastIP[i].Val != ipAddr.Val) { dwLastIP[i].Val = ipAddr.Val; SYS_CONSOLE_PRINT("TCP_TXRX[%d]: IP Address: ", wnetcomData.txrxTaskState); SYS_CONSOLE_PRINT("%d.%d.%d.%d \r\n", ipAddr.v[0], ipAddr.v[1], ipAddr.v[2], ipAddr.v[3]); if (ipAddr.v[0] != 0 && ipAddr.v[0] != 169) // Wait for a Valid IP { wnetcomData. txrxTaskState = WNETCOM_TCPIP_OPENING_SERVER; } } } } break;6
Once a valid IP Address is received, proceed to open a TCP server. Add a couple of console statements toWNETCOM_TCPIP_OPENING_SERVER state for checking (code locations as shown in image below).
SYS_CONSOLE_PRINT("TCP_TXRX[%d]: Couldn't open server socket\r\n", wnetcomData.txrxTaskState); SYS_CONSOLE_PRINT("TCP_TXRX[%d]: Waiting for Client Connection on port: %d\r\n", wnetcomData.txrxTaskState, wnetcomData.port);8
ModifyWNETCOM_TCPIP_WAIT_FOR_RESPONSE state so that if connection is closed, state will be changed toWNETCOM_TCPIP_WAIT_FOR_CONNECTION. If data is received from the client, parse it and add logic for toggling LED’s.
case WNETCOM_TCPIP_WAIT_FOR_RESPONSE: { if (!TCPIP_TCP_IsConnected(wnetcomData.socket)) { SYS_CONSOLE_PRINT("TCP_TXRX[%d]: Connection closed/lost\r\n", wnetcomData.txrxTaskState); SYS_CONSOLE_PRINT("TCP_TXRX[%d]: Waiting for Client Connection on port: %d\r\n", wnetcomData.txrxTaskState, wnetcomData.port); wnetcomData.txrxTaskState = WNETCOM_TCPIP_WAIT_FOR_CONNECTION; break; } if (TCPIP_TCP_GetIsReady(wnetcomData.socket)) { TCPIP_TCP_ArrayGet(wnetcomData.socket, wnetcomMsgFromClient, sizeof(wnetcomMsgFromClient) - 1); SYS_CONSOLE_PRINT("TCP_TXRX[%d]: Client sent: %s\r\n", wnetcomData.txrxTaskState, wnetcomMsgFromClient); if (strncmp((char*) wnetcomMsgFromClient, (const char *) "toggle D", 8) == 0) { if (wnetcomMsgFromClient[8] == '3') { BSP_LEDToggle(BSP_LED_3); SYS_CONSOLE_PRINT("TCP_TXRX[%d]: LED D%c is toggled\r\n", wnetcomData.txrxTaskState, wnetcomMsgFromClient[8]); } if (wnetcomMsgFromClient[8] == '4') { BSP_LEDToggle(BSP_LED_4); SYS_CONSOLE_PRINT("TCP_TXRX[%d]: LED D%c is toggled\r\n", wnetcomData.txrxTaskState, wnetcomMsgFromClient[8]); } } } } break;9
All the necessary changes are complete. Feel free to modify the parsing code, add more states to the TXRX function to handle the closing of sockets, or implement timeout for sockets and so on.
- Save changes
- Click onClean and Build Main Project icon in the MPLAB IDE toolbar
- Check for errors
Do not program the device yet.
V. PC interface to interact with the PIC32 based TCP server
1
Connect the serial port connector on Explorer 16 board to the host computer.
2
Connect the WINC1500 PICtail in top socket of J5 connector (SPI1).
3
Connect power supply and programmer tool to the Explorer 16 board.
For the Wi-Fi portion of this project, you can plug in only the WINC1500 PICtail Plus daughter board. The ENC624J600 PICtail Plus will be used later.
5
ClickMake and Program Device Main Project icon in the MPLAB X IDE toolbar.
Once the PIC32 is successfully programmed, you will see the following messages on the serial terminal. These messages include system debug messages as well as console print statements that you just put in. Numbers in square brackets are the state numbers from respective functions for easier debugging.
VI. Adding Ethernet using MHC
Now that you have a working Wi-Fi project you can extend its functionality by adding Ethernet so that you can have simultaneous Wi-Fi and Ethernet.
You will be connecting theFast 100 Mbps Ethernet PICtail™ Plus Daughter Board (ENC624J600) to theExplorer 16 Development Board orExplorer 16/32 Development Board with aPICtail Plus Expansion Board and communicating via the SPI2 serial interface. You will need to configure the following modules:
- TCP/IP Stack
- ENCx24J600 driver
- SPI driver
- Interrupt driver
.
1
Configuring the TCP/IP Stack:
In this step you will be configuring the TCP/IP stack to communicate with the Ethernet driver.
2
Configuring the ENCx24J600 driver
In this step, you will be configuring the ENCx24J600 driver.
a
UnderDrivers > ENCx24J600:
- Enable 'Use ENCx24J600 Driver?' by checking the box
b
Expand 'ENCx24J600 Driver Instance 0':
- Set 'SPI Driver Instance Number' to1
This is because the SPI driver instance 0 is communicating with the WINC1500 Wi-Fi module.
- Set 'ENCx24J600 SPI Slave Select Port Pin' toPORTS_BIT_POS_12
To identify pin mappings for ENCx24J600 module refer toAppendix A-2.
| ENC624J600 pin | PIC32 Pin Port | PIC32 Pin Bit |
|---|---|---|
| Interrupt | A | 15 (INT4) |
| SPI Clock | G | 6 (SCK2) |
| SPI Data IN | G | 8 (SDO2) |
| SPI Data OUT | G | 7 (SDI2) |
| SPI Slave Select | F | 12 |
| Shutdown | F | 13 |
3
Configuring the SPI Driver
In this step, you will be configuring the SPI driver to communicate with the ENC624J600 PICtail Plus daughter board via the SPI2 serial communications port.
a
Expand the 'SPI Driver' tree:
- Change the 'Number of SPI Driver Instances' to2
b
Under 'SPI Driver Instance 1' tree:
- Under 'RTOS Configuration (Instance 1)', set 'Run This Driver Instance As' toCombined with System Tasks
- Set 'SPI Module ID' toSPI_ID_2
- Set 'Clock\Baud Rate - Hz' to13333333
- Set 'Clock Mode' toDRV_SPI_CLOCK_MODE_IDLE_LOW_EDGE_FALL
- Set 'Input Phase' toSPI_INPUT_SAMPLING_AT_END
4
Setting External Interrupt System Service
In this step, you will be configuring the External Interrupt to communicate with the ENC62J600 PICtail Plus daughter board.
a
UnderSystem Services > Interrupts:
- Change the 'Number of External Interrupt Instances' to2
To be used by the ENC driver.
b
Under 'External Interrupt Instance 1':
- Change 'External Interrupt Module ID' toINT_EXTERNAL_INT_SOURCE_4
Because the ENCx24J600 interrupt pin connects to INT4.
- Enable 'Generate ISR Code?' by checking the box
- Set 'Interrupt Priority' toINT_PRIORITY_LEVEL3
- Set 'Interrupt Sub-priority' toINT_SUBPRIORITY_LEVEL1
- Set 'Polarity' toINT_EDGE_TRIGGER_FALLING
5
Completing the MHC Configuration
a
Click onGenerate Code button in MHC toolbar.
b
Save the configuration in next popup window.
c
In theGenerate Project window, select desired 'merging strategy' and clickGenerate.
In themerge window, ignore all the differences forwnetcom.c file and clickClose. This happens because MHC is comparing a fresh TCP template with your modified one.
6
Modifying Application code
In order to use the Command System Service to receive commands from the serial terminal, you need to addSYS_CMD_READY_TO_READ() function to the application loop.The function is necessary for the Command System Service and Console System Service to function correctly. You will call it inWNETCOM_Tasks() function inWNETCOM_STATE_SERVICE_TASKS state.
SYS_CMD_READY_TO_READ();VII. Testing Your New Application
1
Connect the serial port connector onExplorer 16 Development Board to the host computer.
2
Connect theWINC1500 PICtail/PICtail PLUS daughter board in top socket of J5 connector (SPI1).
3
Plug theENC624J600 Fast 100 Mbps Ethernet PICtail™ Plus Daughter Board in the SPI2 socket connector ofPICtail Plus Expansion board.
4
Connect power supply and programmer tool to the Explorer 16. board.
5
Open Tera Term and select the serial interface instance (seeSection V Step 4).
6
ClickMake and Program Device Main Project icon in the MPLAB X IDE toolbar.
Once the PIC32 is successfully programmed, you will see similar messages on the serial terminal as before (seeSection V Step 5).
7
You can make use of TCP/IP Commands available in the Harmony TCP/IP Stack. In the serial terminal, type commandnetinfo and observe the output. It will show the details of available interfaces and their status. You may notice that the interface names will match with the ones entered in MHC TCP/IP Stack settings.
8
As a simple test, pull out the Ethernet cable from the ENC module and notice the output fromnetinfo command again.
9
At this point, feel free to modify the socket function call to open the server socket on the desired interface. You may implement two different sockets (TCP Client or Server) listening on different interfaces.
VIII. Instructions for migrating this project
Things to take care of when using different hardware:
Which peripheral can be used for console I/O? For example, on some boards, you might have to use the USB CDC console.
Figure out the connections for your hardware. For example, on theCuriosity PIC32MZEF Development Board, there is a MRF24WN0MA module populated. Figure out how it interfaces with the onboard PIC32 microcontroller. Change the Wi-Fi and SPI drivers accordingly. Please refer to the Curiosity demo available on its product page for more information.
Taking it further
- Try adding this Wi-Fi or Ethernet driver to an existing project to add connectivity.
- Study the demo “wifi_easy_configuration” located atC:\microchip\harmony\v2_04\apps\tcpip
- Study other interesting Harmony demo’s located in the install directoryC:\microchip\harmony\v2_04\apps
- Visit Microchip Developer Help website (http://microchipdeveloper.com/harmony:start) for more tutorials.
IX. Troubleshooting
If you are having problems, please refer to theMicrochip Support pages.
Appendix A
A-1 Pin mapping between PIC32MX plug-in-module (PIM) and WINC1500 PICtail module
This section demonstrates how to map a WINC1500 module pin to PIC32 microcontroller pin. Refer to the three figures below for explorer 16 board, WINC1500 module and PIC32MX plug-in-module. An example of a pin mapping process is also provided after the third figure.
1. PICtail Plus connector on Explorer 16 board showing top socket:
2. WINC1500 PICTAIL/PICTAIL PLUS schematics:
3. Explorer 16 board schematic - PIM socket:
Using the three connection diagrams above, find the required plug-in-module(PIM) pins and then look-up those pins in the PIC32MX PIM sheet to get the actual microcontroller pins (As an example of mapping pins - WINC slave select connects to Pin 1 of J5 header on Explorer 16 board which connects to PIM pin 23 which is PIC32 device pin 69 > RD9.)
Here is a snapshot from the PIC32MX PIM sheet:
A-2 Pin mapping between PIC32MX plug-in-module and ENC624J600 PICTail module
1. ENC624J600 Fast 100 Mbps Ethernet PICtail Plus Daughter Board:































































