PWM driver tested in RTEMS with RGB

punit vara punitvara at gmail.com
Fri Apr 15 19:48:02 UTC 2016


On Fri, Apr 15, 2016 at 12:35 AM, Martin Galvan
<martin.galvan at tallertechnologies.com> wrote:
>
> On Thu, Apr 14, 2016 at 1:34 PM, punit vara <punitvara at gmail.com> wrote:
> > Hi all !
> >
> > I had successfully merged the TI Starter Ware Code with RTEMS.
>
> That's great. Could you show us the resulting directory structure
> (perhaps with a diffstat), as well as the changes to Makefile.am?
>

This is my first patch I already sent you when I successfully merged TI SW code.

https://github.com/punitvara/rtems_gsoc16/tree/master/pwm/patch

2. Second patch which shows I added useful registers from TI SW header files

https://github.com/punitvara/rtems_gsoc16/blob/master/pwm/patch/0002-add-register-for-pwm-driver.patch

After above two patches I created testsuite

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

In this testsuite, LED is constantly glowing as I told. No matter what
counter I set or frequency set I am not able to get expected output.

3. Then I added three new function that can be seen in below patch.TI
Copy right is also added as Gedare Bloom suggested me.

https://github.com/punitvara/rtems_gsoc16/blob/master/pwm/patch/0001-PWM-successful-code-added.patch

You should look these definition in patch. I wrote this after first
failed testsuite.

- PWMSS_Setting
- ehrPWM_Enable
- ehrPWM_Disable
- EPWMPinMuxSetup  This last function I also used in first test case.

> > Then I tried
> > to test it with sample application with RGB. As a result I was able to glow
> > the LED with that code but unfortunately, LED was only glowing constantly.
> > It did not blink (at all !!!) according to duty cycle and frequency.
>
> Odd. Could you post your test program (or preferably a link to it)?
> Perhaps we can look into some of the APIs and see what's wrong.
>
> > Yesterday I written my own functions similarly as Worth Burruss suggested
> > me. But they are not exactly same as he told. Those functions are
> >
> > 1. To initialize PWM
> > 2. To Enable PWM
> > 3. To Disable PWM
> > 4. Pinmux for PWM module
> >
> > I have used some Ti Starter Ware clock config functions along with my own
> > written functions and successfully able to test PWM driver on RGB LED. Video
> > is uploaded on youtube and please find the link as below.
>
> So if I understand correctly, you were able to make this work by
> writing your own code to access the PWM instead of the StarterWare
> API? I'd like to see that code as well so we can compare it to
> StarterWare's.

Three functions I wrote are not enough to generate PWM. I have used
following definitions from TI SW code to generate PWM waveform.

- PWMSSModuleClkConfig()
- EHRPWMClockEnable()
- PWMSSTBClkEnable()

>
> > https://www.youtube.com/watch?v=KsdtgVj-ZxU
> >
> > Please let me know if is there any problems with video.
>
> Looks good!
>
> > Martin, you told there are problem with some functions it would be better if
> > you can share so that I can troubleshoot which TI Starter Ware code should I
> > edit. Any comments and suggestions from community members are most welcome.
> > I will soon share the code after suggestions or comments.
>
> I just ran a diff between our sources and the SW version we downloaded
> back then, found here:
>
> http://software-dl-1.ti.com/dsps/forms/self_cert_export.html?prod_no=AM335X_StarterWare_02_00_01_01_Setup.bin&ref_url=http://software-dl.ti.com/dsps/dsps_public_sw/am_bu/starterware/latest/
>
> (You need to register a free account to download it).
>
> From what I saw, most of the changes we did were removing unused code
> and fixing mostly cosmetic issues. I'm attaching the diff file so you
> can take a look at it. I think one of the most important differences
> are the changes in utils/delay.c; Sysdelay was replaced by usleep.
> Don't ask me why though, that was a long time ago and it wasn't me who
> did it :)
>
> I also saw that SW has a git repository, which seemingly has quite a
> few differences from the version we were using. Those seem to be
> mostly related to FatFS though.
>
> If I were you, I'd give the old SW code + our patch a shot, then if it
> works I'd try to replicate some of the changes on the SW git.
>
> Unfortunately, Marcos and I won't be able to test your progress
> because we don't have our BBBs available anymore. We can still review
> your code though, and I think Ben has a BBB if you want additional
> testing.
>
> On a related note, it would be better if you posted your progress on a
> single thread so it's easier to keep track of. No need to open a new
> one for each milestone.

>From now on wards I will reply on this thread so this would be easier
to track for you. Right now I added PWM APIs in
../libbsp/shared/include/gpio.h. Later on can be changed as community
suggest.

Please do let me know If  I am not proper with copy right or any
similar kind of issues. Function I wrote is inspired from below
reference.

https://github.com/VegetableAvenger/BBBIOlib

I hope there is no issue with licence.

As always I am always open to consider all comments and suggestions.
:-) Specially suggest me my next possible small task so I stay
focused. And Yes, Thanks for reviewing all my process.

Cheers,
Punit Vara



More information about the devel mailing list