ENC28J60

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

Moderators: Benj, Mods

Post Reply
User avatar
Alan_37
Posts: 178
Joined: Sun May 01, 2016 8:36 pm
Has thanked: 51 times
Been thanked: 54 times
Contact:

ENC28J60

Post by Alan_37 »

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
(19.79 KiB) Downloaded 2272 times
Attachments
ENC28J60_Example.fcfx
(25.78 KiB) Downloaded 133 times
Last edited by Alan_37 on Mon Mar 11, 2019 2:38 pm, edited 2 times in total.

User avatar
Alan_37
Posts: 178
Joined: Sun May 01, 2016 8:36 pm
Has thanked: 51 times
Been thanked: 54 times
Contact:

Re: ENC28J60 Bug

Post by Alan_37 »

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: 2156
Joined: Tue Jan 17, 2012 10:07 am
Has thanked: 481 times
Been thanked: 699 times
Contact:

Re: ENC28J60 Bug

Post by LeighM »

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.

User avatar
Alan_37
Posts: 178
Joined: Sun May 01, 2016 8:36 pm
Has thanked: 51 times
Been thanked: 54 times
Contact:

Re: ENC28J60 Bug

Post by Alan_37 »

hi LeighM

Thanks for your reply, in the Wiki example the data pointer is being set in the GetTcpDataPointer component macro,
datapontr.png
(15.67 KiB) Downloaded 2201 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: 2156
Joined: Tue Jan 17, 2012 10:07 am
Has thanked: 481 times
Been thanked: 699 times
Contact:

Re: ENC28J60 Bug

Post by LeighM »

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

User avatar
Alan_37
Posts: 178
Joined: Sun May 01, 2016 8:36 pm
Has thanked: 51 times
Been thanked: 54 times
Contact:

Re: ENC28J60 Bug

Post by Alan_37 »

Hi LeighM

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

User avatar
Alan_37
Posts: 178
Joined: Sun May 01, 2016 8:36 pm
Has thanked: 51 times
Been thanked: 54 times
Contact:

Re: ENC28J60

Post by Alan_37 »

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
(200.29 KiB) Downloaded 2184 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: 178
Joined: Sun May 01, 2016 8:36 pm
Has thanked: 51 times
Been thanked: 54 times
Contact:

Re: ENC28J60

Post by Alan_37 »

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
(18.65 KiB) Downloaded 2181 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 132 times

hasait6
Posts: 6
Joined: Fri Apr 16, 2021 9:01 pm
Contact:

Re: ENC28J60

Post by hasait6 »

thank you Alan very mych and thank you to all persons for your help, i hace elevators , and i want to do it for rescue, if same one has been locked inside and elevator is far.

hasait6
Posts: 6
Joined: Fri Apr 16, 2021 9:01 pm
Contact:

Re: ENC28J60

Post by hasait6 »

other question please, when i clock for page1 , web will be http://192.168.0.100/page1.htm, if i want to go back for have just 192.168..0.100, without page1.html, what i must do? thank you friends

User avatar
Benj
Matrix Staff
Posts: 15195
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4761 times
Been thanked: 4296 times
Contact:

Re: ENC28J60

Post by Benj »

Hello,

The IP address http://192.168.0.100/ is basically just a link to the IP. If you leave the file blank then normally a default file is used usually with the name index.htm.

If you want to have a link to the file then you can simply have a piece of html like this.

Code: Select all

<a href="http://192.168.0.100/">Home</a>

hasait6
Posts: 6
Joined: Fri Apr 16, 2021 9:01 pm
Contact:

Re: ENC28J60

Post by hasait6 »

Thank you very much my friend :wink: ,

hasait6
Posts: 6
Joined: Fri Apr 16, 2021 9:01 pm
Contact:

Re: ENC28J60

Post by hasait6 »

Good morning everyone, sorry if I ask a lot, :), I use ENC28j60 for an elevator, and I want an error to appear every time, it is recorded in the myphp database, the problem that I fear, that I do not put in the program flowcode, thank you very much friends

User avatar
Benj
Matrix Staff
Posts: 15195
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4761 times
Been thanked: 4296 times
Contact:

Re: ENC28J60

Post by Benj »

Hello,

I'm guessing the MySQL database is running on a LAMP type server (Linux, Apache, MySQL, PHP).

I would setup a PHP page that logs data to the MySQL from parameters that are passed to the page.

You can then pass parameters to the page by using the URL and doing a page request using the ENC28J60 module.

GET 192.168.0.100/?Error=Error123&ErrorType=123&Flowcode=Good

Hope this helps. Let us know if I've got the wrong end of the stick.

hasait6
Posts: 6
Joined: Fri Apr 16, 2021 9:01 pm
Contact:

Re: ENC28J60

Post by hasait6 »

Thankbuou Benj , i will try, i will inform you

hasait6
Posts: 6
Joined: Fri Apr 16, 2021 9:01 pm
Contact:

Re: ENC28J60

Post by hasait6 »

hi all friends., i have a question more :), when i toush arduino push button, for example B0.i want to send email to me and go from http://192.168.0.100/page1.htm to 192.168.0.100. thank you very much

Post Reply