2021-10-21 12:30 PM
2021-10-21 12:44 PM
You have to choose the right on depending on your external components. PP=push-pull, OD=open-drain. It only affects the type of driver, not the function.
2021-10-21 12:57 PM
I need a PWM out from PA6 using TIM3 PWM CH1. Let me ask this way. What does "GPIO Mode" means in TIM_configuration_GPIOSettings in CubeMX?
Does "Alt_Funct" refer to the timer PWM function? if so, it implies the Timer_PWM engine control the pin (in PP or OD fashion) according to GPIO Mode selection, correct?
2021-10-21 01:06 PM
There are 4 GPIO modes: Input, Output, Analog and Alternate Function. Which alternate function is used is defined in the AFR register. If the PA6 AFR entry is programmed to TIM3_CH1, you are right. See Tables 14 and 15 in STM32F072 data sheet.
hth
KnarfB
2021-10-21 01:35 PM
I have PWM signal correctly with either Alt_Funct_PP or Alt_Funct_OD selection. PP makes more sense for our application. However, this is interesting, Alt_Funct_PP selection causes problem on Vref for ADC_IN0 (pin PA0). Alt_Funct_OD selection does not. So I want to make sure I understand Alt_Funct_PP, Alt_Funct_OD selections correctly.
2021-10-21 02:10 PM
Most likely you want push-pull.
Push-pull with both pull up the pin to 3.3V when the pin is set and pull down the pin to GND when the pin is reset.
Open drain will only pull down the pin to GND when the pin is reset. When the pin is set, the output will float and you will need an external or internal pullup to bring it to 3.3V if desired. OD is often used when multiple devices are controlling the same line.
2021-10-21 02:31 PM
Agree 100% with TDK. Our PWM signal is not shared. My first choice is PP, since I want to have the pin driven at all time. However, PP selection gives me the problem described in my last post. So the problem involves other area.
2021-10-21 02:36 PM
AF_PP is a valid selection for PWM.
> However, this is interesting, Alt_Funct_PP selection causes problem on Vref for ADC_IN0 (pin PA0).
We're not going to be able to debug much with that amount of information. Since it's a different problem than the original post, consider asking it in a new question along with relevant details and closing this one out.
2021-10-21 10:50 PM
In OD the high side mosfet of the GPIO output driver is off all the time. In PP it switches to on when the output is high, connecting Vdd to the external pad. Current will flow with an external load. So you might want to check at external Vdd vs. Vdda routing. Check that the ADC pin is in analog mode. Check also AN2834 Application note How to get the best ADC accuracy in STM32 microcontrollers.
hth
KnarfB