Skip to content

Fix ethernet clk_mode for GPIO0_OUT#4307

Merged
jesserockz merged 3 commits into
esphome:devfrom
jorticus:jorticus/fix-eth-gpio0
Mar 8, 2023
Merged

Fix ethernet clk_mode for GPIO0_OUT#4307
jesserockz merged 3 commits into
esphome:devfrom
jorticus:jorticus/fix-eth-gpio0

Conversation

@jorticus

Copy link
Copy Markdown
Contributor

What does this implement/fix?

The ethernet component has a bug preventing clk_mode: GPIO0_OUT from working.

This is due to the fact that the IDF enum for clk_mode_t has the same value for EMAC_CLK_IN_GPIO and EMAC_APPL_CLK_OUT_GPIO (both are equal to 0), and so the logic that sets rmii.clock_mode sets the incorrect value - we would expect mode to be set to EMAC_CLK_OUT, but instead it is set to EMAC_CLK_EXT_IN.

Fix is to separate the two enums and select the correct mode+gpio in the python layer.

Types of changes

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Other

Test Environment

  • ESP32
  • ESP32 IDF
  • ESP8266
  • RP2040

Example entry for config.yaml:

# Example config.yaml
ethernet:
  type: RTL8201
  mdc_pin: GPIO23
  mdio_pin: GPIO18
  clk_mode: GPIO0_OUT
  phy_addr: 0

Checklist:

  • The code change is tested and works locally.
  • Tests have been added to verify that the new code works (under tests/ folder).

If user exposed functionality or configuration variables are added/changed:

@probot-esphome

Copy link
Copy Markdown

Hey there @esphome/core, mind taking a look at this pull request as it has been labeled with an integration (dashboard_import) you are listed as a code owner for? Thanks!
(message by CodeOwnersMention)

@probot-esphome

Copy link
Copy Markdown

Hey there @esphome/core, mind taking a look at this pull request as it has been labeled with an integration (esp32) you are listed as a code owner for? Thanks!
(message by CodeOwnersMention)

@probot-esphome

Copy link
Copy Markdown

Hey there @jesserockz, mind taking a look at this pull request as it has been labeled with an integration (bluetooth_proxy) you are listed as a code owner for? Thanks!
(message by CodeOwnersMention)

@probot-esphome

Copy link
Copy Markdown

Hey there @asoehlke, mind taking a look at this pull request as it has been labeled with an integration (cd74hc4067) you are listed as a code owner for? Thanks!
(message by CodeOwnersMention)

@probot-esphome

Copy link
Copy Markdown

Hey there @jesserockz, mind taking a look at this pull request as it has been labeled with an integration (esp32_ble) you are listed as a code owner for? Thanks!
(message by CodeOwnersMention)

@probot-esphome

Copy link
Copy Markdown

Hey there @jesserockz, mind taking a look at this pull request as it has been labeled with an integration (esp32_ble_client) you are listed as a code owner for? Thanks!
(message by CodeOwnersMention)

@probot-esphome

Copy link
Copy Markdown

Hey there @esphome/core, mind taking a look at this pull request as it has been labeled with an integration (ota) you are listed as a code owner for? Thanks!
(message by CodeOwnersMention)

@probot-esphome

Copy link
Copy Markdown

Hey there @jesserockz, mind taking a look at this pull request as it has been labeled with an integration (i2s_audio) you are listed as a code owner for? Thanks!
(message by CodeOwnersMention)

@jorticus

Copy link
Copy Markdown
Contributor Author

Apologies, I mixed up my base branch and confused the bot. Things have been fixed now, but let me know if you'd rather me re-submit.

@jorticus jorticus changed the title Jorticus/fix eth gpio0 Fix ethernet clk_mode for GPIO0_OUT Jan 18, 2023
@jesserockz jesserockz added this to the 2023.3.0b2 milestone Mar 8, 2023
@jesserockz jesserockz enabled auto-merge March 8, 2023 20:51
@jesserockz jesserockz added this pull request to the merge queue Mar 8, 2023
Merged via the queue into esphome:dev with commit c12dd77 Mar 8, 2023
jesserockz added a commit that referenced this pull request Mar 9, 2023
* Fix GPIO0_OUT definition for ethernet component

* Formatting

---------

Co-authored-by: Jesse Hills <3060199+jesserockz@users.noreply.github.com>
@jesserockz jesserockz mentioned this pull request Mar 9, 2023
@github-actions github-actions Bot locked and limited conversation to collaborators Mar 11, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants