lwip-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lwip-users] Randomly delayed frame (STM32070 package including LwIP


From: stevestrong
Subject: Re: [lwip-users] Randomly delayed frame (STM32070 package including LwIP v1.4.1)
Date: Mon, 31 Dec 2018 11:10:33 -0700 (MST)

Thank you all for the replies.
Sorry if I was inpatient, I am struggling with this since more than a month.
I really appreciate any help.

As I have the ETH IRQ disabled, I don't think that Bastien's scenario
applies.
And I made several test with serial debug on low level input and output
functions and I had only up to 2 buffers reserved at once in worst case. The
option header file sets 10 Rx buffers and 5 out put buffers.
I could not observe at any time any under-run or overflow. The driver seems
to work correctly, the Rx and Tx time points do not deviate more than 100ms
from the wireshark timestamps. This cannot explain 2.5 seconds delay.

Anyway, I have meanwhile imported the arch/cc.h from 1.4.1.

But now I am stuck at porting DHCP app code from 1.4 to 2.1.
I have read this sites:
https://www.nongnu.org/lwip/2_1_x/group__lwip__nosys.html
https://www.nongnu.org/lwip/2_1_x/upgrading.html
http://lwip.wikia.com/wiki/LwIP_with_or_without_an_operating_system
http://lwip.wikia.com/wiki/Sample_Web_Server

Unfortunately, I am not yet very familiar with the insights of Lwip, and
none of these sites explain in detail how to proceed to have working DHCP.
In 1.4 the netif structure had netif.dhcp member, which is now missing.

Can someone tell me how to re-write this piece of code to have DHCP state
detection?
Thanks in advance.

*************************************
void LwIP_DHCP_Process_Handle()
{
  struct ip4_addr ipaddr;
  struct ip4_addr netmask;
  struct ip4_addr gw;

  switch (DHCP_state)
  {
  case DHCP_START:
    {
      DHCP_state = DHCP_WAIT_ADDRESS;
      dhcp_start(&gnetif);
      /* IP address should be set to 0 
         every time we want to assign a new DHCP address */
      IPaddress = 0;
    }
    break;

  case DHCP_WAIT_ADDRESS:
    {
      /* Read the new IP address */
      IPaddress = gnetif.ip_addr.addr;

      if (IPaddress!=0) 
      {
        DHCP_state = DHCP_ADDRESS_ASSIGNED;     

        /* Stop DHCP */
        dhcp_stop(&gnetif);
        LEDOn(1); // STM_EVAL_LEDOn(LED1);
      }
      else
      {
        /* DHCP timeout */
        if (gnetif.dhcp->tries > MAX_DHCP_TRIES)
        {
          DHCP_state = DHCP_TIMEOUT;

          /* Stop DHCP */
          dhcp_stop(&gnetif);

          /* Static address used */
          IP4_ADDR(&ipaddr, IP_ADDR0 ,IP_ADDR1 , IP_ADDR2 , IP_ADDR3 );
          IP4_ADDR(&netmask, NETMASK_ADDR0, NETMASK_ADDR1, NETMASK_ADDR2,
NETMASK_ADDR3);
          IP4_ADDR(&gw, GW_ADDR0, GW_ADDR1, GW_ADDR2, GW_ADDR3);
          netif_set_addr(&gnetif, &ipaddr , &netmask, &gw);
          LEDOff(1); // STM_EVAL_LEDOn(LED1);
        }
      }
    }
    break;
  default: break;
  }
}





--
Sent from: http://lwip.100.n7.nabble.com/lwip-users-f3.html



reply via email to

[Prev in Thread] Current Thread [Next in Thread]