UDP appears not to be working

I’m trying to build a library to handle E1.31 (sACN) data on my photon.
So I need to be able to receive data over multicast UDP.

So far I’ve got most of the work done but for some reason there doesn’t appear to be any UDP packets being parsed.

You can see my code over at
https://github.com/AdmiralTriggerHappy/E131/blob/master/E131.ino

Any ideas?

Hi @AdmiralTH

There is a lot of code there to read, so I just have a few comments:

I would not use the AUTO setting for the antenna. It has been problematic in certain cases in the past. If you don’t have an external antenna hooked up, just use the default.

In your udp.joinMulticast(myIP) call: that is not the way that UDP multicast works. You need to join using a known multicast address. See http://www.tcpipguide.com/free/t_IPMulticastAddressing.htm

This wiki https://opendmx.net/index.php/Comparison_of_DMX_over_IP_protocols seems to say that E1.31 uses 239.255.0.1 - 239.255.249.255 depending on the universe.

Thanks for that, its my first time working with UDP and the documentation is a little unclear on that front.
I’ve updated to the correct multicast address, but its still not working.

When it tries to receive the UDP packets it seems to always come back with a size < 0 because it always shows the dmx data field in the cloud as “Error0” which means its something to do with my UDP config or code.

@rickkas7 You seem to be a UDP guru around here, got any ideas for me?

I even tried unicasting directly to it and I’m still getting the udp.receivePacket returning 0 and sending an error to the cloud.

bump

I think I found one of the problems, it doesn’t seem to like using the packetWorkingBuffer but it works fine with packet instead.

ie the below doesn’t work but

int size = udp.receivePacket(packetWorkingBuffer->raw, E131_PACKET_SIZE);

but

int size = udp.receivePacket(packet->raw, E131_PACKET_SIZE);

does.

Well it doesn’t really matter why it doesn’t work as it was used for double buffering and with reading of whole packets that not needed.
I’ve updated the code and it should all work if anyone else is interested.