0
\$\begingroup\$

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?

\$\endgroup\$
2
  • \$\begingroup\$ You are not configuring the LED output pin. Or if you are, you are hiding information. What is the output pin, and which Nucleo is this, i.e. which specific STM32 model chip it has? \$\endgroup\$
    – Justme
    Commented Mar 5, 2021 at 13:10
  • \$\begingroup\$ I did configure the LED. I am Using a NUCLEO-F411RE, when i switch to PC13 i actually can use the onboard button. But this one is active low and i try to achiev an active high input by switching to PC14 using Pulldown \$\endgroup\$ Commented Mar 5, 2021 at 13:13

1 Answer 1

2
\$\begingroup\$

PC14 of the connector is not by default connected to the MCU.

By default the MCU pin PC14 is used as the LSE oscillator pins and connected to the 32768Hz tuning fork crystal.

There is a solder bridge SB49 to configure the connection, it is left open at the factory.

\$\endgroup\$
1
  • \$\begingroup\$ Ohh Thats it!! Thank you \$\endgroup\$ Commented Mar 5, 2021 at 13:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.