ENC28J60 Ethernet Library V3.3

General discussion on mikroPascal.
Author
Message
Loki1_11
Posts: 32
Joined: 11 Dec 2008 00:20

#76 Post by Loki1_11 » 30 Dec 2008 18:07

Hi Dany try again now please :D

Do you have msn ?

Regards,
Diego.

Loki1_11
Posts: 32
Joined: 11 Dec 2008 00:20

#77 Post by Loki1_11 » 30 Dec 2008 18:21

I found that it works correct with my ie7 from vmware that sends this header

GET /s HTTP/1.1
Accept: */*
Referer: http://192.168.10.20/
Accept-Language: pt-br
UA-CPU: x86
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1) ; .NET CLR 2.0.50727; FDM)
Connection: Keep-Alive
Host: 192.168.10.20
Pragma: no-cache

But if I try to open with my other ie7 that is not in the vmware it doesnt displays the page, the header sended by this other ie is a litle diferent take a look.

GET / HTTP/1.1
Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, application/x-ms-application, application/x-ms-xbap, application/vnd.ms-xpsdocument, application/xaml+xml, */*
Accept-Language: pt-br
UA-CPU: x86
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1) ; .NET CLR 2.0.50727; .NET CLR 3.0.04506.648; .NET CLR 3.5.21022; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729)
Host: 192.168.10.20
Connection: Keep-Alive

Maybe is a bug with .NET CLR 3.0 ho know ...

Kindly Regards,
Diego.

Dany
Posts: 3854
Joined: 18 Jun 2008 11:43
Location: Nieuwpoort, Belgium
Contact:

#78 Post by Dany » 31 Dec 2008 09:58

Loki1_11 wrote:Hi Dany try again now please :D
Hi, when I try to connect all works, but after a while (10 sec timer?) an update is attempted and then it fails:

(1)Fout bij verbinden
(2)Firefox kan geen verbinding maken met de server op 192.168.10.20.
(3)Hoewel de website lijkt te bestaan is het de browser niet gelukt ermee te verbinden.
(4) Misschien is de website tijdelijk niet beschikbaar? Probeer het later opnieuw.

Translation:
(1): Connection error
(2): Firefox cannot connect to server 192.168.10.20
(3): While the website seems to exist, the browser cannot make a connection
(4): Perhaps the site is not online for the moment? Try later again.

p.s.:similar result with IE7: there it goes wrong after toggling one of the inverters.
Kind regards, Dany.
Forget your perfect offering. There is a crack in everything, that's how the light gets in... (L. Cohen)
Remember when we were young? We shone like the sun. (David Gilmour)

Loki1_11
Posts: 32
Joined: 11 Dec 2008 00:20

#79 Post by Loki1_11 » 31 Dec 2008 15:57

Ok Dany its fixed now ;)

Thanks for that full log ;)

Can you test it now ?

Regards,
Diego.

Dany
Posts: 3854
Joined: 18 Jun 2008 11:43
Location: Nieuwpoort, Belgium
Contact:

#80 Post by Dany » 31 Dec 2008 16:37

Loki1_11 wrote:Can you test it now ?
Hi Diego, OK in Firefox now, but same problem as before with IE7. :cry:
Kind regards, Dany.
Forget your perfect offering. There is a crack in everything, that's how the light gets in... (L. Cohen)
Remember when we were young? We shone like the sun. (David Gilmour)

Dany
Posts: 3854
Joined: 18 Jun 2008 11:43
Location: Nieuwpoort, Belgium
Contact:

#81 Post by Dany » 31 Dec 2008 16:46

Hi, a little bit off topic: I think that a lot of recent posts in this thread belong actually/better to another thread: http://www.mikroe.com/forum/viewtopic.php?t=17602. They do not fall under the title "ENC28J60 Ethernet Library V3.3".

I do not know if a move from this to that other thread is still possible. (Anyway: I think this is something for a moderator.)
But: Yo2Lio is the starter of this thread, of course it is his decision to do the move or not... :D Florin? :?:
Kind regards, Dany.
Forget your perfect offering. There is a crack in everything, that's how the light gets in... (L. Cohen)
Remember when we were young? We shone like the sun. (David Gilmour)

Loki1_11
Posts: 32
Joined: 11 Dec 2008 00:20

#82 Post by Loki1_11 » 31 Dec 2008 22:07

Agreed :D

It can be moved to my old post about the enc28j60 or to a new one ...

