I'm looking to add PWM functionality to my design to drive an LED. Examples exist for other devices, and those don't use the SoftDevice. Is there an example or some reference design for making the PWM module work with the nRF51822 and SD?
I'm looking to add PWM functionality to my design to drive an LED. Examples exist for other devices, and those don't use the SoftDevice. Is there an example or some reference design for making the PWM module work with the nRF51822 and SD?
Hi again
I made some change to the PWM library, and have uploaded a new version below:
Changes include:
I don't know if you ever solved your issue Nils?
Best regards Torbjørn
Hi, I have the problem that my custom Timer controlled PWM has the same bug as yours had. I sometimes get inverted PWM output.
Could you point out what was necessary to circumvent this??
I try to update CC values for a timer at runtime by:
void setPw(uint8_t pw) {
gPulseW = pw;
uint8_t period = 8 * gPeriod;
NRF_TIMER0->CC[0] = pw;
NRF_TIMER0->CC[1] = period/2;
NRF_TIMER0->CC[2] = period/2+pw;
NRF_TIMER0->CC[3] = period;
}
I tried to stop and start again, reset EVENTS_COMPARE Register, ... I don't seem to find the bug ...
any help appreciated
Hi Andreas
Did you figure this out?
For questions like these I would recommend opening a new thread, otherwise it will quickly get lost. You can always refer to this thread to put your question in context.
To answer your question, make sure you are not updating the CC registers while the timer value is at some random spot between min and max. If you look at the PWM example you can see that the CC registers are only updated while the timer is stopped and the timer value is at the max position.
Best regards Torbjørn