cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F407 + LwIP + DP83848 = Cannot Ping - Why?

DMårt
Lead

I have an STM32F407 and I'm using LwIP + DP83848 Ethernet PHY. I'm facing problems to ping the unit and I don't know why.

0693W00000LyBAkQAN.png 

0693W00000LyBAzQAN.png 

The pinouts for the RMII settings.

0693W00000LyBB4QAN.png 

Red rings got to the processor. The blue ring shows RESET. It need to be logic 1 (HIGH) for the Ethernet PHY to start. The green ring shows a LED lamp that flashes when something happen on the internet cable e.g I ping an IP-address.

0693W00000LyBB9QAN.png 

The oscillator is at 50 Mhz and I don't know why it should go inside my processor. This is from the datasheet DS8626 of the ST-microcontroller. https://www.st.com/resource/en/datasheet/dm00037051.pdf

0693W00000LyBBEQA3.png 

I think this is OK to just write 50 MHz for Ethernet PTP?

0693W00000LyBBJQA3.png 

I have connected my RJ45 connector like this

0693W00000LyBBiQAN.png 

0693W00000LyBBTQA3.pngOther tiny pins of the Ethernet PHY

0693W00000LyBBdQAN.png 

Pins that are not used are:

0693W00000LyBBsQAN.png 

Special pinns:

https://i.stack.imgur.com/UszLt.png

Some pins have Pull-up and pull-down. I have pull-downs on all input pins of the ethernet PHY.

https://i.stack.imgur.com/CRwSZ.png

Last picture is the LwIP configuration. Were I select the IP address and the ram address at 0x20014000 with a size of 1600 bytes. My RAM address goes from 0x2000000 to 0x20020000 e.g 128 kB.

https://i.stack.imgur.com/dEliW.png

https://i.stack.imgur.com/HaCJR.png

/* USER CODE BEGIN 0 */
 
extern struct netif gnetif;
 
int main(){
/* USER CODE END 0 */
 
  /* 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_FSMC_Init();
  MX_DCMI_Init();
  MX_SPI2_Init();
  MX_TIM1_Init();
  MX_TIM3_Init();
  MX_ADC1_Init();
  MX_CAN1_Init();
  MX_RTC_Init();
  MX_TIM4_Init();
  MX_DMA_Init();
  MX_UART5_Init();
  MX_LWIP_Init();
  /* USER CODE BEGIN 2 */
  
  /* Activate DP83848 */
  HAL_GPIO_WritePin(ETH_RESET_GPIO_Port, ETH_RESET_Pin, GPIO_PIN_SET);
 
  while (1)
  {
    /* USER CODE END WHILE */
 
    /* USER CODE BEGIN 3 */
 
      ethernetif_input(&gnetif);
 
      sys_check_timeouts();
  }

Result:

Nothing happens when I ping

https://i.stack.imgur.com/rhihe.png

Only the LED D1 flashes when I ping. So that means the pin LED_ACT/COL at my Ethernet PHY goes from HIGH to LOW when something happening at the ethernet cable. Right?

https://i.stack.imgur.com/7T9ZD.png

https://i.stack.imgur.com/Vphkh.png

Question:

What should I do in STM32CubeIDE to make my processor work with the Ethernet PHY? What have I missed?

I have follow this manual that shows how to connect a processor to the network using LwIP and an external Ethernet PHY.

https://controllerstech.com/stm32-ethernet-1-connection/

Datasheets:

50 Mhz oscillator: ECS_3225MVQ-1825332.pdf (mouser.se)

RJ45 connector: https://eu.mouser.com/datasheet/2/445/74990101212-1723960.pdf

STM32MP151AAC3 custom board with STM32-OS as operating system: https://github.com/DanielMartensson/STM32-Computer
1 ACCEPTED SOLUTION

Accepted Solutions

Hey! I found an error! HAL_ETH_ERROR_DMA do I get when I'm only using ETH and not LwIP.. I will open a new question about that.

STM32MP151AAC3 custom board with STM32-OS as operating system: https://github.com/DanielMartensson/STM32-Computer

View solution in original post

7 REPLIES 7
Pavel A.
Evangelist III

> What should I do in STM32CubeIDE to make my processor work with the Ethernet PHY? 

  1. If you have a supported ST eval board (Nucleo, Discovery etc): find a ST-provided example for exactly this board. These examples have been created before CubeIDE so you need to convert (import) it to CubeIDE. Make this example build correctly after conversion; do not change anything until it runs on the board.
  2. If you have a custom board with a custom PHY: find a closest eval board and port some example for that board to yours. If this is too hard, find somebody to help.

  1. No. I don't know which example I should use for the STM32F407 processor. Please, provide me an URL link to that.
  2. Yes. I have a custom board.
STM32MP151AAC3 custom board with STM32-OS as operating system: https://github.com/DanielMartensson/STM32-Computer

Hey! I found an error! HAL_ETH_ERROR_DMA do I get when I'm only using ETH and not LwIP.. I will open a new question about that.

STM32MP151AAC3 custom board with STM32-OS as operating system: https://github.com/DanielMartensson/STM32-Computer
TALHA
Associate II

Hi @Daniel Mårtensson​ I am facing same problem with F107 with DP83848 and F407 with LAN8720 chips. Both setups do not ping at all. Please help. I am stuck :(

Contact ST team. Upplagd your project here.​

STM32MP151AAC3 custom board with STM32-OS as operating system: https://github.com/DanielMartensson/STM32-Computer

You can try this HAL 1.27 ETH driver fix for F4. I fixed some bugs mentioned in this thread:

https://community.st.com/s/question/0D53W00001VYkb5SAD/stm32f417-lwip-udp-packets-are-being-truncated

You must replace driver file, you will probably have it in the folder:

C:\Users\<user_folder>\STM32Cube\Repository\STM32Cube_FW_F4_V1.27.0\Drivers\STM32F4xx_HAL_Driver\Src