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.

Code hanging at "establishConnectionWithAP(); "

Other Parts Discussed in Thread: CC3100, CC3200, CC31XXEMUBOOST, MSP430F5529, CC3100BOOST

I have been trying to my code to connect to an AP but after much debugging and thinking it was the exra code added in I see the code is in fact hanging at establishConnectionWithAP(); is there something I am missing in my code. Any help would be appreciated.

Thanks 

Kas

P.S.  My full code (ll functions can be found in this post but the "main" that I am using is included below

/*
 * Application's entry point
 */

int main(void)
{
	INT32 retVal = -1;

	retVal = initializeAppVariables();
	ASSERT_ON_ERROR(__LINE__, retVal);

    /* Stop WDT and initialize the system-clock of the MCU
       These functions needs to be implemented in PAL */
    stopWDT();
    initClk();

    /* Configure command line interface */
    CLI_Configure();
    CLI_Write("\r\n\r\n\r\n\r\n\r\n\r\n");
	//Initialise I2C
//	I2CInit();
	//Initialise I2C
//	mpl3115aInit();

    displayBanner();
    /*
	 * Following function configures the device to default state by cleaning
	 * the persistent settings stored in NVMEM (viz. connection profiles &
	 * policies, power policy etc)
	 *
	 * Applications may choose to skip this step if the developer is sure
	 * that the device is in its default state at start of application
	 *
	 * Note that all profiles and persistent settings that were done on the
	 * device will be lost
	 */
	retVal = configureSimpleLinkToDefaultState();
	if(retVal < 0)
	{
		if (DEVICE_NOT_IN_STATION_MODE == retVal)
		{
			CLI_Write(" Failed to configure the device in its default state \n\r");
		}

		LOOP_FOREVER(__LINE__);
	}

	CLI_Write(" Device is configured in default state \n\r");

    /*
     * Assumption is that the device is configured in station mode already
     * and it is in its default state
     */
    /* Initializing the CC3100 device */
    retVal = sl_Start(0, 0, 0);
    if ((retVal < 0) ||
        (ROLE_STA != retVal) )
    {
        CLI_Write(" Failed to start the device \n\r");
        LOOP_FOREVER(__LINE__);
    }

    CLI_Write(" Device started as STATION \n\r");

    CLI_Write(" Location C \n\r");
    /* Connecting to WLAN AP - Set with static parameters defined at the top
	After this call we will be connected and have IP address */
	retVal = establishConnectionWithAP();
	if(retVal < 0)
   	{
		CLI_Write(" Failed to establish connection w/ an AP \n\r");
   		LOOP_FOREVER(__LINE__);
   	}

	CLI_Write(" Connection established w/ AP and IP is acquired \n\r");
    CLI_Write(" Location D \n\r");
    /*Before proceeding, please make sure to have a server waiting on PORT_NUM*/

  • Usual suspects:

    1. Is the SSID, password, and security type properly setup?

    2. Have you changed the connection policy? Is DHCP enabled?

    3. Is this for CC3200 or CC3100? Is the Launchpad or boosterpack properly setup? Have you followed the getting-started guide?

  • Hello Lenio, 

     

    I have checked all those things and they are all correct. TO better describe my issue I would say something is flaky, that is it works and then it suddenly stops then I can't get anything to happen. After writing this post it started working, connecting to an AP but now it won't connect anymore. When I pause the debugger I see that it appears to have jumped somewhere in memory and is now in an infinite loop Picture below.

    I have tried to clean, build and reprogram. I have tried code that I 100% know works from previously. I'm not sure what else there is to try, is there maybe a firmware update for the CC3100 or something, or away to test it with the CC31XXEMUBOOST I am really running out of options with the CC3100.

    Thanks

    Kas

  • Certainly. You can test the CC3100 as an access point so you can eliminate possible issues with the radio. Follow the steps of this link:

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

    How busy is the access point you are testing? Could the connection get dropped for too many collisions?

  • I do not believe the access point is very busy, I have tested it with another device and it has no issue connecting. Also I have had this issue of not connecting in two locations with two completely different APs. I will try test with the CC31XXEMUBOOST when I get home this evening. Is there any other reason why code should be working and them seemingly randomly stop working. Also what is with the disassembly, that location appears to be in the middle of nothing and then appears to call back on itself.

     

    Kas

  • I have included the last few assembly instructions that are executed before going into the infinite loop.

    1)

    2)

    3) After reaching this point the program is in a infinite loop why it jumped to this location in the first lace I am still not sure.

    Thanks

    Kas

  • Hello Lenio, 

    I have stepped through the code one assembly instruction at a time and it is clear  the code is getting sent off somewhere randomly. If I step through the code one instruction at a time and go into every function the code will continue to play through. However if I stop going into each function and choose to step over that is when the code gets into an infinite loop.

    I have linked two youtube videos of me stepping through the code so that you can clearly see what it is I am talking about. The videos can be found HERE and HERE.

  • Kas,

    have you followed the steps of this wiki:

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

    Notice how you need to change the IP address to something available in the AP (this is not running DHCP as I suggested previously).

  • Hello Lenio, 

    I have had this working before, the code WAS running. It connected to the AP, Connected to the TCP server on my PC and sent packets across. I am there 100% sure the code I have generated and used is working. Why the code has suddenly decided to STOP I do not know. 

    Again I have tested it now with code that was 100% working yesterday (went back to that version of the code) and the code NO LONGER works. This can NOT be a IP address issue or anything else that needs to be set locally, if it worked yesterday it should work today. I would appreciate if you took a look at the videos I attached so that what I am talking about can be understood. Note how stepping into a function does not cause an issue however, stepping over a function causes the CC3100 to die (this clearer in the second video where I do NOT use hot keys but rather the mouse).

    Thanks

    Kas

  • Kas,

    I have watched the videos repeatedly, but could not get to a conclusion. I have also run the example in my setup to make sure our latest SDK is working properly - indeed it is.

    I hesitate to make the suggestion of reinstalling the SDK, but sometimes a fresh start fixes some of those inexplicable problems. It could be that in the debug process one or more files got inadvertently corrupted. That is a long shot, but not at all impossible. By the way, what is the CCS and SDK versions you are running? 

  • Hi Kas,

    Can you please give a bit more information on your setup?
    which host processor are you using?
    What is the CC3100 BP revision? SDK version?

    In addition, can you please check the stack size that is configured in your CCS environment? maybe it is too small and your are getting into stack overflow situations.

    Thanks,
    Alon

  • Hello Lenio, 

    I Tried reinstalling just the SDK and that seemed to cause a linker issue. I then tried reinstalling CCS and the SDK and that allowed the TCP_Socket example to run. I am now trying the same thing at work (the previous test was at home) to see if this resolves eh issues and if it will then allow me to run my code without issues. 

    The SDK and service pack versions are 0.5.2, the CCS version is 6.0.1.00040. I will let you know how the testing goes once I have completed the re-install of the above mentioned software.

    Thanks

    Kas

  • Hello Alon, 

    I am using a MSP430F5529 Launchpad that is connected to a CC3100BOOST boosterpack. Also connected to the system is a Freescale Xtrinsic sensor board this is for pressure and temperature measurements. The sensor is connected to P4.1 & P4.2 (SDA & SCL respectively) . 

    The CC3100BOOST is revision 3.1 using SDK and service pack versions 0.5.2. I am using CCS 6.0.1.00040. As for the Stack size I am using the default that the TCP_Socket demo code is set to use, when I am finished reinstalling everything I will add those numbers here. I will say that the code has run before with no issue and after running it a few times it started hanging at this point.

    Added Later: Stack & heap information.

    Kas

    PS Other CC3100BOOST info:

  • Hello Lenio, 

    After uninstalling CCS and the SDK and then reinstalling everything (used CCleaner to remove any rogue registry keys etc.) I am now back up and running. 

    Thank you for the help.

    Kas

    UPDATE: I did have further issues but I retested with CC3100BOOST REV3.3 which has a newer FW and the issues seemed to be MUCH less. I am now attempting to update my Rev 3.1 FW to a newer revision and hopefully that will resolve things.

  • Hello Lenio, 

    Unfortunately I am back to square one. I was able to run my code once maybe twice. The TCP_Socket code ran a few times as well but now I am back to the same issues as before... It's not really an option to keep reinstalling everything between every change in the code. Do you have any further suggestions.

    Kas

  • Hello Alon, 

    I know this thread had been marked answered but it appears that that that is not so, therefore if you have any further suggestions I would be happy to try them out.

    Kas

  • Kas,

    another idea would be to erase any existing profiles from the device. Please follow the instructions of this link and select erase all profiles under the setup tab:

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

  • Hello Lenio, 

    Thank you for all the help, the issue appears to be resolved now.

    Thank you very much 

    Kas