Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronic Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Register Log in

[SOLVED] TCP Client USB PIC32 starter kit

Status
Not open for further replies.

Saraa

Member level 1
Joined
Feb 16, 2010
Messages
33
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Activity points
1,524
Hi everybody,
I am working on a project that uses USB PIC32 starter kit, MRF24WB0MA and I/O Expansion Board.

I have modified GenericTCPServer code to send some data to a client (which in my case is a VI on LABView), This has been done successfully ..

My Problem is that I am trying to do the opposite, in other words, I am trying to make LABView as a Server and Pic32 kit as a client by modifying GenericTCPClient code but it didn't work, the communication between them couldn't be established!! The Server (LABView) keeps listening untill a limited time then disconnects!

if anybody can help solving this problem I will be very thankful

Regards;
Sara
 

horace1

Advanced Member level 5
Joined
Nov 18, 2008
Messages
2,123
Helped
596
Reputation
1,188
Reaction score
573
Trophy points
1,393
Location
Norwich, UK
Activity points
13,071
a couple of things
1. have you set up the firewall on the PC to allow external TCP connections to the port LABView is listening on?
2. is the machine you are using on a private network behind a NAT box, i.e. you need to port forward
 

Saraa

Member level 1
Joined
Feb 16, 2010
Messages
33
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Activity points
1,524
thanks for the reply horace..

for the first issue, yes the firewall has been set by LABView ..

for the second thing, I am using a cisco router and have my own network.
I have assigned the kit an IP address 192.168.1.106 and in the GenericTCPClient I wrote the IP address of the host which is automatically assigned by the router.

any suggestions?! ...

-Sara
 

horace1

Advanced Member level 5
Joined
Nov 18, 2008
Messages
2,123
Helped
596
Reputation
1,188
Reaction score
573
Trophy points
1,393
Location
Norwich, UK
Activity points
13,071
could it be a routing problem? what is the IP of the server? in practice it is best to use static IP addresses for servers

unfortunatly I have left my PIC32 USB/Ethernet starter kit in the office so cannot try it out myself
 

Saraa

Member level 1
Joined
Feb 16, 2010
Messages
33
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Activity points
1,524
but I could do the opposit .. I mean, I have modified GenericTCPServer code and sent data through router to the LABView (Client)...

from the Client side (LABView): Host IP address + prot number are used while from the Server side (Kit), only port number is used.
So, I'm going to use only a port number by LABView when I converted to Server, and initialize a port number + IP address by the GenericTCPClient.

I am still trying to figure out what the problem is ..

PS [Although I don't want to use HTTP example provided by the GenericTCPClient.C but I tried to run it to at least establish a connection but it didn't work! ]
 
Last edited:

horace1

Advanced Member level 5
Joined
Nov 18, 2008
Messages
2,123
Helped
596
Reputation
1,188
Reaction score
573
Trophy points
1,393
Location
Norwich, UK
Activity points
13,071
download wireshark and use it to look at the network traffic
Wireshark · Go deep.

this will show if the TCP packets from the PIC32 are arriving at the PC etc

can you ping the PIC32 ?
 
  • Like
Reactions: Saraa

    Saraa

    points: 2
    Helpful Answer Positive Rating

Saraa

Member level 1
Joined
Feb 16, 2010
Messages
33
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Activity points
1,524
I was just pinging the IP address .. and yes I can ping the IP assigned to the Kit ..
Thanks for the recommended link .. I will check it now :)
 

Saraa

Member level 1
Joined
Feb 16, 2010
Messages
33
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Activity points
1,524
any other suggestions?! ...
To be more clear .. I want to send data wirelessly without using the RS-232 cable ...
In this application, switch1 on the USB pic32 kit must be pressed to open the socket, and in my case i want to open the socket and be connected directly ..

could any one help me please!

-Sara
 
Last edited:

horace1

Advanced Member level 5
Joined
Nov 18, 2008
Messages
2,123
Helped
596
Reputation
1,188
Reaction score
573
Trophy points
1,393
Location
Norwich, UK
Activity points
13,071
I downloaded the Microchip applications library
TCP/IP Stack for PIC18, PIC24, dsPIC & PIC32

which include the TCP/IP stack.
I loaded the Microchip Solutions v2010-10-19\TCPIP Demo App example onto an Explorer 16 with a PIC32 PIM and a Ethernet PICtail™ Plus Daughter Board and
1. a C++ TCP client on a PC talked to the TCP server on the Explorer 16 OK
2. the TCP client on the Explorer 16 talked a Java TCP server on a PC OK (once I had opened the port in the firewall)

