Skip to main content
DerekR
Senior
January 6, 2023
Solved

Can a low power timer (LPTIM) drive an RGB LED in STOP mode?

  • January 6, 2023
  • 2 replies
  • 1832 views

MCU: STM32L4R9ZGJ6

Hardware: Custom battery powered board

LED: ARGB1313HS

Desired LED functionality: Blink, on/off, fade in/out ("Breathing")

Hello,

I am familiar with a regular timer and how they can drive a RGB LED using multiple channels (CCx registers) from the same timer. Unfortunately, it doesn't appear this works in STOP low power mode since the PWM will be clock gated.

Question 1: Can all legs (3 pins) of an RGB LED be driven by a low power timer (LPTIM) in STOP mode? It looks like a low power timer (LPTIM) can only drive 1 GPIO in CubeMX.

Question 2: If the answer above is 'no', then what is the most power efficient way to PWM a 3 legged RGB LED?

Thanks,

Derek

This topic has been closed for replies.
Best answer by Peter BENSCH

Correct, LPTIM can only output one PWM channel. By the way, the AN4865 describes some use cases for the LPTIM.

Unfortunately, I don't know of any way to output three independent PWMs with the STM32L4R9 in STOP mode. However, this could be done with external hardware, e.g. a small auxiliary Ultra Low Power MCU, for which the STM32L010 could be suitable, taking its clock from the master MCU.

Hope that helps?

Regards

/Peter

2 replies

Peter BENSCH
Technical Moderator
January 6, 2023

Why not just run the STM32L4R9 in low-power run mode at e.g. 100kHz, then it draws only 0.21mA at 25°C, while your RGB LED ARGB1313HS draws about 60mA at 100% duty cycle (RGB=on)?

Regards

/Peter

In order to give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
DerekR
DerekRAuthor
Senior
January 9, 2023

@Peter BENSCH​ 

Can you confirm that the LPTIM can only drive one GPIO? I only see one compare register in the datasheet (LPTIM_CMP). Any other way to PWM a RGB LED in STOP mode?

Thanks,

Derek

Peter BENSCH
Peter BENSCHBest answer
Technical Moderator
January 10, 2023

Correct, LPTIM can only output one PWM channel. By the way, the AN4865 describes some use cases for the LPTIM.

Unfortunately, I don't know of any way to output three independent PWMs with the STM32L4R9 in STOP mode. However, this could be done with external hardware, e.g. a small auxiliary Ultra Low Power MCU, for which the STM32L010 could be suitable, taking its clock from the master MCU.

Hope that helps?

Regards

/Peter

In order to give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
DerekR
DerekRAuthor
Senior
January 6, 2023

Hey Peter,

The STM is also doing a bunch of other stuff such as driving an AMOLED touch display using TouchGFX, playing audio, reading various sensors over I2C/SPI/UART, etc. The HCLK is running at 120 MHz.

Thanks,

Derek