ENC28J60

For questions and comments on programming in general. And for any items that don't fit into the forums below.

Moderators: Benj, Mods

User avatar
Alan_37
Posts: 152
Joined: Sun May 01, 2016 8:36 pm
Has thanked: 53 times
Been thanked: 53 times
Contact:

ENC28J60

Postby Alan_37 » Thu Mar 07, 2019 10:40 pm

Hi

I am playing around with the ENC28j60 I have flashed the example to an Atmega 328p from the wiki page

I can Ping the module, view a web page but in the wiki example there are 3 pages I can only access one of them
the problem is that Read TCP document request is not returning the “/page1” string, whatever string I write after the IP/ it is only returning the string "GET"

DataPointer is = 54

is this a bug in the component?


Any help for this please?

enc.png
enc.png (19.79 KiB) Viewed 1928 times
Attachments
ENC28J60_Example.fcfx
(25.78 KiB) Downloaded 48 times
Last edited by Alan_37 on Mon Mar 11, 2019 2:38 pm, edited 2 times in total.

User avatar
Alan_37
Posts: 152
Joined: Sun May 01, 2016 8:36 pm
Has thanked: 53 times
Been thanked: 53 times
Contact:

Re: ENC28J60 Bug

Postby Alan_37 » Sat Mar 09, 2019 3:10 pm

Hi
Am I doing something wrong or is a component bug?

Although I use flowcode V7 , the new Flowcode V8.1 might have the same bug!

User avatar
LeighM
Matrix Staff
Posts: 1938
Joined: Tue Jan 17, 2012 10:07 am
Has thanked: 466 times
Been thanked: 664 times
Contact:

Re: ENC28J60 Bug

Postby LeighM » Mon Mar 11, 2019 11:11 am

Hi,
I think the problem could be that you are not moving the DataPointer after the ReadStringFromBuffer for the "GET" text.
So the next ReadStringFromBuffer expecting the "page1" text will just be returning the "GET" again.
These users thanked the author LeighM for the post:
Alan_37 (Mon Mar 11, 2019 11:41 am)
Rating: 5.26%
 

User avatar
Alan_37
Posts: 152
Joined: Sun May 01, 2016 8:36 pm
Has thanked: 53 times
Been thanked: 53 times
Contact:

Re: ENC28J60 Bug

Postby Alan_37 » Mon Mar 11, 2019 11:40 am

hi LeighM

Thanks for your reply, in the Wiki example the data pointer is being set in the GetTcpDataPointer component macro,
datapontr.png
datapontr.png (15.67 KiB) Viewed 1857 times


I understand this can be set manually but it would require Wireshark to see the data.
I don't know where the data pointer has to be set to get the page1 string output.


What value should put in the data pointer variable?

Thanks

User avatar
LeighM
Matrix Staff
Posts: 1938
Joined: Tue Jan 17, 2012 10:07 am
Has thanked: 466 times
Been thanked: 664 times
Contact:

Re: ENC28J60 Bug

Postby LeighM » Mon Mar 11, 2019 12:03 pm

From the DataPointer the text buffer will contain something like "GET /index.html HTTP/1.1"
So you could either say read and compare with "GET /index"
or first compare the "GET" then move the DataPointer on 5 places and read and compare with "index", "page1", "page2" etc
These users thanked the author LeighM for the post:
Alan_37 (Mon Mar 11, 2019 12:13 pm)
Rating: 5.26%
 

User avatar
Alan_37
Posts: 152
Joined: Sun May 01, 2016 8:36 pm
Has thanked: 53 times
Been thanked: 53 times
Contact:

Re: ENC28J60 Bug

Postby Alan_37 » Mon Mar 11, 2019 12:13 pm

Hi LeighM

Thanks for the info , will try it and keep you posted.

User avatar
Alan_37
Posts: 152
Joined: Sun May 01, 2016 8:36 pm
Has thanked: 53 times
Been thanked: 53 times
Contact:

Re: ENC28J60

Postby Alan_37 » Mon Mar 11, 2019 2:52 pm

Hi LeighM

Yes, it worked just incremented +5 the data pointer that was it so there is no bug.

Just another weird thing I noticed the MCU stop responding if the 2 disabled macros are enabled
don't know why.

stop.png
stop.png (200.3 KiB) Viewed 1840 times


Thanks for your help
Last edited by Alan_37 on Mon Mar 11, 2019 4:14 pm, edited 1 time in total.

User avatar
Alan_37
Posts: 152
Joined: Sun May 01, 2016 8:36 pm
Has thanked: 53 times
Been thanked: 53 times
Contact:

Re: ENC28J60

Postby Alan_37 » Mon Mar 11, 2019 4:12 pm

Hi LeighM

Just found it, it was the buffer size increased it from 255 to 500 and everything now works as it should :D

buffeer.png
buffeer.png (18.65 KiB) Viewed 1837 times


You may also want to update the wiki example file with the one attached below.

Thanks very much.
Attachments
ENC28J60_Example.fcfx
(25.14 KiB) Downloaded 54 times
These users thanked the author Alan_37 for the post (total 2):
LeighM (Mon Mar 11, 2019 4:27 pm) • stefan.erni (Thu May 23, 2019 10:22 am)
Rating: 10.53%