Other Parts Discussed in Thread: HALCOGEN
Tms570开发板demo的以太网设置总是失败,static、dhcp和autoip应该选哪个模式?求指导。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.
Other Parts Discussed in Thread: HALCOGEN
Tms570开发板demo的以太网设置总是失败,static、dhcp和autoip应该选哪个模式?求指导。1. 动态分配IP地址可以调用以下函数:
ipAddr = lwIPInit(0, macAddress, 0, 0, 0, IPADDR_USE_DHCP);
注意函数的最后一个参数是“IPADDR_USE_DHCP",这种方法请确认路由已经开启DHCP功能。
2. 使用静态地址,就需要计算静态IP。计算方法如下。
IPv4一般用点分十进制表示,如192.168.0.100。但实际上,IPv4的地址是一个32位整数,按字节(8位)分成4个部分,用点分表示。所以还原计算应按32位整数计算。192.168.0.100计算如下:
192*(2^24)+168*(2^16)+0*(2^8)+100*(2^0) = 3232235620 = 0xC0A80064
调用函数为
ipAddr = lwIPInit(0, macAddress, 3232235620 , 0, 0, IPADDR_USE_STATIC );