W5500 SPI Bottleneck

Hi!

I am aware that in using the W5500, the SPI is the major cause of bottleneck.

When doing IPerf using atmega328p chip on W5500. The SPI we use is about 8MHz. Now, we are expecting the results to be at least near 8Mbps with a few losses on start/stop events. But what we are getting is just ~3 Mbps.

Reading through the results of those who had done this activity, our results are comparable.

But I can’t explain why this is happening and I can’t find anything.

Hoping someone can explain this to us.

it needs 8 clock for 1-byte send. W5500 SPI Frame consists of 16bits Offset Address in Address Phase, 8bits Control Phase and N bytes Data Phase. it needs at least 32 clock for a valid data.
image

Also, Network speed and SPI clock speed is different.
I think if network speed is 3Mbps, it is fast

thanks,
best regards,

Hi,

I am using W5500 chip with Qualcomm msm8909 SOC. What I configured for “spi-max-frequency = 500000” but the output over Iperf observed is ~0.01Mbps. I tried couple of retry but output remain same, whereas Wi-Fi works with 30+Mbps. So something is not write in my configuration.

Here is my configuration:
&spi_0{
law-ethernet@0 {
compatible = “law,ethernet5500”;
reg = <0>;
interrupt-parent = <&msm_gpio>;
interrupts = <58 0x2>;
reset-gpios = <&msm_gpio 99 0x0>;
interrupt-gpios = <&msm_gpio 58 0x2008>;
cts-gpios = <&msm_gpio 111 0x0>;
rts-gpios = <&msm_gpio 112 0x0>;
spi-max-frequency = <5000000>;
};
};
Also, I tried to change clock speed to 33 Mhz as suggested but SPI shows errror in dmesg,

