PWM on the Beagle

127 views
Skip to first unread message

Mark A. Yoder

unread,
Jul 25, 2011, 3:08:08 PM7/25/11
to beagl...@googlegroups.com
I've gotten PWM working on the Beagle.  Notes are here [1].  The biggest challenge was getting the pinMUX set right.  There are good notes on the pinMUX here [2].  I'm running 2.6.32 of the kernel, and had trouble setting the MUX from the kernel.  However, I was able to set it from u-boot.  Watch out though, in u-boot, board/ti/beagle/beagle.h defines the pins in multiple places so you have to be sure to set them in the correct places.

--Mark

Jason Kridner

unread,
Jul 25, 2011, 4:50:24 PM7/25/11
to beagl...@googlegroups.com
On Mon, Jul 25, 2011 at 3:08 PM, Mark A. Yoder <mark.a...@gmail.com> wrote:
> I've gotten PWM working on the Beagle.  Notes are here [1].  The biggest
> challenge was getting the pinMUX set right.  There are good notes on the
> pinMUX here [2].  I'm running 2.6.32 of the kernel, and had trouble setting
> the MUX from the kernel.

At some point, can you come back and try with the newer 3.0 kernels
and mainline u-boot and report if any issues keeping you from setting
the pinmux from the kernel are still there? Or, at least, could you
provide a bit of debug information on the trouble you did see? We
should only be relying on u-boot for a start-up mux setting and
reconfiguring the mux in the kernel should be a reasonable thing to
expect we can do.

> However, I was able to set it from u-boot.  Watch
> out though, in u-boot, board/ti/beagle/beagle.h defines the pins in multiple
> places so you have to be sure to set them in the correct places.
> --Mark
> [1] http://elinux.org/EBC_Exercise_04_Pulse_Width_Modulation
> [2] http://elinux.org/BeagleBoardPinMux

It is a start! I'd say this is a somewhat interesting (due to the
clear exercise material) though not particularly thorough job of
covering the topic of PWM on the BeagleBoard. It does show some
specific working code from userspace given a certain kernel and system
build, but I suspect the treatment is not complete enough for typical
new users to debug their issues outside of your given starting point.

Is there a chance you can talk more about the structure of the timers
and give some analysis on the limitations of using GPIOs vs. different
types of timers?

There is some interesting and not completely thought out discussion
on-going regarding the best API for performing PWM in Linux. I
believe the hacks being done in userspace to directly program the
timer aren't the best to enable your documentation to work on new
platforms, to ease newbie issues or to simplify userspace software
that extends beyond the PWM capabilities (such as limited number of
I/Os) the hardware timers provide. The ePWM controllers on the AM1808
would be an interesting contrast.

Is there a chance you can give a bit of treatment to the PWM proposals
from Bill Gatliff [3] and Sasha Hauer [4]?

[3] http://git.billgatliff.com/pwm.git/?p=pwm.git;a=commit;h=a49cbfff0fa09bff40d328f8985a0a7a7b951d6f
[4] http://git.pengutronix.de/?p=imx/linux-2.6.git;a=commit;h=137654cde98a2ffe548f47f02e7fde512bc2091c

Julia Agius

unread,
Jul 25, 2011, 9:17:02 PM7/25/11
to Beagle Board


On Jul 25, 3:08 pm, "Mark A. Yoder" <mark.a.yo...@gmail.com> wrote:
> I've gotten PWM working on the Beagle.  Notes are here [1].  The biggest
> challenge was getting the pinMUX set right.  There are good notes on the
> pinMUX here [2].  I'm running 2.6.32 of the kernel, and had trouble setting
> the MUX from the kernel.  However, I was able to set it from u-boot.  Watch
> out though, in u-boot, *board/ti/beagle/beagle.h* defines the pins in
> multiple places so you have to be sure to set them in the correct places.

I have a device driver that can set the control module configuration
register, aka the mux, on the OMAP 35xx processor.
This allows configuring the mux from user space the mode (from mode 0
to mode 7) for individual pins.

Source code:
http://github.com/ftagius/OMAP-cmpc

Mark A. Yoder

unread,
Jul 26, 2011, 4:33:40 PM7/26/11
to beagl...@googlegroups.com
Your device driver looks interesting.  I plan to play with it when I have some time.

--Mark

Mark A. Yoder

unread,
Jul 26, 2011, 4:43:16 PM7/26/11
to beagl...@googlegroups.com
One of my projects for the summer is to create some simple exercises for my students that involve common embedded things on the BeagleBoard.  You can follow my work here [1].  (You can even add to it!)

