Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
New Contributor II
1,680 Views

PCA9685 and UPM library

I want to use this pwm driver

https://www.sunfounder.com/modules/pca9685-16-channel-12-bit-pwm-servo-driver.html https://www.sunfounder.com/modules/pca9685-16-channel-12-bit-pwm-servo-driver.html

with this library

http://iotdk.intel.com/docs/master/upm/classupm_1_1_p_c_a9685.html upm: PCA9685 Class Reference

to control four ESC's/brushless motors, but I am having trouble getting it to work. I am using ESC's with battery eliminating circuits, so the wire that would be power input for a regular servo is actually a +5v source.

// Instantiate an PCA9685 on I2C bus 0

upm::PCA9685 *pwm = new upm::PCA9685(1,0x40);

// put device to sleep

pwm->setModeSleep(true);

// setup a period of 50Hz

pwm->setPrescaleFromHz(50);

// wake device up

if(!pwm->setModeSleep(false)) printf("err1");

if(!pwm->ledOnTime(0, 0)) printf("err2");

if(!pwm->ledOffTime(0, 2048)) printf("err3");

When I run theses functions they all return successful but I get no output on the driver: the pwm pin on channel 0 is at zero volts, when it should be around 2.5 volts (5*(2048/4096)). Would it be possible that the driver is broken, but the read/write functions to the registers still work?

I would greatly appreciate any help from anyone who has experience with this library.

0 Kudos
3 Replies
Highlighted
Community Manager
11 Views

Hi Thomas,

 

 

Right now we don't have the PWM driver (PCA9685), so we are not available to do some tests to help you. But personally, I would recommend you to try this example that I found in the UPM repository: https://github.com/intel-iot-devkit/upm/blob/922e0cc26b2eb49dbf4454f05e1912c27ea9fc3b/examples/c%2B%...

 

 

Try to run the example to see if you get the same results, if you doesn't, try to contact the author of the driver to see if he can help you more.

 

 

I hope you find this information helpful.

 

 

Regards,

 

-Leonardo
Highlighted
New Contributor II
11 Views

Something odd is going on.. I run the example and it works.. I run it again and it doesn't work... then I run it again and it does work etc. It only works every other time, which seems to me like something important is being switched or negated once every run, though I can't figure out what.

The example seems to be doing something very particular, because anything else I try that is not the example, the functions simply do not work.

Would really appreciate if someone else knows what in the world could be happening.

0 Kudos
Highlighted
Community Manager
11 Views

Hi Thomas,

 

 

It is a weird problem, and there is not much that I can do to help you because I don't have the driver.

 

 

Like a told you, the best suggestion that I can give you is to try to contact the author of the example, maybe he has information that can be helpful for you.

 

 

I'm very sorry, I hope that someone else helps you.

 

 

Regards,

 

-Leonardo
0 Kudos