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.

cc3000 DHCP problem

Hi, I faced a DHCP problem, I still can not get a correct IP address from my router or AP (I have tried different routers and different modes). The IP I got by using netapp_ipconfig is always 252.255.1.32 and I cannot ping to this IP, very strange. The cc3000 is already connected to the router and I can get its mac address in the router setting page. I have tried netapp_dhcp(0, 0, 0, 0) to enable the DHCP function.

Recently I can send mdnsAdvertiser to my local phone, the IP address displayed in ZeroConf Browser is also 252.255.1.32. But my PC can not get the UDP packet from cc3000 successfully.

The 20 data I got in CC3000_UsynchCallback case HCI_EVNT_WLAN_UNSOL_DHCP is : 32-1-255-252-32-1-255-252-0-0-0-0-0-0-0-0-32-1-255-252

Host MCU: STM32F4
Host Driver version:  1.10.1
Service Pack version: 1.10

Thanks

  • Hi,

    Can you try with static IP setting once and then try with DHCP ?

    Thanks,

    -VR Shankar.

  • VR Shankar said:

    Hi,

    Can you try with static IP setting once and then try with DHCP ?

    Thanks,

    -VR Shankar.

    Thanks, I have tried the static IP but maybe my trying way is wrong. May I ask the correct static IP setting way, I should call netapp_dhcp(...,...) before smart config or after smart config before connection or after connection? I have tried call the function after connection and then can get the correct static IP by netapp_ipconfig, but still can not send udp packet to my PC successfully and the IP in mDNS message got in phone is still 252.255.1.32.

  • Hi,

    Best place to call netapp_dhcp() would be always after a valid AP association. Try to call it after 'ulCC3000Connected' turns to '1' ( after receiving the unsolicited connect event from CC3000).

    Are you able to ping the static IP address from your PC ?

    Unfortunately, I have not tried using mDNS with CC3000. I may not be able to help you there.

    Thanks,

    -VR Shankar.

  • VR Shankar said:

    Hi,

    Best place to call netapp_dhcp() would be always after a valid AP association. Try to call it after 'ulCC3000Connected' turns to '1' ( after receiving the unsolicited connect event from CC3000).

    Are you able to ping the static IP address from your PC ?

    Unfortunately, I have not tried using mDNS with CC3000. I may not be able to help you there.

    Thanks,

    -VR Shankar.

    Hi, I tried the static IP and then I can ping to cc3000 now, thanks. Now I am trying sending UDP packet. How do you check whether the UDP packet is received in PC?

  • Hi,

    Good to know that static IP works. From your MCU send the UDP packet to a particular port in the PC (for eg. 45000).

    Run Wireshark in the PC and filter with udp.dstport == 45000 (or the port number you choose). You should be able to see the packets from CC3000 then.

    Thanks,

    -VR Shankar.

  • VR Shankar said:

    Hi,

    Good to know that static IP works. From your MCU send the UDP packet to a particular port in the PC (for eg. 45000).

    Run Wireshark in the PC and filter with udp.dstport == 45000 (or the port number you choose). You should be able to see the packets from CC3000 then.

    Thanks,

    -VR Shankar.

    Thanks so much! My udp also works. Then I still need to be back to find out the DHCP problem. Thanks again.

  • Hi,

    DHCP should work right away.  If you still face issues, please post the code snippet you are using for DHCP settings, that should give more info.

    Thanks,

    -VR Shankar.

  • VR Shankar said:

    Hi,

    DHCP should work right away.  If you still face issues, please post the code snippet you are using for DHCP settings, that should give more info.

    Thanks,

    -VR Shankar.

    Hi, the dynamic IP setting is easier than the static IP setting right? I only use 

    netapp_dhcp(0, 0, 0, 0);
     
    while ((ulCC3000DHCP == 0) || (ulCC3000Connected == 0))
    {
    hci_unsolicited_event_handler();

    SysCtlDelay(1000);
    }

    to enable DHCP. Did I miss any important steps?

  • Hi,

    Please go through the API documentation once again. netapp_dhcp() expects the DNS server value for DHCP (other three parameters are zero).

    Thanks,

    -VR Shankar.

  • VR Shankar said:

    Hi,

    Please go through the API documentation once again. netapp_dhcp() expects the DNS server value for DHCP (other three parameters are zero).

    Thanks,

    -VR Shankar.

    Thank you so much. You remind me, I can not use netapp_dhcp(0,0,0,0) directly, I must set all the string values as 0 then give the pointer to netapp_dhcp, i.e. I should use 

    pucSubnetMask[0] = 0x0;
    pucSubnetMask[1] = 0x0;
    pucSubnetMask[2] = 0x0;
    pucSubnetMask[3] = 0x0;

    pucIP_Addr[0] = 0x0;
    pucIP_Addr[1] = 0x0;
    pucIP_Addr[2] = 0x0;
    pucIP_Addr[3] = 0x0;

    pucIP_DefaultGWAddr[0] = 0x0;
    pucIP_DefaultGWAddr[1] = 0x0;
    pucIP_DefaultGWAddr[2] = 0x0;
    pucIP_DefaultGWAddr[3] = 0x0;

    pucDNS[0] = 0x0;
    pucDNS[1] = 0x0;
    pucDNS[2] = 0x0;
    pucDNS[3] = 0x0;

    netapp_dhcp((unsigned long *)pucIP_Addr, (unsigned long *)pucSubnetMask, (unsigned long *)pucIP_DefaultGWAddr, (unsigned long *)pucDNS);

    to enable DHCP.

    I should look into the netapp_dhcp source code first, not simply supposed the function will enable DHCP if(pucIP_Addr == NULL).