Skip to contentSkip to conversation

How to sync a task to GPS ptp time ?

Xenomai 书呆子 2 participants 2 messages Mar 17, 2015 – Mar 18, 2015

lore
Share & tools
lore

书呆子

author
#0 lore raw

I need a periodic task run according to GPS ptp time, and native skin will be used.

A linux e1000e driver is used to talk to 1588 GPS master, ptp4l program can maintain PHC clock sync to GPS time.

I think rt_task_sleep_until(RTIME date) may be used if I carefully calculate 'date' as I need.

But xenomai has it's own 'wallclock_offset', which is init when boot. Because TSC clocksource is not very accurate, so 'wallclock_offset' need adjust frequently according to PHC clock.

The ksrc/nucleus provide a function xntbase_adjust_time which can be used to adjust 'wallclock_offset', but how can I do it in userspace?

And my idea feasible or not ?

thanks, zhou

#1 lore raw
Quoted 9 lines · 书呆子

I need a periodic task run according to GPS ptp time, and native skin will be used.

A linux e1000e driver is used to talk to 1588 GPS master, ptp4l program can maintain PHC clock sync to GPS time.

I think rt_task_sleep_until(RTIME date) may be used if I carefully calculate 'date' as I need.

Quoted 8 lines

But xenomai has it's own 'wallclock_offset', which is init when boot. Because TSC clocksource is not very accurate, so 'wallclock_offset' need adjust frequently according to PHC clock.

The ksrc/nucleus provide a function xntbase_adjust_time which can be used to adjust 'wallclock_offset', but how can I do it in userspace?

And my idea feasible or not ?

Sure, but you will have to use clock_settime() from the POSIX skin.

Signature · 1 line
					    Gilles.