-
Sep 2nd, 2020 03:51 AM
#1
New Member
Can't Get Timestamp of IEEE 1588 on XMC4700
Hello everone,
We are implementing IEEE 1588 time sync on XMC4700 relax kit, we base on the DAVE example source code named "HTTP_SERVER_RTOS_XMC47". Our main function is as in the embedded code (print out timestamp of transmitted frame).
However, we always have same output, like "frame transmitted at 0 second, 4 nanosecond", this output only varies when I remove "malloc".
Inside the XMC_ETH_MAC_InitPTP function, I realized that the below assignment, the value of eth_mac->regs->TIMESTAMP_CONTROL always keeps 0, no mater what value I gave to the variable "config".
eth_mac->regs->TIMESTAMP_CONTROL = ETH_TIMESTAMP_CONTROL_TSENA_Msk | ETH_TIMESTAMP_CONTROL_TSCTRLSSR_Msk | config;
So my questions:
- Would any of you have solution?
- Is it possible/better to develop 1588 application without using library (like without using XMC_ETH_MAC_InitPTP from /HTTP_SERVER_RTOS_XMC47/Libraries/XMCLib/inc/xmc_eth_mac.h)? I mean we read/write register by ourself by refering the document "Reference Manual of XMC4700/XMC4800 Microcontroller" (the pdf with ~2893 pages)?
Thanks so much in advance for your help!
Thi
Code:
////////////////////////////we define///////////////////////////
#define MAC_ADDR0 0x8C
#define MAC_ADDR1 0x04
#define MAC_ADDR2 0xBA
#define MAC_ADDR3 0x17
#define MAC_ADDR4 0x8A
#define MAC_ADDR5 0x4A
#define MAC_ADDR ((uint64_t)MAC_ADDR0 | \
((uint64_t)MAC_ADDR1 << 8) | \
((uint64_t)MAC_ADDR2 << 16) | \
((uint64_t)MAC_ADDR3 << 24) | \
((uint64_t)MAC_ADDR4 << 32) | \
((uint64_t)MAC_ADDR5 << 40))
#define XMC_ETH_MAC_NUM_RX_BUF (4)
#define XMC_ETH_MAC_NUM_TX_BUF (4)
static __attribute__((aligned(4))) XMC_ETH_MAC_DMA_DESC_t rx_desc[XMC_ETH_MAC_NUM_RX_BUF] __attribute__((section ("ETH_RAM")));
static __attribute__((aligned(4))) XMC_ETH_MAC_DMA_DESC_t tx_desc[XMC_ETH_MAC_NUM_TX_BUF] __attribute__((section ("ETH_RAM")));
static __attribute__((aligned(4))) uint8_t rx_buf[XMC_ETH_MAC_NUM_RX_BUF][XMC_ETH_MAC_BUF_SIZE] __attribute__((section ("ETH_RAM")));
static __attribute__((aligned(4))) uint8_t tx_buf[XMC_ETH_MAC_NUM_TX_BUF][XMC_ETH_MAC_BUF_SIZE] __attribute__((section ("ETH_RAM")));
////////////////////////////we define///////////////////////////
int main(void)
{
DAVE_STATUS_t status;
status = DAVE_Init();
if(status != DAVE_STATUS_SUCCESS)
{
XMC_DEBUG("DAVE APPs initialization failed\n");
while(1U)
{
}
}
cgi_init();
ssi_init();
osThreadCreate (osThread(main_thread), NULL);
////////////////////////// our 1588 code ////////////////////////////
XMC_ETH_MAC_TIME_t *txTime;
char data[10];
uint32_t config = (uint32_t)ETH_TIMESTAMP_CONTROL_TSENALL_Msk;
memset(data, '\0', 10);
snprintf(data, 10, "%s", "mydata");
txTime = (XMC_ETH_MAC_TIME_t*)malloc(sizeof(XMC_ETH_MAC_TIME_t));
XMC_ETH_MAC_t ethMac =
{
.regs = ETH0,
.address = MAC_ADDR,
.rx_desc = rx_desc,
.tx_desc = tx_desc,
.rx_buf = &rx_buf[0][0],
.tx_buf = &tx_buf[0][0],
.num_rx_buf = XMC_ETH_MAC_NUM_RX_BUF,
.num_tx_buf = XMC_ETH_MAC_NUM_TX_BUF
};
XMC_ETH_MAC_InitPTP(ðMac, config);
lwip_send(0, data, sizeof(data), 1);
XMC_ETH_MAC_GetTxTimeStamp(ðMac, txTime);
printf("transmitted at %"PRIu32" second, %"PRIu32" nanosecond \n", txTime->seconds, txTime->nanoseconds);
////////////////////////// our 1588 code ////////////////////////////
osKernelStart();
}
Disclaimer
All content and materials on this site are provided “as is“. Infineon makes no warranties or
representations with regard to this content and these materials of any kind, whether express or
implied, including without limitation, warranties or representations of merchantability, fitness for
a particular purpose, title and non-infringement of any third party intellectual property right. No
license, whether express or implied, is granted by Infineon. Use of the information on this site may
require a license from a third party, or a license from Infineon.
Infineon accepts no liability for the content and materials on this site being accurate, complete or up-
to-date or for the contents of external links. Infineon distances itself expressly from the contents of
the linked pages, over the structure of which Infineon has no control.
Content on this site may contain or be subject to specific guidelines or limitations on use. All postings
and use of the content on this site are subject to the Usage Terms of the site; third parties using
this content agree to abide by any limitations or guidelines and to comply with the Usage Terms of
this site. Infineon reserves the right to make corrections, deletions, modifications, enhancements,
improvements and other changes to the content and materials, its products, programs and services
at any time or to move or discontinue any content, products, programs, or services without notice.
Bookmarks