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.
Hi,
I have set up my GPIO for PWM (1A/1B/2A/2B/3A/3B) for PWM output. During initilization, I have configured as PWMs.
0x00EEA555 //GPAMUX1 // For EPWM-1/2/3 Config.
0x 0000 0000 1110 1110 1010 0101 0101 0101 // Configured as PWM's
3B3A 2B2A 1B1A
0x3040E03F //GPADIR // For EPWM-1/2/3 Outputs instead of inputs.
0x 0011 0000 0100 0000 1110 0000 00 1 1 1 1 1 1
3B 3A 2B 2A 1B 1A
After the initilization is completed, I am using a function to update the PWM according to the period TBPRD and adjust the duty cycle and output the PWM.
// PWM1A & 1B are set to OUTPUT.
GpioDataRegs.GPADAT.bit.GPIO0 = 1; // EPWM - 1A
GpioDataRegs.GPADAT.bit.GPIO1 = 1; // EWPM - 1B
// PWM2A & 2B are set to OUTPUT
GpioDataRegs.GPADAT.bit.GPIO2 = 1; // EPWM - 2A
GpioDataRegs.GPADAT.bit.GPIO3 = 1; // EWPM - 2B
// PWM3A & 3B are set to OUTPUT
GpioDataRegs.GPADAT.bit.GPIO4 = 1; // EPWM - 3A
GpioDataRegs.GPADAT.bit.GPIO5 = 1; // EWPM - 3B
Problem : I see all the PWM outputs low? Any suggestion would be great help.
Regards,
Kuldeep
Hi Kuldeep,
1. I suggest you configure register-filed instead of assigning a big value to the register. It is more clear and easier for you to make changes later.
i.e.
GpioCtrlRegs.GPAMUX1.bit.GPIO0 = 1; // Configure GPIO0 as EPWM1A
GpioCtrlRegs.GPAMUX1.bit.GPIO1 = 1; // Configure GPIO1 as EPWM1B
...........
2. You don't need to configure 'GPADIR'. This register is only for GPIO, not for ePWM. Once you initialize a pin as ePWM pin, you don't have to worry about the direction, it is always ePWM output.
3. You have to set up ePWM interrupts properly (with PIE and System Interrupt) and use it as required in your application.
4. You can take a look at the example 'epwm_up_aq' from ControlSUITE. It should give you a better understanding of ePWM.
Regards,
Frank
Kuldeep,
Frank is right, you need to use GPxMUXy registers to configure the pins as PWM pins. Once you configure them as PWM pins you need to use the registers provided in PWM module to get the right PWM output. Please refer to PWM examples provided in control suite to help you get started.
Regards,
Manoj
Manoj Santha Mohan said:Please refer to PWM examples provided in control suite to help you get started.
As Manoj indicated, you can find PWM examples in the F28335 device support within controlSUITE.
An example would be found in <CONTROLSUITE_INSTALL_DIR>\device_support\f2833x\v132\DSP2833x_examples_ccsv4\epwm_up_aq