2020-10-26 10:09 AM
Hello experts, what am I doing wrong? For days I have been trying to put the LAN interface of my STM32H743ZI board into operation. I just want to send a text to my PC and also be able to receive text from the PC. The board should be the server. Unfortunately I could not find a working example. Also the sample project
doesn't work. In contrast to the example, however, I could not set the “Ethernet interrupt preemption priority�? to 5 because the value cannot be changed in CUBEMX. Furthermore, I did not select “MII�?, but “RMII�?, because according to the manual for this board, the “RMII�? interface is correct.
The project starts without an error message, but the debugger stops when calling
„MX_LWIP_Init“
at the point
/* Registers the default network interface */
netif_set_default(&gnetif);
I have chosen the following LAN settings:
STM32H743 Board IP-Adress: 192.168.133.53
Router IP-Adress: 192.168.128.1
IP-Adress from PC’s: 192.168.130.5
Sub-NET Mask: 255.255.248.0
Port: 23
The orange control lamp on the Lan port flashes quickly. However, when I send a ping from the PC, I don't get a response from the board.
I have attached the complete CubeIDE project as an attachment.
Can someone help me??? (The solution can also be without freertos)
I am desperate!
Best regards, Holger
void MX_LWIP_Init(void)
{
/* IP addresses initialization */
IP_ADDRESS[0] = 192;
IP_ADDRESS[1] = 168;
IP_ADDRESS[2] = 133;
IP_ADDRESS[3] = 53;
NETMASK_ADDRESS[0] = 255;
NETMASK_ADDRESS[1] = 255;
NETMASK_ADDRESS[2] = 248;
NETMASK_ADDRESS[3] = 0;
GATEWAY_ADDRESS[0] = 192;
GATEWAY_ADDRESS[1] = 168;
GATEWAY_ADDRESS[2] = 128;
GATEWAY_ADDRESS[3] = 1;
/* Initilialize the LwIP stack with RTOS */
tcpip_init( NULL, NULL );
/* IP addresses initialization without DHCP (IPv4) */
IP4_ADDR(&ipaddr, IP_ADDRESS[0], IP_ADDRESS[1], IP_ADDRESS[2], IP_ADDRESS[3]);
IP4_ADDR(&netmask, NETMASK_ADDRESS[0], NETMASK_ADDRESS[1] , NETMASK_ADDRESS[2], NETMASK_ADDRESS[3]);
IP4_ADDR(&gw, GATEWAY_ADDRESS[0], GATEWAY_ADDRESS[1], GATEWAY_ADDRESS[2], GATEWAY_ADDRESS[3]);
/* add the network interface (IPv4/IPv6) with RTOS */
netif_add(&gnetif, &ipaddr, &netmask, &gw, NULL, ðernetif_init, &tcpip_input);
/* Registers the default network interface */
netif_set_default(&gnetif);
if (netif_is_link_up(&gnetif))
{
/* When the netif is fully configured this function must be called */
netif_set_up(&gnetif);
}
else
{
/* When the netif link is down this function must be called */
netif_set_down(&gnetif);
}
/* Set the link callback function, this function is called on change of link status*/
// netif_set_link_callback(&gnetif, ethernet_link_status_updated);
/* Create the Ethernet link handler thread */
/* USER CODE BEGIN H7_OS_THREAD_DEF_CREATE_CMSIS_RTOS_V1 */
osThreadDef(EthLink, ethernet_link_thread, osPriorityBelowNormal, 0, configMINIMAL_STACK_SIZE *2);
osThreadCreate (osThread(EthLink), &gnetif);
/* USER CODE END H7_OS_THREAD_DEF_CREATE_CMSIS_RTOS_V1 */
/* USER CODE BEGIN 3 */
/* USER CODE END 3 */
}
Cube MX Settings:
2020-10-26 11:27 PM
UPDATE:
The Ethernet interrupt preemption priority can be changed in the NVIC settings.
After changing the value to 5, the for (;;;) {... } loop is processed.
/* Infinite loop */
for(;;)
{
for (;;) {
osDelay(10);
udp_buffer = pbuf_alloc(PBUF_TRANSPORT, strlen(message), PBUF_RAM);
if (udp_buffer != NULL) {
memcpy(udp_buffer->payload, message, strlen(message));
udp_send(my_udp, udp_buffer);
pbuf_free(udp_buffer);
}
}
}
But the STM32 still does not answer when I send a ping from the PC. The STM32 also does not send the message to the PC.
Further Setting in CUBEMX:
2024-02-13 01:11 PM
Hello! Did you find the error?
2024-06-14 05:17 AM - edited 2024-06-14 05:18 AM
Hi, I am suffering from the same problem too, have you solved it?
netif_set_down(&gnetif);
program stucks at here and does not turns up. I guess it is related with connection parameters.