PCA9685 setPWM Function

I have a project that requires the need to power a bipolar stepper motor upon controller input. With only two spare pins available on the Pi I was looking to accomplish this via four of the several PWM pins available on the NAVIO2. I have researched the use of mircrostepping the stepper motor (in conjunction with a DRV8833 driver) using phase offset PWM signals. I was very happy to see the setPWM function available for the PWM driver as this seems to provide exactly what I need, however I have not been able to get any shots at implementation to compile. Additionally,I see the the current example found in PWM.cpp does not have the setPWM function implemented just frequency and period? Any assistance with this would be greatly appreciated. Thank you to every one in advance for any pointers!

@John_Herrick Hi! We used PCA9685 to generate PWM on previous hardware generation - Navio+. On Navio2 PWM signals are generated by the RC IO co-processor (STM32 microcontroller). By using set_period and set_duty_cycle methods as shown in Servo example for Navio2 you can achieve the same functionality.

@mikhail.avkhimenia Thank you for your quick response and the explanation of why the setPWM function has been removed. I will research doing it with those two functions.

Okay. I apologize for having to come back to ask additional questions but I have laboured over this for several weeks now with no luck . I have researched and tried unsuccessfully to get results using only the duty cycle and period function calls. I also have tried integrating two TIP127 transistors to inverse the PWM signals originating from the Navio2’s servo rail as inputs to the a and b phases of the DRV8833 stepper driver. After researching online I found a reference sheet from Texas Instruments describing what I am trying to do with the signals (fig 4 on page 5), but from everything I can glean from the document I need to be able to shift the timing of one of the PWM’s in order to accomplish movement. My next attempt I was going to plan on trying to ‘simulate’ a discrete I/O on the PWM channels by setting the periods to zero and using a high frequency. Is this a good tactic or am I going about this all wrong? Thank you in advance for additional information and assistance.

Sorry for the confusion, PCA9685 and RC IO coprocessor over sysfs do handle PWM generation a little differently. Currently phase shifting is not supported by the interface of RC IO, so I’m afraid it’s impossible to use it without some serious hacking. We’ll see what we can do about this, but at the moment I’d suggest to switch to using PCA9685 (e.g. shield from Adafruit).