AnsweredAssumed Answered

BF518: 1588 Receive Packet Detection Problem

Question asked by AlraWong on May 6, 2011
Latest reply on May 6, 2011 by JiangW

Hi,

 

          I configured the PTP_TSYNC module on BF518 for "IEEE 1588-2008(V2) Implementation Over MAC Layer".

 

          And i met a problem:

                         The transmit packet detection was OK,but i can't detect any receive PTP EVENT Packet .

                         The bit 1 of EMAC_PTP_IE Register is always 0 and Receive Snapshot Register is 0;

 

        

           My program is :

                         <Init >

  *pEMAC_PTP_TIMELO=0;
  *pEMAC_PTP_TIMEHI=0;

  //read sequenc ID at position 0x48 offset
  *pEMAC_PTP_ID_OFF =0x48;

  ////////////////////////////////
  // init blackfin PTP control register
  ////////////////////////////////
  /* For 1588 V2 on MAC */
  reg_value = 0x0E24170C;  
  *pEMAC_PTP_FOFF = reg_value;

  reg_value = 0x110488f7;   
  *pEMAC_PTP_FV1 = reg_value;

  reg_value = 0x0140013f;   

  *pEMAC_PTP_FV2 = reg_value;

  reg_value = 0x00000000;  
  *pEMAC_PTP_FV3 = reg_value;


  reg_value = 0x0042;   

  reg_value &= ~0x1100;      /* Enable EtherType mask */
  *pEMAC_PTP_CTL = reg_value;

 

  reg_value |= 1<<13;     /* Enable Clkout */
  reg_value |= 1<<1;      /* Enabe timestamp */
  reg_value |= 1<<0;      /* Enabe the module */

 


  *pEMAC_PTP_CTL = reg_value;

 

  aa = *pEMAC_PTP_TXSNAPLO;
  aa = *pEMAC_PTP_TXSNAPHI;

  aa = *pEMAC_PTP_RXSNAPLO;
  aa = *pEMAC_PTP_RXSNAPHI;

------------------------------------------------------------------------------------------------------

<receive>

  ptp_istat = *pEMAC_PTP_ISTAT;
  printk("ptp_istat = %04x\n",ptp_istat);
  if( ptp_istat & (1<<1) )
  {
   // read from LO before HI
   clock8 = *pEMAC_PTP_RXSNAPLO;
   temp8 = *pEMAC_PTP_RXSNAPHI;

 

   clock82 = clock8;
   temp82 = temp8;

 

   temp82 = temp82 <<32;
   clock82 = clock82 + temp82;

 

   retNumberOfSeconds2 = UINT64Divide(temp8,clock8,0,50000000);
   retNumberOfNanoSeconds2 = (clock82 - retNumberOfSeconds2 * 50000000) * 20;

   sequence_ID = *pEMAC_PTP_ID_SNAP;
   sequenceId    = sequence_ID<<8 & 0xff00;
   sequenceId    = sequence_ID>>8 & 0xff;
   //printk( "getRxStamp: second=%u, nanosecond=%u, sequenceid=%d\n", retNumberOfSeconds2, retNumberOfNanoSeconds2,sequenceId);
   if( ptp_istat & 0x00000010 )
   {
    *pEMAC_PTP_ISTAT |= 0x00000010; //write 1 to clear   
   }
   iosbuffgetrx[0] = 0xCA;
   iosbuffgetrx[1] = retNumberOfSeconds2;
   iosbuffgetrx[2] = retNumberOfNanoSeconds2;
   iosbuffgetrx[3] = sequenceId;
  }
  else
   iosbuffgetrx[0] = 0xCC;

 

------------------------------------------------------------------------------------------------------

Is any wrong there??

 

THX

Outcomes