SWRA704 June 2021 CC3120 , CC3130 , CC3135
There are a few things that must be done in the host MCU application before it can successfully start the CC31xx device. In a RTOS environment, the host driver requires that the application create a spawn contect called sl_Task. This thread serves the asynchronous requests from the network processor, and it should be a high enough priority in the system to handle networking events. For platforms without an OS, the application must call the sl_Task function repeatedly from its main loop.
Example of a main function:
/* Customize sl_Task priority and stack size for your application */
#define sl_PRIORITY ( tskIDLE_PRIORITY + 2UL )
#define sl_STACK_SIZE 768 /* FreeRTOS stack size is specified in words */
int main(void) {
BaseType_t xStatus;
/* STM32L4xx HAL library initialization */
HAL_Init();
/* Configure the system clock */
SystemClock_Config();
/* Start sl_Task thread */
xStatus = xTaskCreate( (TaskFunction_t)sl_Task, "sl_Task", sl_STACK_SIZE, NULL, sl_PRIORITY, NULL);
if (xStatus != pdPASS)
{
printf("\n Unable to create sl_Task\r\n");
}
/* Other application threads can be started here too */
/* Start the RTOS scheduler */
vTaskStartScheduler();
}
After creating the sl_Task thread and starting the RTOS scheduler, the application can call sl_Start(0,0,0) to start the network processor and begin using the Wi-Fi APIs.