Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ethernet low_level_init does not handle return code from LAN8742_init #261

Closed
JojoS62 opened this issue Jun 26, 2023 · 4 comments
Closed
Assignees
Labels
bug Something isn't working eth Ethernet-related issue or pull-request internal bug tracker Issue confirmed and reported into a ticket in the internal bug tracking system mw Middleware-related issue or pull-request.
Milestone

Comments

@JojoS62
Copy link

JojoS62 commented Jun 26, 2023

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

  • NUCLEO_H743ZI2 Rev. E01
  • STM32Cube FW_H7 V1.11.0

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
Copy link
Contributor

RJMSTM commented Jul 4, 2023

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,

@RJMSTM RJMSTM added the mw Middleware-related issue or pull-request. label Jul 4, 2023
@JojoS62
Copy link
Author

JojoS62 commented Jul 6, 2023

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:

  • I found that the H7 is very fast, the init is called about 3 ms after power up. But the chip needs more time to initialize and to read the strapping bits. A delay of 50 ms before calling the lwip init fixed the problem. For cube generated code, the MX_LWIP_init has to be disabled from automatic calling for this.
  • the LAN8742 init tries addresses 0..31, but with its strapping bits it can have only address 0 or 1. It is more important to verify if the SMR read was successful, then the delay is not necessary.

@TOUNSTM
Copy link
Contributor

TOUNSTM commented Aug 15, 2023

ST Internal Reference: 159319

@TOUNSTM TOUNSTM added the internal bug tracker Issue confirmed and reported into a ticket in the internal bug tracking system label Aug 15, 2023
@ALABSTM ALABSTM added the eth Ethernet-related issue or pull-request label Feb 19, 2024
@ALABSTM ALABSTM added this to the v1.11.2 milestone Feb 19, 2024
@ALABSTM ALABSTM added the bug Something isn't working label Feb 21, 2024
@ALABSTM
Copy link
Contributor

ALABSTM commented Feb 21, 2024

Fixed in commit ae3bb54

@ALABSTM ALABSTM closed this as completed Feb 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working eth Ethernet-related issue or pull-request internal bug tracker Issue confirmed and reported into a ticket in the internal bug tracking system mw Middleware-related issue or pull-request.
Projects
Development

No branches or pull requests

4 participants