Skip to content

Commit 2b64cd4

Browse files
author
Microchip Technology
committed
Deploy 1.0.0 to pic-avr-solutions github
0 parents  commit 2b64cd4

File tree

229 files changed

+33593
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

229 files changed

+33593
-0
lines changed

.main-meta/main.json

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
{
2+
"metaDataVersion": "1.0.0",
3+
"category": "com.microchip.ide.project",
4+
"content": {
5+
"metaDataVersion": "1.3.0",
6+
"name": "com.microchip.mcu8.mplabx.project.pic-tcpip-lite-enc28j60-solution",
7+
"version": "1.0.0",
8+
"displayName": "ENC28J60 TCPIP Solutions with PIC",
9+
"projectName": "pic-tcpip-lite-enc28j60-solution",
10+
"shortDescription": "This MPLAB® X MCC example shows implementation of TCP/IP Lite Applications using Microchip ENC28J60 Ethernet Driver on a PIC® Device",
11+
"ide": {
12+
"name": "MPLAB X",
13+
"semverRange": "^6.10.0"
14+
},
15+
"compiler": [
16+
{
17+
"name": "XC8",
18+
"semverRange": "^2.41.0"
19+
}
20+
],
21+
"dfp": {
22+
"name": "PIC18F-Q_DFP",
23+
"semverRange": "^1.14.237"
24+
},
25+
"configurator": {
26+
"name": "MCC",
27+
"semverRange": "^5.3.7"
28+
},
29+
"device": {
30+
"metaDataVersion": "1.0.0",
31+
"category": "com.microchip.portal.contentRef",
32+
"content": {
33+
"metaDataVersion": "1.0.0",
34+
"category": "com.microchip.device",
35+
"name": "PIC18F47Q10",
36+
"versionRange": "*"
37+
}
38+
},
39+
"author": "Microchip",
40+
"peripherals": [
41+
"Interrupt",
42+
"SPI"
43+
],
44+
"keywords": [
45+
"MCC Melody",
46+
"TCPIP",
47+
"Ethernet",
48+
"Curiosity Nano",
49+
"MikroE Click Board"
50+
],
51+
"additionalData": {
52+
"longDescription": {
53+
"metaDataVersion": "1.0.0",
54+
"category": "com.microchip.portal.fileRef",
55+
"content": {
56+
"metaDataVersion": "1.0.0",
57+
"fileName": "./README.md",
58+
"mimeType": "text/markdown"
59+
}
60+
}
61+
}
62+
}
63+
}

LICENSE.TXT

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
© [2023] Microchip Technology Inc. and its subsidiaries
2+
3+
Subject to your compliance with these terms, you may use Microchip software and any derivatives
4+
exclusively with Microchip products. You are responsible for complying with 3rd party license terms
5+
applicable to your use of 3rd party software (including open source software) that may accompany
6+
Microchip software. SOFTWARE IS “AS IS.” NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR
7+
STATUTORY, APPLY TO THIS SOFTWARE, INCLUDING ANY IMPLIED WARRANTIES OF NON-
8+
INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT
9+
WILL MICROCHIP BE LIABLE FOR ANY INDIRECT, SPECIAL, PUNITIVE, INCIDENTAL OR
10+
CONSEQUENTIAL LOSS, DAMAGE, COST OR EXPENSE OF ANY KIND WHATSOEVER RELATED
11+
TO THE SOFTWARE, HOWEVER CAUSED, EVEN IF MICROCHIP HAS BEEN ADVISED OF THE
12+
POSSIBILITY OR THE DAMAGES ARE FORESEEABLE. TO THE FULLEST EXTENT ALLOWED BY
13+
LAW, MICROCHIP’S TOTAL LIABILITY ON ALL CLAIMS RELATED TO THE SOFTWARE WILL NOT
14+
EXCEED AMOUNT OF FEES, IF ANY, YOU PAID DIRECTLY TO MICROCHIP FOR THIS SOFTWARE.

Microchip TCPIP Demo GUI.jar

125 KB
Binary file not shown.

README.md

