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.
Hello all,
I have a project with FreeRTOS running on the TMS570 (MCBTMS570 dev board). I have a task that executes every 100 microseconds (10kHz rate). However when I calculate the time it takes to run this task it is in the order of 170us. Which would indicate that I'm not meeting the 100us schedule. This is perplexing because there are lower priority tasks that do get executed (meaning the 10kHz schedule is being met). Below is the method I employ to calculate the time to execute the task.
I make use of the Free Running Counter Register (FRC) to determine the amount of time it takes to run this task. The counter frequency (per HalCoGen) is 10MHz. This is the code:
// Read FRC register before executing go_10KHz(); FRC_dummy_reg1 = rtiREG1->CNT[0U].FRCx; // Do work... go_10KHz(); // Read FRC register post execution of go_10KHz() FRC_dummy_reg2 = rtiREG1->CNT[0U].FRCx; // Calculate time elapsed TimeElapsed = FRC_dummy_reg2 - FRC_dummy_reg1;
When the above code executes the TimeElapsed is in the order of 1700. 1700 ticks at 10Mhz = 170us.
How can I verify that the FRC ticks I count are indeed at 10MHz?
Thanks
Jairo,
Just a suggestion here . Are the FRC_dummy_reg1/2 declared as register variables ? If not you can try it and see if there is any difference.
Meanwhile let me look into the HalCoGen generated files and see the settings it does.
Best Regards,
Pratip
Hello Pratip, I've resolved the issue.
HalCoGen was doing it job and generating the files for the frequency of the Free Runniing Counter (FRC ) to be at 10MHz, as I specified. However the freeRTOS "os_port.c", (function prvSetupTimerInterrupt() ) file was also changing the value of the RTI registers causing the frequency of the FRC to be different than I had specified in HalCoGen.
To answer your question, FRC_dummy_reg1/2 are both declared as followed:
void vTask10kHz( void * pvParameters) { unsigned FRC_dummy_reg1, FRC_dummy_reg1; ... }
I'm not sure what you mean by "declared as registers". Can you explain?