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.

How to implement the SimpleLink Asynchronous Event Handlers?

Other Parts Discussed in Thread: CC3200

Hi everyone,

I'm starting with the RTOS and the CC3200, so I'm working on the FreeRTOS example and the TCP socket example, I'm trying to combinate both of them, in one task I'll have the TCP functions and in another one I'll have the communication with the UART, untill now I'm having a problem connecting the CC3200 with the AP and after reading a lot of posts I see that is because I need an Asynchronous Event Handler, but is not clear for me how I can implement that, so if you could explain it to me or tell me where is the information to do it I'll be very thankful.

The part of the code where I'm getting stuck is:

/* Wait */
    while((!IS_CONNECTED(g_ulStatus)) || (!IS_IP_ACQUIRED(g_ulStatus)))
    {
        // Wait for WLAN Event
#ifndef SL_PLATFORM_MULTI_THREADED
        _SlNonOsMainLoopTask();
#endif

    }

Is in the part of the funciton WlanConnect()

Regards,

Juan

  • Hi Juan,

    The async event handlers are callback functions from the Simplelink library, namely

    • SimpleLinkWlanEventHandler
    • SimpleLinkNetAppEventHandler
    • SimpleLinkHttpServerCallback
    • SimpleLinkGeneralEventHandler
    • SimpleLinkSockEventHandler

    The names can be found in the user.h file.

    In the example code you provided, the loop is simply checking the g_ulStatus variable and making sure the device is connected and have and IP address acquired before proceeding further. This variable is modified by the SimpleLinkWlanEventHandler() and SimpleLinkNetAppEventHandler() functions to set connection status and IP address status, accordingly.

    If you are using OS, the _SlNonOsMainLoopTask() function can simply be ignored.

    Please refer to the programmers guide from our CC31xx/CC32xx Wiki for more information: processors.wiki.ti.com/index.php

  • Hi Victor

    I've been readign a little bit more and I solve my problem by myself, I found that if you are using a RTOS you just can simply ignored _SlNonOsMainLoopTask(), if that fuction is there is because the example is configured to not use RTOS and if you want to use it you have to make a few thinks.

    In my case I use IAR and you have to do this settings in the options of the project:

    1. In the preprocessor part in C/C++ Compiler I had to write the two defines in the red square.


    2. Then in the Linker option I had to put the direction of the simplelink library made for OS and the RTOS to use

    3. Finally in the code I had to put these lines in the main before call any of the simplelink functions

    lRetVal = VStartSimpleLinkSpawnTask(SPAWN_TASK_PRIORITY);
        if(lRetVal < 0)
        {
            ERR_PRINT(lRetVal);
            LOOP_FOREVER();
        }

    This create a Task that will take care of the asynchronous events

    With this I solve my problem and the CC3200 finally conects to the AP.

    Anyway, Victor thanks for your answer, I think the information in the link will work in the future.

    Regards,

    Juan.