Skip to main content
Graduate II
April 17, 2022
Solved

STM32F407 + LwIP + DP83848 = Cannot Ping - Why?

  • April 17, 2022
  • 2 replies
  • 7947 views

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

    This topic has been closed for replies.
    Best answer by DMårt

    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.

    2 replies

    Super User
    April 17, 2022

    > 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.

    DMårtAuthor
    Graduate II
    April 17, 2022
    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.
    Visitor II
    June 17, 2022

    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 :(

    DMårtAuthor
    Graduate II
    June 20, 2022

    Contact ST team. Upplagd your project here.​