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.

CC3200 wifi DHCP 与 静态分配IP地址问题

Other Parts Discussed in Thread: CC3200

(1)场景 设备: PC, 路由器,CC3200 开发板。 PC 连接路由器 ,CC3200 作为station模式连接路由器。

           现象:CC3200使用DHCP方式分配IP地址正常。请问CC3200是否可以静态分配IP地址,即将CC3200的IP设置为固定的地址(与路由器在同一个网段)?谢谢。

  • 论坛有类似问题,解答请看这边: http://www.deyisupport.com/question_answer/wireless_connectivity/wifi/f/105/t/76374.aspx

  • 直接使用API函数

    Setting a static IP address to the device working in STA mode or P2P client.
    The IP address will be stored in the FileSystem.
    In order to disable the static IP and get the address assigned from DHCP one should use SL_STA_P2P_CL_IPV4_DHCP_SET

    SlNetCfgIpV4Args_t ipV4;
    ipV4.ipV4 = (_u32)SL_IPV4_VAL(10,1,1,201); // _u32 IP address 
    ipV4.ipV4Mask = (_u32)SL_IPV4_VAL(255,255,255,0); // _u32 Subnet mask for this STA/P2P
    ipV4.ipV4Gateway = (_u32)SL_IPV4_VAL(10,1,1,1); // _u32 Default gateway address
    ipV4.ipV4DnsServer = (_u32)SL_IPV4_VAL(8,16,32,64); // _u32 DNS server address

    sl_NetCfgSet(SL_IPV4_STA_P2P_CL_STATIC_ENABLE,IPCONFIG_MODE_ENABLE_IPV4,sizeof(SlNetCfgIpV4Args_t),(_u8 *)&ipV4); 
    sl_Stop(0);
    sl_Start(NULL,NULL,NULL);