![](templates/subSilver/images/CCSLogo.jpg) |
![CCS C Software and Maintenance Offers](templates/subSilver/images/forumAd6.jpg) |
View previous topic :: View next topic |
Author |
Message |
Spiffy_chimp Guest
|
ENC28J60 is insane |
Posted: Fri Aug 29, 2008 8:28 pm |
|
|
OK, maybe not entirely insane, but it sure is acting weird. At this point, I'm not sure if I have a hardware issue, a code issue or a compiler version issue.
The basics:
Compiler v4.013
MCU 18F25J10 (XTAL=25M)
MAC/PHY ENC28J60 (XTAL=25M)
IP Stack v3.02 (could be woefully out of date? but it's what they have here at my current employer)
I've been trying to work through some of the basic example programs that come with the stack, and have yet to have success on a single one. At this point, I'm sticking with example program 7a, which simply grabs MAC headers from incoming packets and throws the source MAC address down the RS232 port.
I've narrowed what I am seeing down to a the file ENC28J60.c, and specifically the function of MACGetHeader(). The problem I am seeing is that reading the EPKTCNT register produces inaccurate but repeatable results.
To troubleshoot I have put the following in place in my main() function:
Code: |
void main(void) {
MAC_ADDR mac;
int8 type;
MACInit();
printf("Mac Initialization Complete\n\r");
while(TRUE)
{
int8 whatsup;
whatsup = ReadETHReg((BYTE)EPKTCNT).Val;
printf("%u" whatsup);
printf("\n\r");
delay_ms(1000);
}
|
The output I get from the serial port shows a consistent pattern of values for packets waiting, and bears no correlation to what is actually happening on the Ethernet segment (as checked with Ethereal).
The repeatable pattern I see for the EPKTCNT register, based on 1 second samples is:
0
0
0
0
0
1
0
3
12
0
0
1
11
63
10
This pattern repeats no matter what is actually happening on the ethernet segment.
I've read about 400 threads from this forum, and done a few hundred Google searches, so far with few results. If I were to speculate wildly, I would guess I am either having compiler version problems, or the timing of the SPI bus is causing inaccurate readings of that register.
The only modifications I have made to the TCP/IP source files is to adjust the SPI pins to match my MCU and the XTAL speed.
Anyone have any clues? I can gladly provide more info, but I fear I have already written too much. |
|
![](templates/subSilver/images/spacer.gif) |
ckielstra
Joined: 18 Mar 2004 Posts: 3680 Location: The Netherlands
|
|
Posted: Sat Aug 30, 2008 1:35 pm |
|
|
Quote: | I've read about 400 threads from this forum, and done a few hundred Google searches, so far with few results. If I were to speculate wildly, I would guess I am either having compiler version problems, or the timing of the SPI bus is causing inaccurate readings of that register. | You've read the wrong threads. Read the sticky thread on top of this forum about the new V4 compiler.
The first releases of the v4 compiler should never have been released into public, so bad was the quality. Only starting at v4.030 things from the v3 compiler started to work again and you have to use at least something like v4.050 to get the new v4 features to work.
Either downgrade to the previous stable version v3.249 or upgrade to one of the latest releases, v4.070 and higher seem to be stable as well.
Whenever I see someone with an old v4 compiler of before v4.030 I refuse to give support. Even if we can solve your current problem in v4.013 you'll be back tomorrow with another compiler bug. |
|
![](templates/subSilver/images/spacer.gif) |
spiffy_chimp Guest
|
|
Posted: Sat Aug 30, 2008 2:32 pm |
|
|
That's what I needed to know. Thanks for the advice on this one. Time for the boss to open his checkbook and get an updated version. |
|
![](templates/subSilver/images/spacer.gif) |
|
|
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
|