Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Can STM32F407VG's one pin set as Analog input in runtime ?

Status
Not open for further replies.

ashes35

Junior Member level 1
Joined
May 15, 2012
Messages
18
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,283
Activity points
1,400
Hi,I'm trying to read one channel ADC on STM32F4Discovery kit.I've closed DMA channel because i'm looking for basic ADC read that start an ADC channel wait for EADC_FLAG_EOC: End of conversion flag.
P.S:I use PA0 as digital input(button) ,read only PA1(Analog input channel 1),GPIOD's some pins are used as LEDs and here is my GPIO initialize routine.I use STD_Periph_Library
Code:
	  RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOD|RCC_AHB1Periph_GPIOA, ENABLE);
 GPIOD_InitStruct.GPIO_Pin=GPIO_Pin_12|GPIO_Pin_13|GPIO_Pin_14|GPIO_Pin_15;
	GPIOD_InitStruct.GPIO_Mode=GPIO_Mode_OUT;
	GPIOD_InitStruct.GPIO_Speed=GPIO_Speed_100MHz;
GPIOD_InitStruct.GPIO_OType=GPIO_OType_PP;
	GPIOD_InitStruct.GPIO_PuPd=GPIO_PuPd_UP;
	GPIO_Init(GPIOD,&GPIOD_InitStruct);
 GPIOD_InitStruct.GPIO_Pin=GPIO_Pin_0;
	GPIOD_InitStruct.GPIO_Mode=GPIO_Mode_IN;
GPIOD_InitStruct.GPIO_OType=GPIO_OType_OD;
	GPIOD_InitStruct.GPIO_PuPd=GPIO_PuPd_NOPULL;
		GPIO_Init(GPIOA,&GPIOD_InitStruct);
So my problem is how can i make PA1 as analog input in runtime.I find a function but it changes AF register,i'm looking for changing MODER register and i can't find it.
void GPIO_PinAFConfig ( GPIO_TypeDef * GPIOx,
uint16_t GPIO_PinSource,
uint8_t GPIO_AF
)
 
Last edited:

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top