My most recent addition is some simple I2C.  I hooked a couple of TC74[2] I2C based temperature sensors to the I2C 2 bus on the Beagle.  The exercise shows how to find the devices using i2cdetect and how to read them with i2cget.

I also have some C code that shows how to use open and ioctl to read the devices.

Enjoy...

--Mark

Aadeesh Bhagwatkar

unread,
Jul 26, 2011, 11:57:58 PM7/26/11
to beagl...@googlegroups.com
Thank you for sharing with us.
Much appreciated.


--
You received this message because you are subscribed to the Google Groups "Beagle Board" group.
To view this discussion on the web visit https://groups.google.com/d/msg/beagleboard/-/JDRht5f37EcJ.
To post to this group, send email to beagl...@googlegroups.com.
To unsubscribe from this group, send email to beagleboard...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/beagleboard?hl=en.



--
Aadeesh S. Bhagwatkar

Naveen Dhawan

unread,
Jul 27, 2011, 2:14:12 AM7/27/11
to Beagle Board
You guys should try Scott Ellis's website from Gumstix forum, he does
some work for them and they use the same SoC as the beagleboard does
and I've been able to edit and compile his code to work on the
beagleboard with no problem. He also has a nice tutorial on PIN
Muxing from the userspace which will help you just to play with the
pins.

His website: http://www.jumpnowtek.com/index.php?option=com_content&view=article&id=56&Itemid=63
Here is a robot that I built that uses the beagleboard (shameless self
promoting was a factor in this post): http://www.youtube.com/watch?v=s30nM-P5LrU

On Jul 26, 11:57 pm, Aadeesh Bhagwatkar <aadees...@gmail.com> wrote:
> Thank you for sharing with us.
> Much appreciated.
>

Aadeesh Bhagwatkar

unread,
Jul 27, 2011, 9:07:01 AM7/27/11
to beagl...@googlegroups.com
Looks like i have to keep myself free this weekend to etch an extension board. ;-)

Thank you for linking to valuable resources.

James

unread,
Jul 27, 2011, 2:53:13 AM7/27/11
to beagl...@googlegroups.com

Hi Mark,

Thanks for sharing and I hope to see more exercise towards writing
device drivers for the platform for the various buses. i.e. i2c, spi,
uart, pci etc..

Using the TC74 should be a good start for this exercise.

I'm a newbies and hope to see more of such exercises and tutorials to
clear the mystery behind writing such device driver that are commonly
encountered in embedded project. Writing for MCU is direct but with an
OS is a different learning curve.

Cheers~!

--
Regards,
James

Bill Traynor

unread,
Jul 27, 2011, 11:10:12 AM7/27/11
to beagl...@googlegroups.com
On Wed, Jul 27, 2011 at 02:53, James <angwe...@gmail.com> wrote:
> On Wed, Jul 27, 2011 at 4:43 AM, Mark A. Yoder <mark.a...@gmail.com> wrote:
>> One of my projects for the summer is to create some simple exercises for my
>> students that involve common embedded things on the BeagleBoard.  You can
>> follow my work here [1].  (You can even add to it!)
>> My most recent addition is some simple I2C.  I hooked a couple of TC74[2]
>> I2C based temperature sensors to the I2C 2 bus on the Beagle.  The exercise
>> shows how to find the devices using i2cdetect and how to read them with
>> i2cget.
>> I also have some C code that shows how to use open and ioctl to read the
>> devices.
>> Enjoy...
>> --Mark
>> [1] http://elinux.org/index.php?title=Category:EmbeddedBeagleClass
>> [2] http://www.microchip.com/wwwproducts/Devices.aspx?dDocName=en010749
>>
>
> Hi Mark,
>
> Thanks for sharing and I hope to see more exercise towards writing
> device drivers for the platform for the various buses. i.e. i2c, spi,
> uart, pci etc..

I've added a TutorialWishlist page for compilation of Tutorials that
people would like to see:

http://elinux.org/TutorialWishlist


>
> Using the TC74 should be a good start for this exercise.
>
> I'm a newbies and hope to see more of such exercises and tutorials to
> clear the mystery behind writing such device driver that are commonly
> encountered in embedded project. Writing for MCU is direct but with an
> OS is a different learning curve.
>
> Cheers~!
>
> --
> Regards,
> James
>

Reply all
Reply to author
Forward
0 new messages