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.

Compiler/TDA4VM: How to select the timer resource? What are the resources limitation of Timer? How to implement the cyclic task?

Part Number: TDA4VM
Other Parts Discussed in Thread: SYSBIOS

Tool/software: TI C/C++ Compiler

I want to implement the periodic task call of 1ms, 5ms, 10ms, 20ms, 25ms, 50ms, 100ms, 200ms, 500ms, 1000ms. And I want run these cyclic task on MCU domain of R5F.

But now I need use 8 MCU_Timer for input capture.

I have questions below:

  1. Is there other resource for the cyclic task? [1ms,5ms,10ms] should be preemptive task and other task should be cooprative task.
  2. How to select the timer resource? Please show us all the possible resources.
  3. What are the resources limitation of Timer? Please show the limitation for each resource.
  4. How to implement the cyclic task? Please give us all the possible ways of MCU-R5F.
  5. Please tell us what is difference between the 3 modules and what is the resource limitation of them:
    1. ti.sysbios.timers.dmtimer.Timer
    2. ti.sysbios.timers.gptimer.Timer
    3. ti.sysbios.timers.timer64.Timer

  • Hi,

    See replies inline TI>>

    1. Is there other resource for the cyclic task? [1ms,5ms,10ms] should be preemptive task and other task should be cooprative task.

    TI>> What is a cooperative task ? Pre-emption can be controlled through Task priority values. Typically you can do a cyclic task using

    • Task_sleep() which gives milisecond granularity
    • BIOS Clock + Interrupt which gives milisecond granularity
    • DM/GP Timer + Interrupt which gives microsecond granularity

    2. How to select the timer resource? Please show us all the possible resources.

    TI>> Please refer to Chapter 5 of the this User Guide https://www.ti.com/lit/ug/spruex3u/spruex3u.pdf

    3. What are the resources limitation of Timer? Please show the limitation for each resource.

    TI>> The two constraints for a timer are domain and granularity. You can refer to the TRM for TDA4 to know which timers are available in each domain and also know the clock speed etc. If you are using the OSAL API's to create a timer then you don't need to configure clock speed etc. The API will do that for you. You can refer to the gateway demos example in SDK which runs on main domain...see psdk_rtos_auto_j7_07_00_00_11/gateway-demos/can_eth_gateway/src/main_tirtos.c

    4. How to implement the cyclic task? Please give us all the possible ways of MCU-R5F.

    TI >> See answer to 1. above.

    5. Please tell us what is difference between the 3 modules and what is the resource limitation of them:

    TI >>

    • GP Timer and DM Timer are one and the same. These are generic names for the general purpose timers inside the SoC
    • Timer64 is the 64 bit timer GP Timer for Keystone 2 and next gen devices which includes TDA4. Previous generations had a 32 bit timer.
    • Timer64 supports chained mode between lower 32 and upper 32 counters and a few more features.

    See this and this for more details.

    Regards

    Vineet

  • Hi,

    I have questions about the reply:

    See replies inline 20200728>>

    1. Is there other resource for the cyclic task? [1ms,5ms,10ms] should be preemptive task and other task should be cooprative task.

    TI>> What is a cooperative task ? Pre-emption can be controlled through Task priority values. Typically you can do a cyclic task using

    • Task_sleep() which gives milisecond granularity
    • BIOS Clock + Interrupt which gives milisecond granularity
    • DM/GP Timer + Interrupt which gives microsecond granularity

    20200728>>

    What is the resource limitation of "BIOS Clock" and "DM/GP Timer"? I mean how many numbers of the resource can I use.

    Can I use one resource which cost no more resource and also can create periodic task of [1ms 5ms 10ms 20ms 50ms 100ms 200ms 500ms 1000ms]?

    2. How to select the timer resource? Please show us all the possible resources.

    TI>> Please refer to Chapter 5 of the this User Guide https://www.ti.com/lit/ug/spruex3u/spruex3u.pdf

    20200728>> In the User Guide above, I have question in chapter5.2:

    Because of I have used 8 timer for input capture and no more timer for periodic task, How can I use Clock resource to create task of [1ms 5ms 10ms 20ms 50ms 100ms 200ms 500ms 1000ms] without using ti.sysbios.hal.Timer module?

    5. Please tell us what is difference between the 3 modules and what is the resource limitation of them:

    TI >>

    • GP Timer and DM Timer are one and the same. These are generic names for the general purpose timers inside the SoC
    • Timer64 is the 64 bit timer GP Timer for Keystone 2 and next gen devices which includes TDA4. Previous generations had a 32 bit timer.
    • Timer64 supports chained mode between lower 32 and upper 32 counters and a few more features.

    20200728>>Where can I find the detailed about the GP/DM Timer?

  • Hi,

    See responses to your answer

    20200728>>

    What is the resource limitation of "BIOS Clock" and "DM/GP Timer"? I mean how many numbers of the resource can I use.

    Can I use one resource which cost no more resource and also can create periodic task of [1ms 5ms 10ms 20ms 50ms 100ms 200ms 500ms 1000ms]?

    TI >> BIOS Clock uses an SWI based on the default timer assigned to BIOS. It does not use any extra resource. DM/GP Timer is an actual HW clock and it's documented in TRM. Actual implementation varies from device to device.

    You don't really need so many timers to create periodic tasks of 1ms 5ms 10ms 20ms 50ms 100ms 200ms 500ms 1000ms. You can create that many BIOS tasks and then use Task_Sleep() with the waiting time.

    20200728>> In the User Guide above, I have question in chapter5.2:

    Because of I have used 8 timer for input capture and no more timer for periodic task, How can I use Clock resource to create task of [1ms 5ms 10ms 20ms 50ms 100ms 200ms 500ms 1000ms] without using ti.sysbios.hal.Timer module?

    TI >> See my previous response. You don't really need that many clocks for your usage. Only if granularity is in microseconds do you need individual timers.

    20200728>>Where can I find the detailed about the GP/DM Timer?

    TI >> It's available in TRM. See the section "Timers" under "Peripherals"

    Regards

    Vineet

  • 20200728>>

    What is the resource limitation of "BIOS Clock" and "DM/GP Timer"? I mean how many numbers of the resource can I use.

    Can I use one resource which cost no more resource and also can create periodic task of [1ms 5ms 10ms 20ms 50ms 100ms 200ms 500ms 1000ms]?

    TI >> BIOS Clock uses an SWI based on the default timer assigned to BIOS. It does not use any extra resource. DM/GP Timer is an actual HW clock and it's documented in TRM. Actual implementation varies from device to device.

    You don't really need so many timers to create periodic tasks of 1ms 5ms 10ms 20ms 50ms 100ms 200ms 500ms 1000ms. You can create that many BIOS tasks and then use Task_Sleep() with the waiting time.

    20200730>> When using create_task with Task_Sleep(), I have question below:

    my code is like this:

    void App_10ms_task()

    {

    while(1)

    {

    Task_sleep(10);

    App_run();

    }

    }

    Is the task App_10ms_task will run the time about [ 10ms+time of App_run]?

    If this is right, it is not my requirement. I want to implement the App_10ms_task running the time of 10ms exactly. But currently I have no more timer resources. Is there any other solution? Please help me!

  • TI >> BIOS Clock uses an SWI based on the default timer assigned to BIOS. It does not use any extra resource. DM/GP Timer is an actual HW clock and it's documented in TRM. Actual implementation varies from device to device.

    I have do some research on task_sleep(). This make task period not very accurate. Now I want to have one demo on BIOS Clock. Could you please give me one demo on this module?

  • Hi,

    >>Is the task App_10ms_task will run the time about [ 10ms+time of App_run]?

    If this is right, it is not my requirement. I want to implement the App_10ms_task running the time of 10ms exactly. But currently I have no more timer resources. Is there any other solution? Please help me!

    TI : Yes, it's 10ms+time of App_run. I think I understand what you want. You need to use BIOS Clock_create() API to create SW Interrupts and tie them to your App_run functions. You will find Clock_create() examples inside both BIOS User Guide and PDK applications.

    An example usage is inside pdk/packages/ti/transport/timeSync/v2/protocol/ptp/src/timeSync_ptp_osal_priv.c

    If you want higher resolution and accuracy then use TimerP_Create() API which uses the HW Timers. BIOS automatically assigns the timers based on availability.

    Regards

    Vineet

  • I have already read the TI-RTOS user guide, It said clock module will use HW timer resource. I can not really understand it with your information.

    Please explain how can I use clock module with SWI.

  • Sorry, I have a misoperation on this topic and it has been closed. I wil create one related question for this topic.

    e2e.ti.com/.../932851

  • Can I close this E2E then ?

    Regards

    Vineet

  • Please focus one the rest of question in another link related above and close this now.

    Thank you!