lwip-users
[Top][All Lists]
Advanced

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

Re: [lwip-users] Problems with sending UDP packets in FreeRTOS


From: Mike Fleetwood
Subject: Re: [lwip-users] Problems with sending UDP packets in FreeRTOS
Date: Thu, 28 Jul 2016 10:52:50 +0100
User-agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0

Hi Simon,

... in that case it must be some other bug!

Every time it crashed, I got ERR_USE. But not only did it crash this thread, but killed all other LWIP functions (killing the HTTP server thread too - making de-bug difficult). The RTOS seems to keep running, as the GPIO toggle markers still appear every 4mS (I had markers in other threads also, and they kept running too).

I'm beginning to wonder if there's some kind of "memory leak" somewhere. I can't think where, as apart from a few "fixed" memory buffers - which aren't being used at the moment - the only memory usage is stacks allocated by the RTOS and buffers allocated by LWIP. I have a status page on the HTTP server which shows the RTOS free stack for each thread - none anywhere near a problem level. Is it possible to extract similar information from LWIP? I see in lwipopts a switch for statistics, but don't know how to access the results - I guess watching that would indicate any growing problem.

I tried one of Noam's linked examples (included below) - but that showed exactly the same problem, stopped sending after about 20 minutes (I couldn't tell if it was ERR_USE again, but no reason to think it was any different!).

void udp_test2(void *arg)
{
  struct netconn *conn;
  char  msg[]="testing" ;
  struct  netbuf *buf;
  char  * data;

  conn = netconn_new( NETCONN_UDP );
  netconn_bind(conn, IP_ADDR_ANY, 1234 ); //local port

  netconn_connect(conn, IP_ADDR_BROADCAST, 1235 );
  for( ;; )
  {
    buf = netbuf_new();
    data =netbuf_alloc(buf,  sizeof(msg));
    memcpy (data, msg, sizeof (msg));
    netconn_send(conn, buf);
    netbuf_delete(buf);  // De-allocate packet buffer

    osDelay(4);  //some delay!
  }
}

I altered the function name and the delay function, but otherwise it's a direct copy.

Many thanks,

Mike.


On 28/07/2016 10:24, Simon Goldschmidt wrote:
Mike Fleetwood wrote:
Question 1: Why should send return with ERR_USE?
It shouldn't. ERR_USE is only returned by tcp_bind() and udp_bind() (and you 
already bound your netconn outside the loop).
The only way it could be returned is by your netif driver's output function - 
or due to some other bug...


Simon

_______________________________________________
lwip-users mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/lwip-users


--
FACE Systems Ltd
The Old Boat House
Cadgwith
Cornwall TR12 7JX
T:01326 291031
M:07831 401464




reply via email to

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