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.

MSP432E401Y: FreeRTOS for MSP432

Part Number: MSP432E401Y
Other Parts Discussed in Thread: SYSCONFIG,

Tool/software:

Hello Team,

I wanted to implement FreeRTOS to my existing project which is developed with the driverlib(C:\simplelink_msp432e4_sdk_4_20_00_12__win\simplelink_msp432e4_sdk_4_20_00_12\source\ti\drivers and not with TI drivers given for RTOS.

I seearched multiple examples from TI resource explorer but all are having examples created with sysconfig and RTOS.

Is there any examples for FreeRTOS implementation done with driverlib?(please share if yes, it will be really helpful) Or is it a limitation that we can use TI drivers only for RTOS?

Thanks in advance

  • Hi Monica,

      Normally, you would find four versions for the same example. For example, in the below timerled example, there are freetos_ccs, freertos_gcc, tirtos_ccs and tirtos_gcc. This is true for all other examples. 

  • Hello Charles,

    I tried importing and building the above mentioned projects.

    While building timerled_MSP_EXP432E401Y_freertos_ccs, i'm getting following errors in below image. This is happening for all Freertos based projects from TI explorer.

    Also if you see the Debug/syscfg folder in the above screenshot of both the projects, obj files, .c , .h files are also missing in the FreeRTOS project

  • Why don't you try importing the projects from CCS instead of using Resource Explorer. See below. 

    After importing, I simply build the project and I have no problem. I use CCS12.

    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    **** Build of configuration Debug for project timerled_MSP_EXP432E401Y_freertos_ccs ****
    "C:\\ti\\ccs1260\\ccs\\utils\\bin\\gmake" -k -j 8 all -O
    Building file: "../timerled.syscfg"
    Invoking: SysConfig
    "C:/ti/sysconfig_1.5.0/sysconfig_cli.bat" --script "C:/Users/a0321879/Documents/CCS/MSP432E/My CCS12 MSP432E4 LaunchPad/timerled_MSP_EXP432E401Y_freertos_ccs/timerled.syscfg" -o "syscfg" -s "C:/ti/simplelink_msp432e4_sdk_4_20_00_12/.metadata/product.json" --compiler ccs
    Running script...
    Validating...
    Generating Code (timerled.syscfg)...
    '/ti/drivers' -> '/ti/devices/driverlib'
    Writing C:\Users\a0321879\Documents\CCS\MSP432E\My CCS12 MSP432E4 LaunchPad\timerled_MSP_EXP432E401Y_freertos_ccs\Debug\syscfg\ti_drivers_config.c...
    Writing C:\Users\a0321879\Documents\CCS\MSP432E\My CCS12 MSP432E4 LaunchPad\timerled_MSP_EXP432E401Y_freertos_ccs\Debug\syscfg\ti_drivers_config.h...
    Writing C:\Users\a0321879\Documents\CCS\MSP432E\My CCS12 MSP432E4 LaunchPad\timerled_MSP_EXP432E401Y_freertos_ccs\Debug\syscfg\ti_utils_build_linker.cmd.exp...
    Writing C:\Users\a0321879\Documents\CCS\MSP432E\My CCS12 MSP432E4 LaunchPad\timerled_MSP_EXP432E401Y_freertos_ccs\Debug\syscfg\syscfg_c.rov.xs...
    Finished building: "../timerled.syscfg"
    Building file: "../main_freertos.c"
    Invoking: Arm Compiler
    "C:/ti/ccs1260/ccs/tools/compiler/ti-cgt-arm_20.2.7.LTS/bin/armcl" -mv7M4 --code_state=16 --float_support=FPv4SPD16 -me --include_path="C:/Users/a0321879/Documents/CCS/MSP432E/My CCS12 MSP432E4 LaunchPad/timerled_MSP_EXP432E401Y_freertos_ccs" --include_path="C:/Users/a0321879/Documents/CCS/MSP432E/My CCS12 MSP432E4 LaunchPad/timerled_MSP_EXP432E401Y_freertos_ccs/Debug" --include_path="C:/ti/simplelink_msp432e4_sdk_4_20_00_12/source" --include_path="C:/ti/simplelink_msp432e4_sdk_4_20_00_12/source/third_party/CMSIS/Include" --include_path="C:/ti/simplelink_msp432e4_sdk_4_20_00_12/source/ti/posix/ccs" --include_path="C:/ti/TivaWare_C_Series-2.2.0.295/third_party/FreeRTOS/Source/include" --include_path="C:/ti/TivaWare_C_Series-2.2.0.295/third_party/FreeRTOS/Source/portable/CCS/ARM_CM4F" --include_path="C:/Users/a0321879/Documents/CCS/MSP432E/My CCS12 MSP432E4 LaunchPad/freertos_builds_MSP_EXP432E401Y_release_ccs" --include_path="C:/ti/ccs1260/ccs/tools/compiler/ti-cgt-arm_20.2.7.LTS/include" --advice:power=none -g --diag_warning=225 --diag_warning=255 --diag_wrap=off --display_error_number --gen_func_subsections=on --preproc_with_compile --preproc_dependency="main_freertos.d_raw" --include_path="C:/Users/a0321879/Documents/CCS/MSP432E/My CCS12 MSP432E4 LaunchPad/timerled_MSP_EXP432E401Y_freertos_ccs/Debug/syscfg" "../main_freertos.c"
    Finished building: "../main_freertos.c"
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

  • Hello Charles,

    Why don't you try importing the projects from CCS instead of using Resource Explorer. See below. 

    I'm importing it in the same way and also tried to import from TI resouce explorer both didn't work.

    But now its working fine, it was due to the FreeRTOS include path.

    One more clarification,

    In MSP432 Simplelink SDK, there are two different driver APIs.

    one is Driverlib specific to MSP432E in C:\ti\simplelink_msp432e4_sdk_4_20_00_12__win\simplelink_msp432e4_sdk_4_20_00_12\source\ti\devices\msp432e4\driverlib This is the driver i'm currently using.

    other is TI driver in C:\ti\simplelink_msp432e4_sdk_4_20_00_12__win\simplelink_msp432e4_sdk_4_20_00_12\source\ti\drivers

    I modified the empty_MSP_EXP432E401Y_freertos_ccs from threads to basic tasks of LED toggling which is in the TI driver format. This worked.

    But i wanted to run RTOS with the MSP432E Driverlib, so in empty_MSP_EXP432E401Y_nortos_ccs project, i pasted the code that worked in empty_MSP_EXP432E401Y_freertos_ccs and modified it to  MSP432 driverlib.

    While running the code, it is getting stuck in a default handler after the line vTaskStartScheduler();

    /* This is the code that gets called when the processor receives an unexpected  */
    /* interrupt.  This simply enters an infinite loop, preserving the system state */
    /* for examination by a debugger.                                               */
    void Default_Handler(void)
    {
        /* Fault trap exempt from ULP advisor */
        #ifdef __TI_ARM__
            #pragma diag_push
            #pragma CHECK_ULP("-2.1")
        #endif

        /* Enter an infinite loop. */
        while(1)
        {
        }

        #ifdef __TI_ARM__
            #pragma diag_pop
        #endif
    }

    Attaching the code for your reference.

    /* Standard Includes */
    #include <stdint.h>

    #include <FreeRTOS.h>
    #include <task.h>
    #include <ti/devices/msp432e4/driverlib/driverlib.h>
    /* Stack size in words (not bytes) */
    #define TASKSTACKSIZE   1024

    /* Function prototypes for the tasks */
    void vTaskBlinkLED1(void *pvParameters);
    void vTaskBlinkLED2(void *pvParameters);
    uint32_t sysClock;
    /*
     *  ======== main ========
     */
    int main(void)
    {
        /* Initialize the system */
        sysClock = MAP_SysCtlClockFreqSet((SYSCTL_XTAL_25MHZ |
                        SYSCTL_OSC_MAIN | SYSCTL_USE_PLL |
                        SYSCTL_CFG_VCO_480), 120000000);
        /* Enable the GPIO port that is used for the on-board LED */
            MAP_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPION);

            /* Check if the peripheral access is enabled */
            while(!MAP_SysCtlPeripheralReady(SYSCTL_PERIPH_GPION))
            {
            }
            MAP_GPIOPinTypeGPIOOutput(GPIO_PORTN_BASE, GPIO_PIN_0|GPIO_PIN_1);
           /* Configure the LED pin */
            MAP_GPIOPinWrite(GPIO_PORTN_BASE, GPIO_PIN_0, ~(GPIO_PIN_0));
            MAP_GPIOPinWrite(GPIO_PORTN_BASE, GPIO_PIN_1, ~(GPIO_PIN_1));
        /* Create the two LED blink tasks */
        xTaskCreate(vTaskBlinkLED1, "BlinkLED1", TASKSTACKSIZE, NULL, 1, NULL);
        xTaskCreate(vTaskBlinkLED2, "BlinkLED2", TASKSTACKSIZE, NULL, 2, NULL);

        /* Start the FreeRTOS scheduler */
        vTaskStartScheduler();

        /* Will only reach here if there is insufficient memory to create the idle task */
      while(1)
      {

      }
    }

    /* Task 1: Blink LED 1 */
    void vTaskBlinkLED1(void *pvParameters)
    {
        while (1) {

            MAP_GPIOPinWrite(GPIO_PORTN_BASE, GPIO_PIN_0, (GPIO_PIN_0));
            vTaskDelay(pdMS_TO_TICKS(500)); // Delay for 500 ms

            MAP_GPIOPinWrite(GPIO_PORTN_BASE, GPIO_PIN_0, ~(GPIO_PIN_0));
            vTaskDelay(pdMS_TO_TICKS(500)); // Delay for 500 ms
        }
    }

    /* Task 2: Blink LED 2 */
    void vTaskBlinkLED2(void *pvParameters)
    {
        while (1) {

            MAP_GPIOPinWrite(GPIO_PORTN_BASE, GPIO_PIN_1, (GPIO_PIN_1));
            vTaskDelay(pdMS_TO_TICKS(1000)); // Delay for 500 ms

            MAP_GPIOPinWrite(GPIO_PORTN_BASE, GPIO_PIN_1, ~(GPIO_PIN_1));
            vTaskDelay(pdMS_TO_TICKS(1000)); // Delay for 500 ms
        }
    }

    I find everything fine and really don't understand, what could be the reason.

  • C:\ti\simplelink_msp432e4_sdk_4_20_00_12__win\simplelink_msp432e4_sdk_4_20_00_12\source\ti\devices\msp432e4\driverlib This is the driver i'm currently using.

    other is TI driver in C:\ti\simplelink_msp432e4_sdk_4_20_00_12__win\simplelink_msp432e4_sdk_4_20_00_12\source\ti\drivers

    The driverlib is the lowest peripheral driver library that is specific to MSP432E MCU. the ti/drivers are SimpleLink SDK drivers that are common to all TI MCU/MPU products. Using ti/drivers allows easy migration from one TI product to another. The ti/drivers will eventually call the driverlib. For non-RTOS projects, you would use driverlib. For RTOS-based projects, you would use ti/drivers although you could also directly call driverlib if ti/drivers do not support a  specific feature you are looking for. For example, the ti/drivers will not support some of the advanced QSSI features such as Quad-Mode or Advance-Hold. In this case, if you want to use these features you will need to use driverlib directly.

    But i wanted to run RTOS with the MSP432E Driverlib, so in empty_MSP_EXP432E401Y_nortos_ccs project, i pasted the code that worked in empty_MSP_EXP432E401Y_freertos_ccs and modified it to  MSP432 driverlib.

    As explained above, you can run RTOS with the driverlib. I will suggest you start with a freeRTOS or a TI-RTOS project. First make sure it works then add code that uses driverlib functions.  Here you said you start with a non-RTOS project and then you add the RTOS code into it. I don't think it is the right way. A RTOS project will create generated code based on the .sysconfig that is not happening on a non-RTOS project. 

  • Hello Charles,

    Thanks for the suggestion, it worked.

    Now i'm trying to integrate the firmware i developed without RTOS. It is getting stuck in lwip init.

    In lwiplib.h i could see some options to create task for ethernet inits and lwIPInterruptTask as well, but not sure how to use that.

    Can you please tell how to use FreeRTOS with ethernet lwip UDP in MSP432E401Y?

    It should be great if there is any example code with lwip and FreeRTOS, Please share if any...

    Thanks in advance.

  • lwip supports sequential and BSD socket-based style APIs with RTOS. Using RAW APIs is also possible with RTOS. Refer to the below lwIP website for details. We don't have examples for lwIP with FreeRTOS. The examples we have are bare-metal using lwIP's RAW APIs only. 

    https://www.nongnu.org/lwip/2_1_x/group__lwip__os.html

    There is a FreeRTOS forum that has discussion about lwIP integration. 

    https://forums.freertos.org/t/lwip-using-freertos/17339