New Ethernet library with improved TCP/IP Stack

Discuss with MikroElektronika software developers about current library development.
Author
Message
murphytheruler
Posts: 6
Joined: 17 Nov 2015 09:52

Re: New Ethernet library with improved TCP/IP Stack

#91 Post by murphytheruler » 05 Oct 2016 17:26

hi,


Have you tried this example in debug mode?

I did try the example. it works, but it is simple. in example, PCB connects to PCB , send data, and disconnects.

in my case,
PCB connects to PC 1st,
moreover, it waits for commands from PC,
when PCB receives cammand from PC, it executes the desired routines, and gives back the result of those routines to PC,
both PCB and PC must keep the connection alive.

i canot use debug mode
I have microprog but P33EP256GM310 is not in list of supported ICs

I use PICkit3, I can only use two leds on PCB for debugging

What are you sending to the PIC?

I send strings to PCB via ethernet port
something like
1|192.168.1.111
2|1
3|
6|
4|1
5|9
7|
for now , and maybe a few more in the future , those are for guiding PCB which kind of activities that should be done by PCB


With which routine you have a problem?

I use "Network_Ethernet_dsPIC" library,
number of avaliable functions in Library manager and in help document doesnt match
furthermore, when I check "__NetEthEnc28j60.h" and "__NetEthEnc28j60Private.h" , I noticed lots of more function is avaliable, but info and examples how to use them in help file

finally,
in my example, I am putting each byte directly to TX, but, I need to transfer message to RAM of ENC28j60 first, then start sending them
one more detail, I disabled interrupt it seems it works, but I need to use recive interrupt, if possible,

latest form of my project is attached. please have a look at it.


Kind regards,
Attachments
ENC28J60 - NET.zip
(2.05 MiB) Downloaded 362 times

User avatar
Aleksandar.Mitrovic
mikroElektronika team
Posts: 1697
Joined: 11 Mar 2015 12:48

Re: New Ethernet library with improved TCP/IP Stack

#92 Post by Aleksandar.Mitrovic » 06 Oct 2016 16:26

Hi,

Have you tried to use different interrupt priority?
Can you try to set the lowest priority possible for the interrupts which you use in the code?

Can you try to comment one Net_Ethernet_28j60_doPacket() ? In the interrupt routine or while loop.
murphytheruler wrote:I have microprog but P33EP256GM310 is not in list of supported ICs
We will try to add support for this MCU in our mikroProg Suite on the next update.
This suggestion has been forwarded to our developers.

Kind regards,
Aleksandar

murphytheruler
Posts: 6
Joined: 17 Nov 2015 09:52

Re: New Ethernet library with improved TCP/IP Stack

#93 Post by murphytheruler » 07 Oct 2016 08:01

hello,

I alredy disabled inteerupt

Code: Select all

  disableinterrupts();
//  initinterrupts();
  enableinterrupts();

Code: Select all

Net_Ethernet_28j60_doPacket(); 
only exist in main loop

Code: Select all

  while (1) {
    asm clrwdt;
    Net_Ethernet_28j60_doPacket();  // process incoming Ethernet packets
    if ( sock->state == 3 ) {
//      Net_Ethernet_28j60_doPacket();  // process incoming Ethernet packets
      if (flagset == 1) {
        TX_index = 0;
        Net_Ethernet_28j60_startSendTCP(sock);      // put a ram string into enc28j60 buffer , and transfer immediately
        flagset  = 0 ;
        }
      Delay_ms(100);
      }
    }
it works like that, but when I enable interrupt, you can look at my interrupt routines , and disable doPacket in main loop it stops sending ACK to the messages of PC

Code: Select all

void xxx() iv ivt_addr_int1interrupt ics ics_auto {

  unsigned int    len;

  Net_Ethernet_28j60_doPacket();
  ifs1bits.int1if = 0;    // clear the int1 interrup
  led_ylw =  ~led_ylw ;

  }

