9 years, 9 months ago.

When I use the BLE function,PWM is not support?

Hello,I added these codes to the example code BLE_HeartRate, but the PWM wave is not correct.

PwmOut pwm1(p12); pwm1.period_ms(1); pwm1.write(0.3);

The wave is shown as follows:

/media/uploads/youyou/i3.jpg

The duty seems not correct. But it worked fine when I don't open the BLE function.The online library(included in the mbed folder) is not compatible when I use the BLE function? If the modification is need,how do I change the code?

Thank you!

Question relating to:

The nRF51822-mKIT is a low cost ARM mbed enabled development board for Bluetooth® Smart designs with the nRF51822 SoC. The kit gives access to all GPIO pins via pin headers …

Hello,

Hwo can I reproduce this? Can you add a snippet of your main, so I will just copy-paste it, run it and see what goes there.

posted by Martin Kojtal 10 Jun 2014

We merged this, use the newest the mbed-src to test the fix by Tuze. Thanks

posted by Martin Kojtal 12 Jun 2014

2 Answers

9 years, 3 months ago.

Hi I have exactly the same problem. When I use PwmOut only, everything works as expected. When I enable ble.startAdvertising(); signal starts to flicker every few seconds and when I connect via BLE, PWM is hardly recognizable (see attached video) /media/uploads/szuperbit/pwm_flickering.zip I use nRF51 Dongle

Hello, are you using latest mbed library? What revision ? Tuze sent a pull request which was supposed to fix this.

posted by Martin Kojtal 10 Dec 2014

Hi, I use revision 92:4fc01daae5a5, last updated 3 days ago. Maybe Tuze did not apply a fix for nRF51 Dongle and he only did it for Nordic nRF51822 DEV board (where the probelm was originally reported)

posted by Rok Okorn 11 Dec 2014

they are sharing the same implementation, means there might be still bug there :/

posted by Martin Kojtal 12 Dec 2014

Hi there, During advertisement the CPU will not get enough time to reliably update the PWM outputs, once a connection is established you should not have this problem. However if you need a fully functional PWM you can either use the timeslot API as shown here: https://github.com/NordicSemiconductor/nrf51-pwm-library

Or you can edit the PWM driver to remove any reliance on the ISR, but this will limit you to a single PWM output.

posted by Tuze Kuyucu 06 Jan 2015

Hi, I experience the same problem with unreliable PWM output when BLE is activated (advertising or connected) in nRF51822. I have tried to use Nordic's example (https://github.com/NordicSemiconductor/nrf51-pwm-library) but I get lots of compilation errors due to missing references. Has anybody been able to implement this example in mbed or found an alternative solution? Thanks!

posted by Javier Montaner 24 Feb 2015
9 years, 9 months ago.

Hey Hey,

Thanks for another find:). This happened due to the PWM timer's interrupt not being serviced on time. I have provided a new implementation that should not suffer from this problem: https://github.com/mbedmicro/mbed/pull/356

Please let us know if you spot any problems once you get a chance to try it out.

Hi,

I've tried using mbed's PwmOut using a slightly modified version of the latest BLE HRM example; which is based on nrf521822 and BLE_API that use SDK8 but there is no PWM output.

Has anyone else gotten it to work?

Thanks Wayne

posted by Wayne Keenan 16 Jun 2015