Skip to content

Conversation

AdrianSoundy
Copy link
Member

@AdrianSoundy AdrianSoundy commented Jun 5, 2025

Description

This corrects a build error with an incorrect SPI host name.
Also changes the DM channels to auto instead of hard coding to 1

The ESP32 rev3 configs updated to disable the NetIF loopback as this was causing the IP address in network interface to be 127.0.0.1 instead of actual IP.

Motivation and Context

Reported on discord
https://discord.com/channels/478725473862549535/1371829744793817260

How Has This Been Tested?

Tested locally using gpio pins from discord

Types of changes

  • Improvement (non-breaking change that improves a feature, code or algorithm)
  • Bug fix (non-breaking change which fixes an issue with code or algorithm)
  • New feature (non-breaking change which adds functionality to code)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Config and build (change in the configuration and build system, has no impact on code or features)
  • Dev Containers (changes related with Dev Containers, has no impact on code or features)
  • Dependencies/declarations (update dependencies or assembly declarations and changes associated, has no impact on code or features)
  • Documentation (changes or updates in the documentation, has no impact on code or features)

Checklist

  • My code follows the code style of this project (only if there are changes in source code).
  • My changes require an update to the documentation (there are changes that require the docs website to be updated).
  • I have updated the documentation accordingly (the changes require an update on the docs in this repo).
  • I have read the CONTRIBUTING document.
  • I have tested everything locally and all new and existing tests passed (only if there are changes in source code).

Summary by CodeRabbit

  • Chores

    • Updated ESP32 configuration to explicitly disable the LWIP network interface loopback feature across multiple profiles.
  • Refactor

    • Improved SPI Ethernet initialization for ESP32 by unifying SPI host references and enhancing interrupt handling setup for SPI Ethernet modules.

@nfbot nfbot added the Type: bug label Jun 5, 2025
Copy link
Contributor

coderabbitai bot commented Jun 5, 2025

Walkthrough

The updates introduce a new configuration option, CONFIG_LWIP_NETIF_LOOPBACK=n, across several ESP32 SDK configuration files to explicitly disable the LWIP loopback network interface. Additionally, the SPI Ethernet initialization code is refactored to install the GPIO ISR service before SPI bus setup, unify SPI host references using the ESP32_ETHERNET_SPI_HOST macro, and update DMA channel usage to SPI_DMA_CH_AUTO.

Changes

File(s) Change Summary
targets/ESP32/_IDF/sdkconfig.default_ble_rev3.esp32
targets/ESP32/_IDF/sdkconfig.default_nopsram_rev3.esp32
targets/ESP32/_IDF/sdkconfig.default_rev3.esp32
Added CONFIG_LWIP_NETIF_LOOPBACK=n to disable LWIP loopback interface in ESP32 SDK config files.
targets/ESP32/_Network/NF_ESP32_Ethernet.cpp Installed GPIO ISR service before SPI bus initialization; replaced hardcoded SPI host and DMA channel with macros (ESP32_ETHERNET_SPI_HOST, SPI_DMA_CH_AUTO); updated Ethernet driver SPI host parameters accordingly.

Sequence Diagram(s)

sequenceDiagram
    participant App
    participant GPIO_ISR_Service
    participant SPI_Bus
    participant Ethernet_Driver

    App->>GPIO_ISR_Service: Install ISR service
    App->>SPI_Bus: Initialize SPI bus (using ESP32_ETHERNET_SPI_HOST, SPI_DMA_CH_AUTO)
    App->>Ethernet_Driver: Configure with ESP32_ETHERNET_SPI_HOST
    Ethernet_Driver-->>App: Initialization complete
Loading

📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 5abeccd and 25d65c6.

