2014-03-21 07:13 AM
Hi guys,
I am a beginner and just start playing around with the board. I need some help on configuring 2 analog inputs for adc3. I already looked at the peripheral example. It seems like it is only configured for 1 pin. Also, I have a question regarding to the adc dma example. In the example, PC2 is configured as an analog input. How do you know that PC2 is connected to ADC3 channel12? If i have 2 analog inputs, do I just pick random 2 pins and hook it up 2 random channels? By the way, I am using stm32f4discovery. Please advice. Thank you. #rtfm #!random-shit #analog-inputs-for-adc2014-03-21 07:22 AM
If i have 2 analog inputs, do I just pick random 2 pins and hook it up 2 random channels?
No, you review thehttp://www.st.com/st-web-ui/static/active/en/resource/technical/document/datasheet/DM00037051.pdf
for the part and review the pin and function designations. You'd review thehttp://www.st.com/st-web-ui/static/active/en/resource/technical/document/user_manual/DM00039084.pdf
for the STM32F4-DISCO to understand what pins are free to use.[DEAD LINK /public/STe2ecommunities/mcu/Lists/STM32Discovery/Flat.aspx?RootFolder=/public/STe2ecommunities/mcu/Lists/STM32Discovery/Multi%20Channel%20ADC%20reading&FolderCTID=0x01200200770978C69A1141439FE559EB459D75800084C20D8867EAD444A5987D47BE638E0F¤tviews=1054]https://my.st.com/public/STe2ecommunities/mcu/Lists/STM32Discovery/Flat.aspx?RootFolder=%2Fpublic%2FSTe2ecommunities%2Fmcu%2FLists%2FSTM32Discovery%2FMulti%20Channel%20ADC%20reading&FolderCTID=0x01200200770978C69A1141439FE559EB459D75800084C20D8867EAD444A5987D47BE638E0F¤tviews=10542014-03-21 07:28 AM
are you referring to the alternate function pins? but the example does not configure any pins as alternate function.
2014-03-21 07:33 AM
Could you tell me where in the manual that tells me the mapping from a GPIO pin to an adc channel? I am having a hard time finding it.
2014-03-21 07:40 AM
Analogue functions are treated slightly differently than Digital AF/GPIO ones
//******************************************************************************
void GPIO_Configuration(void)
{
GPIO_InitTypeDef GPIO_InitStructure;
RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOA, ENABLE);
/* Configure ADC1 Channel3 & 5 pins as analog input ******************************/
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_3 | GPIO_Pin_5;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AN;
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;
GPIO_Init(GPIOA, &GPIO_InitStructure);
}
//******************************************************************************
2014-03-21 07:41 AM
thank you so much