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 

Parents Reply Children
  • 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

  • Hello Karl,

    Thank you for overall guidance ,

    I already done with Bluetooth services and characteristics as you just described ,

    Now i am really confused with implementation of the adaptive frequency and duty cycle waveform with inter-phase adaptive delays.

    I hope you got my point as if you said for reverse polarity but it cant serve my problem as i want adaptive inter-phase delay not just 180 straight.

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

    Yes I have good amount of nRF development as far as services and charactertics for BLE is concerned, I have access to DK board nRF52-DK.

    We have already placed nRF52810 in our carrier board as for final product implmentation.

    I just stuck for this part now in development i.e. of waveforms.

    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 .

Related