2023-02-13 01:10 AM
Hello I wan't to use the ethernet of my MCU (STM32F107VCT6) with using Lwip module. I'm using a dev board (EasyMx Pro V7). For the moment I've connect a etehernet cable between my computer and my ethernet board I've used some example of ethernet example for test the ethernet communication. But I don't arrive to ping my board after settings the differents parameters (GW address, Mask Address, IP Address). All my code has been generated with CubeMx.
I've also debug my program for try to understand why I can't ping my card and all seems to work fine netif is set up. I use wireshark to see the ethernets frame from my ethernet I see only ARP frame but not PING frame (ICMP).
Here is my main loop and it is the part that I modified :
while (1)
{
/* USER CODE END WHILE */
/* USER CODE BEGIN 3 */
/* Read a received packet from the Ethernet buffers and send it
to the lwIP for handling */
ethernetif_input(&gnetif);
/* Handle timeouts */
sys_check_timeouts();
HAL_GPIO_TogglePin(LED_PA_10_GPIO_Port, LED_PA_10_Pin);
HAL_Delay(500);
}
/* USER CODE END 3 */
}
2023-02-14 08:29 AM
Here is the ethernet traffic between my computer and my dev board when I ping it :
and here the result of the ping command :
We can see that the ping is in wireshark but I get any response from my dev board.
2023-02-14 08:42 AM
Is that half-second delay desirable in every loop?
Can't you toggle the GPIO/LED based on time elapsed rather than blocking on every iteration.
2023-02-14 08:53 AM
Yes I think it's possible to toggle the GPIO/LED based on time elapsed, I wanted at the beginning to blink led every seconds. Actualy I remove this code to test only ethernet part.
2023-02-14 05:14 PM
> We can see that the ping is in wireshark
Where? All packets seen on your wireshark screenshot are ARPs from your computer. It does not get any response to these ARPs so it cannot even send ICMP packets (ping).
2023-02-15 12:03 AM
Yes I understand, so it's may be a configuration problem in CubeMX but I have tick some options in LWIP Configuration for icmp and arp like:
But the computer need to get the IP and the MAC via ARP before to send a PING, is that right ?
If the ARP table of my computer doesn't have the IP and MAC address of my board I can't ping it. So I need to use etharp_request in my code ?
2023-02-16 12:46 AM
I also tried to ping my PC from my dev board using this library (https://github.com/particle-iot/lwip-contrib/tree/master/apps/ping) but ping doesn't work more in that way. It's like ethernet data are block.
2023-02-16 07:47 AM
I have add in my main loop the function : ethernetif_set_link(&gnetif);
And when I debugging I go to the else is (which say network cable is disconnected),
but there is a cable connected. So I think it's must be a problem of phy configuration.