I am working with the TMS570 USB development board and I am able to get most of the peripherals working but I'm having trouble using the FreeRTOS component that the HAL tool generates. Is there an app note on how to do this?
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.
I am working with the TMS570 USB development board and I am able to get most of the peripherals working but I'm having trouble using the FreeRTOS component that the HAL tool generates. Is there an app note on how to do this?
An app note is not currently available, but I have listed the steps required to setup the FreeRTOS component n the TMS570 microcontroller.
In order to setup the FreeRTOS component in HalCoGen:
1) Go to the Interrupts tab under the main device tab.
2) Click the checkboxes to the left of the SVC to enable the SVC handler.
3) Delete '_svc' and replace it with 'vPortYieldProcessor'.
4) Go to the VIM Channel 0-31 tab.
5) Notice that the RTI Compare 0 interrupt is assigned to Channel 2.
6) Click the checkboxes to the right of channel 2 to enable the interrupt.
7) Click the checkboxes to enable the interrupt as an IRQ.
8) Go to the VIM RAM tab.
9) Delete 'rtiCompare0Interrupt' from the textbox next to 0x0000000C and replace it with 'vPortPreemptiveTick'.
10) Go to File>Generate Code.
This code can then be converted to a CCS4 project by following these steps:
1) Open CCS4.
2) Create a new project with the same name and in the same directory as the HalCoGen project.
a) Go to File --> New --> CCS Project.
b) Enter the HalCoGen project name in the Project Name box.
c) Verify that the workspace is pointing to the correct directory.
d) Click Next three times and click Finish.
3) Click the C/C++ button on the upper right-hand side of the GUI.
4) The code should now appear on the left-hand side of the GUI.
The following code is available at www.freertos.org and should be placed in the main function located in the sys_main.c file:
int main( void )
{
/* Setup the microcontroller hardware for the demo. */
prvSetupHardware();
/* Create the common demo application tasks, for example: */
vCreateFlashTasks();
vCreatePollQTasks();
vCreateComTestTasks();
//Etc.
/* Create any tasks defined within main.c itself, or otherwise specific to the
demo being built. */
xTaskCreate( vCheckTask, "check", STACK_SIZE, NULL, TASK_PRIORITY, NULL );
//Etc.
Start the scheduler, this function should not return as it causes the execution
context to change from main() to one of the created tasks. */
vTaskStartScheduler();
/* Should never get here! */
return 0;
}
Before the code will run properly, a change must be made to the canGetData() function located in the can.c file:
if (node->IF2MCTL & 0x4000U);
{
success = 3U;
}
should be
if (node->IF2MCTL & 0x4000U)
{
success = 3U;
}
This should be sufficient to get FreeRTOS up and running on the TMS570 microcontroller.
Hello,
There is no app note for this yet. However, the HALCoGen tool does include some example projects which walk you through the steps required to use the FreeRTOS component. These examples are accessible through the Help -> Help Topics menu from the HALCoGen GUI.
Regards, Sunil
Would it be possible to receive an updated guide on how to use freeRTOS with Halcogen? I stumbled across this post after a colleague and I spent the day attempting (and failing) to manually integrate freeRTOS with Halcogen's generated code, so an inbuilt method for doing so would be greatly appreciated.
I followed all the above steps with the current version of Halcogen and Code Composer Studio 5.5, however ran into three errors (STACK_SIZE, TASK_PRIORITY, and vCheckTask were all undefined). We are using the Hercules Safety Microcontroller TMS570L31x (the HDK specifically).
Any aid would be much appreciated.