i try to implement an input which is reacting on an high impedance 3.3V on PC14. My Configuration looks like this.
main.h
#define I_Pin GPIO_PIN_14
#define I_GPIO_Port GPIOC
#define O_LED_Pin GPIO_PIN_5
#define O_LED_GPIO_Port GPIOA
static void MX_GPIO_Init(void)
{
GPIO_InitTypeDef GPIO_InitStruct = {0};
/* GPIO Ports Clock Enable */
__HAL_RCC_GPIOA_CLK_ENABLE();
__HAL_RCC_GPIOB_CLK_ENABLE();
__HAL_RCC_GPIOC_CLK_ENABLE();
/*Configure GPIO pins : O_LED_Pin O_state_Pin */
GPIO_InitStruct.Pin = O_LED_Pin|O_state_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
/*Configure GPIO pin : I_Pin */
GPIO_InitStruct.Pin = I_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
GPIO_InitStruct.Pull = GPIO_PULLDOWN;
HAL_GPIO_Init(I_GPIO_Port, &GPIO_InitStruct);
}
And in my main function i try to read the input like this.
if(HAL_GPIO_ReadPin(I_GPIO_Port, I_Pin)== GPIO_PIN_SET)
{
HAL_GPIO_WritePin(O_LED_GPIO_Port,O_LED_Pin, GPIO_PIN_SET);
}
Then i connect the PIN PC14 to the 3.3V of my Nucleo board but nothing happens. But it should detect the Pin as set and enter the if statement...
Anyone knows what to do?