cancel
Showing results for 
Search instead for 
Did you mean: 

udp_recv trigger when input data available.

Aarra.1
Senior

Hello,

I'm using stm32h757i-eval board & STM23cube ide for programming.

I have successfully achieved the UDP communication.

But there is one problem.

I want a trigger or auto polling function for the UDP_RECV i.e, when ever there is a input data available only then it should enter the UDP_RECV function.

and I'm not able to figure out how to do this.

Kindly help me solve this issue

4 REPLIES 4
LCE
Principal

Assuming you are using lwIP, do you really mean the function "udp_recv" which is only binding a udp receive (recv) function to a certain pcb = setting udp callback function?

In my lwIP application input data is polled through MX_LWIP_Process() in the main while loop, which again calls ... many functions:

I once tracked that down for IP4 to get a better overview for the "processing path":

Network Interface Layer:

main.c:         poll: MX_LWIP_Process()

-> lwip.c: MX_LWIP_Process()         -> ethernetif_input(&netif)

-> ethernetif.c ethernetif_input(&netif)    -> p = low_level_input(netif)

-> ethernetif.c    low_level_input(netif)       -> netif->input(p, netif)

-> ethernet.c      netif->input(p, netif) = ethernet_input(p, netif)

-> ethernet.c      ethernet_input(p, netif)   -> check: header, length, address (ARP), type -> ip4_input(p, netif)

Internet Layer:

-> ip4.c         ip4_input(p, netif)         -> address / broadcast? type? -> RAW, ICMP, IGMP, UDP, TCP ?

   -> ICMP: icmp_input(p, netif)

   -> IGMP: igmp_input(p, netif)

Transport Layer:

   -> UDP: udp_input(p, netif) <<== so this might be of interest to you?

   -> TCP: tcp_input(p, netif)

Aarra.1
Senior

Thank you for your response.

yes. I'm using LwIP and have referred this link for the udp communication: https://controllerstech.com/stm32-ethernet-3-udp-client/

and I have called the MX_LWIP_Process,

The issue is since its in the while loop the data keeps printing till the new input data is enterred.

I want to pause the printing after once and wait for the next input data.

So the UDP_recv function can be replaced with the UDP_Input function?

Is that what you suggest.

Read my latest post in this thread:

https://community.st.com/s/question/0D50X0000C6eNNS/bug-fixes-stm32h7-ethernet

It's exactly about the code from that site...