Skip to main content
Aarra.1
Associate III
December 20, 2021
Question

udp_recv trigger when input data available.

  • December 20, 2021
  • 2 replies
  • 1617 views

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

This topic has been closed for replies.

2 replies

LCE
Principal II
December 20, 2021

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
Aarra.1Author
Associate III
December 20, 2021

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.

Aarra.1
Aarra.1Author
Associate III
December 23, 2021

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

Is that what you suggest.