SWRA704 June   2021 CC3120 , CC3130 , CC3135

 

  1.   Trademarks
  2. 1Introduction
  3. 2Porting the Host Driver
    1. 2.1 Porting Layer Files
    2. 2.2 Driver Enable/Disable
    3. 2.3 SPI Interface
      1. 2.3.1 Hardware Setup and Configuring Clocks
    4. 2.4 Memory Management
    5. 2.5 OS Abstraction: FreeRTOS
    6. 2.6 Timestamp Mechanism
    7. 2.7 Asynchronous Event Handler Routines
  4. 3Tips for Porting
    1. 3.1 Hardware Setup
    2. 3.2 Servicepack
    3. 3.3 Starting the Wi-Fi Driver in the Application Code
    4. 3.4 Configuring Clocks on the STM32L4
    5. 3.5 Terminal I/O Printing
    6. 3.6 Location of the Host Driver and Porting Files
    7. 3.7 Updating to the Latest Host Driver Version
  5. 4References
  6. 5License Information

Starting the Wi-Fi Driver in the Application Code

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.