cancel
Showing results for 
Search instead for 
Did you mean: 

Resetting a GPIO PIN INPUT

didos.nicky
Associate II
Posted on August 18, 2015 at 18:01

Hello guys,

I am using pin PC7 set has input on a

http://www.st.com/web/catalog/tools/FM116/SC959/SS1532/LN1847/PF260320

and use IAR with .

__HAL_RCC_GPIOC_CLK_ENABLE();

GPIO_InitStruct_C.Pin = GPIO_PIN_7;

GPIO_InitStruct_C.Mode = GPIO_MODE_INPUT;

GPIO_InitStruct_C.Pull = GPIO_NOPULL;

GPIO_InitStruct_C.Speed = GPIO_SPEED_MEDIUM;

HAL_GPIO_Init(GPIOC, &GPIO_InitStruct_C);

Using an oscilloscope, i noticed that on this pin i receive a signal, that printed by HAL_GPIO_ReadPin(GPIOC, GPIO_PIN_7) is equal to 1 for default. This situation creates interferences to an Arduino Shield.

How is it possible to put this value to 0, i.e. reset the PC7 ?

Thank you for your help.

#gpio #mode #reset #input
4 REPLIES 4
robert-hartung
Associate II
Posted on August 18, 2015 at 19:59

You can use HAL_GPIO_WritePin for this.

I think it is:

HAL_GPIO_WritePin(GPIOC, GPIO_PIN_7, GPIO_PIN_RESET);

- Robert

didos.nicky
Associate II
Posted on August 18, 2015 at 20:26

HAL_GPIO_WritePin(GPIOC, GPIO_PIN_7, GPIO_PIN_RESET), it works without

Shield

Just

insert

the

shiled

read me

1

,

however, if

I do

the same with

Arduino

I read

0.

Why

?

I must say

that I use

the

UART2

to interact

with

Shiled as example firmware of

.

  * @file    UART/UART_Printf/Src/main.c

  * @author  MCD Application Team

  * @version V1.1.0

  * @date    26-December-2014

  * @brief   This example shows how to retarget the C library printf function

  * to the UART.

Posted on August 18, 2015 at 20:44

If you want to control the pin, INPUT is probably not the mode to use.

If it's an input and you want it low by default, consider setting the Pull-Down on the pin, otherwise it's going to float.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
didos.nicky
Associate II
Posted on August 19, 2015 at 22:57

Hi, thank you to all of you. Your suggestion about pull down clarified our ideas. Then, using oscilloscope we idetntified which pins set the pin PC7 to the high value.

Best Regards