Dany I tryed in IE7 with XP and it works nice I will take a look tomorrow ;)

Thanks for the help, after I fix this things I will post the full code for everybody ;)

Regards,
Diego.

Dany
Posts: 3854
Joined: 18 Jun 2008 11:43
Location: Nieuwpoort, Belgium
Contact:

#83 Post by Dany » 04 Feb 2009 17:06

Hi Florin,
Is there a difference in sending data to UDP with "Send_UDP" and rerurn data at the end of " Eth_UserUDP"? I ask this beacuse the latter works (to be seen in the compiler's UDP terminal), while the "Send_UDP" does not seem to work (nothing received in the compiler's UDP terminal), but on every call to "Send_UDP" the hub's light flashes!

The code that I try to copy is the one from "UDP_Send.pbas", translated to mP.

p.s. I am using the ENC version 3.4 and mikroPascal v8.3 (I get a linker error with 7.0: "Length" redefined).

Probably I do something wrong due to lack of ethernet/tcp/ip knowledge...

Below is some code.
As you can see I added some testcode: writing an "X" to the uart if Send_ARP succeeds and an "S" if Send_UDP succeeds. They both seem to succeed, and, what is more, they continue to do so when the ethernet cable is disconnected from the ENC board.

Any suggestions? Thanks in advance. :oops:

Code: Select all

Procedure Eth_SetParameters;   // set your parameters here
Begin
  Str2Ip('192.168.123.79' ,eth_ip_addr);    // the PIC devices IP address
  Str2Ip('85.120.220.254' ,eth_ntp_addr);  // not used here
  Str2Ip('192.168.123.254',eth_gateway);  // the gateway of the network
  Str2Ip('255.255.255.0'  ,eth_mask);        // the network IP mask
  Str2Mac('0004A3008093'  ,eth_mac);      // the PIC devices MAC address

  eth_port  := 10001;
  dest_port := 10001;

  Str2Ip('192.168.123.77',user_ip_addr);   // PC IP address
end;

begin
  Init;
  Spi_Init;
  Eth_SetParameters;
  Eth_Init_(PORTC, 1, PORTC, 0);//(ENC_Port_CS,CS,ENC_Port_Reset,Reset);
  Wait_for_LAN;
  
  data_user := 'Some data ..... here ....';
  
  while true do
    begin
      Eth_DoPacket;
      if (TickCounter2 > 1000) then
        begin
          TickCounter2 := 0;
          if Send_ARP(user_ip_addr, MacAddress) then Soft_Uart_Write('X');
          if Send_UDP(user_ip_addr, dest_port, eth_port, length(data_user), data_user) 
          then Soft_Uart_Write('S');
        end;
    end;
end.
Kind regards, Dany.
Forget your perfect offering. There is a crack in everything, that's how the light gets in... (L. Cohen)
Remember when we were young? We shone like the sun. (David Gilmour)

yo2lio
Posts: 1878
Joined: 19 Sep 2006 12:57
Location: Romania, Arad City
Contact:

#84 Post by yo2lio » 04 Feb 2009 17:27

Dany wrote:Below is some code.
As you can see I added some testcode: writing an "X" to the uart if Send_ARP succeeds and an "S" if Send_UDP succeeds. They both seem to succeed, and, what is more, they continue to do so when the ethernet cable is disconnected from the ENC board.
Yes, you are right.

I don't take into account the Ethernet link up or down. But this is a very good suggestion ...

Ethernet have ARP cache. The cache is refreshed at every 20 minutes.

If Ethernet have the MAC address in cache and expired time is smaller than 20 minutes, then library take MAC from cache instead to send new ARP request ...

So, the result will be true !!!

I will read documentations about link up and I will change the library regarding this problem ... maybe I can do this today :roll:
Best regards, Florin Andrei Medrea.

http://www.microelemente.ro/
http://www.microelemente.ro/produse-si-servicii/
http://www.microelemente.ro/custom-software/

mail : florin@microelemente.ro

yo2lio
Posts: 1878
Joined: 19 Sep 2006 12:57
Location: Romania, Arad City
Contact:

#85 Post by yo2lio » 04 Feb 2009 17:59

You can download the latest mcl file, including this feature from here : http://www.microelemente.ro/MikroPascal ... l_file.zip

Please try now your example with this mcl.

PS. you must include aditional_string_util in program.

Code: Select all

