cancel
Showing results for 
Search instead for 
Did you mean: 

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

dhs
Senior

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

 

Daniel H Sagarra
8 REPLIES 8
dhs
Senior

Could please some one give some advises?

 

 

Daniel H Sagarra
Imen.D
ST Employee

Hello @dhs,

Did you check the STM32U575 errata sheet in LPTIM section ?

Maybe you have the same condition here:

ImenD_0-1728895213694.png

 

When your question is answered, please close this topic by clicking "Accept as Solution".
Thanks
Imen

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.

 

 

 

 

 

Daniel H Sagarra
Sarra.S
ST Employee

Hello @dhs

>>I made a very short project isolating the problem

can you please share it?

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.

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

JW

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.

Daniel H Sagarra

Hi @waclawek.jan 

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

Daniel H Sagarra

@Sarra.S Could you reproduce in your side? Do you need further assistance to reproduce issue?

 

 

Regards, Daniel.

Daniel H Sagarra