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

W5500/SPI Ethernet Support (T-ETH-Lite-S3) #129

Draft
wants to merge 289 commits into
base: mdev
Choose a base branch
from

Conversation

troyhacks
Copy link
Collaborator

@troyhacks troyhacks commented Apr 17, 2024

W5500/SPI Ethernet support, currently hardcoded for the T-Eth-Lite-S3 board - which is the only S3 board I know of with Ethernet:

https://www.lilygo.cc/en-ca/products/t-eth-lite

Needs lib_deps:

https://github.com/troyhacks/ETHClass2 (for W5500 support)
https://github.com/troyhacks/TroyHacksAsyncUDP (fixes a bug with AsyncUDP, backports some fixes from IDF v5.1)

Also likely needs IDF v4.4 to work correctly. Tested on v4.4.6.

Updated to use the new ETHClass2 - so there's a bunch of code ifdef'd out if it's an ESP32-S3 just to work around the fact that SPI Ethernet isn't really a thing we're accounting for at the moment in WLED - so I'd consider this a proof of concept, even if it works.

May be useful (not in this state) for adding SPI Ethernet to WLED for the original ESP32?

@troyhacks troyhacks added the enhancement New feature or request label Apr 17, 2024
@troyhacks troyhacks requested a review from softhack007 April 17, 2024 18:38
@troyhacks troyhacks marked this pull request as draft April 20, 2024 02:53
commit 1c835b0
Author: Troy <5659019+troyhacks@users.noreply.github.com>
Date:   Fri Apr 19 11:57:54 2024 -0400

    Don't use TroyHacksAsyncUDP on S3 unless WLED_USE_ETHERNET

commit 67f7b0c
Author: Troy <5659019+troyhacks@users.noreply.github.com>
Date:   Fri Apr 19 11:49:05 2024 -0400

    Don't use ETHClass2 on S3 unless WLED_USE_ETHERNET

commit df2d327
Author: Troy <5659019+troyhacks@users.noreply.github.com>
Date:   Fri Apr 19 11:40:55 2024 -0400

    Revert "Merge branch 'W5500+Art-Net_Improvements' into W5500_Support"

    This reverts commit b7acc6a, reversing
    changes made to f51290c.

commit b7acc6a
Merge: f51290c b000c6d
Author: Troy <5659019+troyhacks@users.noreply.github.com>
Date:   Fri Apr 19 11:36:39 2024 -0400

    Merge branch 'W5500+Art-Net_Improvements' into W5500_Support

commit b000c6d
Merge: d1da208 34f4905
Author: Troy <5659019+troyhacks@users.noreply.github.com>
Date:   Fri Apr 19 11:32:19 2024 -0400

    Merge branch 'MoonModules:mdev' into W5500+Art-Net_Improvements

commit f51290c
Merge: 16c782c 34f4905
Author: Troy <5659019+troyhacks@users.noreply.github.com>
Date:   Fri Apr 19 11:32:10 2024 -0400

    Merge branch 'MoonModules:mdev' into W5500_Support

commit 16c782c
Author: Troy <5659019+troyhacks@users.noreply.github.com>
Date:   Fri Apr 19 11:30:50 2024 -0400

    Testing build fixes

commit 8d54d6a
Author: Troy <5659019+troyhacks@users.noreply.github.com>
Date:   Fri Apr 19 11:25:57 2024 -0400

    Testing build fixes

commit 2d2d300
Author: Troy <5659019+troyhacks@users.noreply.github.com>
Date:   Fri Apr 19 11:21:20 2024 -0400

    Testing build fixes for IDF below 4.0.0

commit bbb82e2
Author: Troy <5659019+troyhacks@users.noreply.github.com>
Date:   Fri Apr 19 11:17:00 2024 -0400

    Testing a build fix

commit 494a0f6
Author: Troy <5659019+troyhacks@users.noreply.github.com>
Date:   Fri Apr 19 09:12:06 2024 -0400

    Confirm we have an event list included in build

