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