W5500 - Reading RTR Register Value FFFF while loading w5500 SPI ethernet driver

Hi Team,

We try to interface W5500 SPI Ethernet module to 32-bit SPI interface with our RISC-V development board, We’ve enabled driver support for W5500, But during the kernel boot time, while driver initialisation “w5100_hw_reset” function calling “w5100_read16” function in that function seeing 65535 (FFFF) when tried to print it. But its expecting 2000. Checked MISO and CLK signal in oscilloscope but the MISO value we are seeing other then FFFF but the same value is not reflecting in the driver, please find the logs below for reference.

[ 0.000000] Linux version 5.10.41-soc (riscv@riscv) (riscv64-unknown-linux-gnu-gcc (crosstool-NG 1.24.0) 8.3.0, GNU ld (crosstool-NG 1.24.0) 2.32) #4 SMP Wed May 24 14:48:10 IST 2023
[ 3.429923] riscv : priv value 36075584
[ 3.440282] riscv : w5100_read16 65535

My SPI controller only supports 32 Bit slave devices, and do not support 8 & 16 Bit slaves.

Please do help me on this.


Regards,
Kavya.

What register it reads? Did W5500 finish initialization at this time?

Why?

Do you check value at that exactly moment when kernel reads wrong value? What is on the MISO/MOSI wires?

Reading rtr register, Its not initialising.
In driver code defined rtr register value 2000(0x07D0).
In driver code defined spi_read16 function, when we print that function we are observing 65535 (FFFF) value, when we probe MISO and MOSI we’ve observing other then FFFF in oscilloscope, above attached images for CLK and MISO signal.

Regards,
Kavya.

Hi, @Kavya1

which library are you using?

This is the official ioLibrary we support.

We could find risc-v customer from hongkong. but W5500 already worked well with 32bit ARM cortex-Mx

Hi,

Currently we are not using any library, enabled driver support for wiznet in 5.10.41 kernel, configured wiznet in device tree node. while booting wiznet driver is not loading it stopping in w5100_read16 () function.
is it mandatory to add ioLibrary?

Regards,
Kavya.

Hi,
What did you write for the device tree code?
I was using the dts overlay file provided by version 5.10.x in the Raspberry Pi environment.
The code can be found in the link below.

Hi,

Below dts node used :
eth1@0 {
compatible = “wiznet,w5500”;
reg = <0>;
interrupt-parent = <&porta>;
pinctrl-names = “default”;
interrupts = <21 IRQ_TYPE_EDGE_FALLING>;
irq-gpios = <&porta 21 GPIO_ACTIVE_HIGH>;
mac-address = [00 08 DC 01 02 03];
spi-max-frequency = <35000000>;
status = “okay”;
}

Tested w5100 using spidev_test getting rtr value 07D0, when we try to load Wiznet driver getting 65535(ffff), please find the attached logs below.

spidev_test logs:
spidev_test -D /dev/spidev0.0 -v -p “\x00\x19\x00\x00\x00”
[ 906.293490] cnds_runtime_resume @ 1143
spi mode: 0x0
bits per word: 8
max speed: 500000 Hz (500 kHz)
[ 906.314953] kavya : spi phase
[ 906.334881] kavya : spi polarity
[ 906.355262] kavya : spi mode 0
[ 906.355268] kavya : select the slave
TX | 00 19 00 00 00 __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ |…|
RX | 01 02 03 07 D0 __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ |…|

wiznet driver logs:
[ 206.463853] WIZNET : data is 65535

Please do help me on this.

Regards,
Kavya .

Does it mean that SPI is functioning correctly?

Track how data is being passed till it displays

As per our observation spidev_test reading the actual value from the slave device, we will think like spi is functioning correctly.

When i probe the data line (MISO), getting FFFF find the attached oscilloscope signal below.

Please share the compilation procedure for ioLibrary .

Hi, @Kavya1

could you share the full signal with MOSI and MISO on oscilloscope ?

I would like to also check address, op and data format is right.