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.

Problem while doing ORing two square wave using GPIO pins and ePWM modules in 28335



Hi all,

I am facing problem while implementing logical 'OR' function in GPIO pin(GPIO 32)..I am generating two square wave wsing two ePWM modules(ePWM2A and ePWM3B) and in addition to that i am using extra 6 ePWM for generating signals(for Sine PWM)...But the width of resulting ORed waveform on GPIO pin is changing in spite of having the width of original square waveforms remain fixed...ORed code has been written in main program as follows

...

...

while(1)
{


   if(GpioDataRegs.GPADAT.bit.GPIO2 == 1 || GpioDataRegs.GPADAT.bit.GPIO5 == 1 )
   GpioDataRegs.GPBSET.bit.GPIO32 = 1;
   else GpioDataRegs.GPBCLEAR.bit.GPIO32 = 1;
  }

   

  • TANMOY DEB BARMA said:

    Hi all,

    I am facing problem while implementing logical 'OR' function in GPIO pin(GPIO 32)..I am generating two square wave wsing two ePWM modules(ePWM2A and ePWM3B) and in addition to that i am using extra 6 ePWM for generating signals(for Sine PWM)...But the width of resulting ORed waveform on GPIO pin is changing in spite of having the width of original square waveforms remain fixed...ORed code has been written in main program as follows

    ...

    ...

    while(1)
    {


       if(GpioDataRegs.GPADAT.bit.GPIO2 == 1 || GpioDataRegs.GPADAT.bit.GPIO5 == 1 )
       GpioDataRegs.GPBSET.bit.GPIO32 = 1;
       else GpioDataRegs.GPBCLEAR.bit.GPIO32 = 1;
      }

       

    Tanmoy,

    The while loop itself takes some time.   Since the GPIO2/5 change can happen during different portions of the while()  there will be some jitter / delay on the change of GPIO32.    This can change the width of the signal on GPIO32. 

    -Lori

  • Thanks Lori for your reply...I have realized the problem..but is there any possibility to develop a program with ORing function in 28335 with these signals...

  • Try reading both GPIO pins at the same time using GPADAT.all instead of each one individually using GPADAT.bit.  At least this way both pins will be read together.  I think this will do it:

    while(1)
    {
       if(GpioDataRegs.GPADAT.all & (BIT2 | BIT5))
       GpioDataRegs.GPBSET.bit.GPIO32 = 1;
       else GpioDataRegs.GPBCLEAR.bit.GPIO32 = 1;
    }

    You still have the issue of the while() loop time.  But the above will act like an OR gate with a propgation delay equal to the while() loop time.  Something like that.

    - David