This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

PWM Frequency

Hello, I've looked at the forum response for

devzone.nordicsemi.com/.../is-there-an-example-code-for-using-pwm-on-the-nrf51822-with-a-softdevice

I am unable to implement because, I think, I don't have access to all of the libraries included nor could I find. I'm using the nRF51822 in an RFDuino application running a pump and I need to get the PWM pin upwards of 5 kHz. I know I need to change pin designations but can't get that far yet.

Could use help on getting the libraries so I can examine and try to change correctly.

THX. Mike

  • I've found the include files but still haven't figured it out. I guess this problem is beyond my abilities. I'll keep trying. Any clues would be appreciated. Thx.

  • I've found the include files but still haven't figured it out. I guess this problem is beyond my abilities. I'll keep trying. Any clues would be appreciated. Thx.

  • The library and examples you found depends on having the full nRF51 SDK, which I'm not sure you'll get when using an RFduino.

    The regular SDK is available for download from our main page if you have a product key for one of our nRF51 kits. If you already have it, the examples should compile if the Simple PWM folder is put in the nrf51822\Board\nrf6310\ folder inside the SDK.

  • Hi Mike,

    Have you found a solution to increase the PWM frequency on the RFduino in a way that I can keep on using the analogWrite function?

    I was able to slow it down by increasing the divider, but unable to increase the frequency since it was already set to 1 (2^0). ( I believe the base frequency is around ±240hz)based on this thread: forum.rfduino.com/index.php

    But I've found a way to ramp the PWM frequency up to 62.5 kHz based on this: forum.rfduino.com/index.php

    Unfortunately the RFduinoBLE function interferes with this way of pumping up the frequency (the signal start to jump around as soon as I do RFduinoBLE.begin();. Not exactly sure why but have the feeling it has to do with the interrupts.

    I tried several things but haven't been successful in increasing the frequency in a different way.

    Hope you can help.

    Cheers,

    R.

  • Hello Ruben,

    Thanks for the reply and links. I'll need to look at them and the SDK mentioned in the reply above yours.

    What I did to get the project moving was implemented a work around. I haven't gotten back to solving the correct way which is adjusting the frequency in the RFDuino.

    My work around was to use a Tiny85 as the PWM higher frequency generator. Basically, the low PWM signal from the RFDuino goes through a low pass filter so it looks like an analog out signal. The new analog signal is read by the Tiny85 and re-transmitted out of it as a higher PWM frequency to my pump motor. All is good.

    This added about a buck to my project but got me moving on. Some day I'll return and do it right.

    Hope this helps.

    Mike

Related