wizchip_setnetinfo set configuration doesnt set static IP

Hi All,

I am setting static IP to W5100 ethernet shield from STM32L476RG Nucleo board using wizchip_setnetinfo(&netInfo) API.

wizchip_init() retVal = 0

Network configuration:
MAC ADDRESS: 0:0:50:ba:fb:d8
IP ADDRESS: 192.168.6.192
NETMASK: 255.255.0.0
GATEWAY: 192.168.3.1

When I am calling
wizchip_getnetinfo(&netInfo);
PRINT_NETINFO(netInfo);

I am getting below values which are not valid.

Network configuration:
MAC ADDRESS: 0:0:28:dd:fd:ec
IP ADDRESS: 225.0.3.224
NETMASK: 255.255.0.0
GATEWAY: 224.213.1.1

Any suggestion why these unknown values are comming.

My source code is

PRINT_HEADER();
reg_wizchip_cs_cbfunc(cs_sel, cs_desel);
reg_wizchip_spi_cbfunc(spi_rb, spi_wb);

int retVal = wizchip_init(bufSize, bufSize);
LoggingPrintf("wizchip_init() retVal = %d\r\n",retVal);


wiz_NetInfo netInfo = { .mac 	= {0x00, 0x50, 0x56, 0xba, 0xfb, 0xd8},	// Mac address
                          .ip 	= {192, 168, 6, 192},					// IP address
                          .sn 	= {255, 255, 0, 0},					// Subnet mask
                          .gw 	= {192, 168, 3, 1}};

wizchip_setnetinfo(&netInfo);
PRINT_NETINFO(netInfo);
HAL_Delay(1000);
wizchip_getnetinfo(&netInfo);
PRINT_NETINFO(netInfo);

Some how I am not getting static IP set to W5100 ethernet shield.

What I see immediately is that 0:0:28:dd:fd:ec is almost exactly the half of 0:0:50:ba:fb:d8.

282=50; dd2=1ba, fd2=1fa, ec2=1d8. As there’s one LSB mismatch (in FD/FB), I make a supposition that, if you use SPI, you somehow confuse bit stream, shifting data one bit early (or too late), or read data on wrong clock pulse, and last bit in values you read is a random dangling bit.

Thus:

  1. check your SPI command/data shifting algorithm during writing and during reading (maybe issue in reading, not writing)?
  2. ensure you wired all things correctly (applicable if you use parallel access to the chip).
1 Like

Thank you for your help in analyzing issue and replying back.

1. check your SPI command/data shifting algorithm during writing and during reading (maybe issue in reading, not writing)?

2. ensure you wired all things correctly (applicable if you use parallel access to the chip).

  • connections are done as per link mentioned on Adding ethernet connectivity to a STM32-Nucleo
    Arduino ICSP PIN 1 (MISO) to Nucleo PIN PB_14.
    Arduino ICSP PIN 4 (MOSI) to Nucleo PIN PB_15.
    Arduino ICSP PIN 3 (SCK) to Nucleo PIN PB_13.
    Arduino D10 PIN (SS) to Nucleo PIN PB_12.

  • Now only case which I can imagine is, as you know that ethernet SPI connection need to be done explicitly not through Ardeuno connector so I have reversed SPI connector by de-soldering and soldering on reverse side. So this exercise might have broke my connection with track.

1. I can imagine issue may be with connection, However I have verified by Multimeter connectivity. I will check again. I have ordered 2 more boards.
2. As I am following link exactly as it is, Do you think any other thing which I could try.
3. Do you think any specific need to done with system clock so SPI will work.

Best regards,
Sachin

1 Like

There was issue with my system clock setup, It is fixed now. I can getting correct IP configured, It is working as expected.

Thanks for your help.

Best regards,
Sachin

3 Likes

Same problem here. After been setted, the wizchip_getnetinfo() call returns 255 values for all ip, subnet and gateway.
Can you deeper explain how you solve it?

If chip is reset properly and nothing had been written to these registers it returns zeroes for all these fields.

If you get 255 for them, then you either have written 255 to these fields before, or chip did not initialize properly. Do you wait required time after power on and check if software reset had been completed before configuring chip?