espressif / esp-idf

Espressif IoT Development Framework. Official development framework for Espressif SoCs.
Apache License 2.0
13.32k stars 7.2k forks source link

ESP32-s3 error w5500 with PSRAM (IDFGH-13244) #14178

Closed tresler closed 1 week ago

tresler commented 2 months ago

Answers checklist.

IDF version.

release/v5.1 bd2b9390ef

Espressif SoC revision.

ESP32-S3

Operating System used.

Linux

How did you build your project?

Other (please specify in More Information)

If you are using Windows, please specify command line type.

None

Development Kit.

ESP32-S3-WROOM

Power Supply used.

External 3.3V

What is the expected behavior?

ESP32-S3

What is the actual behavior?

After few moment I have error: w5500.mac: received frame was truncated and few more second: w5500.mac: emac_w5500_transmit(577): free size (1) < send length (350)

Steps to reproduce.

  1. Step: Using ESP32-S3 with Arduino 3.0.2, WiFi, Ethernet SPI W5500 and, sACN signal and smart LED strip by FastLED. Signal by ethernet running well more then 5 hours.
  2. Step: Use I2SClockLessLedDriveresp32s3 with PSRAM to OPI for quicker parallel output of FastLED and now you have after few moments error of w5500.mac.
  3. Step: Comment ethernet and use only WiFi and everything working fine. .... here is my test code.

Debug Logs.

w5500.mac: received frame was truncated
w5500.mac: emac_w5500_transmit(577): free size (1) < send length (350)


### More Information.

I'm trying on Linux with ESP32-Arduino 3.0.2 with IDF v5.1 and ESP32s3-wroom. 
kostaond commented 1 month ago

@tresler, do you have your custom designed board with W5500 or do you use some evaluation board?

tresler commented 1 month ago

@tresler, do you have your custom designed board with W5500 or do you use some evaluation board?

Thank for response. As I wrote I use RJ-45 transformer jack with transformer connected to W5500-io WIZnet modul connected to ESP32-S3-WROOM.
W5500-io_ESP32S3

kostaond commented 1 month ago

Is ESP32 connected to the W5500 module via wires?

tresler commented 1 month ago

Is ESP32 connected to the W5500 module via wires?

I have everything connected using my own PCB board. And yes everything is connected, I tested it three times.

kostaond commented 1 month ago

The reason why I asked is it looks like the SPI message is corrupted.... It's usually caused by problems with signal integrity. Long, non-matching length wires are usual suspect. However, it can also happen on PCB when signal path is not properly designed. What is the SPI frequency you use? If it's higher than 16 MHz, try to decrease it.

tresler commented 1 month ago

I understand. I was try it with 10 MHz, 4 MHz and 1 MHz, unfortunately without big effect. It just moved the error message a few packets further. I still think it has to be something with the memory (not free(buffer);) and with the PSRAM and using the i2sdriver for the led. As I wrote if I using same code only with FastLED without i2cleddriver and PSRAM, everything seems to work. When I use driver and send some sACN packet, I have error message.

kostaond commented 1 month ago

w5500.mac: received frame was truncated should never occur under normal conditions. Therefore, I presume the SPI frame is corrupted. It can be caused by HW (PCB) or the message could theoretically be corrupted by the DMA. Do you observe the issue when you use PSRAM but without i2cleddriver? Or vice versa, do you observe the issue if you use i2cleddriver but without PSRAM? We need to isolate issue as much as possible. Thanks for your help!

tresler commented 1 month ago

All right. Unfortunately led driver need PSRAM, so I can not run program with driver a without PSRAM. When I set PSRAM to OPI and don't use driver everything seems to work without a problem. When I use i2cledriver, after few packet I have error. If I use driver without eth.h only with wifi or Ethernet_Generic library, I don't see the problem there again.

Edit: Okay, so I must correct myself and apologize. With Ethernet_generic library was everything ok, but when I use W6100-io and not now with W5500-io (what I change on same PCB for ETH support). Now I try Ethernet.h, EthernetESP32, Ethernet_generic and it was same as ETH.h. Not error message but it also got stuck shortly after few packet. I realized that I have on the same SPI bus SD card reader. It works by itself without any problem even in the case of a non-functioning driver. I try mechanically cut off the SPI bus to SD card reader and now everything seems to work. So problem is to using same SPI bus for W5500 and SD card reader and also use i2sleddriver. Unfortunately I can not use different SPI bus on ESP32s3.

kostaond commented 1 month ago

The SPI Ethernet module should work along with other device on the same SPI bus when both drivers use the same SPI driver. This is the reason why we recently introduced SPI layer abstraction for our SPI Ethernet module drivers.

@me-no-dev, could you please check the issue if this is the case?

kostaond commented 1 week ago

@tresler any update about the issue? Do you use the same SPI driver for both SPI devices?

tresler commented 1 week ago

I cut paths on the board to SD card reader and now ethernet works fine. Unfortunately now I cannot test two separately SPI bus because I don't have any devices for test.

kostaond commented 1 week ago

I see, so not much to do right now... :/

I think the following could be the issues: 1) If you use Arduino, be sure the W5500 and SD card reader use the same SPI driver. 2) Make sure that CS is correctly handled for both devices.

As such I'm closing the issue. Feel free to reopen or open a new one if you have more detailed information.