cancel
Showing results for 
Search instead for 
Did you mean: 

Pin PF0 as GPIO input doesnt work

Simon Ballat
Associate II
Posted on August 23, 2017 at 09:56

I'm using a STM32F030R8 and configured the pin PF0 as a GPIO-Input. But when i read the pin it is randomly 1 or 0. 

The code was generated with the CubeMX SW. When i try an other pin for exsample PB1 it works fine.

The same issue i have with the STM32F302R8 board

Does anyone know this problem?

8 REPLIES 8
Posted on August 23, 2017 at 10:24

What's connected to that pin externally? What happens if you switch on a pullup or pulldown in GPIO_PUPDR?

JW

Max
ST Employee
Posted on August 23, 2017 at 11:19

For both devices, PF0 is the HSE oscillator input pin.

Make sure HSE is not enabled because it takes precedence over the GPIO configuration.

Posted on August 23, 2017 at 10:30

I just put the pin on GND or 3.3V. Pullup or pulldown makes no differents.

Posted on August 23, 2017 at 12:36

How do you check that input, in the debugger?

Post the relevant RCC and GPIO registers' content.

JW

Posted on August 23, 2017 at 11:12

PF0 is OSC_IN. Do you have RCC_CSR.HSEON set? (See 8.3.13  Using the HSE or LSE oscillator pins as GPIOs in RM0360.)

JW

Simon Ballat
Associate II
Posted on August 23, 2017 at 13:29

I found my mistake. On the Nucleo-Board is the PF0 default not with the pinheader connected. 

But thanks for all your help

Simon

Posted on August 23, 2017 at 12:27

0690X00000607x5QAA.png

The RCC clock is disable and the PF0 is set to GPIO_Input. 

Posted on August 24, 2017 at 06:23

On the nucleo boards, in the default hardware configuration, PF0 is connected to the STLink MCU clock out (MCO).

The purpose is to be able to use HSE set in bypass mode.

This is done this way to save the cost of one crystal and free PF1 while still having a precise clock.