Skip to main content
tpeng.1
Associate III
Apr 13, 2022 11:16 AM UTC
Question

Configure STM32F072 PC15 as input port

I try to configure STM32F072 PC15 as input I/O using STM32F0xx Standard Peripherals Firmware Library, but not successful.

Ask for help.

Tim

This topic has been closed for replies.

4 replies

Peter BENSCH
ST Technical Moderator
Apr 13, 2022 11:44 AM UTC

Have you looked at the examples in the SPL?

How did you try to initialise the GPIO?

Regards

/Peter

In order to give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
TDK
Apr 13, 2022 1:23 PM UTC

PC15 may have RTC/LSE functionality that needs disabled. Show your code.

0693W00000LxsH3QAJ.png

"If you feel a post has answered your question, please click ""Accept as Solution""."
tpeng.1
tpeng.1Author
Associate III
Apr 14, 2022 1:58 AM UTC

Hi Peter and TDK,

Thank your reply.

Where is the examples in the SPL (SPI)? In STM32F0xx_StdPeriph_Lib_V1.5.0/../STM32F0xx_StdPeriph_Examples?

0693W00000Lxvx2QAB.pngHere is my code:  

RCC_AHBPeriphClockCmd(RCC_AHBPeriph_GPIOC, ENABLE);

PWR_BackupAccessCmd( ENABLE );

RCC_LSEConfig( RCC_LSE_OFF );

GpioDriverInit(GpioC,GpioPin15,GpioInput);

Br,

Tim

waclawek.jan
Super User
Apr 14, 2022 7:54 AM UTC

Why do you think you cannot set the pin? Maybe it's a hardware problem.

> PWR_BackupAccessCmd( ENABLE );

You need to enable PWR clock in RCC first.

To test, you can do this all directly in registers in debugger, don't need to write any code.

JW