This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

DP83630 and PPS algorithm

Other Parts Discussed in Thread: DP83640SW-LIB

Hi!

I'm trying to set the GPIO1 as PPS output. Can I get a detailed algorithm for this?

  • The best starting point for this will be the Software Development Guide (SDG) and the EPL C code reference library.  These are avialable on-line at:

    http://www.ti.com/tool/dp83640sw-lib

    The SDG will include descriptions of the functionality beyond what is in the datasheet.  The EPL C code reference library will provide C code examples of various functionality.


    Patrick

  • Thanks!

    I read these instructions and tried to follow it, but there is no pps.

    My actions:

                        SetPHYPage(PHY_PG4_PTP_TSTS, ethNumber);
                        unsigned short reg = (0 << P640_TRIG_SEL_SHIFT) | P640_TRIG_DIS;
                         PHYWrite(reg, PHY_PG4_PTP_CTL,ethNumber);
                        PTPSetTriggerConfig(ethNumber, 0, P640_TRIG_PER|P640_TRIG_PULSE|P640_TRIG_NOTIFY , 1);
                        PTPArmTrigger(ethNumber, 0, 5, 0, false, false, 500000000, 500000000);
                        SetPHYPage(PHY_PG4_PTP_TSTS, ethNumber);
                        tstPhy = PHYRead(PHY_PG4_PTP_TSTS,ethNumber);

                         ...tstPhy =0x0002 - error...

    Code of functions:

    void PTPArmTrigger(unsigned char ethNumber, unsigned short trigger, unsigned int expireTimeSeconds, unsigned int expireTimeNanoSeconds,
            bool initialStateFlag, bool waitForRolloverFlag, unsigned int pulseWidth, unsigned int pulseWidth2)
    {
        unsigned short reg;
        SetPHYPage(PHY_PG4_PTP_CTL, ethNumber);

        reg = (trigger << P640_TRIG_SEL_SHIFT) | P640_TRIG_LOAD;
         PHYWrite(reg, PHY_PG4_PTP_CTL,ethNumber);

         PHYWrite(expireTimeNanoSeconds & 0xFFFF, PHY_PG4_PTP_TDR,ethNumber);
        
        reg = (expireTimeNanoSeconds >> 16) | (initialStateFlag ? 0x80000000 : 0) |
              (waitForRolloverFlag ? 0x40000000 : 0);
         PHYWrite(reg, PHY_PG4_PTP_TDR,ethNumber);

         PHYWrite(expireTimeSeconds & 0xFFFF, PHY_PG4_PTP_TDR,ethNumber);
         PHYWrite(expireTimeSeconds >> 16, PHY_PG4_PTP_TDR,ethNumber);

         PHYWrite(pulseWidth & 0xFFFF, PHY_PG4_PTP_TDR,ethNumber);
         PHYWrite(pulseWidth >> 16, PHY_PG4_PTP_TDR,ethNumber);

        if ( trigger <= 1)
        {
             PHYWrite(pulseWidth2 & 0xFFFF, PHY_PG4_PTP_TDR,ethNumber);
             PHYWrite(pulseWidth2 >> 16, PHY_PG4_PTP_TDR,ethNumber);
        }
        reg = (trigger << P640_TRIG_SEL_SHIFT) | P640_TRIG_EN;
         PHYWrite(reg, PHY_PG4_PTP_CTL,ethNumber);
    }
     
    //****************************************************************************
    void PTPSetTriggerConfig(unsigned char ethNumber, unsigned short trigger, unsigned short triggerBehavior, unsigned short gpioConnection)
    {
        unsigned short reg = 0;
        if ( triggerBehavior & P640_TRIG_PULSE)        reg |= P640_TRIG_PULSE;
        if ( triggerBehavior & P640_TRIG_PER)     reg |= P640_TRIG_PER;
        if ( triggerBehavior & P640_TRIG_IF_LATE)  reg |= P640_TRIG_IF_LATE;
        if ( triggerBehavior & P640_TRIG_NOTIFY)    reg |= P640_TRIG_NOTIFY;
        if ( triggerBehavior & P640_TRIG_TOGGLE)    reg |= P640_TRIG_TOGGLE;
        
        reg |= gpioConnection << P640_TRIG_GPIO_SHIFT;
        reg |= trigger << P640_TRIG_CSEL_SHIFT;
        reg |= P640_TRIG_WR;
        SetPHYPage(PHY_PG5_PTP_TRIG, ethNumber);
        PHYWrite(reg, PHY_PG5_PTP_TRIG,ethNumber);
    }

  • A PPS is a periodic trigger with a 1 second period.  There are some notes on this in section 3.1.4.6 of the SDG. 

    There is an example configuration of a PPS using Trigger 0 shown in section 3.2.  There is also an example configuration in the ptpControl.c file. 

    Patrick

  • Thank you very much, all works correctly!