W5500 and SD card on same SPI host

rtborg
Posts: 67
Joined: Wed Oct 23, 2019 6:15 am

W5500 and SD card on same SPI host

Postby rtborg » Fri May 27, 2022 6:07 am

I have a custom board which has a W5500 and SD card on the same SPI host. Pins are:
SPI Host - 2
SPI Speed - 12 MHz

SCLK - IO 18 - NO PULL-UP
MOSI - IO 23 - NO PULL-UP
MISO - IO 19 - NO PULL-UP

W5500 CS - IO 33 - PULLED UP
W5500 INT - IO 13 - PULLED UP
W5500 RST - IO 12 - PULLED DOWN

SD Card CS - IO 25 - NO PULL-UP

When only one device is enabled, it works fine - either W5550 or SD card. However, when I try using both devices, I get multiple errors. Typically I first initialize the SD card, which is successful, and then I try to initialize the W5500. It also goes fine and I get an IP address; however, then I receive multiple errors:

Code: Select all

E (71006) spi_master: check_trans_valid(689): txdata transfer > host maximum
E (71006) w5500.mac: w5500_read(97): spi transmit failed
E (71006) w5500.mac: w5500_read_buffer(188): read RX buffer failed
E (71016) w5500.mac: emac_w5500_receive(572): read payload failed, len=65533, offset=1
E (72006) sdmmc_cmd: sdmmc_read_sectors_dma: sdmmc_send_cmd returned 0x107
E (72006) diskio_sdmmc: sdmmc_read_blocks failed (263)
E (72006) diskio_sdmmc: Check status failed (0x107)
W (72006) httpd_uri: httpd_uri: uri handler execution failed
E (74636) sdmmc_cmd: sdmmc_read_sectors_dma: sdmmc_send_cmd returned 0x108
E (74636) diskio_sdmmc: sdmmc_read_blocks failed (264)
W (74636) httpd_uri: httpd_uri: uri handler execution failed
E (82586) spi_master: check_trans_valid(689): txdata transfer > host maximum
E (82586) w5500.mac: w5500_read(97): spi transmit failed
E (82586) w5500.mac: w5500_read_buffer(188): read RX buffer failed
E (82596) w5500.mac: emac_w5500_receive(572): read payload failed, len=65533, offset=1
E (82596) spi_master: check_trans_valid(689): txdata transfer > host maximum
E (82606) w5500.mac: w5500_read(97): spi transmit failed
E (82616) w5500.mac: w5500_read_buffer(188): read RX buffer failed
E (82616) w5500.mac: emac_w5500_receive(572): read payload failed, len=65533, offset=1
E (82766) sdmmc_cmd: sdmmc_read_sectors_dma: sdmmc_send_cmd returned 0x108
E (82766) diskio_sdmmc: sdmmc_read_blocks failed (264)
E (82766) spi_master: check_trans_valid(689): txdata transfer > host maximum
W (82776) httpd_uri: httpd_uri: uri handler execution failed
E (82776) w5500.mac: w5500_read(97): spi transmit failed
E (82786) w5500.mac: w5500_read_buffer(192): read RX buffer failed
E (82796) w5500.mac: emac_w5500_receive(572): read payload failed, len=8275, offset=30977
I've tried enabling CS pull-up on SD card, and it made no difference. I've also swapped the SD card adapter with one that provides pull-ups, again that did not make a difference. Can you give some directions where to look for the fault?

henryw
Posts: 1
Joined: Sat Sep 17, 2022 5:19 am

Re: W5500 and SD card on same SPI host

Postby henryw » Sat Sep 17, 2022 5:25 am

Hi, rtborg,

I got the same error code, still working on it and didn't figure it out yet.

There is a page reference the ESP32 Error Codes in the ESP-IDF Programming Guide,
https://docs.espressif.com/projects/esp ... codes.html

Hope this helps you.

iottata
Posts: 3
Joined: Thu Oct 13, 2022 1:02 pm

Re: W5500 and SD card on same SPI host

Postby iottata » Thu Oct 13, 2022 1:06 pm

Hi,
Have you got any solution for it? I am also facing same issue. Any urgent help will be highly appreciated. I am stuck for the further development.

DrMickeyLauer
Posts: 104
Joined: Sun May 22, 2022 2:42 pm

Re: W5500 and SD card on same SPI host

Postby DrMickeyLauer » Sun Mar 17, 2024 12:58 pm

It's been a while since this thread has been opened, but I wonder whether you could fix your problems?

I've been lucky to stay away from multiple device on the same SPI bus, but I wonder: If you are doing this, you likely have multiple threads going on and I'm not sure whether all of SPI is thread safe.

Did you attach an oscilloscope to check what actually happens on the wire level?

Who is online

Users browsing this forum: No registered users and 111 guests