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 First Time Config

Other Parts Discussed in Thread: MSP430FR5739, MSP430F5438

I am working on freescale host controller and trying to perform first time configuration, but due to less information available I could not able to perform the first time config process.

Currently First Time Config process link is down, see the link below :

http://processors.wiki.ti.com/index.php/CC3000_First_Time_Configuration

Please send the detail docuement of it.

As of now when I am trying to perfom the First Time Config then it get stuck in while loop, see below :

while(ulSmartConfigFinished == 0)

{

}

ulsmartconfigfinished flag never get set.

to perform first time config I am doing following step :

1. Run the application on device

2. Create a Ad Hoc connection on Win 7 PC (See the attachement for connection detail)

3.when I start connection then host will never come out of while loop.

 

hert I am making connection name as per the docuementation :

prefix-lenght-TP-LINK_last 6 digit of MAC ID- 0

Before doing First time config  I have not created any user profile

Please let me know what needs to be done to complete the FIrst Time Config


 

  • I'm also facing the same problem nobody is replying in this forum...:-(

  • Hello Abhishek,

    Do you know what version of the CC3000 service patch you are currently using?  If you have the latest v1.10 service pack, then it does not run the First Time Config as it used to.  This functionality has changed and is called the Smart Config and runs differently.  The following link to explains the Smart Config:

    http://processors.wiki.ti.com/index.php/CC3000_Smart_Config

  •  Thanks for looking into it, there is few more update from my side in it :

    Earlier I had patch 1.7 on it, so I was trying to perform First TIme Config but due to lack of information available on web could not able to perform it.

    Now I sucessfully updated the patch with 1.10 on it and working on smart Config but it always get stuck after sending wlan_smart_config_start(0) command and wait forever for ulSmartConfigFinished to get Set:
    while(ulSmartConfigFinished  == 0)
    {}

    control will never come out of this loop.

    Do you know what could be the possible reason of it?


    Before calling to  wlan_smart_config_start(0), I already set the connection policy, set prefix and delete the profile as mentioned in sample code.

    I am using IPOD (smartconfig) to perform this, application is connected to Access Point already, see the attached JPEG file for access point configuration.

  • please update it, I am kind of stuck over here

  • Abhishek,

    Have you made sure that the CC3000 goes through the correct power up sequence?  What processor are you using, MSP430FRAM?

  • Hi Kelvin,

     

    Thanks for looking into it.

    Yes the power sequence is correct, I can able to query for patch version and mac address.

    Also if I will issue a connect command manually then I can see the CC3000 device MAC address in DHCP list of router.

    I am using a Dlink router with no encryption, my IPOD is connected to this router also.

    Let me know if you need more information on it. 

  • I forgot to mention processor name, it is MCF5253

  • The team is looking into this issue.

  • Thanks for giving an update.
    Awaiting for your further response

  • Hi Abhishek,

    I recommend starting from where ulSmartConfigFinished is set to 1 in cc3000.c and working your way backwards when debugging. The CC3000 handles events (including unsolicited ones when smart config is finished) using the hci_event_handler function. Does your application move into this function after smart config is started?

    Thanks,

    Keegan

  • Hey thanks for looking into this issue.

    I didnt get the meaning of starting from the poing ulSmartConfigFinished is set to 1, the problem is a flag. It is not getting set at all via calll back function means call back function is not getting invoked after sneding a wlan_smart_config_start(0) function.

    if I will skip the first step and remove the loop for not waiting to get ulSmartConfigFinished flag set then then control will never come out of wlan_smart_config_process API call.

    Here is my code for performing a smart configuration, see if you can figure out anything from the code :

     

    Do I need to make any special setting on router wo work with it?

    int initDriver(unsigned short patch)
    {
     
     ulCC3000DHCP = 0;
     
     ulCC3000Connected = 0;
     //ulSocket = 0;
     
     ulSmartConfigFinished=0;
     
     bEnableUnSolEvent = 0;
     
     wlan_init( CC3000_UsynchCallback,sendWLFWPatch, sendDriverPatch, sendBootLoaderPatch, ReadWlanInterruptPin, WlanInterruptEnable, WlanInterruptDisable, WriteWlanPin);

     wlan_start(patch);
     
     wlan_set_event_mask(HCI_EVNT_WLAN_KEEPALIVE/*|HCI_EVNT_WLAN_UNSOL_INIT*/|HCI_EVNT_WLAN_ASYNC_PING_REPORT);

     ucStopSmartConfig   = 0;
     
     bEnableUnSolEvent = 1;//To Call hci_unsolicited_event_handler() in every 500ms
     
     
    }

    void SmartConfig()
    {
     long lStatus = 0;
     
     char loop = 1;
     
     int loop_index = 0;
     
     char device_name[] = "CC3000";
     
     char smartconfigkey[] = "Charleston56";
     
     bEnableUnSolEvent = 0;
     
     if((lStatus = wlan_ioctl_set_connection_policy(0, 0, 0)) != 0)
      return;
         
     if((lStatus = wlan_ioctl_del_profile(255)) != 0)
      return;
     

     if((lStatus = wlan_first_time_config_set_prefix(aucCC3000_prefix)) != 0)
      return;
     
     
     if((lStatus = wlan_smart_config_start(0)) != 0)
      return;
     
     hci_unsolicited_event_handler();
     
     while (ulSmartConfigFinished == 0)
     {    
      hci_unsolicited_event_handler();
      
      MCF_GPIO_GPIO_OUT  ^= MCF_GPIO_GPIO_OUT_GPIO_OUT16;  //LG6 -WIFI LED  
      
      
     }
     
     
     
     if((lStatus = wlan_smart_config_process()) != 0)
       return;
     
     if((lStatus = wlan_ioctl_set_connection_policy(0, 0, 1)) != 0)
       return;

     wlan_stop();
     
     DEASSERT_CS();
     
     tx_thread_sleep(3000);
     
     wlan_start(0);
     
     while(loop)
     {
      if ((ucStopSmartConfig == 1) && (ulCC3000DHCP == 1))
      {
       while (loop_index < 3)
       {
        if((lStatus = mdnsAdvertiser(1,device_name,strlen(device_name))) != 0)
         return;
         
        loop_index++;
       }
        
          ucStopSmartConfig = 0;
          loop =0;
      }
     }
    }

    void CC3000_UsynchCallback(long lEventType, char * data, unsigned char length)
    {
     if (lEventType == HCI_EVNT_WLAN_ASYNC_SIMPLE_CONFIG_DONE)
     {
      ulSmartConfigFinished = 1;
      ucStopSmartConfig     = 1;
     }

     if (lEventType == HCI_EVNT_WLAN_UNSOL_CONNECT)
     {
      ulCC3000Connected = 1;
      
     }

     if (lEventType == HCI_EVNT_WLAN_UNSOL_DISCONNECT)
     {  
      ulCC3000Connected = 0;
         ulCC3000DHCP      = 0;
      ulCC3000DHCP_configured = 0;
      
     }
     if (lEventType == HCI_EVNT_WLAN_UNSOL_DHCP)
     {
       ulCC3000DHCP = 1;
     }
     if (lEventType == HCI_EVENT_CC3000_CAN_SHUT_DOWN)
     {
      OkToDoShutDown = 1;
     }
     
    }

    void main
    {
        
     init_spi();
           
     initDriver(0);
        
     SmartConfig();
        
        
        
    }

     

  • Hi Abhishek,

    Sorry if that was a little confusing, I simply meant to suggest that you dive a little deeper in debugging by checking what unsolicited events are received by your host micro. Ultimately, if you receive the correct unsolicited event (where event_type = HCI_EVNT_WLAN_ASYNC_SIMPLE_CONFIG_DONE), the ulSmartConfigFinished flag will be set.

    We should probably make sure your host is correctly receiving and interpreting events from the cc3000. For testing purposes, let's say you were to remove the HCI_EVNT_WLAN_KEEPALIVE mask, does your code correctly enter the hci_unsol_event_handler and identify the HCI_EVNT_WLAN_KEEPALIVE event_type? This should occur without initiating Smart Config.

     

    Hope this helps,

    Keegan

  • hey
    As you said, I remove the masking for HCI_EVENT_WLAN_KEEPALIVE and observed that keep alive event occurs only once after doing the initDriver(0).

    I am not sure about how many times it sholud come. To verify this I made changes in call back routine and in main code I just put the while(1) loop so that control will not go for further operation.

    See the attached code :

    int initDriver(unsigned short patch)
    {
    	
    	ulCC3000DHCP = 0;
    	
    	ulCC3000Connected = 0;
    	//ulSocket = 0;
    	
    	ulSmartConfigFinished=0;
    	
    	bEnableUnSolEvent = 0;
    	
    	wlan_init( CC3000_UsynchCallback,sendWLFWPatch, sendDriverPatch, sendBootLoaderPatch, ReadWlanInterruptPin, WlanInterruptEnable, WlanInterruptDisable, WriteWlanPin);
    
    	wlan_start(patch);
    	
    	wlan_set_event_mask(HCI_EVNT_WLAN_ASYNC_PING_REPORT);
    
    	ucStopSmartConfig   = 0;
    	
    	bEnableUnSolEvent = 1;//To Call hci_unsolicited_event_handler() in every 500ms
    	
    	
    }
    
    void SmartConfig()
    {
    	long lStatus = 0;
    	
    	char loop = 1;
    	
    	int loop_index = 0;
    	
    	char device_name[] = "CC3000";
    	
    	char smartconfigkey[] = "Charleston56";
    	
    	bEnableUnSolEvent = 0;
    	
    	if((lStatus = wlan_ioctl_set_connection_policy(0, 0, 0)) != 0)
    		return;
    					
    	if((lStatus = wlan_ioctl_del_profile(255)) != 0)
    		return;
    	
    
    	if((lStatus = wlan_first_time_config_set_prefix(aucCC3000_prefix)) != 0)
    		return;
    	
    	
    	if((lStatus = wlan_smart_config_start(0)) != 0)
    		return;
    	
    	hci_unsolicited_event_handler();
    	
    	while (ulSmartConfigFinished == 0)
    	{				
    		hci_unsolicited_event_handler();
    		
    		MCF_GPIO_GPIO_OUT  ^= MCF_GPIO_GPIO_OUT_GPIO_OUT16; 	//LG6 -WIFI LED		
    		
    		
    	}
    	
    	
    	
    	if((lStatus = wlan_smart_config_process()) != 0)
    			return;
    	
    	if((lStatus = wlan_ioctl_set_connection_policy(0, 0, 1)) != 0)
    			return;
    
    	wlan_stop();
    	
    	DEASSERT_CS();
    	
    	tx_thread_sleep(3000);
    	
    	wlan_start(0);
    	
    	while(loop)
    	{
    		if ((ucStopSmartConfig == 1) && (ulCC3000DHCP == 1))
    		{
    			while (loop_index < 3)
    			{
    				if((lStatus = mdnsAdvertiser(1,device_name,strlen(device_name))) != 0)
    					return;
    					
    				loop_index++;
    			}
    			  
    		    ucStopSmartConfig = 0;
    		    loop =0;
    		}
    	}
    }
    
    void CC3000_UsynchCallback(long lEventType, char * data, unsigned char length)
    {
    	if (lEventType == HCI_EVNT_WLAN_ASYNC_SIMPLE_CONFIG_DONE)
    	{
    		ulSmartConfigFinished = 1;
    		ucStopSmartConfig     = 1; 
    	}
    
    	if (lEventType == HCI_EVNT_WLAN_UNSOL_CONNECT)
    	{
    		ulCC3000Connected = 1;
    		
    	}
    
    	if (lEventType == HCI_EVNT_WLAN_UNSOL_DISCONNECT)
    	{		
    		ulCC3000Connected = 0;
    	    ulCC3000DHCP      = 0;
    		ulCC3000DHCP_configured = 0;
    		
    	}
    	if (lEventType == HCI_EVNT_WLAN_UNSOL_DHCP)
    	{
    			ulCC3000DHCP = 1;
    	}
    	if (lEventType == HCI_EVENT_CC3000_CAN_SHUT_DOWN)
    	{
    		OkToDoShutDown = 1;
    	}
    	void CC3000_UsynchCallback(long lEventType, char * data, unsigned char length)
    {
    	if (lEventType == HCI_EVNT_WLAN_ASYNC_SIMPLE_CONFIG_DONE)
    	{
    		ulSmartConfigFinished = 1;
    		ucStopSmartConfig     = 1; 
    	}
    
    	if (lEventType == HCI_EVNT_WLAN_UNSOL_CONNECT)
    	{
    		ulCC3000Connected = 1;
    		
    	}
    
    	if (lEventType == HCI_EVNT_WLAN_UNSOL_DISCONNECT)
    	{		
    		ulCC3000Connected = 0;
    	    ulCC3000DHCP      = 0;
    		ulCC3000DHCP_configured = 0;
    		
    	}
    	if (lEventType == HCI_EVNT_WLAN_UNSOL_DHCP)
    	{
    			ulCC3000DHCP = 1;
    	}
    	if (lEventType == HCI_EVENT_CC3000_CAN_SHUT_DOWN)
    	{
    		OkToDoShutDown = 1;
    	}
    	
    	if (lEventType == HCI_EVNT_WLAN_KEEPALIVE)
    	{
    		MCF_GPIO_GPIO1_OUT ^= MCF_GPIO_GPIO1_OUT_GPIO_OUT37;	//LG3 -J1708 LED
    	}
    	
    }
    	
    }
    
    void main
    {
    				
    	init_spi();
    							
    	initDriver(0);
    	
    	while(1)
    	{
    		tx_thread_sleep(100);
    	}
    				
    	SmartConfig();
    				
    				
    				
    }


    I addes following line in call back routine :

     if (lEventType == HCI_EVNT_WLAN_KEEPALIVE)
     {
      MCF_GPIO_GPIO1_OUT ^= MCF_GPIO_GPIO1_OUT_GPIO_OUT37; //LG3 -J1708 LED
     }
    So I can see the control only comes one to this location.

    Is it behaving correctly?

    or this unsol event should come continiously?

    Do you think I need to increase the rate of calling hci_unsolicited_event_handler(). instead 500ms I should call it in 100ms interval

  • Only once? That is unexpected.

    If you continue to call hci_unsolicited_event_handler(), you should continue to see the HCI_EVNT_WLAN_KEEPALIVE event type appear periodically. Are you seeing any other events types appear? I would recommend throwing a breakpoint at the switch-case statement within the hci_unsol_event_handler() function in evnt_handler.c and monitoring the event_type value.

    I do not think it will matter if you call the function at a quicker interval.

  • Still no luck, it will only comes one and never came back for unsolicited event routine

  • what should I do next to confirm weather Hardware is working fine.

    So far I have done following thing :

     

    1. Connect with router
    2. Create Socket
    3. Establish connection with the application running on PC(Connected to same router in which CC3000 is connected)  using TCP/IP
    4. Send Data from CC3000 to PC
    5. Recv works partially, it will work for some time and after that it stops receving data over TCP/IP....and till the time device receives data from PC, CC3000 respond for ping command issue from PC but once CC3000 stops receiving data then it will also stop responding for ping command, and it gets stuck in simplelinkwaitdata function.

    see if this info will help you to figure out the problem.

  • Your list of things you've done looks fine, and it sounds like you're briefly getting the right outcome from your code. It's unusual that the code gets stuck like that.

    A few questions that may help point you in the right direction:

    1) Do you know where in simplelinkwaitdata the code gets stuck?

    2) Are you still receiving data over SPI from the CC3000?

    3) Or is the data getting lost somewhere in the HCI?

     

  • As I said, Initially for few bytes(1- 100), sometime CC3000 receives 1 byte and then get stuck and sometime receives more then 100 bytes and then stuck, See the attached snap shot for the location the controller get stuck

    So it get the length information correctly but when it go for reading a data then it get hang an will never come out of the loop and infinitely look for

    tSLInformation.usEventOrDataReceived to get set in event_handler.c.

    So I am not sure waht needs to done to get it working, cause there is so many APIs are working but some of them are giving a problem :
    1. recv works partially
    2. Smart config is not working
    3. KeepAlive event is not occuring in regular interval.

    Suggest me what needs to done to trace the error.

    Also the time recv operation stuck after that i am not sending anything on SPI, do I need to check it?

    so if recv is hung somewhere then can I send a another command to CC3000 like getpatchversion to verify SPI is working fine?


  • Yes, the code is indeed stuck in SimpleLinkWaitData() - my question is regarding where that code is stuck. Looking at the SimpleLinkWaitData() function, you'll notice it calls hci_event_handler(). Where in hci_event_handler is this code getting stuck? It may give us a clue as to the cause for this erroneous behavior.

     

    Because the APIs are only sometimes having issues, I am lead to believe that this is an issue with the code port onto the host Freescale device, and not necessarily a CC3000 issue. I would recommend reading our CC3000 Host Programming Guide (http://processors.wiki.ti.com/index.php/CC3000_Host_Programming_Guide) to get a better understanding of how these APIs should interact with one another. This understanding will be key to figuring out what part of your ported code is not functioning correctly.

  • Oh ok I Will again check the porting of host driver in our source code and see if I can trace any possible  cause of this behaviour of CC3000 with our controller.

    But the only concern of mine is why it is behaving correctly for send API and some of the socket API , also I can able to delete the profile and can create the profile successfully.

    Please check at your end if anyone has seen the similar behaviour meanwhile I am looking into the porting guide again.

    Also I wanted to share one thing regarding spipausespi and spiresumespi.

    in the above function I am disabling and enabling the interrupt (WL_IRQ). Is there any problem in doing this?

    Also regarding the location at which controller is hanging while doing recv, as I already mention it is in hci_event_handler function, where code will check for tSLInformation.usEventorDataReceived to get set.
    but this flag is never getting set, so it will remain in while(1) loop.

  • Just a quick update on keepalive event, now it is coming continuously but once recv operation stops , keepalive event also stops working

  • hey I have a one quetion reegarding the router setting:

    Do I need to set a specifc SSID name of router to perform the SmartConfig?

    In our case we have only one unsecure netwrok with name "default" , so do I need to change the name of it to perform smartconfig..

  • Your SSID name does not matter, the default name should be okay. As an FYI, you can connect to WPA2-PSK secured networks using the "Password" box in smartconfig.

    EDIT: I'm not exactly sure of the effect of enabling/disabling the IRQ line repeatedly. However, I do not think we do this in any of our example code, I would try removing it. Disabling this IRQ disables the interrupt from the SPI.

  • Hi,

    I have two questions.

    1.
    I use MSP430FR5739 to updated CC3000 firmware last week.

    I use MSP430F5438 to link CC3000 now.

    When I do first time config in Basic Wi-Fi example code,It can’t work.  

    It is ok to do  first time config before I updated CC3000 firmware.

    How can I do?


    2.
    In my project, I need to use TCP protocol to send packet to server. I use  Basic Wi-Fi example code.
    I can use UDP protocol  to send now, but TCP can not work.
    In other post on e2e, someone have the same problem like me.
    He told me if use wlan_connect() function, the problem will happened.
    So I want to use wlan_add_profile() function to try.
    I don't know if I use  wlan_add_profile() ,Should  I need to use SmartConfig to change policy by use  wlan_ioctl_set_connection_policy () function?
    Could you give me step by step to do?

    I try this code, but it is not work.Should  I need to use SmartConfig ? But I can not use first time config  now.


     wlan_add_profile (WLAN_SEC_WPA2,"TP-LINK", 7, NULL, 0,0x18, x1e, 0x2, "sifra123", 8);
    wlan_ioctl_set_connection_policy (0,0,1);
    wlan_stop();
    __delay_cycles(600000);
    wlan_start(0);

    Thanks for your help

  • Hi Edward,

    Thanks for posting on the forums. Since the issues you are describing seem to be unrelated to the ones that have been discussed in this thread, would you mind starting a new thread? It will be easier for us to track that way.

    Thanks,

    Keegan