w5500: 2.0.0
[ 7.733909] <<-SPI-NET-FUNC->> Func:wiz_module_init@Line:182
[ 7.739642] <<-SPI-NET-FUNC->> Func:w5500_probe@Line:98
[ 7.744802] <<-SPI-NET-FUNC->> Func:w5500_init_hw@Line:42 rst gpio:1010
[ 7.751432] <<-SPI-NET-FUNC->> Func:w5500_init_hw@Line:54 int gpio:969
[ 7.757891] <<-SPI-NET-FUNC->> Func:w5500_init_hw@Line:63 cts gpio:1022
[ 7.764533] <<-SPI-NET-FUNC->> Func:w5500_init_hw@Line:76 rts gpio:1023
[ 7.771113] <<-SPI-NET-FUNC-0>> Func:w5500_probe@Line:119
[ 8.878517] msm_bam_device_lpm_ok: Going to LPM now
[ 8.885420] msm_otg 78d9000.usb: USB in low power mode
[ 9.283565] spi_qsd 78ba000.spi: Invalid transfer: 33000000 Hz, 8 bpw tx=ee2fd000, rx= (null)
[ 9.291272] Version : 74
[ 9.293685] spi_qsd 78ba000.spi: Invalid transfer: 33000000 Hz, 8 bpw tx=ee855dd4, rx= (null)
[ 9.302307] iinchip_socket_sethwaddr():425=0:8:dc:91:97:98
[ 9.307749] spi_qsd 78ba000.spi: Invalid transfer: 33000000 Hz, 8 bpw tx=ee2fd000, rx= (null)
[ 9.316364] <<-SPI-NET-FUNC->> Func:w5500_write_buf@Line:232 r:6 status:-22
[ 9.323324] spi_qsd 78ba000.spi: Invalid transfer: 33000000 Hz, 8 bpw tx=ee2fd000, rx= (null)
[ 9.331916] <<-SPI-NET-FUNC->> Func:w5500_read_buf@Line:271 r:6 status:-22
[ 9.338744] w5500: MAC [00:00:00:00:09:00]
[ 9.342818] spi_qsd 78ba000.spi: Invalid transfer: 33000000 Hz, 8 bpw tx=ee855d8c, rx= (null)
[ 9.351464] spi_qsd 78ba000.spi: Invalid transfer: 33000000 Hz, 8 bpw tx=ee855d8c, rx= (null)
[ 9.360030] w5500: socket(0) Tx(0x4000,0x3fff,0x0) Rx(0x4000,0x3fff,0x0)
[ 9.366687] spi_qsd 78ba000.spi: Invalid transfer: 33000000 Hz, 8 bpw tx=ee855d8c, rx= (null)
[ 9.375332] spi_qsd 78ba000.spi: Invalid transfer: 33000000 Hz, 8 bpw tx=ee855d8c, rx= (null)
[ 9.383913] w5500: socket(1) Tx(0x0,0x0,0x0) Rx(0x0,0x0,0x0)
[ 9.389588] spi_qsd 78ba000.spi: Invalid transfer: 33000000 Hz, 8 bpw tx=ee855d8c, rx= (null)
[ 9.398139] spi_qsd 78ba000.spi: Invalid transfer: 33000000 Hz, 8 bpw tx=ee855d8c, rx= (null)
[ 9.406737] w5500: socket(2) Tx(0x0,0x0,0x0) Rx(0x0,0x0,0x0)
[ 9.412377] spi_qsd 78ba000.spi: Invalid transfer: 33000000 Hz, 8 bpw tx=ee855d8c, rx= (null)
[ 9.421000] spi_qsd 78ba000.spi: Invalid transfer: 33000000 Hz, 8 bpw tx=ee855d8c, rx= (null)
[ 9.429576] w5500: socket(3) Tx(0x0,0x0,0x0) Rx(0x0,0x0,0x0)
[ 9.435175] spi_qsd 78ba000.spi: Invalid transfer: 33000000 Hz, 8 bpw tx=ee855d8c, rx= (null)
[ 9.443831] spi_qsd 78ba000.spi: Invalid transfer: 33000000 Hz, 8 bpw tx=ee855d8c, rx= (null)
[ 9.452395] w5500: socket(4) Tx(0x0,0x0,0x0) Rx(0x0,0x0,0x0)
[ 9.458005] spi_qsd 78ba000.spi: Invalid transfer: 33000000 Hz, 8 bpw tx=ee855d8c, rx= (null)
[ 9.466661] spi_qsd 78ba000.spi: Invalid transfer: 33000000 Hz, 8 bpw tx=ee855d8c, rx= (null)
[ 9.475222] w5500: socket(5) Tx(0x0,0x0,0x0) Rx(0x0,0x0,0x0)
[ 9.480880] spi_qsd 78ba000.spi: Invalid transfer: 33000000 Hz, 8 bpw tx=ee855d8c, rx= (null)
[ 9.489530] spi_qsd 78ba000.spi: Invalid transfer: 33000000 Hz, 8 bpw tx=ee855d8c, rx= (null)
[ 9.498018] w5500: socket(6) Tx(0x0,0x0,0x0) Rx(0x0,0x0,0x0)
[ 9.503701] spi_qsd 78ba000.spi: Invalid transfer: 33000000 Hz, 8 bpw tx=ee855d8c, rx= (null)
[ 9.512313] spi_qsd 78ba000.spi: Invalid transfer: 33000000 Hz, 8 bpw tx=ee855d8c, rx= (null)
[ 9.520941] w5500: socket(7) Tx(0x0,0x0,0x0) Rx(0x0,0x0,0x0)
[ 9.526496] spi_qsd 78ba000.spi: Invalid transfer: 33000000 Hz, 8 bpw tx=ee855dd4, rx= (null)
[ 9.535389] <<-SPI-NET-FUNC-1>> Func:w5500_probe@Line:125
[ 9.540485] <<-SPI-NET-FUNC-0>> Func:wiznet_drv_create@Line:264
[ 9.546362] <<-SPI-NET-FUNC-1>> Func:wiznet_drv_create@Line:271
[ 9.552279] <<-SPI-NET-FUNC-2>> Func:wiznet_drv_create@Line:277
[ 9.558147] <<-SPI-NET-FUNC-3>> Func:wiznet_drv_create@Line:281
[ 9.564083] <<-SPI-NET-FUNC-4>> Func:wiznet_drv_create@Line:294
[ 9.570579] <<-SPI-NET-FUNC-5>> Func:wiznet_drv_create@Line:302
[ 9.575855] <<-SPI-NET-FUNC-2>> Func:w5500_probe@Line:128
[ 9.581305] <<-SPI-NET-FUNC-3>> Func:w5500_probe@Line:138
[ 9.586657] w5500 spi register succeed

Can you suggest me, how can I improved the network speed?

I can’t really tell with 100% certainity, but in the case of an atmega328 it may depend on the way the SPI works. Note that, for instance, these chips don’t have DMA (afaik), so after every transfer the controller needs to stop what it is doing, read the received byte and copy it to the appropriate location in memory, check the transfer state and initiate the next transfer. I suppose this wouldn’t matter when manipulating registers, but during burst transfers this may take up some time.

Now, I can’t guarantee that this is the acutal reason, but this would be my assumption as to why this is the result that you get.