2018-01-22 02:26 PM
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.
Solved! Go to Solution.
2018-02-06 01:28 AM
Hello
Golab.Bogdan
,simon.010
,We will take in charge to check and raise this issue internally to the appropriate team.
Thank you for highlighting this issue.
Best Regards,
Imen.
2018-02-19 03:04 AM
Hello,
This issue is confirmed for LL Gpio pins greater than 8 initialization with LL-Init() function and this will be fixed in the next release.
We propose thisfix for ll_gpio driver with LL_GPIO_Init function:
ErrorStatus LL_GPIO_Init(GPIO_TypeDef *GPIOx, LL_GPIO_InitTypeDef *GPIO_InitStruct)
{
uint32_t pinmask = 0x00000000U;
uint32_t pinpos = 0x00000000U;
uint32_t currentpin = 0x00000000U;
/* Check the parameters */
assert_param(IS_GPIO_ALL_INSTANCE(GPIOx));
assert_param(IS_LL_GPIO_PIN(GPIO_InitStruct->Pin));
assert_param(IS_LL_GPIO_MODE(GPIO_InitStruct->Mode));
assert_param(IS_LL_GPIO_PULL(GPIO_InitStruct->Pull));
/* ------------------------- Configure the port pins ---------------- */
/* Initialize pinpos on first pin set */
pinmask = (GPIO_InitStruct->Pin & 0x00FFFF00U) >> 8 ;
pinpos = POSITION_VAL(pinmask);
/* Configure the port pins */
while ((pinmask >> pinpos) != 0U)
{
/* skip if bit is not set */
if ((pinmask & (1U << pinpos)) == 0U)
{
pinpos++;
}
/* Get current io position */
if(pinpos <8 )
{
currentpin = (0x00000101U << pinpos);
}
else
{
currentpin = ((0x00010001U << (pinpos-8)) | 0x04000000U);
}
if (currentpin)
{
/* Pin Mode configuration */
LL_GPIO_SetPinMode(GPIOx, currentpin, GPIO_InitStruct->Mode);
/* Pull-up Pull down resistor configuration*/
LL_GPIO_SetPinPull(GPIOx, currentpin, GPIO_InitStruct->Pull);
if ((GPIO_InitStruct->Mode == LL_GPIO_MODE_OUTPUT) || (GPIO_InitStruct->Mode == LL_GPIO_MODE_ALTERNATE))
{
/* Check Output mode parameters */
assert_param(IS_LL_GPIO_OUTPUT_TYPE(GPIO_InitStruct->OutputType));
/* Output mode configuration*/
LL_GPIO_SetPinOutputType(GPIOx, currentpin, GPIO_InitStruct->OutputType);
/* Speed mode configuration */
LL_GPIO_SetPinSpeed(GPIOx, currentpin, GPIO_InitStruct->Speed);
}
}
pinpos++;
}
return (SUCCESS);
}
Hope this is helpful for you.
Kind Regards,
Imen.
2018-03-16 11:20 AM
Just tested a STM32VLDIscovery board and the issue still exists in CubeMX 4.25.0 with the v1.6.0 HAL/LL drivers.
2018-03-19 10:07 AM
Just tested STM32CubeF1 Firmware patch Package V1.6.1 - GPIO works fine.
2018-03-22 01:52 AM
Hello,
We would inform you that the new patch of STM32CubeF1 Firmware package V1.6.1 is released to fix this issue.
Best Regards
Imen