lwip-devel
[Top][All Lists]
Advanced

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

[lwip-devel] Can I use LWIP RAW API with FreeRTOS?


From: kalkhour
Subject: [lwip-devel] Can I use LWIP RAW API with FreeRTOS?
Date: Wed, 23 May 2018 13:01:12 -0700 (MST)

Hey :) 
I'm working on a project that includes UDP multicast communication using
STM32F7 and freeRTOS.
I have already found a piece of code that can help me but it uses RAW API
with freeRTOS instead of netconn or socket. 
I thought that RAW API is not supposed to be used with an operating system
and actually the code I found is not working (but it is supposed to). to be
precise the callback function that is given to udp_recv function is not
being called even though ethernetif_input is receiving the messages
correctly! and I couldn't find any example on the internet that uses RAW API
with freeRTOS so my question is:
is it possible to use RAW API + freeRTOS? and if yes, can you provide me
with a simple working example?

the following code is a small example of what I need:

void udp_echo_receive_callback(void *arg, struct udp_pcb *upcb, struct pbuf
*p, struct ip4_addr *addr, u16_t port)
{
   //Do Something ... the program never reaches this point!   
}

static void udpecho_thread(void *arg)
{
   struct udp_pcb *upcb;
   err_t err;
   
   /* Create a new UDP control block  */
   upcb = udp_new();
   
   if (upcb)
   {
     /* Bind the upcb to the UDP_PORT port */
     /* Using IP_ADDR_ANY allow the upcb to be used by any local interface
*/
      err = udp_bind(upcb, IP_ADDR_ANY, UDP_SERVER_PORT);
      
      if(err == ERR_OK)
      {
        /* Set a receive callback for the upcb */
        udp_recv(upcb, udp_echo_receive_callback, NULL);
      }
   }
}

void udpecho_init(void)
{
  sys_thread_new("LWIP", udpecho_thread, NULL,
DEFAULT_THREAD_STACKSIZE,UDPECHO_THREAD_PRIO );
}

any advice is appreciated :) 
Thank you.



--
Sent from: http://lwip.100.n7.nabble.com/lwip-devel-f11621.html



reply via email to

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