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.
7 years, 8 months ago.
When PwmOut is enabled on nRF51-DK, System crashes.
Hi,
I am working on nRF51-DK on Mbed IDE, When PwmOut is enabled, system crashed.
I would be grateful if anyone suggests for the same.
Regards Bharat Gopani
1 Answer
7 years, 8 months ago.
Hi Bharat,
Can you please reply with information on how you are enabling PwmOut? (Maybe provide a code snippet?) Are you using the PwmOut API within Mbed OS 5? https://os.mbed.com/docs/v5.8/reference/pwmout.html
- Jenny, team Mbed
If this solved your question, please make sure to click the "Thanks" link below!
Hi Jenny,
Thanks for the immediate reply.
Yes, I am using the PwmOut API within Mbed compiler. PFB the code snippet for the PWM & LED1 .
#include "mbed.h"
PwmOut VMPWM(P0_16); //P0.16 for the PWM
DigitalOut led1(LED1); // P0.21 for LED1
void periodicCallback(void) {
led1 = !led1;
}
int main(void) {
VMPWM.period(0.01f); // 10 ms period
VMPWM = 0.2f; // 20 %
Ticker ticker;
ticker.attach(periodicCallback,1); // In Seconds.
while(1) ;
}
When PwmOut is not enabled, LED1 blinks every second but when I enabling the PwmOut , LED1 is not blinking but PWM pulses are observed Pin P0.16.
posted by 19 Apr 2018