cancel
Showing results for 
Search instead for 
Did you mean: 

Is there a way to set timer CH1 pin (PA5) to LOW from code?

AFied.1
Associate III

I have configured TIM2 to set CH1 to Force Active if x Pulses are reached. That's working fine.

Is there are a way to set it to LOW again from code (main loop)?

This seems not to work:

HAL_GPIO_WritePin(GPIOA, GPIO_PIN_5, GPIO_PIN_RESET);

6 REPLIES 6
Uwe Bonnes
Principal III

Lopp in the reference manual for foirced output mode.

Thanks for your answer! This one? https://www.st.com/resource/en/datasheet/stm32g431kb.pdf

Can you point me to the page please? I can't find it.

Ah, I got it: https://www.st.com/resource/en/application_note/dm00042534-stm32-crossseries-timer-overview-stmicroelectronics.pdf

chapter 2.4

but

TIM2->CCR1 = 0;

seems not to set it to low. Do I miss something?

Reference Manual.

0693W000007Eul4QAC.png 

JW

Uwe Bonnes
Principal III

If nothing elpse help, consider also to switch to and back toGPIO alternate function to output with the right ODR value.

Nice, that's helpful. Thanks a lot!​