cancel
Showing results for 
Search instead for 
Did you mean: 

Simple Ethernet test

Gregory3
Associate III

Hi!

I'm using a custom PCB with STM32F767 on it with LAN8742a for Ethernet communication.

Just to mention, I'm totally new to Ethernet topics.

I have already search for an very simple example on how to just test the connection from the STM to LAN8742a (RMII) and to the PC via Ethernet cable.

Is it possible to just use the CubeIDE with the Ethernet driver but not to use and LwIP or RTOS for a simple test (ping)?

Or do I need to use the above mentioned components in order to just "see" if the HW is alive? Where to start the work? Are there any simple examples/app notes on that?

Like I wrote it is just for a basic HW test. Nothing more.

Thank you for any hints!

Regards,

Gregor

5 REPLIES 5
Gregory3
Associate III

Ok, so I have found the best simple explanation on this under this link:

https://github.com/martinbrickey/lwip/blob/master/STM32%20Ethernet%20Start%20Point%2020180307.pdf

This seems also not to work for me, because I'm not able to get a response to a ping.

To make the picture more clear, I have disabled the HTTPD, so the topic about the fsdata.c is not important at this time. The goal is just to ping the HW and get a response.

Here are my settings for the ETH:

0693W000004KAMcQAO.png0693W000004KJFBQA4.pngAnd for the LwIP:

0693W000004KJFaQAO.png0693W000004KJFfQAO.png 

Here is my main.c code:

#include "main.h"
#include "lwip.h"
#include "gpio.h"
 
/* Private includes ----------------------------------------------------------*/
/* USER CODE BEGIN Includes */
 
/* USER CODE END Includes */
 
/* Private typedef -----------------------------------------------------------*/
/* USER CODE BEGIN PTD */
/* USER CODE END PTD */
 
/* Private define ------------------------------------------------------------*/
/* USER CODE BEGIN PD */
 
/* USER CODE END PD */
 
/* Private macro -------------------------------------------------------------*/
/* USER CODE BEGIN PM */
 
/* USER CODE END PM */
 
/* Private variables ---------------------------------------------------------*/
 
/* USER CODE BEGIN PV */
 
/* USER CODE END PV */
 
/* Private function prototypes -----------------------------------------------*/
void SystemClock_Config(void);
/* USER CODE BEGIN PFP */
/* USER CODE END PFP */
 
/* Private user code ---------------------------------------------------------*/
/* USER CODE BEGIN 0 */
/* USER CODE END 0 */
 
/**
  * @brief  The application entry point.
  * @retval int
  */
int main(void)
{
  /* USER CODE BEGIN 1 */
  /* USER CODE END 1 */
 
  /* 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_LWIP_Init();
  /* USER CODE BEGIN 2 */
  /* USER CODE END 2 */
 
  /* Infinite loop */
  /* USER CODE BEGIN WHILE */
  while (1)
  {
    /* USER CODE END WHILE */
 
    /* USER CODE BEGIN 3 */
	  //Read a received packet from the Ethernet buffers and Send it to the lwIP stack for handling
	  MX_LWIP_Process();
  }
  /* USER CODE END 3 */
}

From my observation I can tell that after connecting the board directly to my PC and after starting the debbug an auto-negotiation process is started after some seconds finalized (activity led is blinking on the Ethernet connector).

When I try to ping the entered IP address then I can also see the LED activity for each of 4 attempts. But there is no answer to the ping message.

I would be grateful for any help with that.

Regards,

Gregor

Gregory3
Associate III

I'm also uploading the .ioc file for all settings.

Gregory3
Associate III

I will just continue this self-discussion :)

After some try's with my router I was able to ping my F767 Board, but only when it's cable connected to the router. The ping was sended from my PC connected to the same network as the router.

Here a picture of the ping details:

0693W000004KMcmQAG.png 

The question is: How can I ping the F767 Board when is directly connected to my PC and not to the router (with which settings) ?

Regards,

Gregor

Zk47
Associate II

Hello !!
After all this time, do you success in simple Ping example for stm32 
Currently, i am working with an stm32h43zi nucleo board, it's still hard for only testing just the ping command from pc 


Pavel A.
Evangelist III