I'm getting some odd behavior using the TB6612 Motor driver board to control two DC motors using my beagle bone. If I command P9_14 on to a 50% duty cycle, the motor on channel B also starts spinning at 50%. If I stop P9_14 to stop sometimes both stop, other times the motor on channel B spins twice as fast. If I then command motor B with P9_16 both motors spin again, but if I command it to stop the B motor stops. It seems like there's some sort of signal leakage, but I'f tried this on multiple setups and I'm seeing the same behavior. Any ideas?
Edit::
On further analysis there is definitely a signal being sent on both P9_14 and P9_16 even though I only command one pin. Both those pins are EHRPWM1A and EHRPWM1B. I can independently control the pins, if I send 14 a 25% duty cycle and 16 a 50% duty cycle they operate independently. Is this just bad isolation on the Beagle Bone?
PWM Issues
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- adafruit2
- Posts: 22144
- Joined: Fri Mar 11, 2005 7:36 pm
Re: PWM Issues
whats your specific commands for setting the PWM?
- Mishra
- Posts: 6
- Joined: Thu Jul 23, 2015 2:04 pm
Re: PWM Issues
After I import the library, just PWM.start("P9_14", 50) and PWM.stop("P9_14"), same for P9_16
- Mishra
- Posts: 6
- Joined: Thu Jul 23, 2015 2:04 pm
Re: PWM Issues
So Here's the sequence of commands I run and what ends up happening after I initialize the various GPIO and PWM pins::
>>> PWM.start("P9_14", 50) ==> Motor A spins at 50%
>>> PWM.stop("P9_14") ==> Motor A stops
>>> PWM.start("P9_14", 50) ==> Motor A spins at 50%
>>> PWM.start("P9_16", 50) ==> Motor B spins at 50%
>>> PWM.stop("P9_14") ==> Motor A stops
>>> PWM.start("P9_14", 50) ==> Motor A spins at 50%
>>> PWM.start("P9_14", 25) ==> Motor A spins at 25%
>>> PWM.start("P9_16", 75) ==> Motor B Spins at 75%
>>> PWM.stop("P9_14") ==> Motor A stops, Motor B spins at 75%
>>> PWM.stop("P9_16") ==> Motor B stops
>>> PWM.start("P9_16", 75) ==> Motor A spins at 25% Motor B spins at 75%
>>> PWM.stop("P9_16") ==> Both Motors stop
>>> PWM.cleanup() ==> Python Crashes with following error
*** Error in `python': double free or corruption (out): 0xb6f1e520 ***
Reboot beaglebone re initialize GPIO pins and load PWM library
>>> PWM.start("P9_14", 50) ==> Motor A spins at 50% and Motor B spins at 50%
>>> PWM.start("P9_14", 50) ==> Motor A spins at 50%
>>> PWM.stop("P9_14") ==> Motor A stops
>>> PWM.start("P9_14", 50) ==> Motor A spins at 50%
>>> PWM.start("P9_16", 50) ==> Motor B spins at 50%
>>> PWM.stop("P9_14") ==> Motor A stops
>>> PWM.start("P9_14", 50) ==> Motor A spins at 50%
>>> PWM.start("P9_14", 25) ==> Motor A spins at 25%
>>> PWM.start("P9_16", 75) ==> Motor B Spins at 75%
>>> PWM.stop("P9_14") ==> Motor A stops, Motor B spins at 75%
>>> PWM.stop("P9_16") ==> Motor B stops
>>> PWM.start("P9_16", 75) ==> Motor A spins at 25% Motor B spins at 75%
>>> PWM.stop("P9_16") ==> Both Motors stop
>>> PWM.cleanup() ==> Python Crashes with following error
*** Error in `python': double free or corruption (out): 0xb6f1e520 ***
Reboot beaglebone re initialize GPIO pins and load PWM library
>>> PWM.start("P9_14", 50) ==> Motor A spins at 50% and Motor B spins at 50%
- adafruit_support_mike
- Posts: 67446
- Joined: Thu Feb 11, 2010 2:51 pm
Re: PWM Issues
Post a photo showing your hardware and connections and we'll take a look. 800x600 images usually work best.
- Mishra
- Posts: 6
- Joined: Thu Jul 23, 2015 2:04 pm
Re: PWM Issues
I've attached a picture of the wires and the wiring diagram I'm giving the students. I don't think this is a wiring issue as it's been seen across multiple kits and :
- tdicola
- Posts: 1074
- Joined: Thu Oct 17, 2013 9:11 pm
Re: PWM Issues
Huh that's odd the behavior you see with both channels being affected. One thing to check since the BBIO library is just a thin wrapper around the Linux sysfs GPIO, PWM, etc. drivers is if you try controlling the PWM devices directly from Linux's filesystem. Check out a guide like this for a few details: https://www.linux.com/learn/tutorials/7 ... bone-black
Do you see similar behavior if you manually control the PWM channels? If so I kind of wonder if it's a quirk or issue with the BBB's PWM channels--perhaps they are related and can affect each other in different ways (the technical reference manual would be a good resource to check for sure, I'm not totally sure myself off hand: http://beagleboard.org/Support/Hardware%20Support). Also another good resource to ask about it is the BeagleBone Black google group--the folks that designed the board are actually there and can help clarify hardware behavior questions: https://groups.google.com/forum/#!categ ... bone-black
Do you see similar behavior if you manually control the PWM channels? If so I kind of wonder if it's a quirk or issue with the BBB's PWM channels--perhaps they are related and can affect each other in different ways (the technical reference manual would be a good resource to check for sure, I'm not totally sure myself off hand: http://beagleboard.org/Support/Hardware%20Support). Also another good resource to ask about it is the BeagleBone Black google group--the folks that designed the board are actually there and can help clarify hardware behavior questions: https://groups.google.com/forum/#!categ ... bone-black
Please be positive and constructive with your questions and comments.