PWM generation using libpruio

89 views
Skip to first unread message

Akshay Gahlot

unread,
Nov 30, 2016, 12:30:41 AM11/30/16
to BeagleBoard
I want to use for PWM generation to control servo motor. The problem i m facing is :

To enable libpruio i m using this dts file 

To enable the pwm pin i m using cape-universaln 

These both files are kind of conflicting with each other as if one is loaded to slots then other is not loading.

If i do not load the cape-universaln i m not able to export the pwm pins.
 
Any help appreciated.

Greg

unread,
Nov 30, 2016, 7:07:00 AM11/30/16
to BeagleBoard
Are you using a recent Beagleboard image?  Beaglebone?

I haven't used libpruio, but I assume it uses the UIO kernel driver.
First, you will need to activate that driver.

This utility will help get it done:


You will need to clone the above to your board and make 2 very easy changes to text files.
Then you have to run the script in the above and re-boot.
Can perhaps guide you but need to know which kernel and which board you are using.
I didn't have to do anything to the Device tree for Remoteproc and PWM.  Hopefully the same
will be true for UIO.

Regarding the PWM, once again, have to assume you are using a recent Debian image.
The version 4 kernels require some steps to get the PWM exported.
I did this just a few days ago, and got it to work.  You need to look for:

/sys/class/pwm/pwmchip0

You need to export by something like:

echo 0 > export

Or it could be other numbers depending on which PWM.

I haven't found a concise reference for the above process, and how the export number maps to the particular PWM.
Perhaps someone else can point us to a good reference guide for this process.

Greg




Message has been deleted

TJF

unread,
Nov 30, 2016, 10:34:31 AM11/30/16
to BeagleBoard

Hi!


Am Mittwoch, 30. November 2016 06:30:41 UTC+1 schrieb Akshay Gahlot:
I want to use for PWM generation to control servo motor. The problem i m facing is :

To enable libpruio i m using this dts file 

To enable the pwm pin i m using cape-universaln 

These both files are kind of conflicting with each other as if one is loaded to slots then other is not loading.

AFAIR cape-universal enables all subsystems, including the PRUSS. So you don't need BB-BONE-PRU-01.
 

If i do not load the cape-universaln i m not able to export the pwm pins.

You need not export any pins when using libpruio. Just disable cape-universaln and load libpruio overlay instead. This has the same pinmuxing capabilities and will enable the PRUSS (just PRUSS, not all the other subsystems, in order to save power). For testing and in the development phase, you run your application with sudo (for pinmuxing). When finished, separate the configuration part from your source, add a line 'io->Init = io->Conf' after configuration and before deleting the libpruio instance, and compile it, in order to execute it in system init (for fixed pinmuxing). Then your app can run without root privileges. (Or use dts_custom.bas to create your customized device tree.)

Regards

PS:
Recent images don't support libpruio at all.
libpruio-0.2.2 is designed for kernel 3.8. It needs adaption for newer kernel versions. In kernel 4.x, PWMSS->ehrPWM generated PWM signals don't work. So it's best to stay with the latest 3.8 for now.

woody stanford

unread,
Jan 29, 2017, 4:23:27 PM1/29/17
to BeagleBoard
Break out your PWM on to a PIC16Fx (using it crystal-controlled with software-based PWM by counting the clock cycles per instruction) and then use UART to control it.

An alternative fix, but it does give you nice isolation in the process.

Depending on how powerful your servos are, you might have to 2 or 3 stage it with SSR's (solid state relay chips) or direct to MOSFET (Irfz24N is a nice cheap one, and use some beefy fast rectifiers going backward to null out the inductive blowback from the coils on stop).

Hobby servos can be controlled direct from a standard TTL level output btw.
Reply all
Reply to author
Forward
0 new messages