This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Is there an example code for using PWM on the nRF51822 with a SoftDevice?

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?

Parents
  • 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

Reply
  • 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

Children
No Data
Related