PWM on the Beagle

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

[1] http://elinux.org/EBC_Exercise_04_Pulse_Width_Modulation
[2] http://elinux.org/BeagleBoardPinMux

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] EBC Exercise 12 Pulse Width Modulation - eLinux.org
[2] BeagleBoardPinMux - eLinux.org

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

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:

Your device driver looks interesting. I plan to play with it when I have some time.

–Mark

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

Thank you for sharing with us.
Much appreciated.

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

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~!

Looks like i have to keep myself free this weekend to etch an extension board. :wink:

Thank you for linking to valuable resources.

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] Category:EmbeddedBeagleClass - eLinux.org
[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