This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Tool/software: Code Composer Studio
I use the (udpecho) code of msp432E401y, how to configure static IP, do not assign IP using DHCP. MSP432E401y launchpad.
Hello Julai,
The following is how the initIP function has to be modified to enable "Static IP".
static void initIp(void *hCfg) { const char *localIPAddr = "192.168.1.2"; const char *localIPMask = "255.255.254.0"; const char *gatewayIP = "192.168.1.1"; const char *domainName = "demo.net"; CI_IPNET netAddr; CI_ROUTE route; /* Add global hostname to hCfg (to be claimed in all connected domains) */ CfgAddEntry(hCfg, CFGTAG_SYSINFO, CFGITEM_DHCP_HOSTNAME, 0, strlen(hostName), (unsigned char *)hostName, NULL); /* Configure static IP address on interface 1 */ memset(&netAddr, 0, sizeof(netAddr)); netAddr.IPAddr = inet_addr(localIPAddr); netAddr.IPMask = inet_addr(localIPMask); strcpy(netAddr.Domain, domainName); netAddr.NetType = 0; CfgAddEntry(hCfg, CFGTAG_IPNET, 1, 0, sizeof(netAddr), (unsigned char *)&netAddr, NULL); /* Add default gateway. Since it's the default gateway, the destination * address and mask are both zero. */ memset(&route, 0, sizeof(route)); route.IPDestAddr = 0; route.IPDestMask = 0; route.IPGateAddr = inet_addr(gatewayIP); CfgAddEntry(hCfg, CFGTAG_ROUTE, 0, 0, sizeof(route), (unsigned char *)&route, NULL); }
Hope this helps!
Thanks,
Sai
**Attention** This is a public forum