WIZnet Developer Forum

W5500 - Data read always returns zero

I am working on a project with an Atmel ATxmega256A3BU communicating over SPI with a WIZNET850io module (W5500 chip).
I use the WIZNET library to communicate with the W5500.
The problem is that I can not read back my settings, e.g. MAC or IP address.
I always get 0x00.
Only if I read the chip version from address 0x0039 I get 0x28.
Checked all the SPI signals with an oscilloscope and it looks OK. For tests I added also some small capacitors to SCS, SCKL and MOSI to be sure there are no glitches with the same result.
Tested it with 3 new 850io modules and it is the same with all 3.
I also reduced the test code to write just to some memory addresses and read it back.
Also if I read back the RETRY TIME Reg. I get 0x0000 but the default value should be 0x07D0.
Here is my test code

/* simple initialization of WIZ550io for tests /
uint8_t mac = {0x00, 0x11, 0x00, 0x11, 0x00, 0x11};
uint8_t sn = {255,255,255,0};

uint8_t Ch_Version; /* for WizChip Version /
uint8_t WizRTR[2] = {0,0}; /
for WizChip Retry Time RTR */

spi_init_ETH (); /* SPI Bus init. */

/* WIZ550io init. /
SPI_SS_OFF_ETH; /* deactivate CS of WIZ850 /
RESET WIZ850 is activated /
_delay_ms (5); /
in WIZ850 datasheet min 0.5ms /
RESET WIZ850 is deactivated /
_delay_ms (70); /
in WIZ850 datasheet min 50ms */

reg_wizchip_cs_cbfunc(wizchip_select, wizchip_deselect); /* set the SPI functions /
reg_wizchip_spi_cbfunc(wizchip_read, wizchip_write); /
set the SPI functions */

WIZCHIP_WRITE_BUF(0x000900, &mac, 6); /* write 6 Byte MAC address /
WIZCHIP_WRITE_BUF(0x000500, &sn, 4); /
write 4 Byte Subnet Mask /
_delay_ms (10);
WIZCHIP_READ_BUF (0x000900, &mac, 6); /
read 6 Byte MAC address /
WIZCHIP_READ_BUF (0x000500, &sn, 4); /
read 4 Byte Subnet Mask /
WIZCHIP_READ_BUF (0x001900, &WizRTR, 2); /
read 2 Bytes Retry Time Value Register /
WIZCHIP_READ_BUF (0x003900, &Ch_Version, 1); /
read 1 Byte W5500 Chip Version Register */

Here the oscilloscope pictures:
(channel 1: yellow = CS, channel 2: cyan= MOSI, channel 3: magenta =CLK, channel 4: green = MISO)

Write MAC address ( 0x00, 0x11, 0x00, 0x11, 0x00, 0x11) to W5500 address 0x0009, variable length mode
MISO shows the debug information for the 2 address and the command byte but at the 3th, 4th and 5th byte I see it again.

Read back the MAC from address 0x0009, result is always 0x00

Write the Subnet Mask (255 255 255 0) to address 0x0005

Read back the Subnet Mask from address 0x0005, result is always 0x00

Read the RETRY Value Reg from address 0x0019, result is always 0x00

Read the the chip version from address 0x0039, result is 0x28, should be 0x04

Thanks for your help!


When you perform reading OR writing, first three SPI cycles return 01 02 03 on the MISO line as discussed here. Do you see these 01-02-03 when reading registers?

Can you post your scope readings so that we can see the whole access cycle - for writing and for reading?

Edit: scope images are too small. Please upload larger images.

Update as far as I can see on these small images you change value on MOSI line with posedge of CLK, and it must be wrong. W5500 samples MOSI on its clock rising edge, thus you must set up the data on the previous falling edge of the clock.

Thank you very much for your help, you are right, I have changed the SPI MODE and it works well now.

Sorry for the small images, unfortunately this is the best what can my oscilloscope offer me!

Copyright © 2017 WIZnet Co., Ltd. All Rights Reserved.