ESP32-S3 + w5500 spi

Annex for ESP32
TyuTyu
Posts: 13
Joined: Sun Apr 09, 2023 5:38 am
Has thanked: 3 times

ESP32-S3 + w5500 spi

Post by TyuTyu »

Hello,

What is the SPI port pins in case of ESP32-S3 ?
I tried different SPI setup, but without any success. Do I need use INT and RST ?
I want it to connect W5500.
Ethernet.init allways give -1 (no module)

FW version: Annex32-S3 CAN DMT VGA HID 1.52.1 qio opi LFS

Thanks in advance..

Best Regards,
TyuTyu
User avatar
Electroguard
Posts: 860
Joined: Mon Feb 08, 2021 6:22 pm
Has thanked: 276 times
Been thanked: 323 times

Re: ESP32-S3 + w5500 spi

Post by Electroguard »

[Local Link Removed for Guests] wrote: [Local Link Removed for Guests]Sat Feb 17, 2024 6:41 pm Hello,

What is the SPI port pins in case of ESP32-S3 ?
I tried different SPI setup, but without any success. Do I need use INT and RST ?
I want it to connect W5500.
Ethernet.init allways give -1 (no module)

FW version: Annex32-S3 CAN DMT VGA HID 1.52.1 qio opi LFS

Thanks in advance..

Best Regards,
TyuTyu
Just a matter of configuring the chosen SPI pins in Config, Advanced, but you must then remember to choose CUSTOM for them to take effect.
I was using a purple esp32-S3 UNO clone, so I just stuck with the standard UNO SPI pins, and 10 for CS in the script.
spi.jpg

The pic below shows the w5500 log returning -2 with the network cable unplugged, then returning 1 when run again with the cable plugged in.
eth.jpg
You do not have the required permissions to view the files attached to this post.
TyuTyu
Posts: 13
Joined: Sun Apr 09, 2023 5:38 am
Has thanked: 3 times

Re: ESP32-S3 + w5500 spi

Post by TyuTyu »

Thanks.
I tried fw version what is in your example, I tried S3 chip, I tried C3 chip. It seems to me I got a fake W5500. (I tried 2 of them, but I ordered together..)

I'll order a new one from another supplier..

Best Regards,
TyuTyu
User avatar
Electroguard
Posts: 860
Joined: Mon Feb 08, 2021 6:22 pm
Has thanked: 276 times
Been thanked: 323 times

Re: ESP32-S3 + w5500 spi

Post by Electroguard »

I was using one of these, so I know this type works...

eth.jpg
You do not have the required permissions to view the files attached to this post.
TyuTyu
Posts: 13
Joined: Sun Apr 09, 2023 5:38 am
Has thanked: 3 times

Re: ESP32-S3 + w5500 spi

Post by TyuTyu »

I started giving up....
The modules arrived (so I have 4 different W5500 module, one of them lite/small what you suggested).
I tried different ESP32-S3 and ESP32-C3 boards without any success. I tried different SPI pinouts in case of ESP32-S3 chip.
The ESP32-S3 boards are not UNO what you suggested I have DEVKIT (purple, with 2 USB connector)
I remain fw version what is in your example. (Annex32-S3 CAN DMT VGA 1.51.5 qio opi LFS)

The program is simple:
'wiznet5500 spi pins in the custom (!) config
wlog "Start"
a = ethernet.init 7
wlog a

I got allways -1

Do you have any idea ?
User avatar
Electroguard
Posts: 860
Joined: Mon Feb 08, 2021 6:22 pm
Has thanked: 276 times
Been thanked: 323 times

Re: ESP32-S3 + w5500 spi

Post by Electroguard »

My test example has WAIT (for interrupts) at the end, yours does not, so add WAIT to yours.
If no good, try a different CS pin - I used 10 in my test example, whereas you are using 7, so maybe your 7 has a problem.
If still no good, I would try using a completely different SPI item with the same SPI configuration, just to check whether your SPI is actually working.

EDIT: Whenever there is any doubt, it is always best to copy a working example as exactly as possible to eliminate variables (which is why I gave everything in my example)... you can always start changing things to suit yourself once you are confident you are in control.
TyuTyu
Posts: 13
Joined: Sun Apr 09, 2023 5:38 am
Has thanked: 3 times

Re: ESP32-S3 + w5500 spi

Post by TyuTyu »

First of all: thanks the helpful information.
A with a lot of hours trying the problem solved .

The problem was: BUG in the system.
If the SD card not enabled SPI doesn't works. -> W5500 not works too.
I haven't SD so it was logical for me disabled. That is why I got -1.
If SD enabled the module got IP from DHCP.
I tried with the latest FW.

Should I post it to "software bug" topic too ?

TyuTyu
User avatar
Electroguard
Posts: 860
Joined: Mon Feb 08, 2021 6:22 pm
Has thanked: 276 times
Been thanked: 323 times

Re: ESP32-S3 + w5500 spi

Post by Electroguard »

I suggest to backtrack to your previous problem scenario then just change one thing at a time to get things to work before jumping to any conclusions.
The SPI pins circled in yellow in the picture are common to everything that uses the SPI, which may be several different things at the same time.
But they must all be controlled by their own assigned Chip Select which will be different for each.
The 3 purple arrows point to 3 different Chip Select pins for 3 different SPI functionalities, which all need to be controlled by their own CS.
But notice that although most of the SPI pins are assigned in Config, the Ethernet CS is not, because it is assigned in the script.
So make sure you are not unnecessarily enabling the Config SD CS thinking it is needed for the Ethernet CS (which was the reason I previously pointed out that you were assigning gpio7 in your script whereas I had been assigning gpio10).
I suspect it may be more a matter of the Help needing updating rather than a firmware bug... but it will undoubtedly all seem clearer in hindsight.
The important point is that you have joined the relatively small club of Annex Ethernet users (plus have the parts for more ethernet nodes if needed).
So you would only have wasted your time if you had given up before experiencing the success of Annex Ethernet capability.

CS.jpg
You do not have the required permissions to view the files attached to this post.
TyuTyu
Posts: 13
Joined: Sun Apr 09, 2023 5:38 am
Has thanked: 3 times

Re: ESP32-S3 + w5500 spi

Post by TyuTyu »

Thanks. I joined to "small club of Annex Ethernet users" :)

SPI pins and CS were fine.
Képernyőkép 2024-03-03 062008.jpg

Switch of SD card was the problem.
kép.png

If SD not enabled all SPI disabled.
I reproduce the bug in this morning, everything is the same (HW, FW, setup, etc..), and a "working" and "not working" state is only depend: SD card enabled or not.
In my system there is no SD so enabling it wasn't obvious for me.
Your example SD was enabled and that give me idea.

BTW: do you have SD or enabled it only for SPI ?
You do not have the required permissions to view the files attached to this post.
User avatar
Electroguard
Posts: 860
Joined: Mon Feb 08, 2021 6:22 pm
Has thanked: 276 times
Been thanked: 323 times

Re: ESP32-S3 + w5500 spi

Post by Electroguard »

SD was just a coincidence because I had previously been trying different SD readers and found that it didn't matter if SD was left enabled cos Annex just falls back to flash file system if no SD card is available.

When you posted your problem I already had SPI pins set up in Config, so I just plugged in the ethernet module and added those few lines temporarily to the top of my existing script so I could try it for you, then took the screen shots of the results to prove that it was working (sounds quicker than it was).

Francesco included Ethernet at my request a few years ago, but he has been on holiday so was up to me to help cos maybe nobody else could or would.
So welcome to the very exclusive Annex Ethernet Club !
Post Reply