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.

EK-TM4C129EXL: PTPv2 over Ethernet(layer 2 PTPv2) Timestamping

Part Number: EK-TM4C129EXL
Other Parts Discussed in Thread: TM4C129ENCPDT

Hello,

I am working on the PTPv2 over Ethernet(layer 2 PTPv2) for Tiva TM4C129ENCPDT. I try to send the messages with the NDK Stack.
I am using the NDK Raw Ethernet Sockets Programming Interface with those functions(to send a sync message):

tEMACDMADescriptor g_psTxDescriptor[NUM_TX_DESCRIPTORS];
UINT32 rawether_type = 0x88F7, rawchannel_num = 1;
int val = 7

socket(AF_RAWETH, SOCK_RAWETH, rawether_type);
setsockopt(sraw, SOL_SOCKET, SO_IFDEVICE, &rawchannel_num, sizeof(rawchannel_num));
setsockopt(sraw, SOL_SOCKET, SO_PRIORITY, &val, sizeof(val));
send(sraw, g_psTxDescriptor[ui32Loop].pvBuffer1, 58, 0);

Sending the sync message works fine, but I do not know how to configure the EMAC and DMA driver to get the Timestamps from the 8-words struct tEMACDMADescriptor.
I want to configure them to detect the start of frame and to do the timestamping, so that I can read it from the tEMACDMADescriptor, or where do I read it from?
Always when I change something in the EMAC driver with functions like EMACConfigSet, the transmission with the send function does not work anymore.
Does anybody has an idea how to configure those drivers?

Any help is appreciated.

Best wishes Waldemar

  • Hello Bob,
    thank you for your reply. That thread uses the current time from when the function EMACTimestampSysTimeGet is called, or by reading directly from the registers like he did there. But I don't want the current time. I want the time from when the Start of frame is detected and it is timestamped. Section 23.3.2.5 Enhanced and Alternate Descriptors, from the Tiva™ TM4C129ENCPDT Microcontroller Datasheet (DS-TM4C129ENCPDT-15863.2743 SPMS441B) describes for example, that when these bits are enabled:

    from Table 23-2. Enhanced Transmit Descriptor 0 (TDES0):

    25 | TTSE: Transmit Timestamp Enable
    "When set, this bit enables IEEE1588 hardware timestamping for the transmit frame referenced by the descriptor.
    This bit is only valid when the First Segment Control bit (TDES0[28] is set."


    17 | TTSS:TX Timestamp
    This status bit indicates that a timestamp has been captured for the corresponding transmit frame. When this bit
    is set, TDES6 and TDES7 have timestamp values that were captured for the transmit frame. This field is valid
    only when the Last Segment control bit (TDES0[29]) in a descriptor is set.

    But they are never set.

    I used the following code to configure it:

    EMACTimestampConfigSet(EMAC0_BASE,
    (EMAC_TS_PTP_VERSION_2 |
    EMAC_TS_DIGITAL_ROLLOVER |
    EMAC_TS_MAC_FILTER_DISABLE |
    EMAC_TS_UPDATE_COARSE |
    EMAC_TS_ALL ),
    40);


    EMACTimestampEnable(EMAC0_BASE);


    Any help is appreciated,
    Best Regards
    Waldemar Voos