Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
10 years, 5 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:
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:
2 Answers
9 years, 11 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 10 Dec 2014Hi, 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 11 Dec 2014they are sharing the same implementation, means there might be still bug there :/
posted by 12 Dec 2014Hi 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 06 Jan 2015Hi, 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 24 Feb 201510 years, 5 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.
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 2014We merged this, use the newest the mbed-src to test the fix by Tuze. Thanks
posted by Martin Kojtal 12 Jun 2014