Using LwIP Raw API?

Good Day,

I am currently working on a video streaming project and am seeking to maximize throughput. Here are my numbers.

Device: Photon 2
Transmission Medium: WiFi
Current Throughput (UDP): ~ 54Mbps
Desired Throughput (UDP): Between 75Mbps and 100Mbps

This is my code measuring the throughput. Just echoing 10KB back to my Photon 2.

I've tried to improve throughput by moving the Photon 2 closer to the WiFi access point and even connecting it to my 5GHz band. Neither will budge the throughput. What this tells me is that the software under the UDP protocol is the bottleneck. In fact, even calling sock_recvfrom (which UDP::receivePacket wraps) bumps the throughput to 56Mbps! The RTL8721DM MCU the Photon 2 is based on has PHY data rate of 150Mbps so I'm sure I can get the throughput higher somehow.

Here's my plan, but I need help finding one important piece to the puzzle. I'm going to attempt to build LwIP myself with the raw, baremetal API (NO_SYS = 1). I will set up Photon 2 WiFi credentials and connect to the access point as usual before placing my LwIP code loop in a SINGLE_THREADED_BLOCK so as to not get interrupted by the FreeRTOS system thread.

I've looked through the LwIP source and understand roughly what's going on but I need one thing. The netif (Network Interface) for the RTL8721DM MCU. This is the low level data link code for transmitting and receiving data to and from the device. Looking through the source I can see a RealtekNcpNetif class under device-os/hal/network/lwip/realtek. But it doesn't look like low level data link code. Maybe I'm wrong though.

Is the source for a RTL8721DM MCU netif available somewhere in the Particle GitHub or anywhere for that matter? I'd love to implement my own netif but I don't have the time to get into the gory details of the RTL8721DM. Plus I can't find much info (datasheet anywhere?) about it anyways.

Thank you so much,

I will preface this with, for experimentation your idea may or may not work, but absolutely should not be done for a production quality product.

When you check out the Device OS source from Github, you must also get the submodules. The Realtek SDK is a submodule:

# In the device-os directory:
git submodule update --init --recursive

Yes, I can imagine the DeviceOS setting up the hardware one way and a bare metal LwIP setting it up another will probably cause problems. Perhaps I'll look to see if I can use the Photon 2 along with another bare metal controller for UDP streaming. Because I could still use the Photon 2 for TCP and cloud services which is handy.

Hmm. Perhaps this. When entering "streaming" mode as I call it, use LwIP raw. After exiting streaming mode, send a reset signal to the Photon 2 to go back into Device OS mode.