Increase UDP WiFi TX buffer count
Posted: Mon Oct 09, 2017 3:50 pm
Hi,
I'm having issues when sending a UDP data stream from the ESP32 using SDK 2.1.
I've tried alot of different settings in menuconfig to improve the performance. I've tried both static and dynamic TX buffers. I tried increasing the number of buffers to the max value 64. I also tried to set it to 0 (manually in the sdkconfig.h since menuconfig does not allow a setting of 0 even though the Wifi manual specifies that 0 should be allowed and then unlimited buffers can be allocated).
Why can I not set CONFIG_ESP32_WIFI_DYNAMIC_RX_BUFFER_NUM to 0 for unlimited allocations?
This is what my initialization logs tell me about allocated buffers.
This is my loop for sending data (15 bytes sent as fast as possible). Using an oscilloscope I see that Pin15 gets set after the loop is run ~35 times. Eventually all data is sent, but there seems to be an issue with the buffers since I set them to 64 which should allow all my packets to be sent without sendto() returning ENOMEM.
This is the table of processes and priorities. All my processes are 3 or 2 (very very low priority). That way I was hoping that the wifi-driver will be prioritized above my processes and thus empty the send queue faster than I can fill it. That is not the case though.
Why does not the wifi driver send the packets faster than I can insert them?
Is there a way to increase the priority or speed of the wifi driver?
Thanks
Rickard
I'm having issues when sending a UDP data stream from the ESP32 using SDK 2.1.
I've tried alot of different settings in menuconfig to improve the performance. I've tried both static and dynamic TX buffers. I tried increasing the number of buffers to the max value 64. I also tried to set it to 0 (manually in the sdkconfig.h since menuconfig does not allow a setting of 0 even though the Wifi manual specifies that 0 should be allowed and then unlimited buffers can be allocated).
Why can I not set CONFIG_ESP32_WIFI_DYNAMIC_RX_BUFFER_NUM to 0 for unlimited allocations?
This is what my initialization logs tell me about allocated buffers.
Code: Select all
I (282) wifi: Init dynamic tx buffer num: 64
I (292) wifi: Init dynamic rx buffer num: 32
I (292) wifi: wifi driver task: 3ffcde84, prio:23, stack:4096
I (292) wifi: Init static rx buffer num: 25
I (292) wifi: Init dynamic rx buffer num: 32
Code: Select all
for(int i = 0; i < 50; ++i)
{
int res = sendto(txSocket, &data[0], 15, 0, (struct sockaddr *)&sRemote, sizeof(sRemote));
while (res == -1)
{
gpio_set_level(15, 0);
ESP_LOGE(TAG, "Error sending: %i", errno);
ESP_LOGE(TAG, "Error sending: %s", strerror(errno));
const TickType_t xDelay = 1 / portTICK_PERIOD_MS;
vTaskDelay(xDelay);
res = sendto(txSocket, &data[0], 15, 0, (struct sockaddr *)&sRemote, sizeof(sRemote));
gpio_set_level(15, 1);
}
}
Why does not the wifi driver send the packets faster than I can insert them?
Is there a way to increase the priority or speed of the wifi driver?
Code: Select all
main R 1 2080 4
IDLE R 0 612 5
IDLE R 0 552 6
tiT B 18 1624 11
Tmr Svc B 1 1696 7
pmT B 21 2152 14
HandleSPIRXTask B 3 3688 18
HandleSPITXTask B 2 3688 20
SPIRXParsePacke B 2 3680 19
rtT B 22 2984 15
ipc1 B 24 576 2
eventTask B 20 3288 12
UDP_ReceiveTask B 3 3328 22
UDP_HandleTXTas B 3 3680 24
UDP_HandleRXTas B 2 3672 23
wifi B 23 1964 13
ipc0 B 24 628 1
Rickard