Lines changed: 179 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,179 @@
1+
<!-- <a href="https://www.microchip.com"><img src="images/microchip.png" alt="Microchip" width=20% /></a> -->
2+
3+
<a target="_blank" href="https://www.microchip.com/" id="top-of-page">
4+
<picture>
5+
<source media="(prefers-color-scheme: light)" srcset="images/mchp_logo_light.png" width="350">
6+
<source media="(prefers-color-scheme: dark)" srcset="images/mchp_logo_dark.png" width="350">
7+
<img alt="Microchip Technologies Inc." src="https://www.microchip.com/content/experience-fragments/mchp/en_us/site/header/master/_jcr_content/root/responsivegrid/header/logo.coreimg.100.300.png/1605828081463/microchip.png">
8+
</picture>
9+
</a>
10+
11+
# TCP/IP Lite Solutions for PIC® Using ENC28J60
12+
13+
## Introduction
14+
15+
This repository provides MPLAB® X IDE projects that are suitable for the PIC18F-Q10 product family and contain solutions for User Datagram Protocol (UDP), as well as Transmission Control Protocol/Internet Protocol (TCP/IP) Client and Server demo applications.
16+
17+
## Hardware Requirements
18+
19+
1. [PIC18F47Q10 Curiosity Nano Evaluation Kit](https://www.microchip.com/en-us/development-tool/dm182029)
20+
2. [ETH Click](https://www.mikroe.com/eth-click)
21+
3. [Curiosity Nano Base for Click Boards™](https://www.microchip.com/en-us/development-tool/AC164162)
22+
4. RJ45 Network Connector Cable
23+
5. USB 2.0 to Micro B Cable
24+
25+
## Software Requirements
26+
27+
1. [MPLAB X IDE v6.10 or later](https://www.microchip.com/en-us/tools-resources/develop/mplab-x-ide#tabs)
28+
2. [MPLAB XC8 Compiler v2.41 or later](https://www.microchip.com/en-us/tools-resources/develop/mplab-xc-compilers/downloads-documentation#XC8)
29+
3. [MPLAB Code Configurator (MCC) v5.3.7 or later](https://www.microchip.com/en-us/tools-resources/configure/mplab-code-configurator)
30+
4. MCC Melody Core v5.5.7 or later
31+
5. Ethernet Drivers Library v6.0.0
32+
6. TCP/IP Lite Library v5.0.0
33+
7. [Microchip TCP/IP Demo GUI](Microchip TCPIP Demo GUI.jar)
34+
8. [Wireshark Network Analyzer Tool](https://www.wireshark.org/)
35+
36+
## Related Documentation
37+
38+
1. [PIC18F47Q10 Data Sheet](https://www.microchip.com/en-us/product/PIC18F47Q10)
39+
2. [ENC28J60](https://www.microchip.com/en-us/product/ENC28J60)
40+
3. [Ethernet Drivers Library Release Notes](https://onlinedocs.microchip.com/oxy/GUID-F319A0CC-8179-4113-B2F3-AA69D1B2C216-en-US-4/GUID-8B345417-6295-49E6-ABEB-D2FA8A5D5561.html)
41+
4. [TCP/IP Lite Library Release Notes](https://onlinedocs.microchip.com/oxy/GUID-AD30B8D1-D966-45C9-950F-6B266508AA41-en-US-4/index.html)
42+
43+
## Hardware Setup
44+
45+
1. Mount the PIC18F47Q10 Curiosity Nano board on the Curiosity Nano Base for Click boards and power it on using a USB 2.0 to Micro B Cable.
46+
2. Mount the ETH Click board on the mikroBUS™ socket 1 of Curiosity Nano Base and connect to a network switch using a RJ45 network connector cable.
47+
<br><img src="images/PIC_Setup.png" alt="PIC Setup" width=40% />
48+
49+
## TCP/IP Client Solution
50+
51+
1. Open MPLAB X IDE.
52+
2. Select *File>Open Project>enc28j60-pic-tcpclient.X*.
53+
3. Right click ```enc28j60-pic-tcpclient.X``` and select Set as Main Project.
54+
<br><img src="images/project_setup.png" alt="project_setup" width=80% />
55+
56+
57+
4. Open the Command Prompt/Terminal window, type ```ipconfig``` and press 'Enter' to get the system IP address.
58+
<br><img src="images/pcipaddress.png" alt="pcipaddress" width=80% />
59+
60+
5. Modify the server IP address with your system IP address in the ```tcp_client_demo.c``` file under the ```TCP_Client_Initialize()``` function. Make a note of the ```remoteSocket.port``` set in the code.
61+
```
62+
void TCP_Client_Initialize(){
63+
64+
// Initialize the server IP address with your system IP address
65+
remoteSocket.addr.s_addr = MAKE_IPV4_ADDRESS(10, 14, 5, 127);
66+
remoteSocket.port = 65534;
67+
}
68+
```
69+
6. Click **Clean and Build Main Project** and make sure the project builds successfully.
70+
7. Click **Make and Program Device Main Project** and check that the programming is complete.
71+
8. Open Wireshark Network Analyser Tool with Administrator Privileges. From the Capture menu, select an interface to which the board and PC are connected. Click **Start capturing packets**.
72+
<br><img src="images/Wireshark_homepage.png" alt="Wireshark_homepage" width=80% />
73+
74+
9. Add the following filters: ```dhcp||icmp||tcp.port==65534```.
75+
<br><img src="images/tcpclient_filter.png" alt="tcpclient_filter" width=80% />
76+
77+
10. Open Microchip TCP/IP Demo GUI. Go to the **TCP Server Demo** tab and assign the port number as **65534** (noted in Step 5), then click the **Listen** button. The status of the TCP connection is printed in the STATUS text box.
78+
<br><img src="images/tclient_listen.png" alt="tclient_listen" width=40% /> <img src="images/tclient_connected.png" alt="tclient_connected" width=40% />
79+
80+
81+
11. After the connection is established:
82+
* Type your text in the Send text box (e.g., 'Hello CNano') and click the **Send** button. The text sent is displayed in the Sent/Received Data box.
83+
<br><img src="images/tcpclient_send1.png" alt="tcpclient_send1" width=40% /> <img src="images/tcpclient_send2.png" alt="tcpclient_send2" width=40% />
84+
85+
* Switch back to Wireshark and observe the packets with your system IP address as the source
86+
<br><img src="images/send_wireshark.png" alt="send_wireshark" width=80% />
87+
88+
* Click the **Led 0** button in the **TCP Server Demo** tab to toggle the LED0 on the Curiosity Nano board
89+
<br><img src="images/tcpclient_led0.png" alt="tcpclient_led0" width=40% />
90+
91+
* Switch back to Wireshark and observe the packets with your system IP address as the source
92+
<br><img src="images/ledon_wireshark.png" alt="ledon_wireshark" width=80% />
93+
94+
12. Click the **Disconnect** button to close the TCP connection. A "Client disconnected" message will appear in the STATUS text box.
95+
<br><img src="images/tcpclient_disconnect.png" alt="tcpclient_disconnect" width=40% />
96+
97+
## TCP/IP Server Solution
98+
1. Open MPLAB X IDE.
99+
2. Select *File>Open Project>enc28j60-pic-tcpserver.X*.
100+
3. Right click ```enc28j60-pic-tcpserver.X``` and select Set as Main Project.
101+
<br><img src="images/project_setup.png" alt="project_setup" width=80% />
102+
103+
4. Open Wireshark Network Analyser Tool with Administrator Privileges. From the Capture menu, select an interface to which the board and PC are connected. Click **Start capturing packets**.
104+
<br><img src="images/Wireshark_homepage.png" alt="Wireshark_homepage" width=80% />
105+
106+
5. Add the following filters: ```dhcp||icmp||tcp.port==7```.
107+
<br><img src="images/tcpserver_wfilter.png" alt="tcpserver_wfilter" width=80% />
108+
109+
110+
6. Click **Clean and Build Main Project** and make sure the project builds successfully.
111+
7. Click **Make and Program Device Main Project** and check that the programming is complete.
112+
8. Switch to Wireshark Network Analyser Tool and wait to receive the Dynamic Host Configuration Protocol (DHCP) handshake packets. Click DHCP ACK and expand the 'Dynamic Host Configuration Protocol' field to reveal the details. Make a note of the IP address in 'Your (client) IP address'.
113+
<br><img src="images/tcpserver_ipaddress.png" alt="tcpserver_ipaddress" width=80% />
114+
115+
9. Open Microchip TCP/IP Demo GUI. Go to the **TCP Client Demo** tab and assign the port number as **7** and server IP address as **10.14.5.95** (noted in Step 8). Click the **Connect** button. The status of the TCP connection is printed in the STATUS text box.
116+
<br><img src="images/tcpserver_connect.png" alt="tcpserver_connect" width=40% /> <img src="images/tcpserver_connect2.png" alt="tcpserver_connect" width=40% />
117+
118+
10. After the connection is established:
119+
* Type your text in the Send text box (e.g., 'Hello CNano') and click the **Send** button. The text sent is displayed in the Sent/Received Data box.
120+
<br><img src="images/tcpserver_send1.png" alt="tcpserver_send1" width=40% /> <img src="images/tcpserver_send2.png" alt="tcpserver_send2" width=40% />
121+
122+
* Switch back to Wireshark and observe the packets with your server IP address as the source to check the response
123+
<br><img src="images/tcpserver_send_wiresrk.png" alt="tcpserver_send_wiresrk" width=80% />
124+
125+
11. Click the **Disconnect** button to close the TCP connection. A "Connection Closed" message will appear in the STATUS text box.
126+
<br><img src="images/tcpserver_con_closed.png" alt="tcpserver_con_closed" width=40% />
127+
128+
## TCP/IP UDP Solution
129+
1. Open MPLAB X IDE.
130+
2. Select *File>Open Project>enc28j60-pic-udp.X*.
131+
3. Right click ```enc28j60-pic-udp.X``` and select Set as Main Project.
132+
<br><img src="images/pic_udp_setup.png" alt="pic_udp_setup" width=80% />
133+
134+
4. Open the Command Prompt/Terminal window, type ```ipconfig``` and press 'Enter' to get the system IP address.
135+
<br><img src="images/pcipaddress.png" alt="pcipaddress" width=80% />
136+
137+
5. Modify the server IP address with your system IP address in the ```udp_demo.c``` file under the ```UDP_Demo_Initialize()``` function.
138+
```
139+
void UDP_Demo_Initialize(void)
140+
{
141+
//Initialize the Destination IP address with your PC's IP address and Destination Port
142+
143+
/* UDP Packet Initializations*/
144+
udpPacket.destinationAddress = MAKE_IPV4_ADDRESS(10,14,5,127);
145+
udpPacket.destinationPortNumber = 65531;
146+
147+
udpPacket.sourcePortNumber = 65533;
148+
}
149+
```
150+
6. Make a note of the ```udpPacket.destinationPortNumber``` you set in the code (anything in the range of dynamic ports).
151+
7. Open Wireshark Network Analyser Tool with Administrator Privileges. From the Capture menu, select an interface to which the board and PC are connected. Click **Start capturing packets**.
152+
<br><img src="images/Wireshark_homepage.png" alt="Wireshark_homepage" width=80% />
153+
154+
8. Add the following filters: ```dhcp||icmp||udp.port==65531```.
155+
<br><img src="images/udp_filter.png" alt="udp_filter" width=80% />
156+
157+
9. Click **Clean and Build Main Project** and make sure the project builds successfully.
158+
10. Click **Make and Program Device Main Project** and check that the programming is complete.
159+
11. Switch to Wireshark Network Analyser Tool and wait to receive the Dynamic Host Configuration Protocol (DHCP) handshake packets. Click DHCP ACK and expand 'Dynamic Host Configuration Protocol' field to reveal the details. Make a note of the IP address in 'Your (client) IP address'.
160+
<br><img src="images/udp_handshake.png" alt="udp_handshake" width=80% />
161+
162+
12. Open Microchip TCP/IP Demo GUI:
163+
* Go to the **UDP** tab and assign the port number as **65531** (noted in Step 5). Click the **Listen** button (Click 'Allow Access' if a warning occurs).
164+
<br><img src="images/udp_listen.png" alt="udp_listen" width=40% />
165+
166+
* Assign server IP address as **10.14.5.128** (noted in Step 11). Click the **Claim** button.
167+
<br><img src="images/udp_claim.png" alt="udp_claim" width=40% />
168+
169+
* Click **1** under the LED section to toggle LED0 on the Curiosity Nano board and observe the Wireshark capture
170+
<br><img src="images/udp_led2.png" alt="udp_led2" width=40% />
171+
<br><img src="images/udp_led_wireshark.png" alt="udp_led_wireshark" width=80% />
172+
173+
174+
* Type your text in the Send Data box (e.g., 'Hello CNano') and click the **Send** button. Observe the packet in the Wireshark capture.
175+
<br><img src="images/udp_send1.png" alt="udp_send1" width=40% />
176+
<br><img src="images/udp_send_wireshark.png" alt="udp_send_wireshark" width=80% />
177+
178+
13. Press the SW0 switch on the Curiosity Nano board. Observe the packet which says 'Hello World' in the Wireshark capture.
179+
<br><img src="images/udp_helloworld.png" alt="udp_helloworld" width=80% />

enc28j60-pic-tcpclient.X/Makefile

Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
#
2+
# There exist several targets which are by default empty and which can be
3+
# used for execution of your targets. These targets are usually executed
4+
# before and after some main targets. They are:
5+
#
6+
# .build-pre: called before 'build' target
7+
# .build-post: called after 'build' target
8+
# .clean-pre: called before 'clean' target
9+
# .clean-post: called after 'clean' target
10+
# .clobber-pre: called before 'clobber' target
11+
# .clobber-post: called after 'clobber' target
12+
# .all-pre: called before 'all' target
13+
# .all-post: called after 'all' target
14+
# .help-pre: called before 'help' target
15+
# .help-post: called after 'help' target
16+
#
17+
# Targets beginning with '.' are not intended to be called on their own.
18+
#
19+
# Main targets can be executed directly, and they are:
20+
#
21+
# build build a specific configuration
22+
# clean remove built files from a configuration
23+
# clobber remove all built files
24+
# all build all configurations
25+
# help print help mesage
26+
#
27+
# Targets .build-impl, .clean-impl, .clobber-impl, .all-impl, and
28+
# .help-impl are implemented in nbproject/makefile-impl.mk.
29+
#
30+
# Available make variables:
31+
#
32+
# CND_BASEDIR base directory for relative paths
33+
# CND_DISTDIR default top distribution directory (build artifacts)
34+
# CND_BUILDDIR default top build directory (object files, ...)
35+
# CONF name of current configuration
36+
# CND_ARTIFACT_DIR_${CONF} directory of build artifact (current configuration)
37+
# CND_ARTIFACT_NAME_${CONF} name of build artifact (current configuration)
38+
# CND_ARTIFACT_PATH_${CONF} path to build artifact (current configuration)
39+
# CND_PACKAGE_DIR_${CONF} directory of package (current configuration)
40+
# CND_PACKAGE_NAME_${CONF} name of package (current configuration)
41+
# CND_PACKAGE_PATH_${CONF} path to package (current configuration)
42+
#
43+
# NOCDDL
44+
45+
46+
# Environment
47+
MKDIR=mkdir
48+
CP=cp
49+
CCADMIN=CCadmin
50+
RANLIB=ranlib
51+
52+
53+
# build
54+
build: .build-post
55+
56+
.build-pre:
57+
# Add your pre 'build' code here...
58+
59+
.build-post: .build-impl
60+
# Add your post 'build' code here...
61+
62+
63+
# clean
64+
clean: .clean-post
65+
66+
.clean-pre:
67+
# Add your pre 'clean' code here...
68+
# WARNING: the IDE does not call this target since it takes a long time to
69+
# simply run make. Instead, the IDE removes the configuration directories
70+
# under build and dist directly without calling make.
71+
# This target is left here so people can do a clean when running a clean
72+
# outside the IDE.
73+
74+
.clean-post: .clean-impl
75+
# Add your post 'clean' code here...
76+
77+
78+
# clobber
79+
clobber: .clobber-post
80+
81+
.clobber-pre:
82+
# Add your pre 'clobber' code here...
83+
84+
.clobber-post: .clobber-impl
85+
# Add your post 'clobber' code here...
86+
87+
88+
# all
89+
all: .all-post
90+
91+
.all-pre:
92+
# Add your pre 'all' code here...
93+
94+
.all-post: .all-impl
95+
# Add your post 'all' code here...
96+
97+
98+
# help
99+
help: .help-post
100+
101+
.help-pre:
102+
# Add your pre 'help' code here...
103+
104+
.help-post: .help-impl
105+
# Add your post 'help' code here...
106+
107+
108+
109+
# include project implementation makefile
110+
include nbproject/Makefile-impl.mk
111+
112+
# include project make variables
113+
include nbproject/Makefile-variables.mk

0 commit comments

Comments
 (0)