Page 1 of 1

UDP Receive in Interrupt mode

Posted: Fri Sep 29, 2023 12:21 pm
by Vineethad
Hello Everyone,

I am using the ESP32C3 WIFI module and the tool is Espressif IDE.

By using Access Point + UDP Server Example, I have done the UDP receiving packets in polling mode. But now I want to receive UDP packets in interrupt mode.

Please give me any suggestions for receiving UDP packets in interrupt mode.

Thanks & Regards,
D.Vineetha.

Re: UDP Receive in Interrupt mode

Posted: Sat Sep 30, 2023 5:09 am
by ESP_Sprite
UDP packets aren't received in polling or interrupt mode. What specifically are you talking about?

Re: UDP Receive in Interrupt mode

Posted: Tue Oct 03, 2023 7:46 am
by Vineethad
I have done UDP receiving packets in polling mode by using UDP Server example which is available in ESP-IDF examples.
https://github.com/espressif/esp-idf/bl ... p_server.c

But now I want to receive UDP packets in interrupt mode for that please clarify how to enable interrupt mode for ESP32C3 in
Espressif IDE.


Thanks & Regards,
D. Vineetha.

Re: UDP Receive in Interrupt mode

Posted: Tue Oct 03, 2023 3:44 pm
by MicroController
Your question doesn't make more sense when you just repeat it.

Create a dedicated task while(1) { len = recvfrom(udpsocket, packet,...); onUdpPacket(packet,len); }.

Alternatively, let us know what you believe "interrupt mode" means and how that would relate to receiving UDP packets.

Re: UDP Receive in Interrupt mode

Posted: Wed Oct 04, 2023 2:59 am
by ESP_Sprite
That code does not use 'polling', it is 'blocking', that is, it uses FreeRTOS primitives (in the TCP/IP stack) to put your task to sleep until the TCP/IP stack receives an UDP packet. What you want probably is a 'callback' rather than 'interrupt mode'. The sockets API does not have something like that, but the code snippet that MicroController provided would be a good workaround that performs a similar function. (But note that you may be better off trying to explain a bit more about the issue you're having, as faking a callback API may not be the best solution to your problem.)