Canbus and ethernet spi problem

I have a module I want to add to and Waveshare ESP32-S3 ETH Development Board. When I add the code for the can bus module and ethernet I get an error

spi component is using interface ‘SPI2_HOST’. To use W5500, you must change the interface on the spi component.

But even when I change the interface on spi I get the same errors as I is ignoring the setting.

esp32:  
  board: esp32-s3-devkitc-1
  framework:
    type: esp-idf

spi:
  id: McpSpi
  interface: spi
  clk_pin: GPIO18
  mosi_pin: GPIO11
  miso_pin: GPIO12

ethernet:
  type: W5500
  clk_pin: GPIO13
  mosi_pin: GPIO11
  miso_pin: GPIO12
  cs_pin: GPIO14
  interrupt_pin: GPIO10
  reset_pin: GPIO9

No idea what the problem is, anyone having an idea? I need the ethernet support and the canbus because wifi is not available at the location I need to control something with canbus.

Not sure about your issue - but why is interface: defined twice in this yaml block?

that was a copy paste error, it is not there in my latest code.

1 Like

Ok seems I need to use a different spi channel for the can bus module but I do not know what GPIOs are the correct ones.

There is also a technical documentation but I do not understand it :smiley:

At around page 19 the GPIO Documentation is located maybe someone here can help

See the interface selection section in the docs - SPI Bus — ESPHome

Use spi3 for the non-ethernet SPI config. Choose whatever pins you like for that interface, but not the ones used by the ethernet.

I tried like this but still getting error can bus module marked as failed-

#########################################
#                                       #
#   SPI configuration                   #
#                                       #
#########################################
spi:
  id: McpSpi
  clk_pin: GPIO39
  mosi_pin: GPIO40
  miso_pin: GPIO41
  interface: spi3

#########################################
#                                       #
#   CAN configuration                   #
#                                       #
#########################################
canbus:
  - id: !extend wp_can
    platform: mcp2515
    spi_id: McpSpi
    cs_pin: GPIO15
    bit_rate: 20kbps

OK does work now, reason after this changes was also I did connect it to 3v3 no 5v pin so the can bus module did not get enough power I think.

1 Like

Hi, sorry for undigging this old treat.
Recently I faced same issue as when using ESP32-S3-POE-ETH board with W5500 ethernet interface.
When I’m trying to compile code with MCP2515 module, getting the same error as @skycryer.
My error is:

  `spi` component is using interface 'SPI2_HOST'. To use W5500, you must change the `interface` on the `spi` component.
  id: my_network
  mosi_pin: 11
  miso_pin: 12
  clk_pin: 13
  cs_pin: 14
  reset_pin: 9
  interrupt_pin: 10
  clock_speed: 25000000
  domain: .local
  type: W5500

MCP2515 definition is exacly the same as @skycryer showed.
W5500 definition in esphome doesn’t have spi interface configuration.

So I don’t know what else I can change.
Can anybody help me resovle this issue?

Do what the message says, change the interface on the spi component - NOT the W5500 component.

Thabnk you - after some digging I’ve found, what I was doing wrong.
When building my project I was using remote packges from github and when compiling esphome it just ognored local files I’ve prepared. When I switched to respect local files, everything is working as extected.
Sorry for the confusion and unnecessary digging up of an old topic.