2014-08-11 05:27 AM
To avoid
glitches
at the output
,we
initialize
in
the following order
:1. GPIOx
clock
enable
2. Set output
registers
to
defined value
3. Perform
initialization
Now we would
like to use
STM32CubeMX
.Is it
possible
when initializing the
GPIO
to initialize the
output level
?Example of
implementation:
In source: /*Configure GPIO pins : PE2 PE3 PE4 PE5 PE6 PE8 PE9 PE10 PE11 PE12 PE14 PE15 PE0 PE1 */ HAL_GPIO_WritePin(GPIOE,GPIO_PIN_2|GPIO_PIN_3|GPIO_PIN_4|GPIO_PIN_5 |GPIO_PIN_6|GPIO_PIN_8,GPIO_PIN_RESET); HAL_GPIO_WritePin(GPIOE,GPIO_PIN_8|GPIO_PIN_9|GPIO_PIN_10 |GPIO_PIN_11|GPIO_PIN_12|GPIO_PIN_14|GPIO_PIN_15 |GPIO_PIN_0|GPIO_PIN_1,GPIO_PIN_SET); GPIO_InitStruct.Pin = GPIO_PIN_2|GPIO_PIN_3|GPIO_PIN_4|GPIO_PIN_5 |GPIO_PIN_6|GPIO_PIN_8|GPIO_PIN_9|GPIO_PIN_10 |GPIO_PIN_11|GPIO_PIN_12|GPIO_PIN_14|GPIO_PIN_15 |GPIO_PIN_0|GPIO_PIN_1; GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP; GPIO_InitStruct.Pull = GPIO_NOPULL; GPIO_InitStruct.Speed = GPIO_SPEED_LOW; HAL_GPIO_Init(GPIOE, &GPIO_InitStruct); #initializing #stm32cubemx #gpio2014-08-29 02:09 AM
Hello,
STM32CubeMX manages the GPIO initialization settings only. The GPIO level is not part of the GPIO init structure (from HAL GPIO driver). The following need to be used to set the GPIO level: /** * @brief GPIO Bit SET and Bit RESET enumeration */ typedef enum { GPIO_PIN_RESET = 0, GPIO_PIN_SET }GPIO_PinState; #define IS_GPIO_PIN_ACTION(ACTION) (((ACTION) == GPIO_PIN_RESET) || ((ACTION) == GPIO_PIN_SET)) I have logged a ticket for your request (on STM32CubeMX and requesting the possibility to go beyond the basic GPIO initialization). Best Regards2016-02-09 03:21 AM
Dear user,
Please note your request is now implemented in STM32CubeMX 4.13. Thank you