2022-09-13 09:15 AM
I create new StCubeIDE project base on NUCLEO-U575ZI-Q EVB.
Set LPTIM1 as "Counts internal clock events" mode and enable interrupt, set clock source to "LSE".
Did some simple modification in main.c to verify it:
When start to run:
Below debugging messages will be shown on terminal. It seems LPTIM1 stopped and wont
trigger interrupt any more. I also tried same thing on L476 board. There is no problem.
Can somebody help me to find if I missed something please?
Can somebody try same testing sequence, help to verify it please?
-- u5_lptm1_wakeup 11:22:33 Sep 13 2022--
in final loop 0
- - - In HAL_LPTIM_CompareMatchCallback - - -
- - - In HAL_LPTIM_CompareMatchCallback - - -
- - - In HAL_LPTIM_CompareMatchCallback - - -
- - - In HAL_LPTIM_CompareMatchCallback - - -
before enter stop mode
.
.
.
/* Private includes ----------------------------------------------------------*/
/* USER CODE BEGIN Includes */
#include "stdio.h"
/* USER CODE END Includes */
.
.
.
int main(void)
{
/* USER CODE BEGIN 1 */
/* USER CODE END 1 */
/* MCU Configuration--------------------------------------------------------*/
/* Reset of all peripherals, Initializes the Flash interface and the Systick. */
HAL_Init();
/* USER CODE BEGIN Init */
/* USER CODE END Init */
/* Configure the system clock */
SystemClock_Config();
/* Configure the System Power */
SystemPower_Config();
/* USER CODE BEGIN SysInit */
/* USER CODE END SysInit */
/* Initialize all configured peripherals */
MX_GPIO_Init();
MX_USART1_UART_Init();
MX_LPTIM1_Init();
/* USER CODE BEGIN 2 */
/* USER CODE END 2 */
/* Infinite loop */
/* USER CODE BEGIN WHILE */
printf("-- u5_lptm1_wakeup %s %s--\r\n", __TIME__,__DATE__);
int i;
while (1)
{
printf("in final loop %d\r\n",i++);
HAL_LPTIM_TimeOut_Start_IT(&hlptim1, 32767);
HAL_Delay(8000);
printf("before enter stop mode\r\n");
HAL_SuspendTick();
// HAL_PWR_EnterSLEEPMode(PWR_LOWPOWERREGULATOR_ON, PWR_STOPENTRY_WFI);
HAL_PWR_EnterSTOPMode(PWR_LOWPOWERREGULATOR_ON, PWR_STOPENTRY_WFI);
// HAL_PWREx_EnterSTOP2Mode(PWR_STOPENTRY_WFI);
SystemClock_Config();
HAL_ResumeTick();
printf("wake up and delay\r\n");
HAL_Delay(8000);
/* USER CODE END WHILE */
/* USER CODE BEGIN 3 */
}
/* USER CODE END 3 */
}
.
.
.
/* USER CODE BEGIN 4 */
int __io_putchar (int ch)
{
(void)HAL_UART_Transmit(&huart1, (uint8_t *)&ch, 1, 100);
return ch;
}
void HAL_LPTIM_CompareMatchCallback(LPTIM_HandleTypeDef *hlptim)
{
printf("- - - In HAL_LPTIM_CompareMatchCallback - - -\r\n");
}
/* USER CODE END 4 */
.
.
.
2022-09-14 12:52 AM
Hello @XGao.2 and welcome to the community,
Can you please share your IOC file with the modified files(main.c).
Mohamed Aymen
2022-09-14 06:28 AM
2022-09-14 06:28 AM
2022-09-20 02:33 PM
Any update please?
2022-09-21 03:44 AM
Hello @XGao.2,
I apologize for the late reply, I was out of the office for a few days.
I'm working on this issue. I will get back to you shortly.
Thank you for your patience while we work on this.
Mohamed Aymen
2022-09-30 08:33 AM
Hello @XGao.2,
Sorry for delayed answer.
I did run your code on my side and didn't work as expected( the system didn't go to stop mode), what I suggest is to try the LPTIMER example from STM32U5CubeFirmware and compare your configuration with the example configuration to see if there is some missing set up ?
Mohamed Aymen
2022-10-03 02:23 PM
Thank you for your help. I will do more test base on your suggestion.