UDP Receive in Interrupt mode

Vineethad
Posts: 55
Joined: Wed Jul 19, 2023 7:45 am

UDP Receive in Interrupt mode

Postby Vineethad » Fri Sep 29, 2023 12:21 pm

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.

ESP_Sprite
Posts: 9730
Joined: Thu Nov 26, 2015 4:08 am

Re: UDP Receive in Interrupt mode

Postby ESP_Sprite » Sat Sep 30, 2023 5:09 am

UDP packets aren't received in polling or interrupt mode. What specifically are you talking about?

Vineethad
Posts: 55
Joined: Wed Jul 19, 2023 7:45 am

Re: UDP Receive in Interrupt mode

Postby Vineethad » Tue Oct 03, 2023 7:46 am

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.

MicroController
Posts: 1707
Joined: Mon Oct 17, 2022 7:38 pm
Location: Europe, Germany

Re: UDP Receive in Interrupt mode

Postby MicroController » Tue Oct 03, 2023 3:44 pm

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.

ESP_Sprite
Posts: 9730
Joined: Thu Nov 26, 2015 4:08 am

Re: UDP Receive in Interrupt mode

Postby ESP_Sprite » Wed Oct 04, 2023 2:59 am

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.)

Who is online

Users browsing this forum: ESP_adokitkat, Gaston1980 and 172 guests