Re: Problem with LPTIM on Zephyr


Erwan Gouriou
 

First it depends what you intend to do with LPTIM.
There is a LPTIM driver which is meant to be used as a low power kernel ticker 
instead of the Cortex systick.

You can enable it in any sample using CONFIG_STM32_LPTIM_TIMER=y
By default it will use LSE as clock source.


On Tue, 16 Feb 2021 at 16:25, Raz <raziebe@...> wrote:
I tried to compile LPTIM in the kernel but Zephyr fails. 
Is there an example for LPTIM in an app ?


On Tue, Feb 16, 2021 at 12:30 PM Erwan Gouriou <erwan.gouriou@...> wrote:
Hi Raz,


Did you checked that the clocks are correctly enabled?
In any case, I'd suggest to minimize the use of Cube functions to the timer related functions.
Zephyr provides most of things you need for MSP and board init.

Cheers
Erwan

On Fri, 12 Feb 2021 at 14:59, Raz <raziebe@...> wrote:
hello.
I am trying to use the LPTIM for the nucleos 476  by integrating it from CUBE. I ported the code below to Zephyr:

 HAL_Init();

  SystemClock_Config();

  /* Initialize all configured peripherals */
  MX_GPIO_Init();
  MX_LPTIM1_Init();
  for (;i<2;i++) {
 HAL_GPIO_TogglePin (GPIOA, GPIO_PIN_5);
 HAL_Delay(1000);
  }
  /*
   * LSE Input freq is 32768 hz.
   *  32768/64 = 512hz
   * */
  int secs = 3;
  if (HAL_LPTIM_Counter_Start_IT(&hlptim1, 512* secs + 1) != HAL_OK) {
     Error_Handler();
  }
  HAL_PWREx_EnterSTOP2Mode(PWR_STOPENTRY_WFI);
  while (1)
  {
 HAL_PWREx_EnterSTOP2Mode(PWR_STOPENTRY_WFI);
  }
  /* USER C

However, the timer does not start. Anyone is familiar with this problem ?

Kind regards

Join users@lists.zephyrproject.org to automatically receive all group messages.