This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Trip zone 5 - piccolo

Hi all!

I'm trying to configure the TZ5 and I don't know if I do it wrong or test it wrong.

Here is what I'm doing:

// Set CLOCKFAIL
     SysCtrlRegs.CLKCTL.bit.NMIRESETSEL = 1;  // enable the generation of the CLOCKFAIL signal
     NmiIntruptRegs.NMICFG.bit.CLOCKFAIL = 1;  // CLOCKFAIL Interrupt Enabled
     NmiIntruptRegs.NMIWDPRD = 0xFFFF;            // default

// Enable Trip Zone    
     GpioCtrlRegs.GPAPUD.bit.GPIO16   = 0;     // Enable pullup on GPIO16
     GpioCtrlRegs.GPAQSEL2.bit.GPIO16 = 3;   // asynch input
     GpioCtrlRegs.GPAMUX2.bit.GPIO16  = 3;    // 3=TZ5

// Enable TZ5 as one cycle-by-cycle trip sources
   EALLOW;
   EPwm2Regs.TZSEL.bit.CBC5 = 1;
     
   // What do we want the TZ5 and TZ6 to do?
   EPwm2Regs.TZCTL.bit.TZA = TZ_FORCE_LO;
  
   // Enable TZ interrupt
   EPwm2Regs.TZEINT.bit.CBC = 1;
   EDIS;

interrupt void nmi_isr(void)
{
     NMIIntCount++;
// Clear the flags
   EALLOW;
   NmiIntruptRegs.NMIFLGCLR.bit.CLOCKFAIL = 1;
   NmiIntruptRegs.NMIFLGCLR.bit.NMIINT = 1;
   EDIS;
}

 

Somewhere in the code I force a clockfail:

EALLOW;
        NmiIntruptRegs.NMIFLGFRC.bit.CLOCKFAIL = 1;
EDIS;

 

I can see NMIIntCount was incremented, so the execution gets in the isr, but the PWM are not in low.I don't understand exactly how this should work, I thought TZ5 will first put the PWM in low and after that NMI_ISR will be executed.

Can somebody clarify this?

Thanks a lot,

Monica

 

  • Hallo,
    I have a similar problem using the 28035.
    I want to use the ClockFail internal signal as OSH5 Tripzone source, in order to stop PWMs outputs when the external quartz clock is missing.
    My configuration seems to work, but I can observe the following behavior:
    as soon as I disconnect the external quartz, the pwms show a frequency shift (as their clock source is suddenly changed), and only after about 1.5ms they go to the low level (desired behavior).
    It seems that the ClockFailure signal (that stops pwms) is issued some times after the source clock disconnection and for this reason there is no chance to stop the pwms immediately.
    In your experience, can this be true?
    Do I have some possibility to stop the pwms immediately?
  • Hi Davide,

    I remember I had a delay between the simulation of ClockFail and the reaction of the pwms, but I haven't tried to fix it, as the system could handle the delay. For the watchdog, I remember there is a possibility to set expire time, maybe you can find something like this too for NMI.

    Hope this helps,
    Monica