void initinterrupts(void) {
  
  intcon1bits.nstdis = 1;               /* interrupt nesting disabled here */

  iec1bits.int1ie = 0;                  /* disable int1 interrupt */
  ipc5bits.int1ip = 7;                  /* highest priority */
  intcon2bits.int1ep = 1;               /* edge polarity ( 1 rising, 0 falling edge )  */
  iec1bits.int1ie = 1;                  /* enable int1 interrupt */
  ifs1bits.int1if = 0;                  /* reset int1 interrupt flag */

  }

User avatar
Aleksandar.Mitrovic
mikroElektronika team
Posts: 1697
Joined: 11 Mar 2015 12:48

Re: New Ethernet library with improved TCP/IP Stack

#94 Post by Aleksandar.Mitrovic » 10 Oct 2016 13:49

Hi,

Like I said, have you tried to set lower priority for the INT1 interrupt, lower then Timer?

Also, how do you maintain your socket active?

Kind regards,
Aleksandar

murphytheruler
Posts: 6
Joined: 17 Nov 2015 09:52

Re: New Ethernet library with improved TCP/IP Stack

#95 Post by murphytheruler » 10 Oct 2016 15:17

hello,
Like I said, have you tried to set lower priority for the INT1 interrupt, lower then Timer?
OK, I will try soon.


Also, how do you maintain your socket active?
attached project in previous messages, with a doPacket() only in main loop,kept the connection alive for 12 hours, I can send wireshark log for that if you want.

murphytheruler
Posts: 6
Joined: 17 Nov 2015 09:52

Re: New Ethernet library with improved TCP/IP Stack

#96 Post by murphytheruler » 11 Oct 2016 14:55

hello,

attached wireshark log, as I promissed.
Attachments
communication.zip
(5.25 MiB) Downloaded 254 times

User avatar
Aleksandar.Mitrovic
mikroElektronika team
Posts: 1697
Joined: 11 Mar 2015 12:48

Re: New Ethernet library with improved TCP/IP Stack

#97 Post by Aleksandar.Mitrovic » 11 Oct 2016 16:47

Hi,

Ethernet is very sensitive about timings.
Your code will probably not be achievable with two interrupts.

Our developers do not suggest this in design.

Kind regards,
Aleksandar

innoware
Posts: 6
Joined: 18 Oct 2012 07:10

Re: New Ethernet library with improved TCP/IP Stack

#98 Post by innoware » 14 Dec 2016 12:37

How about the Ethernet_Intern_doDHCPLeaseTime() DHCP module routine?

I have manage to successfully get the DHCP functionality to work, but I will never get Ethernet_Intern_doDHCPLeaseTime() flag to be set. Is there any other way to check the leaseTime? When I am reading the documentation, it states that the Ethernet_Intern_doDHCPLeaseTime() will be '1' when lease time has expired.

Normally an DHCP client will renew the lease when 50% of the lease time has expired, with maximum of 3 retries, 4, 8 and 16 seconds. Hopefully the server vill answer with an ACK and the lease time is renewed and everything is OK. If not, the client waits until 87.5% of the lease time has been expired and goes into an rebinding state, sends out an new broadcast Discover message (once again with three retires 4, 8 and 16 seconds) to any DHCP server that responds to it and we could get a new IP from another DHCP server.

If the lease expires and no server has been contacted, the client must immediately discontinue using its leased IP address. The client then proceeds to follow the same process used during its initial startup to obtain a new IP address lease.

So the following question(s).
1. Why do I not get the '1' flag from Ethernet_Intern_doDHCPLeaseTime() after 50%, or even 100% of the lease time has occurred?
2. Can I get the current lease time value and skip using the Ethernet_Intern_doDHCPLeaseTime() module?
3. Does the Ethernet_Intern_doDHCPLeaseTime() module follow the above standard for DHCP communication according to lease time operation?
4. How do I know if the lease time has been expired so I can close down the clients communication and restart the DHCP init procedure?

