Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Rakshith_LTTS
Level 1
Level 1
First reply posted 10 sign-ins 5 sign-ins

Hi,

Can I get the FreeRTOS for the TC38x Board?

I came across the example code for the TC375 but how to use for TC389 EVB Board?

 

Thanks & Reagrds,

Rakshith 

 

0 Likes
1 Solution

Hi @Rakshith_LTTS 

Thank you for taking the time to  upload the project, right now i don't have the MCU to test the code but as far as i can tell it looks good, so in theory it should work but i can't be 100% secure till run it, to do so, i'll need to ask for the MCU or test it on another MCU (TC375), but i think this could be a possible solution, 

Do not declare a handler:

 

#define TASK_ENCODE_P    (tskIDLE_PRIORITY + 2)
#define TASK_DECODE_P    (tskIDLE_PRIORITY + 1)

void core0_main(void){
.
.
    xTaskCreate(task_decode, "DECODE", 512, NULL, TASK_DECODE_P, NULL);
    xTaskCreate(task_encode, "ENCODE", 512, NULL, TASK_ENCODE_P, NULL);
}

 

 Rise the priority of the task, in this case task_decode

 

void task_decode(void *arg)
{
    app_init();
    while(1)
    {
        IfxPort_setPinLow(LED_D1);
        waitTime(IfxStm_getTicksFromMilliseconds(BSP_DEFAULT_TIMER, 1000));
        IfxPort_setPinHigh(LED_D1);
 vTaskPrioritySet(NULL, TASK_ENCODE_P + 1);
    }
}

 

 

Regards!

View solution in original post

0 Likes
8 Replies
Erick_G
Moderator
Moderator
Moderator
100 sign-ins 25 solutions authored 50 replies posted

Hi @Rakshith_LTTS,

You can add the OS directory, as well as the FreeRTOSConfig.h file in the Configurations directory to your directory from the Example project. To build it you need to exclude from the build (or delete from the project) the OS/FreeRTOS/portable/GCC directory as well as the heap_2.c to heap_5.c (all of the files in the folder except one) files that are in the OS/FreeRTOS/portable/MemMang directory.

If you want to use the code from the example, you can just adapt the ports used.

Best regards,

Erick

0 Likes
Rakshith_LTTS
Level 1
Level 1
First reply posted 10 sign-ins 5 sign-ins

Hi Erick,

I'm able to run the tasks but not able to change the priority of the 1st task from 2nd task . What might the issue?

Which RTOS is suggested to use in Aurix TC389?

If it is FreeRTOS where can I get the FreeRTOS support for further development process?

 

0 Likes

Hi @Rakshith_LTTS,

Could you share the error when changing the priority or could you clarify what happens when changing the priority?

AURIX is compatible with several RTOS, as shown in this page. It would depend in your needs.

You can find the documentation for FreeRTOS in this link.

Best regards,

Erick

0 Likes

Hello @Rakshith_LTTS 

As @Erick_G  states, a little more information is needed to be able to help you, but i think you're not aware of an important parameter of configuration and that's why you're not able to establish the priority, you only will be able to change the priority of a task only if you are using a preemptive scheduler, otherwise is a little different,

So let's go step by step,

first step:

To check if you are using a preemptive or a cooperative scheduler look into the FreeRTOSConfig.h file  and look out for the value of

 

#define configUSE_PREEMPTION

 

If is set (equal to 1) this mean it is preemptive, so the task with higher priority will take the control of the CPU

If is no set (equal to 0) this mean it is cooperative, so the task must yield to release the CPU,

Step 2:

Now that you know which RTOS scheduler you're using to change the priority is as follow:

For preemptive, the priority is defined when a task is created, to create a task the prototype is:

 

BaseType_t xTaskCreate( TaskFunction_t pvTaskCode, const char * const pcName, configSTACK_DEPTH_TYPE usStackDepth, void *pvParameters, UBaseType_t uxPriority, TaskHandle_t *pxCreatedTask );

 

UBaseType_t uxPriority <- This defines the priority

Example:

 

xTaskCreate(test, "Test task", configMINIMAL_STACK_SIZE, NULL, 1, NULL);

 

test <- Function pointer

"Test task" <- Useful when to debug

configMINIMAL_STACK_SIZE <- stack size

NULL <- Parameters (we're not going to send data to the task)

1<- This one defines the priority

NULL <- Handler

Now if it is a cooperative scheduler, there're not priority at all, you use the taskYIELD  when you're done with the current task.

Step 3:

Check out the links that Erick_G posted.

Regards!

 

0 Likes

Hi,

Thanks for the quick response.

The issue I'm facing if there is 2 tasks I'm not able to increase the priority of the 2nd Task from 1st task using vTaskPrioritySet() function.

Instead of increasing the priority of 2nd task it's increasing the 1st task only. I'm passing the 2nd task handler and priority as the parameter.

0 Likes

Hello @Rakshith_LTTS 

Ok, so you checked that is a preemptive scheduler RTOS, and the priority isn't changing, to be able to help you more quickly, please share the code you're using, right now i'm assuming that you used the code of the vTaskPrioritySet page, also please share the actual content of the FreeRTOSConfig.h to see if it's not a stack problem.

Regards!

0 Likes
lock attach
Attachments are accessible only for community members.

Hi @David_R ,

Please find the attached file of freeRTOS project for TC389 controller.

Thanks,

Rakshith

0 Likes

Hi @Rakshith_LTTS 

Thank you for taking the time to  upload the project, right now i don't have the MCU to test the code but as far as i can tell it looks good, so in theory it should work but i can't be 100% secure till run it, to do so, i'll need to ask for the MCU or test it on another MCU (TC375), but i think this could be a possible solution, 

Do not declare a handler:

 

#define TASK_ENCODE_P    (tskIDLE_PRIORITY + 2)
#define TASK_DECODE_P    (tskIDLE_PRIORITY + 1)

void core0_main(void){
.
.
    xTaskCreate(task_decode, "DECODE", 512, NULL, TASK_DECODE_P, NULL);
    xTaskCreate(task_encode, "ENCODE", 512, NULL, TASK_ENCODE_P, NULL);
}

 

 Rise the priority of the task, in this case task_decode

 

void task_decode(void *arg)
{
    app_init();
    while(1)
    {
        IfxPort_setPinLow(LED_D1);
        waitTime(IfxStm_getTicksFromMilliseconds(BSP_DEFAULT_TIMER, 1000));
        IfxPort_setPinHigh(LED_D1);
 vTaskPrioritySet(NULL, TASK_ENCODE_P + 1);
    }
}

 

 

Regards!

0 Likes