1 头文件使能LWIP_PTPD
2 我用PG0作为PPS输出,如下设置:
主函数中 ROM_GPIOPinConfigure(GPIO_PG0_EN0PPS);
驱动库中加入EMACTimestampPPSSimpleModeSet(EMAC0_BASE, EMAC_PPS_1HZ);
#if LWIP_PTPD
//
// Enable timestamping on all received packets.
//
// We set the fine clock adjustment mode and configure the subsecond
// increment to half the 25MHz PTPD clock. This will give us maximum control
// over the clock rate adjustment and keep the arithmetic easy later. It
// should be possible to synchronize with higher accuracy than this with
// appropriate juggling of the subsecond increment count and the addend
// register value, though.
//
EMACTimestampConfigSet(EMAC0_BASE, (EMAC_TS_ALL_RX_FRAMES |
EMAC_TS_DIGITAL_ROLLOVER |
EMAC_TS_PROCESS_IPV4_UDP | EMAC_TS_ALL |
EMAC_TS_PTP_VERSION_1 | EMAC_TS_UPDATE_FINE),
(1000000000 / (25000000 / 2)));
EMACTimestampAddendSet(EMAC0_BASE, 0x80000000);
EMACTimestampEnable(EMAC0_BASE);
EMACTimestampPPSSimpleModeSet(EMAC0_BASE, EMAC_PPS_1HZ);
#endif
但是经测试,PG0没有PPS输出,还缺什么吗?