For more information about lease time and DHCP: https://technet.microsoft.com/en-us/lib ... 58919.aspx

As mentioned earlier in my post, everything works just fine with DHCP except the lease time issue above. I have tried several routers and computers acting as DHCP server, all the messages looks fine in Wireshark and so on, I have tested different lease time periods, from 24h down to 30 seconds without any success, If I hard code my own leasetime in the same interrupt function that increments Net_Ethernet_Intern_userTimerSec to an predefined time (for instance 30 sec) the Net_Ethernet_Intern_renewDHCP module works just fine. But the problem is that I don't know the lease time that the DHCP server sent me.

Thank you for your support in this matter.

Best regards
Karl-Henrik Söderqvist

User avatar
Aleksandar.Mitrovic
mikroElektronika team
Posts: 1697
Joined: 11 Mar 2015 12:48

Re: New Ethernet library with improved TCP/IP Stack

#99 Post by Aleksandar.Mitrovic » 15 Dec 2016 17:42

Hi Karl,

Can you please tell me which architecture and compiler do you use?

Is it your Net_Ethernet_Intern_doDHCPLeaseTime() routine in the while loop?
That way you will decrement global lease time library counter.

You should after receiving the 1:
1 - lease time has expired, it's time to renew it.

Use Net_Ethernet_Intern_renewDHCP to renew it.

Kind regards,
Aleksandar

innoware
Posts: 6
Joined: 18 Oct 2012 07:10

Re: New Ethernet library with improved TCP/IP Stack

#100 Post by innoware » 03 Jan 2017 16:54

Hello Aleksandar, sorry for late reply! I didn't got any notification from the forum on your post.
Also! Sorry for not telling which software and hardware I've been using in my first post.

MikroC Pro for PIC32 version 3.6.0

Hardware.
* PIC32MX795F512L
* LAN8729IA

Pretty much like your development board (speaking of ethernet).

As first I've just only had the Net_Ethernet_Intern_doDHCPLeaseTime() in an if case like:

Code: Select all

if (Net_Ethernet_Intern_doDHCPLeaseTime()) {
	Net_Ethernet_Intern_renewDHCP(5);	
}
Now I tested with this code with no result:

Code: Select all

Net_Ethernet_Intern_doDHCPLeaseTime();

if (Net_Ethernet_Intern_doDHCPLeaseTime()) {
	Net_Ethernet_Intern_renewDHCP(5);	
}
Both code snippets where in the main loop.

For testing and devlopment purpose I've have been using an Linksys router where I can adjust the lease time of my DHCP server down to 60 seconds.
Is there a minimum lease time in the Net_Ethernet_Intern_doDHCPLeaseTime() function?

The solution we have made today is to manually read out the DHCP lease time (code 51) from the UDP ACK message sent from DHCP server to the MCU, but still, why don't we get the Net_Ethernet_Intern_doDHCPLeaseTime() to work? are you perhaps using code 58 (Renewal T1 Time value) for your function?

Best regards
Karl-Henrik Söderqvist

VCC
Posts: 463
Joined: 08 Jun 2009 18:31
Location: Romania

Re: New Ethernet library with improved TCP/IP Stack

#101 Post by VCC » 28 Jul 2020 20:04

Hi mikroe team,
I hope this time I'm posting in the right place, since the post from viewtopic.php?f=172&t=76904 is one month old and has 50+ views, without any response.
Now, my question is: is this library still supported? I see that it is 9 years old and the last post is 3+ years old. Am I the only one still interested in it? Looking at this thread (and others, including Libstock), I can see that most people use this library for implementing http servers, which only have to read short strings as requests, and only from time to time. The problem I'm facing is reading/processing much longer strings (like 256B - 1KB or more) in continuous mode, i.e. receiving files, because the connection drops randomly between client and PIC32 server (details on original post). Can somebody from mikroe look at this please?

Thank you :)

Post Reply

Return to “Library Development Discussion”