PWM Driver in BeagleBone

Hi,

I have been trying to work with PWM in my beaglebone for a while, and
no success at all!

So here are the things I have tried and no success:

1 - I tried to use the Cloud9 IDE and write a simple script which uses
GPIO - P8_13 ! but clearly it didn't work because I am using
digitalWrite which is not the PWM ideal write, as far as I am
concerned PWM need a analogWrite, which I didnt find in that Node.js
API.

2 - I tried to use this http://dominion.thruhere.net/koen/cms/using-the-analog-pins-on-a-beaglebone
to use anolog input, but it didnt work either.

3 - I have tried this http://elinux.org/BeagleBoard/GSoC/2010_Projects/Pulse_Width_Modulation
which doesnt work when I tried to run 'make'
I got this error:

root@beaglebone:~/omap3-pwm# make
make -C /tmp/sysroots/overo-angstrom-linux-gnueabi/kernel M=/home/root/
omap3-pwm modules
make: *** /tmp/sysroots/overo-angstrom-linux-gnueabi/kernel: No such
file or directory. Stop.
make: *** [default] Error 2

So I have no idea what is missing! this kernel folder should be
somewhere in the Angstrom distribution ?

4 - I tried to get that kernel folder like this:

git clone git://git.angstrom-distribution.org/setup-scripts
cd setup-scripts
./oebb.sh config beaglebone
MACHINE=beaglebone ./oebb.sh bitbake systemd-image

However this doesnt work, because bitbake was saying that it need
Python 2.6 ! which should be already ok because Angstrom has python
2.7 !

So as u guys can see I am really lost over here!

Any help will be really appreciated!

Again, my main goal for this is try to make PWM work in my beagle-bone
board!

thanks

I have just been working on this problem myself. You need to download
the setup-scripts as you did, but you need to run:

$ MACHINE=beaglebone ./oebb.sh config beaglebone
$ MACHINE=beaglebone ./oebb.sh update
$ MACHINE=beaglebone ./oebb.sh bitbake virtual/kernel

These will build the actual images for the bone, when you want to
deploy:
$ MACHINE=beaglebone ./oebb.sh bitbake console-image
$ MACHINE=beaglebone ./oebb.sh bitbake systemd-gnome-image

This will setup the whole kernel source, not just the images, so it
builds all of the modules and the cross compiler toolchain. This
takes several GB of space and it will take a little while to complete.

From there you can download the driver...I forked the repo in the
article you posted and made some changes in it, as the kernel version
it was design for is older, and the drivers would not compile on the
bone (i.e. in later versions of the kernel the .ioctl kernel call must
be .unlocked_ioctl). You can get it from:

$ git clone git://github.com/jyore/omap3-pwm.git
$ cd omap3-pwm

I was able to get the driver to build and load on the BeagleBone,
however, it errored during use, as I expected do to the fact that I
had not messed with the pin configs yet.

Which brings me to this point: I am having trouble tracking down the
correct place to modify the pin configuration and device
configuration. I believe the CONFIG_OMAP_RESET_CLOCKS parameter must
be changed, and the pin mux must be set in order for the driver to
work correctly...anyone have any suggestions on this part?

-joey

From quickly glancing over the AM3359 datasheet (http://www.ti.com/lit/
ug/spruh73c/spruh73c.pdf), it looks like the whole PWM subsystem has
much changed from how it was in the 3530 of the beagleboard. Also,
other things might have changed, like the memory address for the pin
muxing registers etc. So, I do not expect this code to work
immediately.
Unfortunately, I lack the skills and the time to fix this, and I am
hoping someone can come up with a solution that we can all use.

Andre

ah, I see the thread at http://groups.google.com/group/beagleboard/browse_thread/thread/6a529febb7703072
has much more progress.

Yeah, I saw noticed the same thing when I actually started to look at
the pin muxing...referring to your link, looks like something should
be released next week. Hopefully that will stand.

Hi jyore, thanks for the reply! so the final deal is, should i keep watching that new thread?there is no solution so far for PWM in beagle bone?

Also I have a really dum question, this commands:

$ MACHINE=beaglebone ./oebb.sh config beaglebone
$ MACHINE=beaglebone ./oebb.sh update
$ MACHINE=beaglebone ./oebb.sh bitbake virtual/kernel

These will build the actual images for the bone, when you want to
deploy:
$ MACHINE=beaglebone ./oebb.sh bitbake console-image
$ MACHINE=beaglebone ./oebb.sh bitbake systemd-gnome-image

I have to run in my local PC? or inside the board(via ssh) ??

thanks

Those are run on your local machine in order to setup the kernel source and cross compiler. With it, you can cross compile modules for the beaglebone, and also generate new images with certain modules/muxes/etc setup.