设置cc3200的DHCP后,电脑连接模块经常获取不到IP。
SlNetAppDhcpServerBasicOpt_t dhcpParams;
unsigned char outLen = sizeof(SlNetAppDhcpServerBasicOpt_t);
dhcpParams.lease_time = 8192; // lease time (in seconds) of the IP Address
dhcpParams.ipv4_addr_start = SL_IPV4_VAL(11,11,11,2); // first IP Address for allocation. IP Address should be set as Hex number
dhcpParams.ipv4_addr_last = SL_IPV4_VAL(11,11,11,250); // last IP Address for allocation. IP Address should be set as Hex number
sl_NetAppStop(SL_NET_APP_DHCP_SERVER_ID); // Stop DHCP server before settings
sl_NetAppSet(SL_NET_APP_DHCP_SERVER_ID, NETAPP_SET_DHCP_SRV_BASIC_OPT, outLen, (unsigned char*)&dhcpParams); // set parameters
sl_NetAppStart(SL_NET_APP_DHCP_SERVER_ID);
sl_Stop(10); //模式设置后重启生效
sl_Start(NULL,NULL,NULL);