Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics 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.

Help to compile TCP/IP stack for ENC28J60

Status
Not open for further replies.

iplay

Newbie level 4
Joined
Aug 16, 2011
Messages
6
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,315
Hi!

I'm trying to make simple Ethernet transmission on my PIC18F4620(my PIC should send data to another PC). I've read AN833, tried to compile example in my project and get a lot of errors:( Somebody please can explain me how to compile stack for enc28j60, to make data transmission....

P.S. I'm using Proteus....
 

To be of assistance we will need to see your project files.

Can you zip up the project and upload it?

Are you using the C18 Compiler?

BigDog
 
  • Like
Reactions: iplay

    iplay

    Points: 2
    Helpful Answer Positive Rating
I'm using HI-TECH C compiler.

I've just compiled project with TCPInit() function, but don't know what to do next to transmit data (the data to transmit is "map" variable).

View attachment prob2send.rar
 

Trying to do TCPConnect(), bu no result :(
Code:
APP_CONFIG AppConfig; 
NODE_INFO remoteNode; 

void main(void) 
{
	remoteNode.IPAddr = "127.0.0.1"; 
	TCPInit();
	TCP_SOCKET sock = TCPConnect(&remoteNode,3135);
    init();

When I'm trying to compile:
Error [499] ; 0. undefined symbol:
_TCPConnect(prob2.obj)
 

I've found the problem:
using this code
Code:
APP_CONFIG AppConfig; 
NODE_INFO remoteNode; 

void main(void) 
{
	int test = 5;
	TCPInit(); 
	TCP_SOCKET socket = TCPConnect(192.168.1.10, 3135);
	TCPPut(socket,test);
I've tried to send some TCP sockets to 192.168.1.10 but realized that TCP is exchange with confirmation protocol and my PIC is a client, not Server. So I cant see any packets in tcpdump.

I've also tried to make ICMP request for PIC controller:
Code:
ICMPPut(192.168.1.10, ICMP_ECHO_REPLY, data, datalen, id, seq);
And its OK. I got some ICMP packets in tcpdump.

So the problem is that I'm using TCP protocol, I guess I should use UDP, but using UDPInit(), get a lot of errors:
Code:
#include <htc.h>
#include "StackTsk.c"
#include "TCP.c"
#include "IP.c"
#include "UDP.c"
#include "MAC.c" 
#include "Helpers.c"
#include "Tick.c" 
#include "delay.c"

#define THIS_IS_STACK_APPLICATION
#define STACK_CLIENT_MODE

APP_CONFIG AppConfig; 
NODE_INFO remoteNode; 

void main(void) 
{
	int test = 5;
	UDPInit();
	//TCPInit(); 
	//TCP_SOCKET socket = TCPConnect(127.0.0.1, 3135);
	//TCPPut(socket,test); 
	//ICMPPut(192.168.1.10, ICMP_ECHO_REPLY, data, datalen, id, seq);
    init(); 
	PORTC = 150;
	while(1) 
    {  
		if ( flag == 1 ) recieve();
    } 
}

Errors:
Code:
Error   [103] C:\MPLAB\prob2\UDP.c; 68.37 #error: UDP module is not enabled.
Error   [103] C:\MPLAB\prob2\UDP.c; 69.68 #error: If you do not want UDP module, remove this file from your
Error   [103] C:\MPLAB\prob2\UDP.c; 70.44 #error: project to reduce your code size.
Error   [103] C:\MPLAB\prob2\UDP.c; 71.66 #error: If you do want UDP module, make sure that STACK_USE_UDP
Error   [103] C:\MPLAB\prob2\UDP.c; 72.41 #error: is defined in StackTsk.h file.
 

I'm glad you've had some progress.

Rather than use Proteus, I've put together a quick prototype using Microchip's ENC28J60 Ethernet PICtail board and development board.

You may have to adapt the final code to your design.

BigDog
 

I think I'm stuck with this UDPInit();
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top