2024-02-15 01:31 AM
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
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.
Solved! Go to Solution.
2024-02-16 12:00 AM
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.
2024-02-15 04:30 AM
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 :
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
2024-02-15 08:02 AM
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.
2024-02-15 07:26 PM
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.
2024-02-16 12:00 AM
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.