Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs
This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Questions about PWM's end delay and initialized unused channels

Hi,

I'm using PWM on a nRF52832 (nRF52 DK) with SDK 17.0.2 . I have 3 PWM channels configured to LED2, LED3 and LED4. Below are my questions. I'm using PWM to dim the LED for 1-2 seconds and then switch it off using a timer.

  • I am trying to use the end delay parameter to control the duration the LED stays dimmed. I noticed that end delay is ignored when the playback count is 1. I changed playback count to 2 and the LED stayed dimmed for that duration. So is end delay ignored when playback count is 1? I would like to avoid using a timer to turn off the LED after a specific duration.
  • At any point of time, I am only using one of the LEDs. So considering the power consumed, is it better to configure the 3 LEDs to 3 PWM channels or is it better to reconfigure the peripheral to use 1 channel with a different LED each time. In short, I would like to know how much current would be consumed by the PWM peripheral if a channel is initialized but not used.

Thanks

Parents
  • Hi, 

    I am trying to use the end delay parameter to control the duration the LED stays dimmed. I noticed that end delay is ignored when the playback count is 1. I changed playback count to 2 and the LED stayed dimmed for that duration. So is end delay ignored when playback count is 1? I would like to avoid using a timer to turn off the LED after a specific duration.

    Yes, I believe this is a limitation. If I understand what you are trying to achieve correctly, and if you are seeing this using nrf_drv_pwm_simple_playback(), then perhaps a workaround would be to just add your last duty cycle value in another separate sequence(seq1), and use nrf_drv_pwm_complex_playback(seq0,seq1) instead.

    At any point of time, I am only using one of the LEDs. So considering the power consumed, is it better to configure the 3 LEDs to 3 PWM channels or is it better to reconfigure the peripheral to use 1 channel with a different LED each time. In short, I would like to know how much current would be consumed by the PWM peripheral if a channel is initialized but not used.

     AFAIK, it will not consume any current if you only initialize it.

Reply
  • Hi, 

    I am trying to use the end delay parameter to control the duration the LED stays dimmed. I noticed that end delay is ignored when the playback count is 1. I changed playback count to 2 and the LED stayed dimmed for that duration. So is end delay ignored when playback count is 1? I would like to avoid using a timer to turn off the LED after a specific duration.

    Yes, I believe this is a limitation. If I understand what you are trying to achieve correctly, and if you are seeing this using nrf_drv_pwm_simple_playback(), then perhaps a workaround would be to just add your last duty cycle value in another separate sequence(seq1), and use nrf_drv_pwm_complex_playback(seq0,seq1) instead.

    At any point of time, I am only using one of the LEDs. So considering the power consumed, is it better to configure the 3 LEDs to 3 PWM channels or is it better to reconfigure the peripheral to use 1 channel with a different LED each time. In short, I would like to know how much current would be consumed by the PWM peripheral if a channel is initialized but not used.

     AFAIK, it will not consume any current if you only initialize it.

Children
Related