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.

CCS/TMS320F28377D: INPUTXBAR & OUTPTXBAR how to set up equation

Part Number: TMS320F28377D


Tool/software: Code Composer Studio

Hi,

I am trying to do almost the same task as this previous forum:

I want to XOR three PWM signals. (PWM1A, PWM2A, PWM3A). and output the signal on GPIO6.

I understood it would be much easier to do it with CLB but unfortunately, I am using the F28377D MCU which is not compatible with the CLB feature. So I am left with the INPUTXBAR & OUTPTXBAR option. 

I figure out that I have to use Input XBAR to take the signal from the GPIO's back into the device. So I used the source for INPUTXBAR INPUT1/2/3 to be the GPIO number and then I have to do the equation for the XOR of the signals and place the output on GPIO. 

I am only confused about how to set up the equation and assign the output to OutputXbarRegs and which MUX I should use. So please help me out? 

 

EALLOW; 
  GpioCtrlRegs.GPAPUD.bit.GPIO0 = 1; // Disable pull-up
  GpioCtrlRegs.GPAMUX1.bit.GPIO0 = 1;  /* Configure GPIOGPIO0 as EPWM1A*/
  GpioCtrlRegs.GPAGMUX1.bit.GPIO0 = 0; 

  GpioCtrlRegs.GPAPUD.bit.GPIO2 = 1; // Disable pull-up
  GpioCtrlRegs.GPAMUX1.bit.GPIO2 = 1;  /* Configure GPIOGPIO0 as EPWM2A*/
  GpioCtrlRegs.GPAGMUX1.bit.GPIO2 = 0; 
  //GpioCtrlRegs.GPADIR.bit.GPIO2 = 0; 

  GpioCtrlRegs.GPAPUD.bit.GPIO4 = 1; // Disable pull-up
  GpioCtrlRegs.GPAMUX1.bit.GPIO4 = 1;  /* Configure GPIOGPIO0 as EPWM3A*/
  GpioCtrlRegs.GPAGMUX1.bit.GPIO4 = 0; 
  //GpioCtrlRegs.GPADIR.bit.GPIO4 = 0; 
                                                                                                 
  GpioCtrlRegs.GPAPUD.bit.GPIO6 = 1; // Disable pull-up                                                                                                                   
  GpioCtrlRegs.GPAMUX1.bit.GPIO6 = 1; // Configure GPIO6 as EPWM4A 
  //GpioCtrlRegs.GPADIR.bit.GPIO6 = 1; 
                                      
  InputXbarRegs.INPUT1SELECT = 0;  //Selecting GPIO0 to go to INPUT1 of InputXbar PWM1A
  InputXbarRegs.INPUT2SELECT = 2;  //Selecting GPIO2 to go to INPUT2 of InputXbar PWM2A
  InputXbarRegs.INPUT3SELECT = 4;  //Selecting GPIO4 to go to INPUT3 of InputXbar PWM3A

  /* I believe I should set up the XOR equation somewhere here and which MUX I should use*/

// Select INPUTXBAR2 from InputXbar to be the OUTPUT4MUX0TO15CFG=GPIO6  (MUX1=INPUTXBAR1)
  OutputXbarRegs.OUTPUT4MUX0TO15CFG.bit.MUX1 = 1;  
  OutputXbarRegs.OUTPUT4MUXENABLE.bit.MUX1 = 1;  // Enable Mux

// Select INPUTXBAR2 from InputXbar to be the OUTPUT4MUX0TO15CFG=GPIO6  (MUX3=INPUTXBAR2)
  OutputXbarRegs.OUTPUT4MUX0TO15CFG.bit.MUX3 = 1; 
  OutputXbarRegs.OUTPUT4MUXENABLE.bit.MUX3 = 1; // Enable Mux

// Select INPUTXBAR3 from InputXbar to be the OUTPUT4MUX0TO15CFG=GPIO6  (MUX5=INPUTXBAR3)
  OutputXbarRegs.OUTPUT4MUX0TO15CFG.bit.MUX5 = 1; 
  OutputXbarRegs.OUTPUT4MUXENABLE.bit.MUX5 = 1; // Enable Mux

  EDIS;