AnsweredAssumed Answered

Timer1 - Alternate Function - Pin state if deinitialized?

Question asked by life_augmented.st on Oct 16, 2015
Latest reply on Oct 16, 2015 by waclawek.jan
Hi Guys,

I am working on a project, where I need to output a PWM for a certain period of time and then stop and deinitialize the PWM. 

In my case, I use timer 1 as my PWM output. I can initialize, start, stop, and deinitialize the timer, and therefore the PWM. 
Now my problem is that the signal is low active and every time the timer is not initialized, the pin is set to low. 

I set the GPIO function here:
1.GPIO_InitStruct.Mode        = GPIO_MODE_AF_PP;
2.GPIO_InitStruct.Pull        = GPIO_PULLUP;
3.GPIO_InitStruct.Speed       = GPIO_SPEED_HIGH;
4.GPIO_InitStruct.Alternate   = GPIO_AF1_TIM1;
5. 
6.GPIO_InitStruct.Pin         = GPIO_PIN_9;
7.HAL_GPIO_Init(GPIOE, &GPIO_InitStruct);

In my understanding this should pull up the pin. On the other hand I seem to remember it is only pulled up, when the AF output is in reset? I am not sure if this is my mistake.

Has anybody an idea how to get the output pulled up whithout reconfiguring the GPIO pin?

Any help is highly appriciated and I thank you for your time.

eimer

Outcomes