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,
Is it possible to produce a floating point PWM signal below 1 Hz with DSP? (for example 0.575 Hz)
Thanks,
Sinan,
Best regards.
Hi Sinan,
Typically low frequency PWM operation (below 250 kHz) does not require HRPWM; the normal capabilities of EPWM are enough. Is this a requirement in your system?
Best Regards,
Marlyn
Hi, Marlyn:
Yes, it's a requirement on my system. When I looked at the EPWM section in TRM, I could not create the low frequency (for example 0.575 Hz) I wanted with the formulas. Probably, DSP doesn't support low frequency.
Thanks,
Sinan.
Hi Sinan,
You could try the below as an example:
In up-down count mode,
TPWM = 2(TBPRD)(TTBCLK)
TTBCLK = 1/ (EPWMCLK/(HSPCLKDIV * CLKDIV))
EPWMCLK can be configured to SYSCLKOUT/2 through the EPWMCLKDIV bit. If your SYSCLKOUT is 200Mz, then EPWMCLK will be 100MHz.
The max value HSPCLKDIV can be is 14, and for CLKDIV its 128.
HSPCLKDIV * CLKDIV = 1792
TBCLK = EPWMCLK / (HSPCLKDIV * CLKDIV) = 100M / 1792 = 55803.6
TTBCLK = 1/TBCLK = 1/55803.6 = .000018
Your desired frequency is .575 Hz so TPWM = 1/.575 = 1.73913
We can use the first equation [TPWM = 2(TBPRD)(TTBCLK)] to solve for TBPRD now
TBPRD = TPWM / (2*TTBCLK) = 1.73913 / (2*.000018) = 48309
This is the above in code:
// Set EPWMCLK to SYSCLKOUT/2. If SYSCLKOUT is 200MHz, EPWMCLK will be 100MHz SysCtl_setEPWMClockDivider(SYSCTL_EPWMCLK_DIV_2); // Within EPWM Initialization: Setup HSPCLKDIV and CLKDIV EPWM_setClockPrescaler(myEPWM1_BASE, EPWM_CLOCK_DIVIDER_128, EPWM_HSCLOCK_DIVIDER_14); // Within EPWM Initialization: Setup Count mode and TBPRD EPWM_setTimeBaseCounterMode(myEPWM1_BASE, EPWM_COUNTER_MODE_UP_DOWN); EPWM_setTimeBasePeriod(myEPWM1_BASE, 48309);
Best Regards,
Marlyn