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,

    Have you seen the PWM driver example from the SDK? It demonstrates a range of different PWM waveforms and how to implement them. The PWM library example demonstrates how to generate the two waveforms with 180 degree interphase delay.
    Furthermore, you can read about the nRF52810 SoC PWM driver and its usage in the PWM Driver documentation, and the PWM API Reference.

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

    I am not sure what you mean here - are you asking how to get started on the implementation(getting started with the nRF52810 SoC?) or are you asking about the resources I referenced above?

    Please let me know if this does not answer your question,

    Best regards,
    Karl

     

  • Ok so I am bit confuse over PWM Library an PWM Driver!

    Which should i use for my sort of application in which the freq, duty cycle changes with variable inter phase delay!

    Please help to clear out confusion!

  • Hello.

    Smit said:
    I am bit confuse over PWM Library an PWM Driver!

    My apology, I should have been more elaborate in my previous reply.
    The PWM Library is a library we have made, to simplify the usage of PWM waveform generation.
    The PWM driver is a lower level interface, that directly interfaces the PWM peripheral.
    So, in your case, you could make use of the PWM Library - the app_pwm functionality - which you can read about here.
    As you can see in the documentation, you can then use the app_pwm_channel_duty_set function to change duty cycle. The PWM Library example I linked in my last comment also demonstrates how you can two PWM waveforms, where one is of the opposite polarity, or if you are using the nrfx driver you may just use the NRFX_PWM_PIN_INVERTED to achieve this 180 degree shift.
    Changing the frequency will require setting up a new PWM instance. Please see this ticket for further information.

    Let me know if anything still should be unclear.

    Best regards,
    Karl

  • Hey Karl,


    Actually We are making the frequency simulator using Bluetooth application and user can control by Mobile Application, following are my parameters basically to control from the app:

    1) Frequency user can vary from 1 to 120 Hz

    2) Pulse Width from 0 to 250 usec

    Can you please suggest what should I use for such application .

  • Hello,

    I understand, so the user will use their phone to set the frequency and duty cycle of the PWMs.
    In that case, you might want to create a custom service to hold these characteristics, and to make them available to your mobile application.
    To get started on how to create a custom service I highly recommend this tutorial - it takes your through the process of creating a customer service, and the following characteristics tutorial goes through how to add any characteristic to your service. Then, you could create a "PWM control service" with the characteristics "Frequency" and "Pulse width", and when those characteristics are written to you will either initialize a new PWM waveform or change the duty cycle of an existing PWM waveform - both of which as discussed in my previous comment.
    When this is done, you could either immediately use the nRF Connect mobile application to control your device, or you could write a custom smartphone application to control it.

    Are you familiar with nRF development, and do you have access to a Development Kit?

    Best regards,
    Karl

1 2 3