Enabling 4 PWM Pins?

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
Billwaa
 
Posts: 10
Joined: Wed Apr 16, 2014 11:10 pm

Enabling 4 PWM Pins?

Post by Billwaa »

Hi,

Sorry, I have been asking lots of questions lately regarding BBB for my quadcopter projcet.
I was using a Micro Maestro 6-Ch Servo Controller through Serial to control the motors on the aircraft.
It is quite slow (50 Hz) and cause a massive time delay on the control loop which drive the thing unstable.

So in an attempt to solve that, I was trying to use BBB's on-board PWM pins.
However, I was only able to enable 1 pin from each chip: P9_14, P9_21, P8_23.
Enabling others causes and error saying that I didn't start the pwm pins...

All of them are running the same frequency, just different duty cycle output by the controller.

Is there a way I can enable a 4th pin? Or if not, are there any pwm controller that's fast?
Preferrablely 300+ Hz?

I am so close on getting the quadcopter flying stable, really don't want to switch platform again >_<

Thanks

User avatar
tdicola
 
Posts: 1074
Joined: Thu Oct 17, 2013 9:11 pm

Re: Enabling 4 PWM Pins?

Post by tdicola »

That's odd, although there have been some reports of PWM issues on the github repository and this might be related. You might try asking on the beaglebone black google group to see if folks there have any better advice for using all the PWM pins: https://groups.google.com/forum/#!categ ... bone-black

Wow a quadcopter project with the BeagleBone Black sounds pretty interesting. I'm not sure you really want the BBB to be driving the feedback loop to power all the motors though, particularly if it's running Linux. Linux is a multitasking OS so your program doesn't have a real guarantee that it has exclusive access to the hardware and CPU time. For example it would be really bad if your program detects that it needs to slow a few motors down to prevent a crash, but suddenly a cron job or other background task takes over and delays your program from changing the motor speed.

That said the BBB does have a special realtime control process called the PRU (programmable realtime unit) and you might want to look at moving your control loop to run there. It's only programmed in assembly but it does have exclusive access to some GPIO pins and will never be interrupted by processes on the Linux OS / main CPU. Here's a good general overview of the PRU: http://www.element14.com/community/comm ... cssprussv2

Alternatively you could do something like put the control loop on a small Arduino and have the BBB talk to it with high level commands like 'go straight', 'turn left', etc. Good luck!

Locked
Please be positive and constructive with your questions and comments.

Return to “Beagle Bone & Adafruit Beagle Bone products”