commit 5d36aa8
Author: Troy <5659019+troyhacks@users.noreply.github.com>
Date:   Fri Apr 19 09:07:07 2024 -0400

    Check for ethernet support

commit 8d3af36
Author: Troy <5659019+troyhacks@users.noreply.github.com>
Date:   Fri Apr 19 08:58:54 2024 -0400

    Network Event fixes

commit d1da208
Author: Troy <5659019+troyhacks@users.noreply.github.com>
Date:   Fri Apr 19 08:58:54 2024 -0400

    Network Event fixes

commit c8cfa9d
Author: Troy <5659019+troyhacks@users.noreply.github.com>
Date:   Thu Apr 18 10:42:53 2024 -0400

    DDP port fix

commit fe2958a
Author: Troy <5659019+troyhacks@users.noreply.github.com>
Date:   Thu Apr 18 09:25:19 2024 -0400

    For my test setup

commit 09da8cb
Merge: e6d127d 3987960
Author: Troy <5659019+troyhacks@users.noreply.github.com>
Date:   Thu Apr 18 09:20:29 2024 -0400

    Merge pull request #1 from troyhacks/Art-Net_Improvements

    Art net improvements

commit 3987960
Author: Troy <5659019+troyhacks@users.noreply.github.com>
Date:   Thu Apr 18 09:10:53 2024 -0400

    Make sure "0" is never a sequence number

commit 42926f6
Author: Troy <5659019+troyhacks@users.noreply.github.com>
Date:   Thu Apr 18 09:09:30 2024 -0400

    Revert. Art-Net compliance app complained about missing packets due to sequence numbers.

commit e72a779
Author: Troy <5659019+troyhacks@users.noreply.github.com>
Date:   Thu Apr 18 08:59:30 2024 -0400

    Packet sequence numbering to Art-Net spec

commit e6d127d
Author: Troy <5659019+troyhacks@users.noreply.github.com>
Date:   Thu Apr 18 08:33:32 2024 -0400

    Updated to ETHClass2

commit 16ee90b
Author: Troy <5659019+troyhacks@users.noreply.github.com>
Date:   Wed Apr 17 14:17:38 2024 -0400

    Comments

commit 5dde1f9
Author: Troy <5659019+troyhacks@users.noreply.github.com>
Date:   Wed Apr 17 14:16:24 2024 -0400

    Bring in a fixed version of AsyncUDP

commit 483daa9
Author: Troy <5659019+troyhacks@users.noreply.github.com>
Date:   Wed Apr 17 10:43:24 2024 -0400

    Logic for new ethernet board

commit 6b60013
Merge: 1c17886 0f79e9b
Author: Troy <5659019+troyhacks@users.noreply.github.com>
Date:   Wed Apr 17 10:05:06 2024 -0400

    Merge branch 'MoonModules:mdev' into W5500_Support

commit 2641dd5
Merge: f5b97f2 0f79e9b
Author: Troy <5659019+troyhacks@users.noreply.github.com>
Date:   Wed Apr 17 10:03:46 2024 -0400

    Merge branch 'MoonModules:mdev' into Art-Net_Improvements

commit f5b97f2
Author: Troy <5659019+troyhacks@users.noreply.github.com>
Date:   Mon Apr 15 10:18:20 2024 -0400

    Force routing only on non-ESP8266

commit 3f574a9
Author: Troy <5659019+troyhacks@users.noreply.github.com>
Date:   Thu Apr 4 10:33:34 2024 -0400

    Force use of Ethernet if configured.

commit 549f014
Author: Troy <5659019+troyhacks@users.noreply.github.com>
Date:   Thu Apr 4 09:42:24 2024 -0400

    Start of custom mapping ability

commit 334884a
Author: Troy <5659019+troyhacks@users.noreply.github.com>
Date:   Sat Mar 30 08:45:00 2024 -0400

    Forgot BGR and default RGB order

