cancel
Showing results for 
Search instead for 
Did you mean: 

Why is my PIN configured as Input, but still acts as Output?

Dali
Associate

Hi all

I'm working on Nucleo-F410RB

I have a UV filter that sends back a 0V-5V digital signal that I'm trying to read on PIN D13 (PA5).

The issue if the following (I'm using a multimeter to read the voltage, and all components have a common ground):

  • when the cable is not connected to the PIN
    • I read a voltage of 5V from the UV filter side
    • I read a voltage of 1.7V from the PIN D13 side
  • when I connect them both
    • I read a voltage of 2V

Even though I can interpret the signal, the imposed voltage on the UV filter makes him go into default mode.


_legacyfs_online_stmicro_images_0693W00000bj4sKQAQ.png 

Here is the code I'm using

#define OTH2_GPIO GPIOA

#define OTH2_PIN GPIO_PIN_5

  /*Configure GPIO pin Output Level */

  HAL_GPIO_WritePin(GPIOB, GPIO_PIN_0|GPIO_PIN_3|GPIO_PIN_4|GPIO_PIN_6|GPIO_PIN_5|GPIO_PIN_10, GPIO_PIN_RESET);

  HAL_GPIO_WritePin(OTH1_GPIO, OTH1_PIN, GPIO_PIN_RESET);

  HAL_GPIO_WritePin(OTH2_GPIO, OTH2_PIN, GPIO_PIN_RESET);

  GPIO_InitStruct.Pin = OTH2_PIN;

  GPIO_InitStruct.Mode = GPIO_MODE_INPUT;

  GPIO_InitStruct.Pull = GPIO_NOPULL;

  HAL_GPIO_Init(OTH2_GPIO, &GPIO_InitStruct);

2 REPLIES 2
gbm
Lead III

PA5 (Arduino D13) pin is connected to an LED ("user LED") - check the Nucleo schematic.

My STM32 stuff on github - compact USB device stack and more: https://github.com/gbm-ii/gbmUSBdevice
S.Ma
Principal

And remember that analog inputs on some STM32 are 3.3V tolerant only, so don't connect a 5V signal to it, unless you made sure reading the datasheet that this is safe to do so.