AnsweredAssumed Answered

LPC54606 ENET MAC timestamp trigger interrupt

Question asked by liang chen on Mar 18, 2019
Latest reply on Jun 20, 2019 by soledad

Hi

    In LPC54606 manual "36.7.11.8.2 System time correction"

To synchronize or update the system time to reduce system-time jitter (fine correction
method), complete the following steps:
1. With the help of the algorithm explained in
Section 36.7.8.9 “System time register
module”
, calculate the rate by which you want to make the system time increments
slower or faster.
2. Update the MAC timestamp addend register
Table 813 with the new value and set bit
5 of the MAC timestamp control register
Table 806.
3. Wait for the time for which you want the new value of the addend register to be active.
You can do this by enabling the timestamp trigger interrupt after the system time
reaches the target value.
4. Enable the timestamp interrupt in bit 12 of MAC interrupt enable register
Table 789.

I don't understand "enabling the timestamp trigger interrupt after the system time reaches the target value"

1 which reg should i set the target second and nanosecond?  i cann't find in the manual.

2 how do I install the callback function for timestamp interrupt trigger ?

  I see in the fsl_enet.c(SDK 2.4.1) function ENET_IRQHandler, sames there is only one callback hold by "handle->callback", but there are multiple interrupt events,

void ENET_IRQHandler(ENET_Type *base, enet_handle_t *handle)
{
    /* Check for the interrupt source type. */
    /* DMA CHANNEL 0. */
    if (base->DMA_INTR_STAT & ENET_DMA_INTR_STAT_DC0IS_MASK)
    {
        ...
                handle->callback(base, handle, kENET_RxIntEvent, 0, handle->userData);
        ....
    }

    /* DMA CHANNEL 1. */
    if (base->DMA_INTR_STAT & ENET_DMA_INTR_STAT_DC1IS_MASK)
    {
        ...
                handle->callback(base, handle, kENET_RxIntEvent, 1, handle->userData);
        ...
    }

#ifdef ENET_PTP1588FEATURE_REQUIRED
    /* MAC TIMESTAMP. */
    if (base->DMA_INTR_STAT & ENET_DMA_INTR_STAT_MACIS_MASK)
    {
        if (base->MAC_INTR_STAT & ENET_MAC_INTR_STAT_TSIS_MASK)
        {
            if (handle->callback)
            {
                handle->callback(base, handle, kENET_TimeStampIntEvent, 0, handle->userData);
            }
        }
    }
...
}

 

I see in ethernetif.c:

static void enet_init(struct netif *netif, struct ethernetif *ethernetif,
                      const ethernetif_config_t *ethernetifConfig)
{

...

/* Create the handler. */
#if USE_RTOS && defined(FSL_RTOS_FREE_RTOS)
    ENET_EnableInterrupts(ethernetif->base, kENET_DmaTx | kENET_DmaRx);
    ENET_CreateHandler(ethernetif->base, &ethernetif->handle, &config, &buffCfg[0], ethernet_callback, netif);
#endif

...

use "ENET_CreateHandler" to install callback for timestamp interrupt trigger event? if so , what the value of "enet_config_t *config, enet_buffer_config_t *bufferConfig" should input?

thanks very much.

Outcomes