commit b1a099c
Author: Troy <5659019+troyhacks@users.noreply.github.com>
Date:   Mon Mar 18 20:32:32 2024 -0400

    Minor tidy.

commit d398a4d
Author: Troy <5659019+troyhacks@users.noreply.github.com>
Date:   Mon Mar 18 20:16:17 2024 -0400

    Comments fixed, minor code tidy/revert.

commit 1a90b73
Author: Troy <5659019+troyhacks@users.noreply.github.com>
Date:   Mon Mar 18 19:57:56 2024 -0400

    hardware_outputs back to 1 to not break defaults

commit ddfa90a
Author: Troy <5659019+troyhacks@users.noreply.github.com>
Date:   Mon Mar 18 19:49:32 2024 -0400

    Overhaul Art-Net to be more "professionally" good

commit 1c17886
Merge: 9f3e491 01c187f
Author: Troy <5659019+troyhacks@users.noreply.github.com>
Date:   Tue Jan 2 10:19:12 2024 -0600

    Merge branch 'MoonModules:mdev' into W5500_Support

commit 9f3e491
Merge: cca0055 cdc8a48
Author: TroyHacks <5659019+troyhacks@users.noreply.github.com>
Date:   Mon Dec 11 09:29:47 2023 -0500

    Merge branch 'W5500_Support' of https://github.com/troyhacks/WLED into W5500_Support

commit cca0055
Author: TroyHacks <5659019+troyhacks@users.noreply.github.com>
Date:   Mon Dec 11 09:29:22 2023 -0500

    Added WLED_DISABLE_MDNS for no really great reason

commit cdc8a48
Merge: c0a115a 6cd9d80
Author: Troy <5659019+troyhacks@users.noreply.github.com>
Date:   Thu Dec 7 00:03:42 2023 -0500

    Merge branch 'MoonModules:mdev' into W5500_Support

commit c0a115a
Author: TroyHacks <5659019+troyhacks@users.noreply.github.com>
Date:   Wed Dec 6 23:51:43 2023 -0500

    Pin reservation and better include logic for S3
commit fd85794
Merge: 3987960 34f4905
Author: Troy <5659019+troyhacks@users.noreply.github.com>
Date:   Fri Apr 19 12:09:30 2024 -0400

    Merge branch 'MoonModules:mdev' into Art-Net_Improvements

commit 3987960
Author: Troy <5659019+troyhacks@users.noreply.github.com>
Date:   Thu Apr 18 09:10:53 2024 -0400

    Make sure "0" is never a sequence number

commit 42926f6
Author: Troy <5659019+troyhacks@users.noreply.github.com>
Date:   Thu Apr 18 09:09:30 2024 -0400

    Revert. Art-Net compliance app complained about missing packets due to sequence numbers.

commit e72a779
Author: Troy <5659019+troyhacks@users.noreply.github.com>
Date:   Thu Apr 18 08:59:30 2024 -0400

    Packet sequence numbering to Art-Net spec

commit 2641dd5
Merge: f5b97f2 0f79e9b
Author: Troy <5659019+troyhacks@users.noreply.github.com>
Date:   Wed Apr 17 10:03:46 2024 -0400

    Merge branch 'MoonModules:mdev' into Art-Net_Improvements

commit f5b97f2
Author: Troy <5659019+troyhacks@users.noreply.github.com>
Date:   Mon Apr 15 10:18:20 2024 -0400

    Force routing only on non-ESP8266

commit 3f574a9
Author: Troy <5659019+troyhacks@users.noreply.github.com>
Date:   Thu Apr 4 10:33:34 2024 -0400

    Force use of Ethernet if configured.

commit 549f014
Author: Troy <5659019+troyhacks@users.noreply.github.com>
Date:   Thu Apr 4 09:42:24 2024 -0400

    Start of custom mapping ability

