About the W5500 Ethernet chip, sending and receiving data bits

Dear all:
I looked at the W5500 example on github and found that buf in both the send() and recv() functions is handled in 8-bit terms. I was wondering if I could change this to a 16-bit unsigned char? Because I’m using DSP28335. The char for this platform is 16-bit.What do I need to change if I can? SPI changed to send receive 16 bits. There is also buf in send() and recv(). What else needs to be changed.
Look forward to hearing from the official staff.

Network data is byte stream (not “char” stream in this terminology), and the library operates 8-bit byte values. I suspect you ask to save memory for this platform, if you declare char buf[1024] it will actually allocate 16x1024 bits of memory, while store only 8*1024 bits. In my opinion the best portable solution could be declaring your target array as uint8_t buf[1024]. But you need to test anyway to ensure routines copy data to/from your array properly.

Hi Eugeny
Thank you very much for your answer.This is because the W5500 communicates with the MCU through SPI. I’m looking at the data book and the examples on github. The Offset Address here is to send 8bits data twice via SPI. The later Control Phase and Data Phase are also 8-bit.I was wondering if SPI could be configured to send 16 bits of data at a time. Then Control Phase data I only select the higher eight digits to send. The following Data Phase data. I send 16bit data at a time.

What problem are you trying to solve or what are you trying to improve? SPI transmits one bit a time, not one byte or one character a time, and it does not matter if you feed the intermediate circuit with 8-bit data or 16-bit data - at the end they all are converted to bits.

1 Like

I think I’ve got an idea. I’ll give it a try. Thank you very much for your patient answer.