Minsu Jeun
Published © GPL3+

Simple Web-Server with WIZ550io

Web-server test with WIZ550IO

IntermediateFull instructions provided1,409
Simple Web-Server with WIZ550io

Things used in this project

Hardware components

WIZ550io
×1
STM32
×1

Schematics

STM32 and WIZ550io

Code

Simple webserver

C/C++
void WIZ_Config(void)
{
	uint8 i;
	wiz_NetInfo netinfo;
	extern u_char GET_SN_MASK[4];			        /**< Subnet mask received from the DHCP server */
	extern u_char GET_GW_IP[4];			        /**< Gateway ip address received from the DHCP server */
	extern u_char GET_SIP[4];				/**< Local ip address received from the DHCP server */

	Reset_W5200();
	wizInit();

    i = IINCHIP_READ(PHY);
    cm_printf("PHY Register: %x, %d\r\n", i, i);

    while ( (i & 0x20)!=0)
    {
        cm_printf("PHY Link success %x\r\n",i);
        return;
    }

	if(Enable_DHCP == ON){
		for(i=0; i<4; i++){
			netinfo.Mac[i] = Mac[i];
			netinfo.IP[i] = IP[i];
			netinfo.Subnet[i] = Subnet[i];
			netinfo.Gateway[i] = Gateway[i];
			netinfo.DNSServerIP[i] = DNSServerIP[i];
		}
		netinfo.Mac[i] = Mac[i];
		i++;
		netinfo.Mac[i] = Mac[i];

	} else{
		for(i=0; i<6; i++){
			SRC_MAC_ADDR[i] = Mac[i];
		}

		cm_printf("Delay for 2 Seconds..\r\n");
		Delay_ms(8000);

		// Set DHCP
		init_dhcp_client(SOCK_DHCP, wizSWReset, wizSWReset);
		getIP_DHCPS();

		for(i=0; i<4; i++){
			netinfo.Mac[i] = SRC_MAC_ADDR[i];
			netinfo.IP[i] = GET_SIP[i];
			netinfo.Subnet[i] = GET_SN_MASK[i];
			netinfo.Gateway[i] = GET_GW_IP[i];
			netinfo.DNSServerIP[i] = GET_DNS_IP[i];
		}
		netinfo.Mac[i] = SRC_MAC_ADDR[i];
		//i++;
		//netinfo.Mac[i] = SRC_MAC_ADDR[i];
	}

	SetNetInfo(&netinfo);

	cm_printf("\r\n--------------------------------------- \r\n");
	cm_printf("W5200E01-M3                       \r\n");
	cm_printf("Network Configuration Information \r\n");
	cm_printf("--------------------------------------- ");

	GetNetInfo(&netinfo);
	cm_printf("\r\nMAC : %X.%X.%X.%X.%X.%X", netinfo.Mac[0],netinfo.Mac[1],netinfo.Mac[2],netinfo.Mac[3],netinfo.Mac[4],netinfo.Mac[5]);
	cm_printf("\r\nIP : %d.%d.%d.%d", netinfo.IP[0],netinfo.IP[1],netinfo.IP[2],netinfo.IP[3]);
	cm_printf("\r\nSN : %d.%d.%d.%d", netinfo.Subnet[0],netinfo.Subnet[1],netinfo.Subnet[2],netinfo.Subnet[3]);
	cm_printf("\r\nGW : %d.%d.%d.%d", netinfo.Gateway[0],netinfo.Gateway[1],netinfo.Gateway[2],netinfo.Gateway[3]);
	cm_printf("\r\nDNS server : %d.%d.%d.%d", netinfo.DNSServerIP[0],netinfo.DNSServerIP[1],netinfo.DNSServerIP[2],netinfo.DNSServerIP[3]);
}

Credits

Minsu Jeun
1 project • 3 followers

Comments