stm32f103xx spi + w5500 - Write successful but read returns 0

Hi There,
I am trying to get W5500 work as a TCP Server.
As initial steps, I first provided a static IP address so that I could test the spi connectivity between stm32f103xx microcontroller and w5500.
I have successfully programmed an IP address, Subnet mask, MAC Address and gateway address by using the VDM mode and writing to Common Register 0x0001-0x0012.
I pinged the w5500 and got a response and also did an arp -a to check the programmed MAC address.
both ping and arp were successful.

So far all is good. I have the following issues:
Issue 1:
Next I tried to read the programmed MAC address that I was able to see using the arp command.

I did the following

  • Sent address High = 0x00, address Low = 0x09 and control = 0x00.
    The SPI mode is 0 and the host configured as the Master.
    I have activated SPI interrupt. So in the ISR I am checking" if((SPI1->SR & SPI_SR_RXNE) == SPI_SR_RXNE)" for any received data packets.
    I was expecting to receive the MAC Address but received 0x00 zeros.
    Next I tried reading the Version so wrote address High = 0x00, address Low = 0x39 and control = 0x00, but again received Zeros.

Note: All my write are successful and I receive a 0x01,0x02,0x03.

Issue 2:
Each time I open socket 0 by writing to Sn_Cr register, I cannot even ping the W5500.

I am using 3.3V, Port A PA4,5,6,7 for SPI1 on stm32f103xx.
I have connected the interrupt pin of W5500 to PB15.
Both port A and port B of stm32f103xx are activated in RCC, AFIO for SPI1 is activated.

Any help would be appreciated.
Thanks in advance.

You must receive 0x01,0x02,0x03 also during read. If you do not, then it means W5500 does not recognize the command.

Sounds like you write to wrong register page (e.g. to common register block).

Dear Eugeny,
Thanks for your prompt response.
I am for some reason not getting 0x01,0x02,0x03 for read.
To read the version number, I am transmitting the following:

  1. Address High Byte = 0x00, Low Byte = 0x39
  2. BSB,RWB,OM = 0x00
  3. I keep the Chip select line low so that I can sequentially receive data but I only receive a couple of 0x00s.

For the second problem regarding Socket 0:
I am doing the following to open TCP socket and then listen to it:

  1. To Select TCP - Address High Byte = 0x00, Address Low Byte = 0x00, BSB,RWB,OM (VDM) = 0x0C and data = 0x21 (To enable ND/NC/MMB and TCP)
  2. I specify port number as 9000 (in hex 0x23,0x28), I write the following to the W5500 - Address High Byte = 0x00, Address Low Byte = 0x04, BSB,RWB,OM (VDM) = 0x0C and data = 0x23, 0x28
  3. I enable the socket interrupt - Address High Byte = 0x00, Address Low Byte = 0x2C, BSB,RWB,OM (VDM) = 0x0C and data = 0x1F
  4. I set RX Buf size as Address High Byte = 0x00, Address Low Byte = 0x1E, BSB,RWB,OM (VDM) = 0x0C and data = 0x02 (2Kb)
  5. I set TX Buf size as Address High Byte = 0x00, Address Low Byte = 0x1F, BSB,RWB,OM (VDM) = 0x0C and data = 0x02 (2Kb)
  6. Socket OPEN - Address High Byte = 0x00, Address Low Byte = 0x01, BSB,RWB,OM (VDM) = 0x0C and data = 0x01
  7. Socket Listen - Address High Byte = 0x00, Address Low Byte = 0x01, BSB,RWB,OM (VDM) = 0x0C and data = 0x02
    Socket open and listen are in the CR register 0x00, 0x01.

When I write I immediately pull the CS line up after the last byte is written and I receive 0x01,0x02,0x03.
However for read I let the CS line low so that I can read sequentially but do not receive any valid data, only Zeros.

Am I missing something?
Your help would be most appreciated.
Thanks,
SR

Please share scope shot of the communication between MCU and W5500 (in the best case having all 4 waveforms altogeter) for reads and writes.