Skip to main content
Zanon.Luciano
Associate III
March 15, 2021
Solved

stm32f1xx_ll_gpio.h, wrong LL_GPIO_PIN_x definition

  • March 15, 2021
  • 2 replies
  • 2126 views

Hello the pin definition> 7 in the stm32f1xx_ll_gpio.h file seems to be wrong:

0693W000008wvgvQAA.pngin fact when I use LL_GPIO_PIN_8 with the function HAL_GPIO_WritePin (GPIO_TypeDef * GPIOx, uint16_t GPIO_Pin, GPIO_PinState PinState)

the ODR0 bit of the port concerned is moved instead of ODR8.

Also when I try to move the LL_GPIO_PIN_6 pin, the HAL_GPIO_WritePin function moves ODR6 and ODR14 ....

Is it really a mistake or am I making a mistake?

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

This group of definitions seems completely wrong to work with HAL_GPIO_WritePin function.

I can't understand what the << GPIO_PIN_MASK_POS (8 bit) scrolling is for, which generates the command on two pins when the selected pin is less than 8.

Furthermore, the following Or is even more mysterious ....

This topic has been closed for replies.
Best answer by Mike_ST

>> in fact when I use LL_GPIO_PIN_8 with the function HAL_GPIO_WritePin (GPIO_TypeDef * GPIOx, uint16_t GPIO_Pin, GPIO_PinState PinState)

You can't use LL definitions (LL_GPIO_PIN_8) with HAL_GPIO_WritePin, which is a HAL function.

Pin can be a mask like : GPIO_PIN_0 | GPIO_PIN_5 etc...

You need to use what is inside stm32f1xx_hal_gpio.h

If you need to use LL_GPIO_PIN_8, you have to use LL functions.

2 replies

Mike_ST
Mike_STBest answer
Technical Moderator
March 15, 2021

>> in fact when I use LL_GPIO_PIN_8 with the function HAL_GPIO_WritePin (GPIO_TypeDef * GPIOx, uint16_t GPIO_Pin, GPIO_PinState PinState)

You can't use LL definitions (LL_GPIO_PIN_8) with HAL_GPIO_WritePin, which is a HAL function.

Pin can be a mask like : GPIO_PIN_0 | GPIO_PIN_5 etc...

You need to use what is inside stm32f1xx_hal_gpio.h

If you need to use LL_GPIO_PIN_8, you have to use LL functions.

In order to give better visibility on the answered topics, please click on 'Best answer' on the reply which solved your issue or answered your question. 
Zanon.Luciano
Associate III
March 15, 2021

Ah.... As often happens, the error was so stupid that it seemed like a difficult problem !!

Thanks Mike_ST