W5500 not getting IP from router but able to direct from laptop

Hello everyone,

I am able to connect my laptop to w5500 without any router but when I am connecting it to the office local network then it is not getting IP.

Here is my code.

void eth_reset()
{
unsigned char status_ir;
GPIOB-> BRR |= (1<<7); // Reset pin
HAL_Delay(200);//reset
GPIOB-> BSRR |= (1<<7);
HAL_Delay(500);

reg_wizchip_cs_cbfunc(cs_sel, cs_desel);  //  cs select and deselect pass in wizchip library
reg_wizchip_spi_cbfunc(spi_rb, spi_wb);   //  receive buff and transmit buff pass in wizchip libra
//wizchip_init(socketRxTxBuff, socketRxTxBuff);    //  Socket Rx amd Tx buffer initialization (Max 16kb for rx and 16kb for tx), Max size can be divide in 8 socket buffer according to need
if(ctlwizchip(CW_INIT_WIZCHIP,(void*)memsize) == -1){
	UARTSendString(logPort, (unsigned char*)"WIZCHIP Initialized fail.\r\n");
	//while(1);
}

volatile wiz_PhyConf phyConf =
{
		PHY_CONFBY_HW, // PHY_CONFBY_SW
		PHY_MODE_AUTONEGO, // PHY_MODE_AUTONEGO
		PHY_SPEED_100, // PHY_SPEED_100
		PHY_DUPLEX_FULL, // PHY_DUPLEX_HALF
};

volatile wiz_NetInfo netInfo = { .mac = {0xa1,0xb2,0xc3,0xd1,0xe1,0xf4},	// Mac address
		.ip 	= {192,168,1,199},	// IP address
		.sn 	= {255,255,255,0},	// Subnet mask
		.gw 	= {192,168,1,1},    // Gateway address
		.dns	= {0,0,0,0},
		.dhcp   =  NETINFO_STATIC};

//wizchip_setnetinfo(&netInfo);
HAL_Delay(200);
ctlnetwork(CN_SET_NETINFO, (void*) &netInfo);
//UARTSendString(2, "ctlnetwork\r\n");

HAL_Delay(200);
ctlwizchip(CW_SET_PHYCONF, (void*) &phyConf);
//UARTSendString(2, "ctlwizchip\r\n");

HAL_Delay(200);
ctlwizchip(CW_GET_PHYLINK, (void*) &tmp);

// setSIMR(0x01);
}

Please suggest any change if I am doing anything wrong.

Hi @Deepak ,
Thank you for reaching us…
Can you send me the log …
And once make sure that gateway address of yours office…??

Thanks & Regards
Teju S H

It is connect now, If sometimes I change the mac address, It also work. Right now it is working. I will send the the log if It will occur again.