uses aditional_string_util,lib1_enc28j60_V3_4,enc_lib_user,lib2_enc28j60_V3_4;
Please give me a feedback about the result . Thanks.
Best regards, Florin Andrei Medrea.

http://www.microelemente.ro/
http://www.microelemente.ro/produse-si-servicii/
http://www.microelemente.ro/custom-software/

mail : florin@microelemente.ro

Dany
Posts: 3854
Joined: 18 Jun 2008 11:43
Location: Nieuwpoort, Belgium
Contact:

#86 Post by Dany » 04 Feb 2009 19:56

yo2lio wrote:Please try now your example with this mcl. Please give me a feedback about the result . Thanks.
Hi Florin, thanks for your fast response. :D

The good news:
As you can see I added some testcode: writing an "X" to the uart if Send_ARP succeeds and an "S" if Send_UDP succeeds. They both seem to succeed, and, what is more, they continue to do so when the ethernet cable is disconnected from the ENC board.
This is solved: both fail (return false) once the network cable is removed. :D


The bad news:
Is there a difference in sending data to UDP with "Send_UDP" and return data at the end of " Eth_UserUDP"? I ask this beacuse the latter works (to be seen in the compiler's UDP terminal), while the "Send_UDP" does not seem to work (nothing received in the compiler's UDP terminal), but on every call to "Send_UDP" the hub's light flashes!
My original problem still persists. :oops: I must be doing something wrong :?:
Kind regards, Dany.
Forget your perfect offering. There is a crack in everything, that's how the light gets in... (L. Cohen)
Remember when we were young? We shone like the sun. (David Gilmour)

Dany
Posts: 3854
Joined: 18 Jun 2008 11:43
Location: Nieuwpoort, Belgium
Contact:

#87 Post by Dany » 04 Feb 2009 20:07

yo2lio wrote:

Code: Select all

uses aditional_string_util,lib1_enc28j60_V3_4,enc_lib_user,lib2_enc28j60_V3_4;
Hi Florin, the unit "definitions_ENC" should not be "used" any more? (It works apparently without it...). It was part of the ENC library I think?
Kind regards, Dany.
Forget your perfect offering. There is a crack in everything, that's how the light gets in... (L. Cohen)
Remember when we were young? We shone like the sun. (David Gilmour)

yo2lio
Posts: 1878
Joined: 19 Sep 2006 12:57
Location: Romania, Arad City
Contact:

#88 Post by yo2lio » 04 Feb 2009 20:10

When you send data with Send_UDP , you are the master and you initiate the transmission :

First send ARP request and the send data over UDP.

In the second case when you send reply in Eth_UserUDP function you just send data back to remote server.

Your problem will be resolved with this software : http://www.hw-group.com/download/sw/HerculesSetup.zip

I use this software like terminal for UDP, TCP, RS232 ... etc
Best regards, Florin Andrei Medrea.

http://www.microelemente.ro/
http://www.microelemente.ro/produse-si-servicii/
http://www.microelemente.ro/custom-software/

mail : florin@microelemente.ro

Dany
Posts: 3854
Joined: 18 Jun 2008 11:43
Location: Nieuwpoort, Belgium
Contact:

#89 Post by Dany » 04 Feb 2009 20:18

Nice! Thanks Florin for the fast reply and the adaptation of the library. I will try "Hercules" asap and give you feedback. :D

In the mean time: my mP V8.3 has crashed (during its startup) and I have to re-install it before I can go on (all settings are lost, o.a. docking is gone). :cry:
One can experience always something new with mP...
Kind regards, Dany.
Forget your perfect offering. There is a crack in everything, that's how the light gets in... (L. Cohen)
Remember when we were young? We shone like the sun. (David Gilmour)

Dany
Posts: 3854
Joined: 18 Jun 2008 11:43
Location: Nieuwpoort, Belgium
Contact:

#90 Post by Dany » 04 Feb 2009 20:26

Hi Florin, as you said:
Your problem will be resolved with this software : http://www.hw-group.com/download/sw/HerculesSetup.zip
Everything works! :D :D :D Thanks!!!

So, the "guilty" (if I may say so) was the compiler's UDP terminal. :shock:
Kind regards, Dany.
Forget your perfect offering. There is a crack in everything, that's how the light gets in... (L. Cohen)
Remember when we were young? We shone like the sun. (David Gilmour)

Post Reply

Return to “mikroPascal General”