cancel
Showing results for 
Search instead for 
Did you mean: 

Problem of porting LwIP to STM32H573I-DK

EyckHuang
Associate II

Hi Everyone,

I'm trying to port LwIP to STM32H573I-DK and has referenced to:

1. GitHub - STMicroelectronics/stm32h5-classic-coremw-apps at v1.0.0 

2. GitHub - stm32-hotspot/STM32H7-LwIP-Examples: Ethernet examples using LwIP + FreeRTOS for STM32H7 Discovery and Nucleo boards

But it still cannot work. The problems is that HAL_ETH_ReadData cannot receive any data after initialized.

The attachment is my ethernetif.c and eth.c which including MX_ETH_Init and HAL_ETH_MspInit

And STM32H573I-DK configuration is also attached.

Thanks for everyone.

1 ACCEPTED SOLUTION

Accepted Solutions
EyckHuang
Associate II

Hi @STea and @Guillaume K ,

I've fixed the issues after tracing some code. STM32H5 series have newer HAL API. There are some callback functions need to be implemented by ourselves.

For example, HAL_ETH_RxAllocateCallback and HAL_ETH_RxLinkCallback.

And STM32H573I-DK also needs to enable Ethernet global interrupt and calls HAL_ETH_Start_IT.

It can work well after did these.

View solution in original post

4 REPLIES 4
STea
ST Employee

Hello @EyckHuang ,

I'm lacking some information to further guide you to resolve your issue i need to know if you did the necessary modification to the linker script to declare the placement of the DMA descriptors because i see that in the eth.c file :

ETH_DMADescTypeDef  DMARxDscrTab[ETH_RX_DESC_CNT]; /* Ethernet Rx DMA Descriptors */
ETH_DMADescTypeDef  DMATxDscrTab[ETH_TX_DESC_CNT]; /* Ethernet Tx DMA Descriptors */

 but they should be declared as follows :

ETH_DMADescTypeDef  DMARxDscrTab[ETH_RX_DESC_CNT]__attribute__((section(".RxDecripSection"))); /* Ethernet Rx DMA Descriptors */
ETH_DMADescTypeDef  DMATxDscrTab[ETH_TX_DESC_CNT]__attribute__((section(".RxDecripSection")));/* Ethernet Tx DMA Descriptors */

with the addition of this zones in the Linker file :

 .tcp_sec (NOLOAD) : 
  {
	
    . = ABSOLUTE(0x30040000);
    *(.RxDecripSection)

    . = ABSOLUTE(0x30040060);
    *(.TxDecripSection)
	
  } >RAM 

another point you should reconfigure the pins assigned to Ethernet as follows :

STea_0-1708000065252.png

making sure speed is set to very HIGH and check the board schematics for the right pins physically connected in you Disco (this is the valid pinout configuration for the nucleo H563) .

after doing those modifications you need to check for the Ethernet interrupt and try to debug to make sure your code enters inside it .

i'll be waiting for your feedback after those tests if any .

BR

In order to give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

Hello @STea

You mention the pinout for ethernet for Nucleo H563.

As mentioned by @EyckHuang, he is using a STM32H573I-DK.

So I think the GPIO pins configuration for Ethernet he indicates in Gateway_H573.ioc is correct and doesn't need to be changed.

EyckHuang
Associate II

Hi @STea  and @Guillaume K  ,

I tried your solution, but it still cannot work. In STM32H573I-DK, the RAM starts from 0x20000000 and length is 640K. I can't set RxDecripSection and TxDecripSection to the position you provided. I set them to 0x20040000 and 0x20040060, respectively.

And as @Guillaume K mentioned, the GPIO pins configuration seems not need to be changed. I only changed Maximum output speed from High to Very High. But still not worked.

I create a new project which is simpler than previous attachment. It just calls MX_ETH_Init and sets MACConfig then calls HAL_ETH_Start.

In the main while loop, only call HAL_ETH_ReadData and check whether received data or not.

Hope this can help your analysis. Thank you.

 

EyckHuang
Associate II

Hi @STea and @Guillaume K ,

I've fixed the issues after tracing some code. STM32H5 series have newer HAL API. There are some callback functions need to be implemented by ourselves.

For example, HAL_ETH_RxAllocateCallback and HAL_ETH_RxLinkCallback.

And STM32H573I-DK also needs to enable Ethernet global interrupt and calls HAL_ETH_Start_IT.

It can work well after did these.