cancel
Showing results for 
Search instead for 
Did you mean: 

UDP Echo server example is not working(Nucleo-144 for STM429ZI)

BPark.4
Associate II

I used example from STM324xG_EVAL\Applications\LwIP\LwIP_UDP_Echo_Server\Src.

I add lwIP into the project using CubeMX.

ping test is good.

I sent the message using Hercules tool. but Necleo didn't receive massages .

0693W000000Wop3QAC.png

there are CubeMX setting value.

I also change GATEWAY ADDRESS to 192.168.42.1, not working too.

0693W000000Wop8QAC.png

0693W000000WopNQAS.png

0693W000000WopSQAS.png

/* lwIP.c*/
void MX_LWIP_Init(void)
{
  /* IP addresses initialization */
	  	IP_ADDRESS[0] = 192;
		IP_ADDRESS[1] = 168;
		IP_ADDRESS[2] = 42;
		IP_ADDRESS[3] = 51;
		NETMASK_ADDRESS[0] = 255;
		NETMASK_ADDRESS[1] = 255;
		NETMASK_ADDRESS[2] = 255;
		NETMASK_ADDRESS[3] = 0;
		GATEWAY_ADDRESS[0] = 0;
		GATEWAY_ADDRESS[1] = 0;
		GATEWAY_ADDRESS[2] = 0;
		GATEWAY_ADDRESS[3] = 0;
 
  /* Initilialize the LwIP stack without RTOS */
....
..
}
 
/*udp_echoserver.c */ 
void udp_echoserver_receive_callback(void *arg, struct udp_pcb *upcb, struct pbuf *p, const ip_addr_t *addr, u16_t port)
{
 
  /* Connect to the remote client */
  udp_connect(upcb, addr, UDP_CLIENT_PORT);
    
  /* Tell the client that we have accepted it */
  udp_send(upcb, p);
 
  /* free the UDP connection, so we can accept new clients */
  udp_disconnect(upcb);
	
  /* Free the p buffer */
  pbuf_free(p);
   
}
 
 
/*main.c*/
int main(void)
{
  /* Reset of all peripherals, Initializes the Flash interface and the Systick. */
  HAL_Init();
 
  /* USER CODE BEGIN Init */
	/* tcp echo server Init */
	udp_echoserver_init();
  /* USER CODE END Init */
 
  /* Configure the system clock */
  SystemClock_Config();
 
  /* Initialize all configured peripherals */
  MX_GPIO_Init();
  MX_USART3_UART_Init();
  MX_USB_OTG_FS_PCD_Init();
  MX_LWIP_Init();
 
  /* Infinite loop */
  /* USER CODE BEGIN WHILE */
  while (1)
  {
    /* USER CODE END WHILE */
 
    /* USER CODE BEGIN 3 */
	    ethernetif_input(&gnetif);
	    /* Handle timeouts */
	    sys_check_timeouts();
  }
  /* USER CODE END 3 */
}

​I want to work udp_echoserver_receive_callback fuction when I send a message.

1 ACCEPTED SOLUTION

Accepted Solutions
Piranha
Chief II
4 REPLIES 4
Piranha
Chief II

You are calling udp_echoserver_init() before MX_LWIP_Init(). :)

Also be warned...

https://community.st.com/s/question/0D50X0000BOtfhnSQB/how-to-make-ethernet-and-lwip-working-on-stm32

Thank you.

I modifed it under MX_LWIP_Init(). and I can receive the message.

Hi

Im trying to run echo server on stm32h743z nucleo without any success

int main(void)

{

 /* USER CODE BEGIN 1 */

 /* USER CODE END 1 */

 /* Enable D-Cache---------------------------------------------------------*/

 SCB_EnableDCache();

 /* MCU Configuration--------------------------------------------------------*/

 /* Reset of all peripherals, Initializes the Flash interface and the Systick. */

 HAL_Init();

 /* USER CODE BEGIN Init */

 /* USER CODE END Init */

 /* Configure the system clock */

 SystemClock_Config();

 /* USER CODE BEGIN SysInit */

 /* USER CODE END SysInit */

 /* Initialize all configured peripherals */

 MX_GPIO_Init();

 MX_SPI3_Init();

 MX_USART3_UART_Init();

 MX_USB_OTG_FS_PCD_Init();

 MX_LWIP_Init();

 /* USER CODE BEGIN 2 */

 /* USER CODE END 2 */

 /* Infinite loop */

 /* USER CODE BEGIN WHILE */

 udp_echoserver_init();

 while (1)

 {

/* USER CODE END WHILE */

/* USER CODE BEGIN 3 */

ethernetif_input(&gnetif);

/* Handle timeouts */

sys_check_timeouts();

 }

 /* USER CODE END 3 */

}

any help ?

LBadi.1
Associate II

Hello @BPark.4,

I am facing the same issue like you. Ping test is also working and my echo_init in the right place but nucleo can't receive messages using Hercules.

Any idea ?