CAF LED blinks on wake up event

Hi,

I use CAF LEDs with PWM. I have a timer that would make device wake up every 20 seconds with a CONFIG_CAF_POWER_MANAGER_TIMEOUT to make it sleep 2 seconds after waking up.

Every time the system wakes up from sleep, the LED will be turned on for a brief moment before turning off again, and I think it is because of the code below. This happens even though I manually turn off LEDs on a system wake up. Is there any way to prevent the blink from happening (either through my code or modifying the source code)? 

https://github.com/nrfconnect/sdk-nrf/blob/main/subsys/caf/modules/leds.c#L207C32-L207C32

Best,

Kevin

Parents
  • Hello Kevin,

    If you assign a new LED effect on wake_up_event processing, the old effect would still be in use for time between wake_up_event processing and processing of the led_event turning off LEDs that is submitted by you.

    We would suggest assigning the new LED effect earlier (e.g. on power_down_event) to ensure that the LED effect is set before wake_up_event is processed.

    Regards,

    Elfving

  • Hi Elfving,

    Thanks for the reply. I actually tried that with the following code but still got the LED to blink when system wakes up.

    In my app_event_handler,  I have

        if (is_power_down_event(aeh)) {
            return handle_power_down_event(cast_power_down_event(aeh));
        }

    static bool handle_power_down_event(const struct power_down_event *event) {
      LOG_DBG("Handling power down event");
      led_turn_off(LED_USER);
      return false;
    }

    led_turn_off would submit a new_led_event to turn the LED off. 

    This problem seems to be related to something that is triggered when PWM starts back up. The blink is very brief (maybe about 20ms?), but is still is visible. Even if LED doesn't turn on in any part of my code, the power manager + PWM LED module themselves are able to trigger the symptom here.

Reply
  • Hi Elfving,

    Thanks for the reply. I actually tried that with the following code but still got the LED to blink when system wakes up.

    In my app_event_handler,  I have

        if (is_power_down_event(aeh)) {
            return handle_power_down_event(cast_power_down_event(aeh));
        }

    static bool handle_power_down_event(const struct power_down_event *event) {
      LOG_DBG("Handling power down event");
      led_turn_off(LED_USER);
      return false;
    }

    led_turn_off would submit a new_led_event to turn the LED off. 

    This problem seems to be related to something that is triggered when PWM starts back up. The blink is very brief (maybe about 20ms?), but is still is visible. Even if LED doesn't turn on in any part of my code, the power manager + PWM LED module themselves are able to trigger the symptom here.

Children
Related