对PTP 1588新的认识

对1588的研究持续了一段时间,总有不太确定的地方,现在进行个阶段性总结,也包含了个人的思考,可能还有认识不到位的地方,请这方面的专家能提点意见。

图1 Model of an ordinary clock,来自于IEC 61588-2009网络测量和控制系统的精密时钟同步协议标准.pdf

仅介绍在SLAVE模式下PTP同步过程:

分为两个阶段,时钟同步和时间同步。
step 1. master 每0.1S发1个SYNC包,Slave通过更新上图Time的值来调整供给自己PHY(上图下方紫框)的时钟(上图红色Clock)使得接收到SYNC包的时间间隔=0.1S,实现时钟同步,同时达到了时间也尽可能靠近master时间的目的,这部分内容可以在I210手册page337页找到佐证,以下是摘抄:

The slave calculates the time gap between consecutive SYNC packets defined by the master clock. It then calibrates itself to get the same time gap defined by its own clock. During this phase the slave also sets its time to be as close as possible to the master time。
step 2. 时间同步阶段,Slave MAC得到时间戳t1~t4,计算得到时间偏差,只需要在slave MAC侧加上时间偏差就得到了对齐后的时间,实现了时间同步,这个阶段无需再调整上图的Clock了。

因此:

1. 对于1588的硬件设计,除了MAC、PHY的参与,也需要板载支持1588的时钟的参与,这个时钟不同于一般的时钟芯片,后者只支持锁相环的功能,前者还支持时间的写入(如上图Local Clock框内的Time输入),通过写入Time来调整送到PHY的Clock,这也就是为什么在时钟同步阶段,调整Clock也能达到调整Time的原因。支持1588的时钟芯片比如8A34002,通过相位控制字实现DCO控制的框图如下:

图2 External DCO Control via Phase Control Word

上图中的Phase Control Word(PCW)关联了1个timer(there is an optional timer associated with the PCW. This allows a phase control word to be applied for a limited period of time after which it will be automatically reset to zero or placed into holdover by the 8A34002, and therefore, it will avoid the DCO continuing to apply the phase adjustment indefinitely until it reaches its tuning range limits. The timer value is a 16-bit integer that has a granularity (粒度) of 1 millisecond and a full range of up to 65.535 seconds.)可通过设置timer来调整时钟输出,即是说通过I2C或SPI写入time可以调整时钟的输出,这和图1中左上角紫框的功能是对应的,支持time写入可能就是支持1588的时钟芯片的特色吧。

  • 4
    点赞
  • 19
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

努力不期待

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值