feature-requests icon indicating copy to clipboard operation
feature-requests copied to clipboard

Add support for Davicom DM9051 SPI Ethernet Controller

Open tudstudent opened this issue 1 year ago • 7 comments

Describe the problem you have/What new integration you would like Introduce support for the Davicom DM9051 SPI Ethernet Controller

Please describe your use case for this integration and alternatives you've tried: The ETH01 Evo modules are equipped with this "new" ETH chip, enabling POE usage, however device not currently supported in ESPHome.

Additional context Davicom Website - Product Page Espreff Description on how to implement

Unfortunately I am not a programmer, will be able to test, but not to make pull requests in this topic, therefore asking for implementation to this community.

tudstudent avatar Oct 12 '23 11:10 tudstudent

Additionally: Driver source code

tudstudent avatar Oct 26 '23 05:10 tudstudent

Support for DM9051 was added to Arduino ESP32 Core version 3.0.0

Espressif Announcement

cleymaba avatar Nov 03 '23 10:11 cleymaba

I bought 5 eth01-evo units on Aliexpress that mount this chip thinking they were compatible with esphome but I wasn't able to make them work, does anyone have a solution thanks

khabbar-a avatar Dec 12 '23 23:12 khabbar-a

The EVO work perfectly, EXCEPT the physical ETH01 port. Unfortunately as you have seen my request this is not (yet) supported in ESPHome.

All other functionalities work fine.

I suppose you have them working by WiFi?

tudstudent avatar Dec 17 '23 07:12 tudstudent

+1 for this requests, as the eth01-evo ist by far the cheapest solution for PoE enabled ESP32.

d3rsch0rsch avatar Dec 25 '23 17:12 d3rsch0rsch

I have added an issue to the eth01-evo repo with full documentation and an example to get wired ethernet working. https://github.com/AI6YP/eth01-evo/issues/2

skinkie avatar Dec 28 '23 10:12 skinkie

With the W5500 support added which is also based on an SPI implementation, should this be too hard to add now?

tube0013 avatar Apr 16 '24 20:04 tube0013

Any update? Thanks!

Imanol82 avatar May 21 '24 16:05 Imanol82

I purchased a bunch of these boards, just to realize that it's not supported. It would be great if this board could be added to ESPHome.

sabaatworld avatar May 22 '24 02:05 sabaatworld

I started looking at this, with partial success. WiP code (expect lots of force-pushing and buggy commits!) is here: https://github.com/bmork/esphome/tree/dm9051

Not sure I like the current ethernet SPI solution. Will probably try to change that into using the spi bus component. Doesn't seem impossible. I had to drop the only W5500 specific part (SPI framing) anyway, since the DM9051 uses different framing. Both drivers will auto-configure the format anyway as long as it's unset, so why bother? Letting the driver DTRT looks much better than moving that knowlegde into esphome.

But first task is to make RX more stable. It's pretty unusable as-is.

EDIT: very happy to admit I was completely wrong. Reducing SPI clock to 8 MHz seems to stabilize this completely. Will move focus to cleaning up the SPI bus config and submit this.

EDIT2: reconsidering. Guess it's best to add this feature using the current scheme, and then modify the scheme later in a separate PR.

bmork avatar Jun 04 '24 08:06 bmork

So I realized why the current code didn't use the esphome spi component: We need commit ecd1759a0ba6 ("feat(esp_eth): abstraction of SPI driver for SPI Ethernet modules") in esp-idf for that, and it was added as recently as v5.2

I did a quick hack, but it is not exactly ready to merge... It boots and sort of works. But it's easy to make it fall over with an

spi_master: spi_device_acquire_bus(1031): Cannot acquire bus when a polling transaction is in progress.

error by simply flood pinging the device. I will leave it there until we both have a use case and esp-idf v5.2 or higher is recommended. The current PR is fine.

My experimental hack is here if anyone is interested: https://github.com/bmork/esphome/tree/dm9051-spidev-experimental

bmork avatar Jun 06 '24 13:06 bmork

Hello! I was very excited to see that you had managed to get the ETH01-EVO working but I can't... Is it because it hasn't been officially uploaded yet or something like that?

image

But the result is this one:

image

What am I doing wrong?

Thank you very much!

Imanol82 avatar Sep 05 '24 15:09 Imanol82

@Imanol82 It was not merged yet, this is the reason why it is not working. The PR was linked, but here is a direct link to the config https://github.com/esphome/esphome/pull/6861#issuecomment-2276027979

randybb avatar Sep 05 '24 15:09 randybb

Well, I'll have to wait for it to come out officially (because that doesn't work for me). It looks like they are making a lot of progress :)

Thank you!

Imanol82 avatar Sep 05 '24 15:09 Imanol82

You are missing the external component part - which will pull the component from that PR.

randybb avatar Sep 05 '24 15:09 randybb

Sorry. I'm a bit beginner. I don't understand what you're telling me.

Thank you very much!!!

Imanol82 avatar Sep 05 '24 15:09 Imanol82

This part :)

external_components:
  - source: github://pr#6861
    components:
      - ethernet

randybb avatar Sep 05 '24 15:09 randybb

Yes, now it is compiling

Thank you very much!

Imanol82 avatar Sep 05 '24 16:09 Imanol82

hahahaha now I'm not able to flash...

Imanol82 avatar Sep 05 '24 16:09 Imanol82

I win hahahaha. Online :)

image

Thank you very much @randybb

Imanol82 avatar Sep 05 '24 16:09 Imanol82