AnsweredAssumed Answered

STM32CubeMX v4.24.0 - STM32F1 GPIO LL - LED blinking fails

Question asked by Bogdan Golab on Jan 22, 2018
Latest reply on Mar 22, 2018 by Imen D

Hi,

Excited by the LL support added to the F1 line I generated simple project for STM32F103C8 board where the PC13 is connected to a LED: HSE enabled, PC13 Push-Pull output.

 

Generated GPIO initialization code seems to be fine:

 

static void MX_GPIO_Init(void)
{

 

  LL_GPIO_InitTypeDef GPIO_InitStruct;

 

  /* GPIO Ports Clock Enable */
  LL_APB2_GRP1_EnableClock(LL_APB2_GRP1_PERIPH_GPIOC);
  LL_APB2_GRP1_EnableClock(LL_APB2_GRP1_PERIPH_GPIOD);
  LL_APB2_GRP1_EnableClock(LL_APB2_GRP1_PERIPH_GPIOA);

 

  /**/
  LL_GPIO_ResetOutputPin(LED_GPIO_Port, LED_Pin);

 

  /**/
  GPIO_InitStruct.Pin = LED_Pin;
  GPIO_InitStruct.Mode = LL_GPIO_MODE_OUTPUT;
  GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_LOW;
  GPIO_InitStruct.OutputType = LL_GPIO_OUTPUT_PUSHPULL;
  LL_GPIO_Init(LED_GPIO_Port, &GPIO_InitStruct);

 

}

 

Added the blinking part:

 

/* USER CODE BEGIN WHILE */
  while (1)
  {

 

  /* USER CODE END WHILE */

 

  /* USER CODE BEGIN 3 */
        
        LL_GPIO_TogglePin(LED_GPIO_Port, LED_Pin);
    LL_mDelay(1000);

  }
  /* USER CODE END 3 */

 

But unfortunately the LED is not blinking.

---------------------------------------------------------

 

Entered Keil debuger, GPIOC and noticed that MODE13=0, so entered manually value 1 (MODE13=1) and the LED started blinking.

 

It seems that the LL GPIO driver is somewhat broken because the MODE is wrongly set.

The whole project is attached.

Attachments

Outcomes