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.

FreeRTOS on TMDSRM48USB

Other Parts Discussed in Thread: HALCOGEN

Hello,

I am using TMDSRM48USB stick. I have quite good theoretical idea regarding FreeRTOS.
What I really want to do is:
1. At every 1 second I need ADC values of accelerometer X, Y, Z axis values.
2. At every 2 seconds need ADC values from light sensor.

I am able to do above task without using FreeRTOS.
I am learning FreeRTOS newly.  So now I want to implement  above task using FreeRTOS.
Can anyone guide me, how can I proceed ? 

  • Hi Ankush,
    i will suggest you start with the HalCoGen FeeRTOS example. In HalCoGen go to Help->Help Topics -> Examples, you will find example_freeRTOSBlinky.c Click on it, it will show you how to configure the HalCoGen to get a working FreeRTOS project. You can then later adapt your application to it.
  • Hi Ankush,
    Do you have more questions on the HalCoGen FreeRTOS Blinky example? If you question is answered can you please click the Verify Answer button? Thanks.
  • RE: FreeRTOS on TMDSRM48USB

    Hello,

    I created 12 tasks which are just to blink all the LED's including RGB on RM48USb stick using the sample program.
    I was successful till 10 tasks. As soon as I create 11th task, the program pass through vTaskStartScheduler(); function and stays at while(1).
    How ever if I am creating 12 tasks, I am not able to get pdTRUE for 12th process. Thus the 12th process is not able to create at all.
    Is there any limit on maximum number of tasks we can create ? Please have a look at my code

    */

    /* USER CODE BEGIN (0) */
    /* USER CODE END */

    /* Include Files */

    #include "sys_common.h"
    #include "system.h"

    /* USER CODE BEGIN (1) */
    /* Include FreeRTOS scheduler files */
    #include "FreeRTOS.h"
    #include "os_task.h"

    /* Include HET header file - types, definitions and function declarations for system driver */
    #include "het.h"
    #include "gio.h"

    /* Define Task Handles */
    xTaskHandle xTask1Handle_1,xTask1Handle_2,xTask1Handle_3,xTask1Handle_4,xTask1Handle_5,xTask1Handle_6,xTask1Handle_7,xTask1Handle_8,xTask1Handle_9,xTask1Handle_10,xTask1Handle_11, xTask1Handle_12;

    /* Task1 */
    void vTask1(void *pvParameters)
    {
    for(;;)
    {
    /* Taggle HET[1] with timer tick */
    gioSetBit(hetPORT1, 16, gioGetBit(hetPORT1, 16) ^ 1);
    vTaskDelay(1000);
    }
    }
    void vTask2(void *pvParameters)
    {
    for(;;)
    {
    /* Taggle HET[1] with timer tick */
    gioSetBit(hetPORT1, 27, gioGetBit(hetPORT1, 27) ^ 1);
    vTaskDelay(1000);
    }
    }
    void vTask3(void *pvParameters)
    {
    for(;;)
    {
    /* Taggle HET[1] with timer tick */
    gioSetBit(hetPORT1, 04, gioGetBit(hetPORT1, 04) ^ 1);
    vTaskDelay(1000);
    }
    }
    void vTask4(void *pvParameters)
    {
    for(;;)
    {
    /* Taggle HET[1] with timer tick */
    gioSetBit(hetPORT1, 20, gioGetBit(hetPORT1, 20) ^ 1);
    vTaskDelay(1000);
    }
    }
    void vTask5(void *pvParameters)
    {
    for(;;)
    {
    /* Taggle HET[1] with timer tick */
    gioSetBit(hetPORT1, 05, gioGetBit(hetPORT1, 05) ^ 1);
    vTaskDelay(1000);
    }
    }
    void vTask6(void *pvParameters)
    {
    for(;;)
    {
    /* Taggle HET[1] with timer tick */
    gioSetBit(hetPORT1, 02, gioGetBit(hetPORT1, 02) ^ 1);
    vTaskDelay(1000);
    }
    }
    void vTask7(void *pvParameters)
    {
    for(;;)
    {
    /* Taggle HET[1] with timer tick */
    gioSetBit(hetPORT1, 25, gioGetBit(hetPORT1, 25) ^ 1);
    vTaskDelay(1000);
    }
    }
    void vTask8(void *pvParameters)
    {
    for(;;)
    {
    /* Taggle HET[1] with timer tick */
    gioSetBit(hetPORT1, 18, gioGetBit(hetPORT1, 18) ^ 1);
    vTaskDelay(1000);
    }
    }
    void vTask9(void *pvParameters)
    {
    for(;;)
    {
    /* Taggle HET[1] with timer tick */
    gioSetBit(hetPORT1, 29, gioGetBit(hetPORT1, 29) ^ 1);
    vTaskDelay(1000);
    }
    }
    void vTask10(void *pvParameters)
    {
    for(;;)
    {
    /* Taggle HET[1] with timer tick */
    gioSetBit(hetPORT1, 17, gioGetBit(hetPORT1, 17) ^ 1);
    vTaskDelay(1000);
    }
    }
    void vTask11(void *pvParameters)
    {
    for(;;)
    {
    /* Taggle HET[1] with timer tick */
    gioSetBit(hetPORT1, 31, gioGetBit(hetPORT1, 31) ^ 1);
    vTaskDelay(1000);
    }
    }
    void vTask12(void *pvParameters)
    {
    for(;;)
    {
    /* Taggle HET[1] with timer tick */
    gioSetBit(hetPORT1, 0, gioGetBit(hetPORT1, 0) ^ 1);
    vTaskDelay(1000);
    }
    }

    /* USER CODE END */


    /** @fn void main(void)
    * @brief Application main function
    *
    */

    /* USER CODE BEGIN (2) */
    /* USER CODE END */


    void main(void)
    {
    /* USER CODE BEGIN (3) */

    /* Set high end timer GIO port hetPort pin direction to all output */
    gioSetDirection(hetPORT1, 0xFFFFFFFF);
    gioSetPort(hetPORT1, 0x08110034); //Set RGB off White Off

    /* Create Task 1 */
    if (xTaskCreate(vTask1,"Task1", configMINIMAL_STACK_SIZE, NULL, 1, &xTask1Handle_1) != pdTRUE)
    {
    /* Task could not be created */
    while(1);
    }
    if (xTaskCreate(vTask2,"Task2", configMINIMAL_STACK_SIZE, NULL, 1, &xTask1Handle_2) != pdTRUE)
    {
    /* Task could not be created */
    while(1);
    }
    if (xTaskCreate(vTask3,"Task3", configMINIMAL_STACK_SIZE, NULL, 1, &xTask1Handle_3) != pdTRUE)
    {
    /* Task could not be created */
    while(1);
    }
    if (xTaskCreate(vTask4,"Task4", configMINIMAL_STACK_SIZE, NULL, 1, &xTask1Handle_4) != pdTRUE)
    {
    /* Task could not be created */
    while(1);
    }
    if (xTaskCreate(vTask5,"Task5", configMINIMAL_STACK_SIZE, NULL, 1, &xTask1Handle_5) != pdTRUE)
    {
    /* Task could not be created */
    while(1);
    }
    if (xTaskCreate(vTask6,"Task6", configMINIMAL_STACK_SIZE, NULL, 1, &xTask1Handle_6) != pdTRUE)
    {
    /* Task could not be created */
    while(1);
    }
    if (xTaskCreate(vTask7,"Task7", configMINIMAL_STACK_SIZE, NULL, 1, &xTask1Handle_7) != pdTRUE)
    {
    /* Task could not be created */
    while(1);
    }
    if (xTaskCreate(vTask8,"Task8", configMINIMAL_STACK_SIZE, NULL, 1, &xTask1Handle_8) != pdTRUE)
    {
    /* Task could not be created */
    while(1);
    }
    if (xTaskCreate(vTask9,"Task9", configMINIMAL_STACK_SIZE, NULL, 1, &xTask1Handle_9) != pdTRUE)
    {
    /* Task could not be created */
    while(1);
    }
    if (xTaskCreate(vTask10,"Task10", configMINIMAL_STACK_SIZE, NULL, 1, &xTask1Handle_10) != pdTRUE)
    {
    /* Task could not be created */
    while(1);
    }
    if (xTaskCreate(vTask11,"Task11", configMINIMAL_STACK_SIZE, NULL, 1, &xTask1Handle_11) != pdTRUE)
    {
    /* Task could not be created */
    while(1);
    }
    if (xTaskCreate(vTask12,"Task12", configMINIMAL_STACK_SIZE, NULL, 1, &xTask1Handle_12) != pdTRUE)
    {
    /* Task could not be created */
    while(1);
    }
    /* Start Scheduler */
    vTaskStartScheduler();

    /* Run forever */
    while(1);
    /* USER CODE END */
    }


    /* USER CODE BEGIN (4) */
    /* USER CODE END */