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.

CC3120: Port of CC3120 driver for STM32 + FreeRTOS

Part Number: CC3120
Other Parts Discussed in Thread: CC3100, SIMPLELINK-SDK-WIFI-PLUGIN,

Hello,

Could someone share the port of CC3120 driver SDK 2.40 for STM32 + FreeRTOS? (cc_pal.c, cc_pal.h)

Att,

  • Hi,

    There is no official port of the CC3120 host driver and you will need to port the CC3120 host driver yourself. I suggest you take the CC3100 host driver port from the CC3100 SDK and use it as a guide for porting the needed functions in cc_pal.h and cc_pal.h. The SPI functions as well as the nHib interrupt handler functionality can probably be taken from the CC3100 STM32 port without much modification.

    As for freeRTOS support, you can use the cc_pal.c/cc_pal.h of the MSP432 freeRTOS platform files in the SIMPLELINK-SDK-WIFI-PLUGIN as an example.

    I recommend that you take a look at those two sources as you work on your port. This E2E thread also has some discussion on STM32 + CC3120: https://e2e.ti.com/support/wireless-connectivity/wifi/f/968/t/695123

    Let me know if you run into issues porting the host driver, or have more specific questions on using the CC3120 with STM32.

    Regards,

    Michael

  • Hello,


    I am working on porting for STM32 + FreeRTOS. I made use of the Semaphore and Mutex examples in simplelink_cc32xx_sdk_3_20_00_06.

    However, I'm having a problem calling sl_Start

    I commented:
    SL_PLATFORM_MULTI_THREADED

    What does my process in
    _SlDrvWaitForInternalAsyncEvent
    Call
    SL_DRV_SYNC_OBJ_WAIT_FOREVER

    Who calls (where I get stuck):
    _SlDrvSyncObjWaitForever

    After calling sl_SyncObjWait (pSyncObj, SL_OS_WAIT_FOREVER);

    PS: SL_OS_WAIT_FOREVER = NONOS_WAIT_FOREVER = ~ (0UL)

    What can I do wrong?

    My user.h4011.user.h

  • PS:

    I am developing with a CC3120BOOST connected with STM32F4 via SPI.
  • Hi,


    The SL_PLATFORM_MULTI_THREADED define should be declared and uncommented for CC3120 host driver implementations on devices running an RTOS. What happens if you uncomment that define?

    Also, if you are using an RTOS and running the CC3120 host driver in multithreaded mode, you should ensure that your program is creating a thread that runs sl_Task(). See one of the RTOS-enabled demos in the CC3120 wi-fi plugin for an example. Without that sl_Task() thread, you will not be able to process asynchronous events from the CC3120 including the ones needed for sl_Start().

    Regards,

    Michael

  • I uncomment SL_PLATFORM_MULTI_THREADED and add this function:

    int pthread_self(void)
    {
        TaskHandle_t task;
        int    thread;

        task = xTaskGetCurrentTaskHandle();
        thread = (int)xTaskGetApplicationTaskTag(task);

        return (thread);
    }


    I created one task for sl_Task and another for sl_Start.

    osThreadNew(sl_Task, NULL, &sl_Task_attributes); /* The CMSIS-RTOS */

    osThreadNew(main_task, NULL, &main_attributes); /* The CMSIS-RTOS */

    But the routine gets stuck in:


    void SemaphoreP_post(SemaphoreP_Handle handle)
    {
        LOG("trying SemaphoreP_post\r\n");
        xSemaphoreGive((SemaphoreHandle_t)handle);
        LOG("xSemaphoreGive\r\n");
    }


    What can cause this?

  • Hi,

    For porting the RTOS functions needed such as the sem_post() function, in general you will need to investigate and debug that on your own since we do not support FreeRTOS nor STM32 platform directly as they are not TI products.

    However, for your case I suspect that the error you are seeing is simply due to how the FreeRTOS semaphore API requires you to use a different set of functions if you are running in an ISR context. For example, instead of xSemaphoreGive() you have xSemaphoreGiveFromISR(). I suggest you take a look at the implementation of those porting layer functions in \kernel\freertos\dpl\ of the SimpleLink SDK for a guide on how you want to implement them.

    Regards,

    Michael

  • Hi Michael,

    The problem was exactly what you mentioned, thank you very much.