2011-11-11 01:08 AM
Hi everyone
I have some silly newbie doubts on stm32f2 seriesI had downloaded the standard peripheral library and was looking at the sample codes in \STM32F4xx_DSP_StdPeriph_Lib_V1.0.0\Project\STM32F4xx_StdPeriph_Examples\TIM\PWM_InputMy doubt is in the linesGPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF; GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz; GPIO_InitStructure.GPIO_OType = GPIO_OType_PP; GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP ;When we want to read a pwm signal, why are we setting the pin as an output?ThanksSrinath2011-11-11 09:21 AM
When we want to read a pwm signal, why are we setting the pin as an output?
It's not so much that it's an output, but that it is NOT controlled by the GPIO unit. Alternate function devices with bidirectional functionality, or ambiguous internal configurations, will in fact control the ''Output Control'' portion of the pin driver shown in the documentation. For example all the SPI projects dating back to the F1 series set all pins as ''AF OUT'' and the peripheral controls the details based on the slave/master/1-wire/2-wire configurations.
2011-11-11 11:19 AM
Thanks Clive.
Are the following 2 lines necessary or should they always be set as follows for AF mode?
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP ;