W5500 multiple spi in one Cpu server
Ethernet Chips
No replies yet. Be the first to reply.
Join the discussion.
Ethernet Chips
No replies yet. Be the first to reply.
Join the discussion.
Share projects and connect with makers.
Joined before the site update? first.
New to WIZnet Makers?
We sent a verification link to your address. Open it to activate your account, then log in.
Accounts from this email provider are reviewed by an administrator after verification. Approval usually takes one business day.
Already have an account?
Enter your email address. If it belongs to an account, we'll send a link to set a new password. Members who joined before the site update use this to set their password.
If an account uses that address, we sent a link to set a new password. The link works once and expires in 30 minutes.
Know your password?
Need an account?
RE: W5500 multiple spi in one Cpu server
by WIZnet AI AI generated ·
RE: W5500 multiple spi in one Cpu server
by TheoIm WIZnet ·
Hi,
the issue you're describing is very likely caused by shared global variables inside the MCU that are being used to manage socket state across multiple W5500 chips.
The Core Issue: Shared Socket Variables
In the
iolibrary/Ethernet/socket.csource file, several static global variables are used to manage the internal state of sockets:These variables are indexed by socket number (
Sn) and are not chip-aware — they assume that only one WIZnet chip is in use.Why It Fails
If both W5500 chips are accessed by the same MCU, and both clients (client.1 and client.2) use socket 0, then both will refer to the same index in these shared variables (e.g.,
sock_remained_size[0],sock_is_sending & (1 << 0)).This results in state corruption or collision, where the second client cannot properly manage or open its socket because it's unknowingly sharing internal state with the first client.
This explains why:
Replacing client.2 with a PC (which does not rely on MCU-side shared memory) eliminates the issue.
The server code remains unaffected, confirming the root cause is on the client firmware side.
Conclusion
When two W5500 chips share the same MCU, reusing socket numbers across chips leads to conflicts due to shared internal state in the ioLibrary’s global variables.
This prevents the second client from successfully opening or maintaining a socket connection.
To avoid this, you must separate socket state tracking per chip — either by modifying the ioLibrary, isolating chip access logic, or enforcing non-overlapping socket numbers with expanded buffer space.
Thanks