How to use GPIOTE and PPI to output extra 3 pwm on nRF52840 @ ncs2.9.1

Hi,

Our project need 7 seperate PWM outputs, as the nRF52840 have 4 hardware pwm, I decide to use GPIOTE with PPI to create extra 3 pwm outputs to drive Red/Green/Blue leds.

Is there any recommend samples on how to do it on NCS?

I found a few samples on github but they are using nRF SDK.

Regards,

Anthony Yuan

Parents
  • Hi Anthony,

    If all PWM outputs need to be fully independable, you can use the 4 PWM and use software based PWM for the others, using timer and PPI. That is supported by the PWM driver in zephyr , and you can refer to this thread for details on how to use it. However, each of the 4 PWM instances supprot 4 channels, so you may be able to use only hardware PWM. There are some limitations here though, and all channels of the same instance need to use the same frequency (but can have different duty cycle and polarity).

    Br,

    Einar

Reply
  • Hi Anthony,

    If all PWM outputs need to be fully independable, you can use the 4 PWM and use software based PWM for the others, using timer and PPI. That is supported by the PWM driver in zephyr , and you can refer to this thread for details on how to use it. However, each of the 4 PWM instances supprot 4 channels, so you may be able to use only hardware PWM. There are some limitations here though, and all channels of the same instance need to use the same frequency (but can have different duty cycle and polarity).

    Br,

    Einar

Children
Related