Hello,
I have been playing around with StarterWare on the BeagleBone Black and wanted to send UDP packets as fast as possible in a tight loop. The 1.4.0 version of lwIP has the fix described in the thread listed below so I'm not losing packets:
http://e2e.ti.com/support/embedded/starterware/f/790/t/171893.aspx
My loop is very similar to Jay Larson's main while(1) loop but there is something I don't understand.
When I have a delay between sending packets, I have no problem and all the packets are sent and correctly received by the receiver at a bandwidth of about 4 MByte/S. However, if the delay is too short, something happens which temporarily blocks the transmission every 3 packets and as a result, the overall bandwidth drops to something like 300kbps.
I've traced the issue to the function cpswif_output() in ports/cpsw/netif/cpswif.c. In cpswif_output(), just after the call to cpswif_transmit(), there is a call to SYS_ARCH_UNPROTECT().
After SYS_ARCH_UNPROTECT() is called, the cpswif_transmit() function is supposed to return but doesn't. Another packet is queued to be sent. At this point, there is a huge delay every third packet that is sent by the main loop.
I haven't succeeded in enabling the lwip debug traces so it's difficult to know what is being executed and when. I'm still trying...
For my loop, I don't want to use a fixed delay, I just want to send packets sequentially as fast as possible so I either need to:
1. Find a way to do a 'blocking' send (or poll a flag) so the main loop isn't executed faster than the maximum bandwidth of the Ethernet link.
or
2. Use another mechanism or configuration to send UDP packets.
Could someone suggest an alternative or explain what I'm doing wrong?
Many thanks,
Vic.