lwip-users
[Top][All Lists]
Advanced

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

Re: [lwip-users] netconn receive UDP via multicast address


From: MaartenPR
Subject: Re: [lwip-users] netconn receive UDP via multicast address
Date: Wed, 10 Jan 2018 01:56:54 -0700 (MST)

Hi,

Yes I am using the by ST provided HAL and LL libraries. After you pointed
out that by default multicast reception might be disabled I started
searching through the stm32f7xx_hal_eth.c file and it turned out the
function "ETH_MACDMAConfig()" disabled the reception of multicast frames. I
turned on promiscious mode, and turned off the multicast frame filter. After
that frames were handed over to lwip.

For those interested and using the same processor and drivers. This is what
I ended up changing in the stm32f7xx_hal_eth.c driver file (lines 1632 to
1653):



Hope this help others with the same problems. Always check the hardware
first.

Thank you,

Greetings,

Maarten


Jens Nielsen wrote
> Hi
> 
> Are you using the driver and libraries from ST? Are you sure you're 
> actually receiving the packets and handing them over to lwip? I'm 
> guessing this has nothing to do with lwip but you need to enable the 
> reception of multicast frames in the hardware. In my case (based on some 
> old drivers for STM32F4) this was off by default
> 
> Best regards
> Jens
> 
> On 2018-01-09 21:11, Maarten Roozendaal wrote:
>>
>> Goodday,
>>
>> I am working on an implementation of lwip netconn api in combination 
>> with FreeRTOS. I use lwip version 2.0.0 on an STM32F7 microcontroller 
>> with FreeRTOS V9.0.0
>>
>> I want to use lwip to receive UDP packets from a mullticast adress. 
>> 239.0.0.0 in this case.
>>
>> The system running lwip is assigned a static ip adress, being 
>> 192.169.123.109.
>>
>> When sending UDP packets to 192.169.123.109 directly I can process 
>> them and echo them back. However, I need to be able to read UDP 
>> packets send to the multicast ip adress 239.0.0.0. To accomplish this 
>> I use the following task:
>>
>> static void vUDPnetconnTask(void *pvParameters)
>>
>> {
>>
>>   static struct netconn *conn;
>>
>>   static struct netbuf *buf;
>>
>>   ip_addr_t DestIPaddr, OwnAddr;
>>
>>   err_t err, recv_err;
>>
>>   LWIP_UNUSED_ARG(pvParameters);
>>
>>   netif_default->flags = NETIF_FLAG_UP | NETIF_FLAG_BROADCAST | 
>> NETIF_FLAG_ETHARP | NETIF_FLAG_LINK_UP | NETIF_FLAG_IGMP;
>>
>>   IP4_ADDR(&MulticastIPaddr, 239, 0, 0, 0);
>>
>>   IP4_ADDR(&OwnAddr, 192, 168, 123, 109);
>>
>>   conn = netconn_new(NETCONN_UDP);
>>
>>   if (conn!= NULL)
>>
>>   {
>>
>>     netconn_bind(conn, IP_ADDR_ANY, 60004);  // returns ERR_OK
>>
>>     err = netconn_join_leave_group(conn, &MulticastIPaddr, &OwnAddr, 
>> NETCONN_JOIN); // returns ERR_OK
>>
>>     if (err == ERR_OK)
>>
>>     {
>>
>>       while (1)
>>
>>       {
>>
>>         recv_err = netconn_recv(conn, &buf);
>>
>>         if (recv_err == ERR_OK)
>>
>>         {
>>
>>             // process the packet
>>
>>         }
>>
>>       }
>>
>>     }
>>
>>     else
>>
>>     {
>>
>>       netconn_delete(conn);
>>
>>     }
>>
>>   }
>>
>> }
>>
>> So, I bind to IP_ADDR_ANY using port 60004 (this is the port that the 
>> multicast address receives UDP packets on) and I use the function 
>> netconn_join_leave_group() to subribe to the multicast address.
>>
>> I do not get any error returns but I do not receive any UDP packets 
>> send to 293.0.0.0.
>>
>> I have been trying for a long time to get this to work but feel like I 
>> am missing something fundamental. Is there a way to accomplish what I 
>> need?
>>
>> Help is very much appriciated!
>>
>> Greetings,
>>
>> Maarten
>>
>>
>>
>> _______________________________________________
>> lwip-users mailing list
>> 

> lwip-users@

>> https://lists.nongnu.org/mailman/listinfo/lwip-users
> 
> 
> _______________________________________________
> lwip-users mailing list

> lwip-users@

> https://lists.nongnu.org/mailman/listinfo/lwip-users





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



reply via email to

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