W5500 reading from RX buffer


I am writing TCP connection using W5500 with STM32 with bare hands (no libraries)
So far I have configured W5500 to be both, client and server. I have connection but I cannot figure out how to read or send data.

Yes I have read datasheet but it fails hard for me to make sense out of it.

My current problem is that, I connect to a server (wireshark confirms connection), then server sends me some string (I can see its size from W5500 and its correct) but I have no goddamn idea how to actually read the string.

Yes I have read about RX write pointer and RX read pointers but have no idea how to use.

datasheet mentions RX Buffer but I cannot find it anywhere.

Please help me

You can examine the working code at https://github.com/SapientHetero/Ethernet to see how it’s done. The code that reads and writes is in socket.cpp. Look at the methods read_data() and write_data().

W5500 commands are sent in W5100.cpp, which can be found in the /utilities subdirectory. This version of W5100.cpp works with W5500, W5200 and W5100 chips.

Compare what these functions do with what you’re reading in the datasheet and that will help you understand how they work.

One word of warning… W5100 uses macros and inline functions to perform register reads and they’re a bit opaque, but they work. For instance, you’ll be hard-pressed to find functions like W5100.writeSnIR() because it’s generated using macros defined in W5100.h in the section that begins with the comment // W5100 Registers.

1 Like

Thank you for your response.

I like the datasheet of W5500 but this part was made so poorly. In 65 paged datasheet there is one and only page that shows how to access RX and TX buffers (It is in the section of Block arrangements, p 15-16)

So that was a bit awkward to find