Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs
This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

How to Generate Bi-Phasic PWM with interpulse delay and variable Duty Cycle?

Hello All,

I want to generate Bi-Phasic two PWMs with 180 degree interphase delay and variable Duty Cycle with variable frequency upto 250 Hz in nRF52810 SoC.

Can you please suggest the mechanism as far as firmware programming is concerned!

Thank you in advance 

  • Hello again,

    In the project you set up for the TIMER approach, did you have the SoftDevice enabled?
    Bear in mind that the SoftDevice uses timer0, and it will block off access from the application layer.
    Instead, you should use TIMER1 and TIMER2.

    Smit said:
    Actually Interphasing delay should be same as the duty cycle for the PWM.

    So if user changes the duty cycle the interphasic delay also changes and should be same as duty cycle of the PWM.

    I understand. This would be the same as calculating the duty cycles length in time, and adding that as an offset to the CAPTURE/COMPARE register, like I referenced in my previous comment.

    Smit said:
    But in the above code i didnt get the resolution of 1usec as pulse width and interphasic delay .
    It might be due to GPIO toggling latency or internal delay.

    Yes, that might well be the reason. I would not recommend using software PWM's when you have access to hardware for PWM generation along with the app_pwm library.

    Smit said:
    Can you please elaborate and please share the other method for the same

    The PWM library documentation includes a usage section, that demonstrates how you can setup a PWM waveform on the LEDs.
    You will then need to implement the steps for changing the frequency and duty cycle as described in my previous reply.
    Please attempt this, and post the code if you are not able to achieve the desired functionality.

    Best regards,
    Karl

Related