Skip to main content
Explorer II
October 8, 2024
Question

NUCLEO-U575 CAPTURE FAIL, is it a silicon level bug?

  • October 8, 2024
  • 4 replies
  • 2554 views

For the Nucleo-575ZI-Q, while in stop mode 2, I have the capture module enabled, I set CH1 IO Usage as input.

A square wave generator connected to PC1->LPTIM_CH1.
While the Micro is in stop mode 2 an indeterminate number of pulses trigger successive captures.
If the pulses on PC1 were odd CCR1 has the correct data.
If the pulses on PC1 were even CCR1 value doesn't updated at all.

Please note that all pulses arrive while STM32U575 is on stop mode.

 

I made a very short project isolating the problem, the RTC is used to exit stop mode 2 every second, when waking up only CRR1 is read and returns to stop mode 2.

 

 

 

void FM_MAIN_Main()
{
	uint16_t capture = 0;

	HAL_LPTIM_IC_Start(&hlptim1, LPTIM_CHANNEL_1);
	__HAL_RCC_LPTIM1_CLKAM_ENABLE();

	for (;;)
	{
		 HAL_GPIO_WritePin(LED_GPIO_Port, LED_Pin, GPIO_PIN_SET);
		 capture = LPTIM1->CCR1;
		 FM_DEBUG_UartUint16(capture);
		 HAL_GPIO_WritePin(LED_GPIO_Port, LED_Pin, GPIO_PIN_RESET);

		 HAL_SuspendTick();
		 HAL_PWREx_EnterSTOP2Mode(PWR_STOPENTRY_WFI);
		 HAL_ResumeTick();
	}
}

/**
 * @brief LPTIM1 Initialization Function
 * None
 * @retval None
 */
static void MX_LPTIM1_Init(void)
{

 /* USER CODE BEGIN LPTIM1_Init 0 */

 /* USER CODE END LPTIM1_Init 0 */

 LPTIM_IC_ConfigTypeDef sConfig = {0};

 /* USER CODE BEGIN LPTIM1_Init 1 */

 /* USER CODE END LPTIM1_Init 1 */
 hlptim1.Instance = LPTIM1;
 hlptim1.Init.Clock.Source = LPTIM_CLOCKSOURCE_APBCLOCK_LPOSC;
 hlptim1.Init.Clock.Prescaler = LPTIM_PRESCALER_DIV1;
 hlptim1.Init.Trigger.Source = LPTIM_TRIGSOURCE_SOFTWARE;
 hlptim1.Init.Period = 65535;
 hlptim1.Init.UpdateMode = LPTIM_UPDATE_IMMEDIATE;
 hlptim1.Init.CounterSource = LPTIM_COUNTERSOURCE_INTERNAL;
 hlptim1.Init.Input1Source = LPTIM_INPUT1SOURCE_GPIO;
 hlptim1.Init.Input2Source = LPTIM_INPUT2SOURCE_GPIO;
 hlptim1.Init.RepetitionCounter = 0;
 if (HAL_LPTIM_Init(&hlptim1) != HAL_OK)
 {
 Error_Handler();
 }
 sConfig.ICInputSource = LPTIM_IC1SOURCE_GPIO;
 sConfig.ICPrescaler = LPTIM_ICPSC_DIV1;
 sConfig.ICPolarity = LPTIM_ICPOLARITY_RISING;
 sConfig.ICFilter = LPTIM_ICFLT_CLOCK_DIV1;
 if (HAL_LPTIM_IC_ConfigChannel(&hlptim1, &sConfig, LPTIM_CHANNEL_1) != HAL_OK)
 {
 Error_Handler();
 }
 /* USER CODE BEGIN LPTIM1_Init 2 */

 /* USER CODE END LPTIM1_Init 2 */

}

/**
 * @brief RTC Initialization Function
 * None
 * @retval None
 */
static void MX_RTC_Init(void)
{

 /* USER CODE BEGIN RTC_Init 0 */

 /* USER CODE END RTC_Init 0 */

 RTC_PrivilegeStateTypeDef privilegeState = {0};

 /* USER CODE BEGIN RTC_Init 1 */

 /* USER CODE END RTC_Init 1 */

 /** Initialize RTC Only
 */
 hrtc.Instance = RTC;
 hrtc.Init.HourFormat = RTC_HOURFORMAT_24;
 hrtc.Init.AsynchPrediv = 127;
 hrtc.Init.SynchPrediv = 255;
 hrtc.Init.OutPut = RTC_OUTPUT_DISABLE;
 hrtc.Init.OutPutRemap = RTC_OUTPUT_REMAP_NONE;
 hrtc.Init.OutPutPolarity = RTC_OUTPUT_POLARITY_HIGH;
 hrtc.Init.OutPutType = RTC_OUTPUT_TYPE_OPENDRAIN;
 hrtc.Init.OutPutPullUp = RTC_OUTPUT_PULLUP_NONE;
 hrtc.Init.BinMode = RTC_BINARY_NONE;
 if (HAL_RTC_Init(&hrtc) != HAL_OK)
 {
 Error_Handler();
 }
 privilegeState.rtcPrivilegeFull = RTC_PRIVILEGE_FULL_NO;
 privilegeState.backupRegisterPrivZone = RTC_PRIVILEGE_BKUP_ZONE_NONE;
 privilegeState.backupRegisterStartZone2 = RTC_BKP_DR0;
 privilegeState.backupRegisterStartZone3 = RTC_BKP_DR0;
 if (HAL_RTCEx_PrivilegeModeSet(&hrtc, &privilegeState) != HAL_OK)
 {
 Error_Handler();
 }

 /** Enable the WakeUp
 */
 if (HAL_RTCEx_SetWakeUpTimer_IT(&hrtc, 0, RTC_WAKEUPCLOCK_CK_SPRE_16BITS, 0) != HAL_OK)
 {
 Error_Handler();
 }
 /* USER CODE BEGIN RTC_Init 2 */

 /* USER CODE END RTC_Init 2 */

}

 

 

 

dhs_0-1728412991039.png

dhs_1-1728413010046.png

 

    This topic has been closed for replies.

    4 replies

    dhsAuthor
    Explorer II
    October 11, 2024

    Could please some one give some advises?

     

     

    Technical Moderator
    October 14, 2024

    Hello @dhs,

    Did you check the STM32U575 errata sheet in LPTIM section ?

    Maybe you have the same condition here:

    ImenD_0-1728895213694.png

     

    dhsAuthor
    Explorer II
    October 14, 2024

    Hello @Imen.D 

    Yes, I saw it and I followed the workaround, but the problem persist.

    To reproduce the issue, all pulses must arrive while the STM32U575 is in stop mode 2

    Initially. I encountered this problem with a custom board using a STM32U575VIT6Q, LPTIM 3, after that I reproduce the problem on the Nucleo board using LPTIM 1 and 3.

    I'm amazed how such a basic feature can fail.

     

     

     

     

     

    ST Employee
    October 22, 2024

    Hello @dhs

    >>I made a very short project isolating the problem

    can you please share it?

    dhsAuthor
    Explorer II
    October 25, 2024

    Hello @Sarra.S 

    https://github.com/gamarrita/Nucleo-U575ZI-Q

    I shot a video, please note that only for odd frequency the CCR1 register is updated.

    https://youtu.be/C-1DqWXYvDQ

    Regards, Daniel.

    Super User
    October 22, 2024

    What are your observations and how are they different from the expectations?

    JW

    dhsAuthor
    Explorer II
    October 25, 2024

    Hi @waclawek.jan 

    Please take a look to my answer to @Sarra.S