PWM driver tested in RTEMS with RGB

punit vara punitvara at gmail.com
Fri May 27 19:53:54 UTC 2016


On Thu, May 12, 2016 at 6:55 PM, Martin Galvan
<martin.galvan at tallertechnologies.com> wrote:
> Hi Punit! Sorry I didn't answer, I was off sick for a couple days. Marcos
> and I are a bit crowded so we can't review every bit of your patch right now
> (plus we don't have our BBB anymore). Could you make the RGB test work using
> SW code only?
Hi all,

I tested test suite which only use TI SW API. Like as follow :

https://github.com/punitvara/rtems_gsoc16/blob/master/pwm/fail.c

Whatever frequency  I change LED glows continuously only. In between
CMPA or CMPB whichever is higher , that respective EPWMA or EPWMB is
more brighter.That is the only difference I found out.

Second test case which is with custom function not with TI SW only :

https://github.com/punitvara/rtems_gsoc16/blob/master/pwm/success.c

Here whatever frequency I pass as argument , LED blinks at same rate.
There is no difference. If I set different duty cycle for EPWMA and
EPWMB, LED glowing time is more for which duty cycle is higher. But it
seems in this case PWM wave generates , not sure at which frequency.

To calculate frequency(UP or DOWN count only) equation is

TPWM = (TBPRD + 1) x TBCLK
FPWM = 1/TPWM

In program we need to assign value to TBPRD register.

Another important equation to remember is

TBCLK = SYSCLKOUT/(HSPCLKDIV *CLKDIV)

How to calculate duty cycle ?

Simply value need to pass to CMPA or CMPB register.

I am trying to generate testcase which can generate different
frequencies with different duty cycle on LED with TI SW. I tried to
debug with printf but dont know how to use that results. Can you
suggest me any test cases so that I can able to find what is the
problem with code ? Any conclusion why in one case LED just blinks and
in another it just glows continuous. ?

Any help will be appreciated. :-)

Thank you,
Punit Vara


More information about the devel mailing list