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.