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.

Configuring PWM Trip-Zone to One Shot Trip

Other Parts Discussed in Thread: MOTORWARE

I am using 2802F chip on a custom board. The GPIO17 is connected to external short circuit detect which goes low for 30ms. I am trying to configure the PWMs so that all three of them will be forced to low when short circuit is detected. 

So far I have added following code:

In hal.c

...

...

...

void HAL_setupFaults(HAL_Handle handle)
{
HAL_Obj *obj = (HAL_Obj *)handle;
uint_least8_t cnt;


// Configure Trip Mechanism for the Motor control software
// -Cycle by cycle trip on CPU halt
// -One shot fault trip zone
// These trips need to be repeated for EPWM1 ,2 & 3
//Might need to use this format:
//PWM_TripZoneSrc_OneShot_TZ2_NOT=(1 << 9),
//PWM_TripZoneSrc_OneShot_TZ3_NOT=(1 << 10),
//Instead of cycle by cycle.
for(cnt=0;cnt<3;cnt++)
{
PWM_enableTripZoneSrc(obj->pwmHandle[cnt],PWM_TripZoneSrc_CycleByCycle_TZ2_NOT);

//PWM_enableTripZoneSrc(obj->pwmHandle[cnt],PWM_TripZoneSrc_CycleByCycle_TZ3_NOT);


PWM_enableTripZoneSrc(obj->pwmHandle[cnt],PWM_TripZoneSrc_OneShot_TZ3_NOT);

// What do we want the OST/CBC events to do?
// TZA events can force EPWMxA
// TZB events can force EPWMxB

PWM_setTripZoneState_TZA(obj->pwmHandle[cnt],PWM_TripZoneState_EPWM_Low);
PWM_setTripZoneState_TZB(obj->pwmHandle[cnt],PWM_TripZoneState_EPWM_Low);
}

...

...

...

// SPI_SDO if JP6 is soldered, No Connection if JP6 is not soldered
//GPIO_setMode(obj->gpioHandle,GPIO_Number_17,GPIO_17_Mode_SPISOMIA);

// Setting up pin 17 for Short Ckt protection.
GPIO_setMode(obj->gpioHandle,GPIO_Number_17,GPIO_17_Mode_TZ3_NOT);

It is not working with this. Is there anywhere else that I need to add the code?

Also in the original code, 1. the comments talk about one shot trip for faults and cycle by cycle trip for CPU but in the code TZ2 and TZ3 are configured in cycle by cycle mode. 2. Trip for TZ6 was not configured in the original code, so is it taken care of somewhere else? Because on some older posts it was recommended to add that extra line, so I thought that it might be addressed in the latest release of MotorWare.

  • Nikhil,

    From an enablement POV I think every thing is there, my theory is that the signal may not be getting captured correctly due to input qualification.  When you set up the GPIO to be a TZ also add this function

    GPIO_setQualification(obj->GpioHandle, GPIO_Number_17, GPIO_Qual_ASync);

    This will let the signal on the pin go straight to the TZ module rather than get sync'd(and possibly missed) to the SYSCLK.

    Let me know if this fixes the problem.

    Best regards,

    Matthew

  • Hi Matthew, thanks for the reply. It seems that the missing qualification was the problem. I have added that and now the whole thing seems to be working fine :-)