2023-04-29 01:41 AM - edited 2023-11-20 06:48 AM
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):
Even though I can interpret the signal, the imposed voltage on the UV filter makes him go into default mode.
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);
2023-04-29 02:28 AM
PA5 (Arduino D13) pin is connected to an LED ("user LED") - check the Nucleo schematic.
2023-04-29 05:09 PM
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.