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.

CCS/LAUNCHCC3220MODASF: Best way to switch between two different use cases in the CC3220 power measurement example

Part Number: LAUNCHCC3220MODASF

Tool/software: Code Composer Studio

Hello,

I'm implementing a simple firmware based on the CC3220 power measurement example. My need is to transmit a few RAW packets every 1 minute in "transceiver mode". I implemented this task simply by removing the starting banner selection on the example and by forcing the use-case to the "transceiver use-case" one. On course, the firmware works fine.

However, somewhat I also need to transmit a few packets in a connected way (for instance intermittently connected), if my device is externally awakened (i.e. through GPIO).

So, the implemented GPIO interrupt routine works fine as well, but I have a trouble/question in switching between the use cases. In particular, the first-time configuration of the intermittently connected mode is not well-performed under/after the transceiver routine. Indeed, after configuring the launching the wlanconnect() function with success, I have the error -2018 related to the socket ID. And somewhat other errors.

So, please, how could I switch between the two different use cases (transceiver and Intermittently connected and vice-versa) in a correct way? Which is the good practice to switch between the two operating modes without errors?

I the restart of the MCU mandatory?

This is one of my tentative wrong solutions when a GPIO interrupt occur:

GPIO INTERRUPT

{

/* clear SimpleLink Status */

   PowerMeasure_CB.slStatus = 0;

 

   ClockP_Params_init(&lpdsParams);

   PowerMeasure_lpdsHandle = ClockP_create((ClockP_Fxn)&powerMeasureDoNothing, 0 , &lpdsParams);

 

 

       PowerMeasure_appData.useCase = UseCase_IntermittentlyConnected;     //forced use-case instead of using setUseCase()

 

 

         /* configure device to the selected use-case */

         status = configSimplelinkToUseCase();

       // UART_PRINT("Device Configured to the selected Power Management use case.\n\r");   //R

 

        

         /* Connect To AP for first time, connected use cases only */

         if( PowerMeasure_appData.useCase == UseCase_IntermittentlyConnected)

         {

             status = sl_Start(0,0,0);

             status = wlanConnect();

           /* Stay connected if the use case is always connected */

             if (PowerMeasure_appData.useCase == UseCase_IntermittentlyConnected)

             {

                 status = sl_Stop(SL_STOP_TIMEOUT);

             }

         }

       // startMeasureBanner();

   }

 

               UART_PRINT("Intermittently Connecting...\n\r");

               intermittentlyConnected();

}

 

Thank you.

  • Hi Riccardo,

    If you are waking up from sleep the device may have not fully initialized yet and generally it is not a good idea to have long interrupt routine. It would be better to post a semaphore in your GPIO application that would run the routine you are running and have a task to handle the changes between both use cases and the specific behavior you're looking for. 

    The error you are getting means the device has not been started yet. So if you still get this issue when handling this in a task try adding a delay to make sure the device has time to initialize everything again after wake up.

    Jesu