commit 334884a
Author: Troy <5659019+troyhacks@users.noreply.github.com>
Date:   Sat Mar 30 08:45:00 2024 -0400

    Forgot BGR and default RGB order

commit b1a099c
Author: Troy <5659019+troyhacks@users.noreply.github.com>
Date:   Mon Mar 18 20:32:32 2024 -0400

    Minor tidy.

commit d398a4d
Author: Troy <5659019+troyhacks@users.noreply.github.com>
Date:   Mon Mar 18 20:16:17 2024 -0400

    Comments fixed, minor code tidy/revert.

commit 1a90b73
Author: Troy <5659019+troyhacks@users.noreply.github.com>
Date:   Mon Mar 18 19:57:56 2024 -0400

    hardware_outputs back to 1 to not break defaults

commit ddfa90a
Author: Troy <5659019+troyhacks@users.noreply.github.com>
Date:   Mon Mar 18 19:49:32 2024 -0400

    Overhaul Art-Net to be more "professionally" good
Optimized FFT from ESP-DSP
Optimized Low-Pass filter from ESP-DSP
Un-interleave ESP-DSP FFT results
@januszwoj
Copy link

Hi @troyhacks .
If you need someone to test, I will be happy to help.
I am hopefully the lucky owner of Lilygo T-ETH-Lite-S3. I also have XIAO ESP32S3. In my case, they are supposed to work via I2S with WM8782S and PCM1808 ADC and DIR9001 SPDIF to I2S.
My programming skills are rather poor and I can't wait for support for T-ETH-Lite-S3 via ethernet, unfortunately my XIAO ESP32S3 somehow does not manage to stream the audio signal to the rest of the ESP32 via wifi.
Regards Janusz

@troyhacks
Copy link
Collaborator Author

Hi @troyhacks .
If you need someone to test, I will be happy to help.
I am hopefully the lucky owner of Lilygo T-ETH-Lite-S3. I also have XIAO ESP32S3. In my case, they are supposed to work via I2S with WM8782S and PCM1808 ADC and DIR9001 SPDIF to I2S.
My programming skills are rather poor and I can't wait for support for T-ETH-Lite-S3 via ethernet, unfortunately my XIAO ESP32S3 somehow does not manage to stream the audio signal to the rest of the ESP32 via wifi.
Regards Janusz

This is great, thanks @januszwoj !

Just to assess the level you can help here, do you know how to build WLED from the source code and upload the resulting firmware to the ESP32-S3?

@januszwoj
Copy link

Hi @troyhacks
I'm not very good at it yet, but I manage to do it from time to time.
Sometimes I have trouble understanding where some things come from, but I'm trying to learn.
I use Visual Studio and Platformio to compile the firmware myself.

@januszwoj
Copy link

Hi @troyhacks
I have been trying for several days to compile a program for esp32S3 with w5500 support from your Github: "W5500_Support."
After adding the switche: -D WLED_USE_ETHERNET; at first I received messages that it's missing <ETHClass2.h> library.
I've added the libraries: ETHClass2 & TroyHacksAsyncUDP from your Github to the lib_deps in platformio.
Thanks to this, the messages about the missing library disappeared. Unfortunately, a different message appeared now:

.pio/libdeps/esp32S3_8MB_S/ETHClass2/src/ETHClass2.cpp: In member function 'bool ETHClass2::beginSPI(eth_phy_type_t, uint8_t, int, int, int, int, int, int, spi_host_device_t, uint8_t)':

.pio/libdeps/esp32S3_8MB_S/ETHClass2/src/ETHClass2.cpp:403:15: error: 'digitalPinToGPIONumber' was not declared in this scope

 _pin_cs = digitalPinToGPIONumber(cs);

So far I haven't been able to figure out a way to jump over it.
Regards Januszz

Copy link

coderabbitai bot commented Feb 27, 2025

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ 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.
    • Generate unit testing code for this file.
    • 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 generate unit testing code for this file.
    • @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 generate unit testing code.
    • @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.

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 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request magic
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants