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.

About clear the trip zone flag on TMS320F28035

I have a TMS320F28035-based motor control board and following code for fault trip when PWMs is low

void B1(void) // Toggle GPIO-00
//----------------------------------------
{
if(EPwm1Regs.TZFLG.bit.OST == 0x1) // TripZ for PWMs is low (fault trip)
{
TripFlagDMC=1;
GpioDataRegs.GPBTOGGLE.bit.GPIO42 = 1;
}

GpioDataRegs.GPBTOGGLE.bit.GPIO34 = 1; // Turn on/off LD3 on the controlCARD
//-----------------
//the next time CpuTimer1 'counter' reaches Period value go to B2
B_Task_Ptr = &B2;
//-----------------
}

After the TZFLG is tripggered, I was trying to clear the flag, but once I clear it, it will automatically come back until I reset the power. Is there any other way to clear the flag by re-initializing some parameter instead of reset the chip?

  • Huaping Wang,

    It looks like you are trying to reset one of the /TZ inputs by writing to the GPIO pin directly. Normally, an I/O pin intended for use as a Ttrip zone would be configured as an input, in which case writing to the appropriate GPSET/CLEAR/TOGGLE register bits won't have any effect. BTW, I see you are writing to GPIO42, but that pin is not allocated to a TZ function on any package.

    The correct way to recover from a one-shot trip event is to leave the GPIO registers alone and write to the appropriate bit in the TZCLR register. Providing the physical trip condition has disappeared the TZ flag will be cleared.

    Regards,

    Richard
  • Richard,
    That GPIO42 is used for control the LED. not for clearing the flag purpose. I have another code for clearing the flag as following:
    EPwm1Regs.TZCLR.bit.OST = 1;
    Here is the story:
    I have an over current circuit that is used for over current protection. When this over current is triggered. The IGBT module will be turned off by outpu of over current circuit and at the same time, this PWMs low signal will be detected and then the TZFLG will be set to 1.

    First, I will clear the over current flag connected to the power module and then I clear the TZFLG. However, once it was cleared, the TZFLG will be set again.

    Regards,

    Huaping

  • Huaping Wang,

    Thanks for the clarification.  What is the physical condition at the pin when you write to the TZCLR register?  If it's still low the trip will happen again immediately and you can't reset it.

    You can test for the pin condition at any time on the GPxDAT register.

    Regards,

    Richard