Skip to content

w5500_tsk not deleted when esp_eth driver initialization fails (IDFGH-16721) #120

@szerwi

Description

@szerwi

Checklist

  • Checked the issue tracker for similar issues to ensure this is not a duplicate
  • Read the documentation to confirm the issue is not addressed there and your configuration is set correctly
  • Tested with the latest version to ensure the issue hasn't been fixed

How often does this bug occurs?

always

Expected behavior

During esp_eth_driver_install(), there is a w5500_tsk task created for W5500 module. If the initialization fails, the task should be destroyed.

Actual behavior (suspected bug)

The task is not destroyed, resulting in constantly reporting w5500.mac: w5500_get_rx_received_size(238): read RX RSR failed error.

When the W5500 is initialized for the second time, another w5500_tsk is created resulting in memory leak.

Error logs or terminal output

Errors during initialization (W5500 is physically not connected, which results in initialization error):

14:42:09.623 > E (13:42:08.164) w5500.mac: w5500_reset(308): reset timeout
14:42:09.630 > E (13:42:08.165) w5500.mac: w5500_send_command(210): send command timeout
14:42:09.637 > E (13:42:08.165) w5500.mac: emac_w5500_init(893): reset w5500 failed
14:42:09.644 > E (13:42:08.175) w5500.mac: emac_w5500_receive(757): issue RECV command failed
14:42:09.652 > E (13:42:08.176) esp_eth: esp_eth_driver_install(250): init mac failed
14:42:09.659 > E (13:42:08.186) w5500.mac: frame read from module failed
14:42:09.665 > E (13:42:08.197) ARDUINO: SPI Ethernet driver install failed: 263

After the failure, w5500_tsk keeps running resulting in errors every 1 second:

14:42:23.708 > E (14:42:22.233) w5500.mac: w5500_get_rx_received_size(238): read RX RSR failed
14:42:24.708 > E (14:42:23.233) w5500.mac: w5500_get_rx_received_size(238): read RX RSR failed
14:42:25.708 > E (14:42:24.233) w5500.mac: w5500_get_rx_received_size(238): read RX RSR failed
14:42:26.709 > E (14:42:25.233) w5500.mac: w5500_get_rx_received_size(238): read RX RSR failed

Steps to reproduce the behavior

Try to initialize W5500 driver when module is not connected. I use arduino-esp32 and ETH.begin(ETH_PHY_TYPE, ETH_PHY_ADDR, ETH_CSN_PIN, ETH_IRQ_PIN, -1, eth_spi, ETH_SPI_CLOCK_FREQ) function.

Project release version

ESP-IDF v5.5.1.250929

System architecture

Intel/AMD 64-bit (modern PC, older Mac)

Operating system

Windows

Operating system version

Windows 11

Shell

CMD

Additional context

I am using arduino-esp32 3.3.2 framework.

I have W5500 Ethernet module connected via SPI. Examining the driver initialization functions, I have narrowed down the issue and I am convencied that the bug is inside ESP-IDF W5500 driver.

The issue happens when communication with W5500 chip is not working, eg. when the chip is not powered.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions