cancel
Showing results for 
Search instead for 
Did you mean: 

Two bugs in CubeMX 6.15 code generation with STM32U031e Low Layer libraries

cb.7
Associate III

The first case concerns the DAC, by setting "Output Buffer" = Disable in CubeMX, it is enabled in code generation instead, i had to add "DAC1->MCR = 0x03" in the initializations.

Cattura.PNG

 
/**
  * @brief DAC1 Initialization Function
  * @PAram None
  * @retval None
  */
static void MX_DAC1_Init(void)
{

  /* USER CODE BEGIN DAC1_Init 0 */

  /* USER CODE END DAC1_Init 0 */

  LL_DAC_InitTypeDef DAC_InitStruct = {0};

  /* Peripheral clock enable */
  LL_APB1_GRP1_EnableClock(LL_APB1_GRP1_PERIPH_DAC1);

  /* USER CODE BEGIN DAC1_Init 1 */

  /* USER CODE END DAC1_Init 1 */

  /** DAC channel OUT1 config
  */
  DAC_InitStruct.TriggerSource = LL_DAC_TRIG_SOFTWARE;
  DAC_InitStruct.WaveAutoGeneration = LL_DAC_WAVE_AUTO_GENERATION_NONE;
  DAC_InitStruct.OutputConnection = LL_DAC_OUTPUT_CONNECT_INTERNAL;
  DAC_InitStruct.OutputMode = LL_DAC_OUTPUT_MODE_NORMAL;
  LL_DAC_Init(DAC1, LL_DAC_CHANNEL_1, &DAC_InitStruct);
  LL_DAC_DisableTrigger(DAC1, LL_DAC_CHANNEL_1);
  /* USER CODE BEGIN DAC1_Init 2 */

  /* USER CODE END DAC1_Init 2 */

}

 

The second case concerns IWDG, which generates the string "__HAL_RCC_IWDG_CLK_ENABLE()" which

obviously causes compilation to fail. I solved it by adding " #ifdef BUG_CLK_IWDG "

/**
  * @brief IWDG Initialization Function
  * @PAram None
  * @retval None
  */
static void MX_IWDG_Init(void)
{

  /* USER CODE BEGIN IWDG_Init 0 */
#ifdef BUG_CLK_IWDG
  /* USER CODE END IWDG_Init 0 */

  /* Peripheral clock enable */
  __HAL_RCC_IWDG_CLK_ENABLE();

  /* USER CODE BEGIN IWDG_Init 1 */
#endif
  /* USER CODE END IWDG_Init 1 */
  LL_IWDG_Enable(IWDG);
  LL_IWDG_EnableWriteAccess(IWDG);
  LL_IWDG_SetPrescaler(IWDG, LL_IWDG_PRESCALER_8);
  LL_IWDG_SetReloadCounter(IWDG, 4095);
  while (LL_IWDG_IsReady(IWDG) != 1)
  {
  }

  LL_IWDG_ReloadCounter(IWDG);
  /* USER CODE BEGIN IWDG_Init 2 */

  /* USER CODE END IWDG_Init 2 */

}

 

2 REPLIES 2
Mahmoud Ben Romdhane
ST Employee

Hello @cb.7 

 

First let me thank you for posting.

Your request is under investigation, and I will get back to you ASAP.

 

Thanks.

Mahmoud

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.

Mahmoud Ben Romdhane
ST Employee

Hello @cb.7 ,

 

Thank you for bringing these issues to our attention.

Related to the first problem (DAC Peripheral), an internal ticket is raised to the dedicated team

( Ticket Number : 214226 ).

Related to the second problem (IWDG Peripheral), an internal ticket is raised to the dedicated team

( Ticket Number : 214196 ).

 

Thanks.

Mahmoud

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.