did wireshark show you the network traffic
 

Saraa

Member level 1
Joined
Feb 16, 2010
Messages
33
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Activity points
1,524
Thanks for the reply, I really appreciate it ..

The library you have mentioned is what I am using.
But, I am not using Explorer 16! My components are: USB Pic32 kit, Pictail MRF24WB0MA, and I/O Expansion board ..
that's why if I want to display data I must use "UART" and use Hyper-terminal that will be connected to a communication COM port. While I want to communicate wirelessly since my server is a LabView VI on another PC.

Unfortunately, wireshark doesn't show me the network traffic!! I will check the firewall again ..

-Sara
 

horace1

Advanced Member level 5
Joined
Nov 18, 2008
Messages
2,123
Helped
596
Reputation
1,188
Reaction score
573
Trophy points
1,393
Location
Norwich, UK
Activity points
13,071
when the client and server are communicating wireshark should show you information such as (plus lots of packets from other applications)
Code:
No.     Time        Source                Destination           Protocol Info
     17 15.988748   Microchi_00:00:5c     Broadcast             ARP      Who has 192.168.1.3?  Tell 192.168.1.5
     18 15.988792   IntelCor_62:86:7c     Microchi_00:00:5c     ARP      192.168.1.3 is at 00:21:5d:62:86:00
     19 15.990341   192.168.1.5           192.168.1.3           TCP      hydra > dnp [SYN] Seq=0 Win=100 Len=0 MSS=536
     20 15.990694   IntelCor_62:86:7c     Broadcast             ARP      Who has 192.168.1.5?  Tell 192.168.1.3
     21 15.992141   Microchi_00:00:5c     IntelCor_62:86:7c     ARP      192.168.1.5 is at 00:04:a3:00:00:00
     22 15.992188   192.168.1.3           192.168.1.5           TCP      dnp > hydra [SYN, ACK] Seq=0 Ack=1 Win=8192 Len=0 MSS=1460
     23 15.993513   192.168.1.5           192.168.1.3           TCP      hydra > dnp [ACK] Seq=1 Ack=1 Win=100 Len=0
the PC is 192.168.1.3 and the PIC24 is 192.168.1.5. this shows (using the number at the start of the line)
17 an ARP from the 192.168.1.5 (the PIC) requesting the MAC address of 192.168.1.3 (the PC)
18 reply with the MAC address
19 TCP packet from 192.168.1.5 to 192.168.1.3
20 an ARP from the 192.168.1.2 (the PC) requesting the MAC address of 192.168.1.5 (the PIC)
etc etc

to check the firewall settings open it, click advanced settings then click inbound rules and you should see the programs that have TCP and UDP ports enabled
 

    V

    points: 2
    Helpful Answer Positive Rating

horace1

Advanced Member level 5
Joined
Nov 18, 2008
Messages
2,123
Helped
596
Reputation
1,188
Reaction score
573
Trophy points
1,393
Location
Norwich, UK
Activity points
13,071
does the Microchip TCPIP Discoverer program (in start > all programs > microchip > TCPIP stack v?.?? ) list the board? you will have open a port in the firewall.
 
  • Like
Reactions: Saraa

    Saraa

    points: 2
    Helpful Answer Positive Rating

Saraa

Member level 1
Joined
Feb 16, 2010
Messages
33
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Activity points
1,524
Yes it listed the board ..

I would simply write hello message to the labview server by using TCPPutArray(MySocket,"hello",size).

while GenericTCPClient uses UART to display data! what could I change!
 
Last edited:

horace1

Advanced Member level 5
Joined
Nov 18, 2008
Messages
2,123
Helped
596
Reputation
1,188
Reaction score
573
Trophy points
1,393
Location
Norwich, UK
Activity points
13,071
you can use putsUART2() and putsUART1() to write to the UARTs - also printf() will work (you may need to change the default UART that printf() uses)
 
  • Like
Reactions: Saraa

    Saraa

    points: 2
    Helpful Answer Positive Rating

Saraa

Member level 1
Joined
Feb 16, 2010
Messages
33
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Activity points
1,524
I have run the client and server and pressed button1 and the msg has appeared in LabView (which is the Server) :)
I will try to find where is that condition to remove it, because it does not make since that each time you want to run the App you should press button1 !!

Thank you very much horace for your replies :)

-Sara
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top