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.

TMS320F28335: TMS320F28335

Part Number: TMS320F28335
Other Parts Discussed in Thread: TMS320F28379D,

Hey guys

I have a problem with creating deadtime in CCSv6.

The code bellow generating a three-level waveform, but I cannot add a delay or deadtime on it, by using DELAY_US(). what can I do about it?!

I don't wanna use EPWM modules due to a couple of reasons,

Thanks in advance

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

interrupt void cpu_timer0_isr(void)
{

realtime_sin=(0.9*(sin(0.00314*cnt)));//sin(2*3.14*50Hz*(cnt/100kHz));50Hz frequency shabake, 100khz frequency har intruppt.

////////////////////////////////////////////////////////////////////////////
if(cnt1<25)
{
realitime_triangle1=((float)(0.04*(cnt1)));
}
if(cnt1>24)
{
realitime_triangle1=((float)((-0.04*(cnt1))+2));
}
/////////////////////////////////////////////////////////////////////////
if(realtime_sin==0)
i++;
if((i%2)==0)
{
C=1;
NC=0;
}
else
{
C=0;
NC=1;
}
/////////////////
if(realtime_sin>realitime_triangle1)
{
B=1;
NB=0;
}
else
{
B=0;
NB=1;
}
///////////////////Gate signals//////////////////////////
LP1=(B & C);
LN1=(B & NC);

EALLOW;
GpioDataRegs.GPADAT.bit.GPIO1 = LP1;
EDIS;

EALLOW;
GpioDataRegs.GPADAT.bit.GPIO7 = LP1;
EDIS;

EALLOW;
GpioDataRegs.GPADAT.bit.GPIO3 = LN1;
EDIS;

EALLOW;
GpioDataRegs.GPADAT.bit.GPIO5 =  LN1;
EDIS;

cnt++;

cnt1++;

if(cnt>999)
cnt=0;
if(cnt1>49)
cnt1=0;

///////////////////////////////////////////////////////

// Acknowledge this interrupt to receive more interrupts from group 1
PieCtrlRegs.PIEACK.all = PIEACK_GROUP1;
}

  • Akbari,

    I would say that bit bashing a PWM waveform isn't the best idea, nonetheless it can be done. Using "DELAY_US()" isn't a good idea either, it will stall the CPU wasting cycles.

    If you don't want to use the ePWM modules that leaves us with two reasonable option, 1 eCAP and 2 CPU timers.

    The eCAP has an "APWM" mode of operation that allows basic PWM output, likely much better than you would achieve through toggling GPIOs. 

    If you have available CPU timers it would provide consistent way to measure delays between the GPIO toggles. It will also leave your CPU free to run application code.

    What is your justification for not using the ePWM module? I cannot think of a valid reason for not using the ePWM modules other than " I already allocated all of the ePWM modules and need another PWM output."

    Regards,
    Cody 

  • Thanks for your Reply Cody,

    The reason I am not using ePWM modules is that I am working on multilevel inverters. in Multilevel inverters, we need more than two carries which for level-shifted SPWM method, these carries need to be shifted in amplitude. Then, these carries should be compared to the Sin reference to produce proper signals for driving power switches. In multilevel inverters, one switch maybe needs to be turned on for more than one voltage level. Consider the simple T-type inverter shown in Fig. below. Switch S1 needs to be turned on to produce levels +2,+1. I tried to use ePWM modules to produce the gate signal for this switch, but the thing is it is not allowed to do logical operations (and, or, xor, ....) on GPIOs. So, I produce the gate signal and then assign it to the GPIO.

    I tried DELAY_US() but it just produces a delay, and I cannot produce dead-time intervals with it.

    All the best

    Amir

  • Amir,

    If you are OK switching to another device TMS320F28379D or any device in that family would be a good option. They all have the CLB(Configurable Logic Block) which specifically enabled logical combinations of PWM outputs. FYI CLB can do way more than that, but this is one of the possible use cases.

    Regards,
    Cody 

  • Dear Cody,

    Thanks for your reply,

    So, you mean we cannot use TMS320F28335 for multilevel inverters applications by using ePWM modules? I tried different ways but at the end of the day, I have to use my proposed procedure to produce gate signals.

    Thanks for your precious time

    Amir

  • Amir,

    no not at all. I have seen customers implement multilevel inverters on this device. While I cannot comment on the exact methodologies they use, it would either be done through code controlling the PWMs or explicit external logic(And, Or , etc.). The code could be interrupt or state machine based, but would use the PWM modules. I don't know of any one who has successfully used GPIOs to emulate as many PWMs as you are trying to do. 

    Regards,
    Cody 

  • Dear Cody,

    Thanks for your reply and time you spent to help me,

    Well, I guess I should try it with different methods! It is getting very annoying for me!

    All the best