PPS generation using ENET timer

achal

New member
I have written this code for generating PPS on pin AD_B0_12 (pin 24 of teensy), but it's not getting generated please help.
// DPS_DCO PPS generation through
// peripherial: ENET_1588_EVENT1_OUT
// IOMUX: ALT6,
// teensy pin: 24

Serial.println("pps_generate");

IOMUXC_SW_MUX_CTL_PAD_GPIO_AD_B0_12 = 6;
/*--- route AD_B0_12 to 1588 timer ---*/

/*--- wait for disable to cross clock domains ---*/
while(ENET_TCSR1 & ENET_TCSR_TMODE_MASK) {}
asm("dsb"); /* allow write to complete thus add Data Synchronise Barrier */

ENET_TCCR1 = PPStoDCOPulseOffset; /* load the offset vale for pps generation */
asm("dsb"); /* allow write to complete thus add Data Synchronise Barrier */
char buffer[50];

sprintf( buffer, "\r\n[%lX] ENET_TCSR1 before\r\n",ENET_TCSR1 );
Serial.println(buffer);

/*--- enable rising edge and interrupts from GPS PPS ---*/

ENET_TCSR1 = ENET_TCSR_TPWC(31);

asm("dsb"); /* allow write to complete thus add Data Synchronise Barrier */

// ENET_TCSR_TMODE_OC_PULSE1 = (0b1111<<2)

ENET_TCSR1 = ENET_TCSR1|ENET_TCSR_TMODE_OC_PULSE1;

asm("dsb"); /* allow write to complete thus add Data Synchronise Barrier */

while( (ENET_TCSR1 & ENET_TCSR_TMODE_OC_PULSE1) != ENET_TCSR_TMODE_OC_PULSE1)
{
}

sprintf( buffer, "\r\n[%lX] ENET_TCSR1 after\r\n",ENET_TCSR1 );

Serial.println(buffer);
 

Attachments

  • MVME2C_iMXRT1062.cpp
    32.3 KB · Views: 6
Back
Top