Search code examples
autosar

How accurate is Explicit Synchronization of Schedule Tables?


I am reading up on time synchronization in AUTOSAR. Specifically, how to use global/PTP time to actually do time sensitive work on an ECU.

The way I understand it (from the OS spec "AUTOSAR_SWS_OS"), the way to do this is to put tasks in Schedule Tables, and then synchronize the tables either implicitly or explicitly.

Implicit synchronization I understand: lower level code/hardware sorts out the synchronization of a physical clock, and then the schedule tables just use a timer based on this clock.

I'm a bit puzzled by Explicit Synchronization however: It seems the way the table is synchronized is by periodic calls to SyncScheduleTable(). This tells the scheduler "the PTP time now is X".
But wouldn't the process of retrieving the current PTP time and then updating the table (in software...) introduce error in the time sync? I would think this would take at least a few microseconds?

Is the level of synchronization not expected to be sub-microsecond in AUTOSAR?


Solution

  • You will always have small offsets between SW modules.

    1. Normally you receive PTP global time from bus.
    2. Then STBM will use global time value and manage internal timer to start counting from last received value from bus. after sometime you will have offset between internal time and master clock from bus. This offset will be corrected always when new value is received but you will always have small offsets.
    3. The internal timer will keep synchronizing the schedule table and yes there will be few nano seconds for time take from reading the time from HW register till it is sent to the OS to synchronize.
    4. Even after synchronization command, OS runnables events will be fired with offsets due to CPU load.

    In the end would really few nano seconds hurt your design? in most projects I have seen such small offsets are acceptable.