Page 1 of 1

ENC28J60 compiler problems

Posted: Fri Jul 24, 2015 8:49 am
by cruzxia
I am just trying to setup and use the ENC28J60 component for the first time, but I am having a few compiling problems.

If I use Bens WebserverwithpingECIO it compiles, If I change the micro to PIC18F2455 it compiles ok.
If I start a new project using PIC18F2455 and try to Initialise the ENC28J60 component, it fails to compile.
I have checked the compiler and linker settings and they are identical.

Here is the error
Test_Code.c(190): error: total number of array elements can not exceed 0x100 (use -idx 2 compiler command line argument to remove this restriction)

I added "-idx 2" to the compiler and linker but it still had an error.

Has the ENC28J60 component been updated or modified?

Cruzxia

Re: ENC28J60 compiler problems

Posted: Fri Jul 24, 2015 9:03 am
by kersing
Check the ENC28J60 component properties to make sure arrays/buffers contain max 255 elements. The BoostC compiler limits array sizes.

Re: ENC28J60 compiler problems

Posted: Sat Jul 25, 2015 1:54 am
by cruzxia
Thanks for that, it is compiling now. :D

Re: ENC28J60 compiler problems

Posted: Sat Jul 25, 2015 7:27 am
by Steve001
didn't know that V6 had this component now , does it work with this module ?

http://hobbycomponents.com/network/111- ... ork-module

Steve

Re: ENC28J60 compiler problems

Posted: Sat Jul 25, 2015 10:36 am
by kersing
Steve001 wrote:does it work with this module ?
Yes, it should work with that module.

Re: ENC28J60 compiler problems

Posted: Mon Jul 27, 2015 6:22 am
by cruzxia
I have the ENC28J60 connected and working. I am using a Pic 1825K20 @ 16mhz with hardware SPI.
It will respond to the ping in about 3ms.
When I type in the IP address In the browser, it does not receive the webpage data from the webserver (FILLTcpDATA).
I just get - "This page can’t be displayed"

I have tried using software spi - same results
I bumped my clock speed to 64mhz with the PLL, I had to then slow the SPI down to Fosc/16 to get it running in hardware, no change
I then tried it in software mode at 64mhz with the SPI Fosc/4, no change.

Any suggestions on how to get it to respond.

Re: ENC28J60 compiler problems

Posted: Mon Jul 27, 2015 6:53 am
by kersing
Please post your flowchart.

Re: ENC28J60 compiler problems

Posted: Mon Jul 27, 2015 7:51 am
by cruzxia
Here is the flowchart
ENC28J60.fcfx
(21.16 KiB) Downloaded 398 times

I use the LCD for a few Debug markers. When I try to access the IP in my browser, the code make it to the reply (marker "4") but there is no data on the web page.
The ping looks like this.
Ping.jpg
Ping.jpg (42.86 KiB) Viewed 7885 times

Re: ENC28J60 compiler problems

Posted: Fri Jul 31, 2015 3:44 am
by cruzxia
I managed to get the 8 bit pic sort of working, it would reply with half the webpage data. Having read the forum I decided to move to a 16 bit pic to try to get it working.

I setup the component using a DSPic33EP64MC206, because I had one from another project.
The SPI ports for channel 1 did not match the actual ports on the pic so I used channel 2 and remapped the ports to the ones I selected.
The SPI is now working, I can initialise the ENCJ60 and control the LED's, read the version etc.


The compiler did give me a whole heap of warnings relating to the ENC28J60 component.
Do I need to rectify some of these warnings?

Here are the compiler warnings.
Launching the compiler...
C:\Program Files (x86)\Flowcode 6\compilers\pic16\batchfiles\pic16_C30_comp.bat "LAN_Webserver_33" "C:\Users\AMD\DOCUME~1\PIC\REMOTE~1\LANWEB~1\" "33EP64MC206"
Launching compiler...

C:\Users\AMD\DOCUME~1\PIC\REMOTE~1\LANWEB~1>pic30-gcc -c -mcpu="33EP64MC206" -funsigned-char -fno-short-double -Os -I"C:\PROGRA~2\FLOWCO~1\COMPIL~1\pic16\BATCHF~1\..\support\h" -I"C:\PROGRA~2\FLOWCO~1\COMPIL~1\pic16\BATCHF~1\..\MX_support" -Wall -std=gnu99 "LAN_Webserver_33".c -o "LAN_Webserver_33".o
LAN_Webserver_33.c: In function 'FCD_0f5c1_TCPIP_ENC28J60__MakeTcpAckFromAny':
LAN_Webserver_33.c:578: warning: unused variable 'FCL_SUBBUFF'
LAN_Webserver_33.c:576: warning: unused variable 'FCL_IDX'
LAN_Webserver_33.c: In function 'FCD_0f5c1_TCPIP_ENC28J60__ClientSendPacket':
LAN_Webserver_33.c:1530: warning: pointer targets in passing argument 2 of 'FCD_0f5c1_TCPIP_ENC28J60__IpMakeIpTcpNew' differ in signedness
LAN_Webserver_33.c: In function 'main':
LAN_Webserver_33.c:2085: warning: passing argument 1 of 'FCD_0f5c1_TCPIP_ENC28J60__ReadStringFromBuffer' discards qualifiers from pointer target type
LAN_Webserver_33.c:2089: warning: passing argument 1 of 'FCI_COMPARE' discards qualifiers from pointer target type
LAN_Webserver_33.c:2089: warning: pointer targets in passing argument 3 of 'FCI_COMPARE' differ in signedness
LAN_Webserver_33.c:2094: warning: passing argument 1 of 'FCD_0f5c1_TCPIP_ENC28J60__ReadStringFromBuffer' discards qualifiers from pointer target type
LAN_Webserver_33.c:2098: warning: passing argument 1 of 'FCI_COMPARE' discards qualifiers from pointer target type
LAN_Webserver_33.c:2098: warning: pointer targets in passing argument 3 of 'FCI_COMPARE' differ in signedness
LAN_Webserver_33.c:2125: warning: passing argument 1 of 'FCI_COMPARE' discards qualifiers from pointer target type
LAN_Webserver_33.c:2125: warning: pointer targets in passing argument 3 of 'FCI_COMPARE' differ in signedness

Compilation successful!
Completed compilation, return = 0

Re: ENC28J60 compiler problems

Posted: Fri Jul 31, 2015 4:27 am
by cruzxia
I have encountered a problem in the example software that I am having trouble getting passed.

The Readstringfrombuffer only ever seems to return "GET"

When it tests for data with this
Compare$ (CompareString,"/page2.htm",0) = 0

there is no data (other than GET) in the comparestring so it wont go to Page 2 or to the Root Page in the example software.
I can only ever display Page X

Please advise what is wrong?

Re: ENC28J60 compiler problems

Posted: Fri Jul 31, 2015 5:26 am
by cruzxia
I found the problem.
The CompareString=TCPIP_ENC28J60::ReadStringFromBuffer(DataPointer, 10)
must be changed to
CompareString=TCPIP_ENC28J60::ReadStringFromBuffer(DataPointer + 4, 10)
To read from the correct buffer
:)