CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

pic18f4620 and enc28j60 don't get ip and no output on serial

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
OpenSys



Joined: 15 Oct 2010
Posts: 19

View user's profile Send private message

pic18f4620 and enc28j60 don't get ip and no output on serial
PostPosted: Fri Oct 15, 2010 6:41 pm     Reply with quote

Hello,

I just compile ex_st_webserver.c tcp/ip example and program the 18f4620, then tested with my enc28j60 module, but I don't get any ip by dhcp.
I reread the pic data and is there.
I tested the ethernet with sniffer and no data was sent, seems that the pic is dead.
I use a 10MHz external crystal, I check the voltages of pic, enc and 74hc125, is all fine.
From serial port at 9600 I don't get any data also. What could be wrong ?
If I connect the pic without any lcd, or enc28j60 could I get any data from serial?

Please help me, to move on.

Thank you.

VS
OpenSys



Joined: 15 Oct 2010
Posts: 19

View user's profile Send private message

PostPosted: Sat Oct 16, 2010 3:51 am     Reply with quote

simple serial code loop like this don't work:

#include <18f4620.h>
#use delay(clock=40000000)
#use rs232(baud=9600,parity=N,xmit=PIN_C6,rcv=PIN_C7,bits=8)

#fuses MCLR
#fuses NOPROTECT
#fuses INTRC_IO
#fuses NOWDT
#fuses NOPUT
#fuses NOLVP
#fuses NOBROWNOUT
#fuses NOCPD
#fuses WRT
#fuses NOWRTD
#fuses NOEBTR
#fuses NOCPB
#fuses NOEBTRB
#fuses WRTB


void main(void)
{
while (TRUE) {
DELAY_MS(100);
printf("ok 123\r\n");
}

}
Rocket



Joined: 29 Aug 2005
Posts: 27

View user's profile Send private message

PostPosted: Sat Oct 16, 2010 4:31 am     Reply with quote

If you want to work at 40Mhz, you need a 10Mhz Xtal and the fuse statement "#fuses INTRC_IO" replaced with "
#FUSES H4 //High speed osc with HW enabled 4X PLL
_________________
J.I.L.
bkamen



Joined: 07 Jan 2004
Posts: 1611
Location: Central Illinois, USA

View user's profile Send private message

PostPosted: Sat Oct 16, 2010 7:47 am     Reply with quote

Rocket wrote:
If you want to work at 40Mhz, you need a 10Mhz Xtal and the fuse statement "#fuses INTRC_IO" replaced with "
#FUSES H4 //High speed osc with HW enabled 4X PLL


Right. Read the Datasheet. You'll hear that a lot here. You want the section titled "Oscillator Configurations".

Also, if you leave out the #fuses that select the oscillator config and use #use delay (clock=40M, crystal=10M) that will set most stuff up for you one later compiler versions. (which you didn't tell us which you have)


the TCPIP stack does work - but needs modification to fit most cases.. and you say you just compiled it.

Is it set up to work with your board? or is this a standard demo PCB from someone?
_________________
Dazed and confused? I don't think so. Just "plain lost" will do. :D
OpenSys



Joined: 15 Oct 2010
Posts: 19

View user's profile Send private message

PostPosted: Sat Oct 16, 2010 9:55 am     Reply with quote

yes I miss the #FUSES H4 :( serial is working, so programmer is ok, and connections also ok.

So i programmer again the example code.
I found that is dhcp that is the problem, he is unable the send any udp packet to network, so i put with static ip address and was worked!

to dhpc i need this:

#define STACK_USE_DHCP TRUE
#define STACK_USE_UDP TRUE
#define STACK_USE_ARP TRUE

in main:


MACAddrInit();
// IPAddrInit();

MACInit();


init_user_io();

StackInit();

while(TRUE) {
StackTask();

}


is correct ?

thank for all your help.

VS
bkamen



Joined: 07 Jan 2004
Posts: 1611
Location: Central Illinois, USA

View user's profile Send private message

PostPosted: Sat Oct 16, 2010 10:20 am     Reply with quote

I've used the DHCP feature before and found it to work fairly well.

The question I have for you is:

What is providing your DHCP service?

-Ben
_________________
Dazed and confused? I don't think so. Just "plain lost" will do. :D
OpenSys



Joined: 15 Oct 2010
Posts: 19

View user's profile Send private message

PostPosted: Sat Oct 16, 2010 10:30 am     Reply with quote

bkamen wrote:
I've used the DHCP feature before and found it to work fairly well.

The question I have for you is:

What is providing your DHCP service?

-Ben


hello,

is a router that is provide it, with openwrt.
dhcp is working in all network, i also check if the module sends any udp packet, but no.
I also put the serial port the send a simple text when the pic was init, with static ip, the text shows, with dhcp no.

VS
OpenSys



Joined: 15 Oct 2010
Posts: 19

View user's profile Send private message

PostPosted: Sat Oct 16, 2010 2:17 pm     Reply with quote

hello again,

After a while working, pic makes resets. I found that if remove the 74hc125 the resets stops so may have some problems with enc28j60 ?
The enc28j60 init's ok, the lead blink ok.
seams to be from enc28j60 (SO) to pin23 pic18f4620 that i get the loop.
What tests can I do more?

VS
OpenSys



Joined: 15 Oct 2010
Posts: 19

View user's profile Send private message

PostPosted: Sat Oct 16, 2010 6:27 pm     Reply with quote

OpenSys wrote:
hello again,

After a while working, pic makes resets. I found that if remove the 74hc125 the resets stops so may have some problems with enc28j60 ?
The enc28j60 init's ok, the lead blink ok.
seams to be from enc28j60 (SO) to pin23 pic18f4620 that i get the loop.
What tests can I do more?

VS


OK a add some 180R resistors do the ports to drop some voltage pic's, and it works.
The Only thing thats misses is DHCP. if i activate it, the pic's don't run.
ip stack last version for ccs is 3.75 ?

VS
OpenSys



Joined: 15 Oct 2010
Posts: 19

View user's profile Send private message

PostPosted: Mon Oct 18, 2010 2:19 pm     Reply with quote

I found something interesting i have a web server on pic, if i activate it with
#define STACK_USE_HTTP 1

the dhcp don't work, and freeze the pic if is:

#define STACK_USE_HTTP 0

dhcp works fine.

the http code is simple like the example.

What could be the problem ?

found something more, dhcp use udp so if:

#define STACK_USE_UDP 1

pic freeze, so something with http and udp.


found more things....

the problem is the STACK_USE_HTTP 1

if web server is activated lcd don't work and dhcp the same way.

if webserver is disabled all things works fine.
OpenSys



Joined: 15 Oct 2010
Posts: 19

View user's profile Send private message

PostPosted: Thu Oct 21, 2010 6:03 pm     Reply with quote

found it, it seams that is the rom of the pic, if pass over 50% occupied, pic freeze....


i will open a new post
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group