📒 Files selected for processing (1)
  • targets/ESP32/_Network/NF_ESP32_Ethernet.cpp (4 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • targets/ESP32/_Network/NF_ESP32_Ethernet.cpp
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: Analyze (actions)
✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9cf2a69 and 5abeccd.

📒 Files selected for processing (4)
  • targets/ESP32/_IDF/sdkconfig.default_ble_rev3.esp32 (1 hunks)
  • targets/ESP32/_IDF/sdkconfig.default_nopsram_rev3.esp32 (1 hunks)
  • targets/ESP32/_IDF/sdkconfig.default_rev3.esp32 (1 hunks)
  • targets/ESP32/_Network/NF_ESP32_Ethernet.cpp (4 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (3)
  • GitHub Check: nf-interpreter (Check_Build_Options)
  • GitHub Check: nf-interpreter (Nightly build) (Check_Build_Options)
  • GitHub Check: nf-interpreter (Check_Build_Options)
🔇 Additional comments (5)
targets/ESP32/_IDF/sdkconfig.default_ble_rev3.esp32 (1)

71-71: LGTM! Loopback interface correctly disabled.

This change properly disables the LWIP loopback interface, which should resolve the issue where the network interface IP address was displaying as 127.0.0.1 instead of the actual IP address.

targets/ESP32/_IDF/sdkconfig.default_nopsram_rev3.esp32 (1)

50-50: LGTM! Consistent loopback configuration across build variants.

This change maintains consistency with other ESP32 configuration files by disabling the LWIP loopback interface, ensuring uniform network behavior across different build configurations.

targets/ESP32/_IDF/sdkconfig.default_rev3.esp32 (1)

59-59: LGTM! Completes consistent loopback configuration.

This change completes the uniform application of loopback interface disabling across all ESP32 rev3 configuration variants, ensuring consistent network behavior.

targets/ESP32/_Network/NF_ESP32_Ethernet.cpp (2)

160-160: LGTM! Unified SPI host configuration.

The consistent replacement of CONFIG_EXAMPLE_ETH_SPI_HOST with ESP32_ETHERNET_SPI_HOST across all Ethernet modules (DM9051, W5500, ENJ28J60) improves code maintainability and ensures consistent SPI host usage.

Also applies to: 178-178, 195-195


146-146:

✅ Verification successful

LGTM! Improved SPI configuration with automatic DMA selection.

The changes to use ESP32_ETHERNET_SPI_HOST macro and SPI_DMA_CH_AUTO are excellent improvements. The automatic DMA channel selection prevents conflicts and the macro usage provides better consistency.

Verify that the ESP32_ETHERNET_SPI_HOST macro is properly defined:


🏁 Script executed:

#!/bin/bash
# Description: Verify ESP32_ETHERNET_SPI_HOST macro definition

# Search for ESP32_ETHERNET_SPI_HOST definition
echo "=== ESP32_ETHERNET_SPI_HOST macro definition ==="
rg -A 3 -B 3 "#define.*ESP32_ETHERNET_SPI_HOST"

# Check if it's used consistently
echo "=== All usages of ESP32_ETHERNET_SPI_HOST ==="
rg "ESP32_ETHERNET_SPI_HOST"

Length of output: 1651


Confirmed ESP32 Ethernet SPI host macro definition and usage

Verified that ESP32_ETHERNET_SPI_HOST is defined in

  • targets/ESP32/_Network/esp32_ethernet_options.h.in
    #define ESP32_ETHERNET_SPI_HOST SPI2_HOST

and is consistently used in

  • targets/ESP32/_Network/NF_ESP32_Ethernet.cpp

All SPI initializations now leverage the macro with SPI_DMA_CH_AUTO as intended.

@AdrianSoundy AdrianSoundy merged commit e8b977d into main Jun 6, 2025
16 checks passed
@josesimoes josesimoes added the Platform: ESP32 Everything related specifically with ESP32 platform label Jun 6, 2025
@AdrianSoundy AdrianSoundy deleted the W5500-testing branch July 2, 2025 03:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Config-and-Build Platform: ESP32 Everything related specifically with ESP32 platform Type: bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants