Xmc4800 - ieee1588

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Not applicable
Hi,

We are implementing IEEE1588 in our distributed system. I have read through the Reference Manual in order to grasp the hardware support of time stamping Ethernet packages. On TX operation, I have managed to get the device to write the time stamp to the DMA descriptor. The problem I'm having is that I do not understand how to enable the PTP clock. I expect the registers SYSTEM_TIME_SECONDS and SYSTEM_TIME_NANOSECONDS to continuously be updated with the internal timer (called PTP clock in the reference manual) but they stay permanently the same value all the time.

I'm using the XMC_ETH_MAC_InitPTP() function to initialize the PTP registers.

Do you have any pointers for me to get forward?

Thanks
Rickard
0 Likes
11 Replies
Not applicable
Bumping this thread. Still waiting for an answer.

Rickard
0 Likes
User12775
Level 5
Level 5
First solution authored First like received
Which version of XMC Lib are you using?

Which configure word do you use to initialize the PTP?
/**
* ETH MAC time-stamp configuration enable
*/
typedef enum XMC_ETH_MAC_TIMESTAMP_CONFIG
{
XMC_ETH_MAC_TIMESTAMP_CONFIG_FINE_UPDATE = ETH_TIMESTAMP_CONTROL_TSCFUPDT_Msk, /**< Fine update */
XMC_ETH_MAC_TIMESTAMP_CONFIG_ENABLE_ALL_FRAMES = ETH_TIMESTAMP_CONTROL_TSENALL_Msk, /**< Enable all frames */
XMC_ETH_MAC_TIMESTAMP_CONFIG_ENABLE_PTPV2 = ETH_TIMESTAMP_CONTROL_TSVER2ENA_Msk, /**< PTPV2 */
XMC_ETH_MAC_TIMESTAMP_CONFIG_ENABLE_PTP_OVER_ETHERNET = ETH_TIMESTAMP_CONTROL_TSIPENA_Msk, /**< PTP over ETH */
XMC_ETH_MAC_TIMESTAMP_CONFIG_ENABLE_PTP_OVER_IPV6 = ETH_TIMESTAMP_CONTROL_TSIPV6ENA_Msk, /**< PTP over IPV6 */
XMC_ETH_MAC_TIMESTAMP_CONFIG_ENABLE_PTP_OVER_IPV4 = ETH_TIMESTAMP_CONTROL_TSIPV4ENA_Msk, /**< PTP over IPV4 */
XMC_ETH_MAC_TIMESTAMP_CONFIG_ENABLE_MAC_ADDRESS_FILTER = ETH_TIMESTAMP_CONTROL_TSENMACADDR_Msk /**< MAC address filter */
} XMC_ETH_MAC_TIMESTAMP_CONFIG_t;

void XMC_ETH_MAC_InitPTP(XMC_ETH_MAC_t *const eth_mac, uint32_t config);



Have you tried this?
void XMC_ETH_MAC_UpdatePTPTime(XMC_ETH_MAC_t *const eth_mac, const XMC_ETH_MAC_TIME_t *const time);
0 Likes
Not applicable
I have the same issue here.

After using the XMC_ETH_MAC_InitPTP() function, I read back the value of TIMESTAMP_CONTROL register and it is 0x6401 (ie: TIMESTAMP enabled, PTPv2, UDP packets, snapshots for events) which is what I expect.
Each time I readback the time with XMC_ETH_MAC_GetPTPTime(), I get back 0.
I can set the value of those registers SYSTEM_TIME_SECONDS and SYSTEM_TIME_NANOSECONDS, but they never change by themselves.

Something is missing. Any ideas?

Thanks and regards
Loic
0 Likes
lock attach
Attachments are accessible only for community members.
jferreira
Employee
Employee
10 sign-ins 5 sign-ins First like received
Hi,

We have reworked the PTP functions implementation.
Have a look to the attachment. This is going to be part of the upcoming new release next week.

Regards,
Jesus
0 Likes
Not applicable
Hello,

This new driver look better indeed.
Still, I have some problem with the function XMC_ETH_MAC_SetPTPAlarm: it does not set the TSTRIG bit in the TIMESTAMP_CONTROL register, so the interrupt is never triggered.

I am trying to make a PPS signal but I am having some trouble even after setting the TSTRIG manually.I am using an XMC4700.
My interrupt is triggered, each time, I assert an IO pin and I clear the Timestamp event by reading the TIMESTAMP_STATUS register.

What is wrong is the timing. TARGET_TIME_NANOSECONDS is completely ignored, whatever value I put in there, it seems as if it is
always 0. So, it only triggers on round seconds. And, for TARGET_TIME_SECONDS, I cannot get my software to trigger on 1s increments: ie in the interrupt, I read the current time, add 1s and reload the PTP alarm time.
It only works with 2s increments or higher.

Any idea what I am missing?

Best regards
Loic
0 Likes
lock attach
Attachments are accessible only for community members.
jferreira
Employee
Employee
10 sign-ins 5 sign-ins First like received
Hi,

Thanks for reporting the issue.
Please try with the attached files. I found an issue in the SetPTPAlarm, where the nanoconversion was not correct.

Regards,
Jesus
0 Likes
Not applicable
Hello Jesus,

Thanks for the updated driver. It works better but I still have issues.

First, in the code that is provided, the XMC_ETH_MAC_InitPTP() and XMC_ETH_MAC_InitPTPEx() will work well depending of you clockfrequency.
In my case, on a KIT_XMC47_RELAX_V1 at 144MHz, the settings turns out to have a pps signal every 1.004 s instead of 1s.
The addend register should be programmed with something like 2^63/(fSYS * SUB_SECOND_INCREMENT) to have a more precise incrementation.

My bigger issue now is with the timestamping of the packets: XMC_ETH_MAC_GetTxTimeStamp() and XMC_ETH_MAC_GetRxTimeStamp() are not returning the correct timestamps at all.

Best regards
Loic
0 Likes
jferreira
Employee
Employee
10 sign-ins 5 sign-ins First like received
Hi Loic,

I just found that the order of the time members in the descriptor structure is wrong.
The one below should be correct.
/**
* ETH MAC DMA descriptor
*/
typedef struct XMC_ETH_MAC_DMA_DESC
{
uint32_t status; /**< DMA descriptor status */
uint32_t length; /**< Descriptor length */
uint32_t buffer1; /**< Buffer 1 */
uint32_t buffer2; /**< Buffer 2 */
uint32_t extended_status; /**< Extended status */
uint32_t reserved; /**< Reserved */
uint32_t time_stamp_nanoseconds; /**< Time stamp low */
uint32_t time_stamp_seconds; /**< Time stamp high */
} XMC_ETH_MAC_DMA_DESC_t;


Regards,
Jesus
0 Likes
Not applicable
Hi,

Thanks for that one.

I just noticed as well that there is a problem in the XMC_ETH_MAC_GetRxTimeStamp() and XMC_ETH_MAC_GetTxTimeStamp() as the scaling factor (1000000000.0F / 0x80000000U) is missing on the nanoseconds timestamp.
Also, these functions are really only usable in an ISR servicing the Ethernet packet reception or sending, otherwise, it is impossible to match a particular packet with the correct timestamp. This could be added to the documentation of the function.

In general, an example program (including PTP stack) or an application note would be really useful on how to use the IEEE1588 hardware on an XMC processor.

Best regards
Loic
0 Likes
Not applicable
Hi Jesus and Loic,

We are thinking of implementing IEEE1588 on XMC4500/4700 platform, but are not sure if there is a way to share PTP system time with other XMC hardware without adding time uncertainty introduced with serving ISR.
Some questions that have to be solved:
- is there a way to coordinate PTP system time with other fast timers in XMC core
- how to control (set/reset) output signal with PTP system timer without active involvement of uC core?
- is there a way to train PTP system time with external PPS signal?

A couple months ago I contacted Infineon support, case number 3551550, but the response was of no use.
I quote my inquiry.
...
We found many inconsistencies and the lack of the information in XMC4500 and XMC4[78]00 data sheets, user manual and application notes that cover Ethernet module, especial “system time” and “PPS output” functionality.
For example, in XMC4700 reference manual (pg. 1219/2892), register PPS_CONTROL is referenced but not defined.
Abovementioned register in explained in XMC4500 reference manual (pg. 1181/2675), but the output functionality signals that are controlled with PPS_CONTROL register, namely ptp_pps_o[0] to ptp_pps_o[3] are not specified in any document available on Infineon XMC controllers.
Another non documented function is “external timestamp input”, rm XMC4500, pg. 1174/2675 and ETH0_TIMESTAMP_STATUS pg. 1178/2675.

I kindly ask you for a document that describes behavior of abovementioned Ethernet MAC module on XMC4500 and XMC4700.
....

Your suggestions will be highly appreciated. Thank you in advance.
Best regards,
Dalibor
0 Likes
Not applicable
Hello, just checking if anyone has a suggestion.
0 Likes