DP83640 通过GPIO输出周期信号失败
时间:10-02
整理:3721RD
点击:
通过GPIO输出秒脉冲信号,一直失败,麻烦各位大侠看下原因,下面是代码
//===================================================================== //====== ====== //====== 原型: uint8 DP83640_SetPPS(void) ====== //====== ====== //====== 功能:DP83640配置输出秒脉冲 ====== //====== ====== //===================================================================== uint8 DP83640_SetPPS(void) { uint32 value0 = 0; //----------------------------------------------------------------- //----- 1、关闭TRIGGER //----- 1.1 设置页地址 DP83640_SetPage(PAGE4); //----- 1.2 读取配置寄存器 HAL_ETH_ReadPHYRegister(&EthHandle, PTP_CTL, &value0); //----- 1.3 写地址,关闭TRIGGER value0 |= PTP_TRIG_DIS; HAL_ETH_WritePHYRegister(&EthHandle, PTP_CTL, value0); //----------------------------------------------------------------- //----- 2、配置TRIGGER DP83640_SetPage(PAGE5); HAL_ETH_ReadPHYRegister(&EthHandle, PTP_TRIG, &value0); //----- 2.1 选择IO 、源、写、周期信号 value0 |= (TRIG_GPIO4 + TRIG_CSEL0 + TRIG_WR + TRIG_PER); HAL_ETH_WritePHYRegister(&EthHandle, PTP_TRIG, value0); HAL_ETH_ReadPHYRegister(&EthHandle, PTP_TRIG, &value0); //----------------------------------------------------------------- //----- 3、使能TRIGGER //----- 3.1 设置页地址 DP83640_SetPage(PAGE4); //----- 3.2 读取配置寄存器 HAL_ETH_ReadPHYRegister(&EthHandle, PTP_CTL, &value0); //----- 3.3 写地址,使能TRIGGER value0 |= (PTP_TRIG_EN + PTP_TRIG_SEL0); HAL_ETH_WritePHYRegister(&EthHandle, PTP_CTL, value0); HAL_ETH_ReadPHYRegister(&EthHandle, PTP_CTL, &value0); HAL_ETH_ReadPHYRegister(&EthHandle, PTP_TSTS, &value0); HAL_ETH_ReadPHYRegister(&EthHandle, PTP_TSTS, &value0); HAL_ETH_ReadPHYRegister(&EthHandle, PTP_TRIG, &value0); }
Hi,
你把TRIG_PULSE位设置一下试试: