lpc54s018 enet PTP timestamp

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

lpc54s018 enet PTP timestamp

526 Views
ppardo
Contributor II

Hi All,

 

I configure my device as a PTP master, and I expect to receive PTP timestamps when I send a Sync.

ENET->MAC_TIMESTAMP_CTRL is configured like this:

ENET->MAC_TIMESTAMP_CTRL |= ENET_MAC_TIMESTAMP_CTRL_TSENA_MASK;
ENET->MAC_TIMESTAMP_CTRL |= ENET_MAC_TIMESTAMP_CTRL_TSCFUPDT_MASK;

ENET->MAC_TIMESTAMP_CTRL |= ENET_MAC_TIMESTAMP_CTRL_TSIPV4ENA_MASK;
ENET->MAC_TIMESTAMP_CTRL |= ENET_MAC_TIMESTAMP_CTRL_TSVER2ENA_MASK;
ENET->MAC_TIMESTAMP_CTRL &= ~ENET_MAC_TIMESTAMP_CTRL_SNAPTYPSEL_MASK; // 00
ENET->MAC_TIMESTAMP_CTRL &= ~ENET_MAC_TIMESTAMP_CTRL_TSENALL_MASK;// not all timestamps, i want only sync

 

ENET->MAC_TIMESTAMP_CTRL |= ENET_MAC_TIMESTAMP_CTRL_TSMSTRENA_MASK;// ptp master

 

After digging a lot, I see that I need to add

txFrame.txConfig.tsEnable=1;

in err_t ethernetif_linkoutput(struct netif *netif, struct pbuf *p)

 

But, when I add this tsenable, all the packets are timestamped !

 

i can receive the timestamp in static void ethernet_callback(...)

when ther's a kENET_TxIntEvent,.

 

Here're my questions:

* why is there many settings in ENET->MAC_TIMESTAMP_CTRL, but it seems that there's just the .tsEnable that's is used to activate timestamp for a packet.

* if there's no other better way to do the job, how can I discriminate sent packets in ethernet_callback(...) to reclaim (or not) the timestamps.

Is there somewhere an updated documentation about this lpc554s018 (and family) ?

regards

 

0 Kudos
6 Replies

441 Views
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi,

Have you seen the following section which give the procedure for the system time generation in UM11155.pdf?

37.7.11.8 Programming guidelines for IEEE 1588 timestamping
37.7.11.8.1 Initialization guideline for system time generation

 

BR

XiangJu8n Rong

0 Kudos

437 Views
ppardo
Contributor II

Yes,

I think I've read all these chapters,

 

But find no way to:

* generates a PPS synchronized with ptp time (the only way I've found to simulate this, is to use some hidden registers, and use the TSIS of MAC_INTR_STAT)

* use MAC_TIMESTAMP_CTRL to select which TX packet must be timestamped (the only way I've found is to add txFrame.txConfig.tsEnable = true;), but it's not a reliable way if I've many packets to timestamps.

and what's is the use of MAC_TIMESTAMP_CTRL if I've have to manually select TX packets that I want to timestamp.

 

Regards

* and so on...

0 Kudos

501 Views
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi,

I have not seen the IEEE 1588 example code in SDK package, can you post the project so that we can have a review?

Anyway, I think the application note AN12149.pdf is helpful, pls refer to it.

 

https://www.nxp.com.cn/docs/en/nxp/application-notes/AN12149.pdf

BR

XiangJun Rong

0 Kudos

497 Views
ppardo
Contributor II

Hi,thanks for documentation,

the base example is lpcxpresso54s018m_enet_txrx_ptp1588_transfer in lpc54s018 SDK.

I'll look at the AN you've send, bt I'm not sure it's directly related to the lpc.

 

Regards

0 Kudos

458 Views
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi,

Thank you for the response, I have got the example lpcxpresso54s018m_enet_txrx_ptp1588_transfer in lpc54s018 SDK.

But the example does not use LWIP, it creates a packet and send it without UDP.

xiangjun_rong_0-1693821063158.png

 

Now, do you use LWIP UDP to transfer PTP packet?

BR

XiangJun Rong

0 Kudos

454 Views
ppardo
Contributor II

Hi,

Yes, I use lwip.

 

But, what's the use of ENET->MAC_TIMESTAMP_CTRL settings, if I have to change myself txFrame.txConfig.tsEnable=1; in order to have a tx timestamp ?

 

is there another way ?

regards

 

 

0 Kudos