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.

CC3220SF-LAUNCHXL: Having trouble chnaging IP address in AP mode

Part Number: CC3220SF-LAUNCHXL


Hello:

I need to change the IP address (while in AP mode) of my CC3220 from the default of 10.123.45.1 to 192.168.5.10 to match that of a windows app to send data to it.

I used the following code to change the IP address:

ipV4.Ip          = (_u32)SL_IPV4_VAL(192, 168, 5, 10);   // _u32 IP address
ipV4.IpMask      = (_u32)SL_IPV4_VAL(255, 255, 255, 0);                                                                     // _u32 Subnet mask for this AP/P2P
ipV4.IpGateway   = (_u32)SL_IPV4_VAL(192, 168, 5, 10);   // _u32 Default gateway address
ipV4.IpDnsServer = (_u32)SL_IPV4_VAL(192, 168, 5, 10);   // _u32 DNS server address

sl_NetCfgSet(SL_NETCFG_IPV4_AP_ADDR_MODE,SL_NETCFG_ADDR_STATIC,sizeof(SlNetCfgIpV4Args_t),(_u8 *)&ipV4);

sl_Stop(0);
sl_Start(NULL,NULL,NULL);

It appears that the change did occur but, when I connect to it with my laptop, The SL_NETAPP_EVENT_DHCPV4_LEASED event does not occur and I cannot view the embedded page on the CC3220. Also, I cannot send any data to the 192.168.5.10  IP address. 

Previously, when the IP address was set to the default of 10.123.45.1, I would always see "IP Leased to Client" diagnostic message (meaning the SL_NETAPP_EVENT_DHCPV4_LEASED event did occur and it indicated that the address 10.123.45.2 was leased to client) and I can view the embedded page and use a windows app to send data to 10.123.45.1, no problem.
(NOTE: I went back and re-ran the above functions to change the IP address back to the default and everything runs just fine)

Do I need to run any other functions after I change the IP address?
Does the default IP address need to be "released" or something along those lines in order for the new one to take effect?

Thank you in advance....

  • Hi Dave,

    Does sl_Start return a value other than 0?
    Try sl_Stop with a timeout (eg. 200 for 200 ms).


    Regards,
    Toby
  • Hi Dave,

    You changed IP address for AP mode, but you not change DHCP pool range. That means address of the device and DHCP pool range are set to different subnets and DHCP server cannot work that. You should use API sl_NetAppSet(SL_NETAPP_DHCP_SERVER_ID, SL_NETAPP_DHCP_SRV_BASIC_OPT..) and set proper range for ipv4_addr_start and ipv4_addr_last.

    Jan

  • Jan:

    Using the following code has resolved my issue:

        // default 10.123.45.2 to 10.123.45.254
        dhcpParams.ipv4_addr_start = SL_IPV4_VAL(192,168,5,1); // first IP Address for allocation (TODO: change this hardcoding later)
        dhcpParams.ipv4_addr_last = SL_IPV4_VAL(192,168,5,254); // last IP Address for allocation   (TODO: change this hardcoding later)

    Thanks so much for the response!

    Dave...