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.

AM3359: Timer synchronization with external clock

Part Number: AM3359
Other Parts Discussed in Thread: SYSBIOS

Hi,

At our Application on TI-Rtos/AM335x we have a periodically called task (with ~1000µs).

Now we want to synchronize the period to an external clock, with changes of n*0.1% of the period duration. 

Currently we use the timer functions to call the periodic task.

Timer_setPeriod(...) , Timer_setFunc(...) , Timer_start(...)

 

We need a way 

- to change the speed of a clock which creates the time base for the timer.

- or a way to set the period duration which affects with the next period. 

 

Is there a safe way? Which doen't  create systematic drift.

 

Thanks & Best regards

Daniel

 

  • Daniel,

    I am not sure that I understand the use case completely so I have looped in a few folks from our industrial team. how is the external clock information brought into AM335x? e.g., PTP over Ethernet? PPS signal? Something else?

    The BIOS kernel for the platform that you are using uses DMtimer for the Timer module that is clocked using the OSCIN. You should be able to use the timer prescalar functionality to change the timer resolution. 

    Regards,

    Rahul

  • Hi Rahul,

    For EtherCAT a device connected via Ethernet measures the time of an Ethernet frame and the average value is used to calibrate the period.

    I tried to follow your suggestion, but I only found  setPrescale() functions for the wrong SoC.

    For the A9 family there is ti_sysbios_family_arm_a9_Timer_setPrescale.

    Do I have to change this CPU registers directly?

    Best Regrads

    Daniel

  • Daniel,

    As you referred to EtherCAT, you should be able to synchronize the tasks with external signal attached to latch pin in PRU-ICSS, please see the comment in our tiescbsp.h:

    /* Uncomment following to enable DC feature of system time compensation via PDI interface instead of ECAT interface
    for synchronizing two independent EtherCAT networks */
    //#define SYSTEM_TIME_PDI_CONTROLLED

    And check the API: bsp_pdi_latch0_control() in tiescbsp.c

    If you meant to change system tick (tickPeriod), the training material may help: http://processors.wiki.ti.com/images/e/ee/Timers_Clocks.pdf

    Regards,

    Garrett