STMicroelectronics / STM32CubeH7

STM32Cube MCU Full Package for the STM32H7 series - (HAL + LL Drivers, CMSIS Core, CMSIS Device, MW libraries plus a set of Projects running on all boards provided by ST (Nucleo, Evaluation and Discovery Kits))
https://www.st.com/en/embedded-software/stm32cubeh7.html
Other
518 stars 308 forks source link

Ethernet low_level_init does not handle return code from LAN8742_init #261

Closed JojoS62 closed 9 months ago

JojoS62 commented 1 year ago

Caution The Issues are strictly limited for the reporting of problem encountered with the software provided in this project. For any other problem related to the STM32 product, the performance, the hardware characteristics and boards, the tools the environment in general, please post a topic in the ST Community/STM32 MCUs forum

Describe the set-up

Describe the bug The return code from https://github.com/STMicroelectronics/STM32CubeH7/blob/c2b13142a354d26b0baa5f505bb5607cd4aadd88/Projects/NUCLEO-H743ZI/Applications/LwIP/LwIP_HTTP_Server_Netconn_RTOS/Src/ethernetif.c#L216C10-L216C10

is not used. I have the case that a timeout error occurs. The code continues without checking (same in CubeMX generated code) and the link status is set wrongly to 10 M / half duplex. A following dhcp sequence executes correctly, but never sends a valid discover on the wire. So the debugging is difficult, as everything seems to be fine. How can the soft reset of LAN8742 fail? Haven't tested yet, but must not the link mode set before the soft reset? According to the datasheet, the soft reset doesn't evaluate the hardware strapping bits.

How To Reproduce

  1. Indicate the global behavior of your application project Build a ethernet app with CubeMX (needs additional steps, CubeMX code is not valid at the moment) or use the LwIP_HTTP_Server_Netconn example.

  2. The modules that you suspect to be the cause of the problem (Driver, BSP, MW ...) Middlewar LWIP, ethernetif.c

  3. The use case that generates the problem power on board with external supply

  4. How we can reproduce the problem I can reproduce the problem by using an external 5 V power supply, or unplug/plug the JP2 in STLink position

Additional context return code of LAN8742 must be checked. In a debug build, it should run into ErrorHandler. Print out the Error Codes as in lwip, there is a lot of nice tracing output.

Screenshots If applicable, add screenshots to help explain your problem.

RJMSTM commented 1 year ago

Hello @JojoS62,

Thank you for this report. We will get back to you as soon as we analyze it further. This may take some time. Thank you for your comprehension.

With regards,

JojoS62 commented 1 year ago

thanks for your response. I had also opened a thread in the ST community: https://community.st.com/t5/stm32cubemx-mcu/h743-and-lan8742-init/td-p/570179

Two more issues with the LAN8742_init:

TOUNSTM commented 1 year ago

ST Internal Reference: 159319

ALABSTM commented 9 months ago

Fixed in commit ae3bb5433e3a493b8d759ccd39dc50dce4e49e30