1 Reply Latest reply on May 21, 2014 12:34 PM by userc_3610

    Is FreeRTOS - LwIP Multicast working?

      Hi!

      Did anyone use multicast with FreeRTOS-LwIP,

      I tried but wiced_multicast_join() function fails, when using with FreeRTOS-LwIP.

      With ThreadX-NetX it works as expected.

       

      Wireshark sniffing claims that header checksum is wrong in FreeRTOS-LwIP case, did anyone else experience this?

       

      Regards Erik

        • 1. Re: Is FreeRTOS - LwIP Multicast working?

          Found 2 problems with this. First this one, in file Wiced/Network/LwIP/ver1.4.0.rc1/src/core/ipv4/ip.c line 64.

           

          #ifndef LWIP_INLINE_IP_CHKSUM
          #define LWIP_INLINE_IP_CHKSUM   1
          #endif

           

          if #define LWIP_INLINE_IP_CHKSUM   1 is set, ip header checksum for igmp join multicast is of by 0x1600

          if #define LWIP_INLINE_IP_CHKSUM   0 is set, ip header checksum for igmp join multicast is correct.

          Did not investigate why that is, Not yet anyways.

           

          Second, this one, in file Wiced/Network/LwIP/wiced/tcpip.c where I think the if statement is wrong and reversed, i.e. ERR_OK means SUCCESS not ERROR. So change != to == and then it is correct.

           

          wiced_result_t wiced_multicast_join( wiced_interface_t interface, const wiced_ip_address_t* address )
          {
              uint32_t temp;

           

              WICED_LINK_CHECK( interface );

           

              temp = htonl(address->ip.v4);
              if ( igmp_joingroup( &IP_HANDLE(interface).ip_addr, (ip_addr_t*) &temp ) != ERR_OK )
              {
                  return WICED_SUCCESS;
              }
              else
              {

                   return WICED_ERROR;
              }
          }

           

          wiced_result_t wiced_multicast_leave( wiced_interface_t interface, const wiced_ip_address_t* address )
          {
              uint32_t temp;

           

              WICED_LINK_CHECK( interface );

           

              /* call lwip stack to leave a multicast group */
              temp = htonl(address->ip.v4);
              if ( igmp_leavegroup( &wiced_ip_handle[interface].ip_addr, (ip_addr_t*) &temp ) != ERR_OK )
              {
                  return WICED_SUCCESS;
              }
              else
              {
                  return WICED_ERROR;
              }
          }