• Resolved

Code hanging at "establishConnectionWithAP(); "

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?

  • In reply to Lenio Cacula:

    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

  • In reply to Kas Lewis:

    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?

  • In reply to Lenio Cacula:

    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

  • In reply to Kas Lewis:

    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

  • In reply to Lenio Cacula:

    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.

  • In reply to Kas Lewis:

    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).

  • In reply to Lenio Cacula:

    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

  • In reply to Kas Lewis:

    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? 

  • In reply to Lenio Cacula:

    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