EEVblog Electronics Community Forum

Electronics => Microcontrollers => Topic started by: kgavionics on February 02, 2023, 06:29:36 pm

Title: STM32 Timers channels questions?
Post by: kgavionics on February 02, 2023, 06:29:36 pm
Hello guys
Sorry if this is a stupid question!
I want to generate a wave form using the output compare feature on Stm32F407 on timer3, but I'm a bit confused which pin do I have to choose, because if I look in the  alternate function table, I find that TIM3_CH1 is assigned to the following pins:
-PA6
-PB4
-PC6
So, my question, can I use either one of them? Also, they don't mention if these channels are inputs or outputs! So, I guess I have to use the MODER register to set them there?

Thank you in advance
Title: Re: STM32 Timers channels questions?
Post by: wek on February 02, 2023, 06:33:34 pm
> can I use either one of them?

Yes.

> Also, they don't mention if these channels are inputs or outputs!

Once they are set to AF in GPIOx_MODER and assigned to timer in GPIOx_AFR[], it's the timer which determines the direction - through setting given channel to Input Capture or Output Compare (using TIMx_CCMRx.CCxS).

JW
Title: Re: STM32 Timers channels questions?
Post by: langwadt on February 02, 2023, 06:48:47 pm
unless you want to make things more difficult than necessary, just start with cubemx and go from there
Title: Re: STM32 Timers channels questions?
Post by: kgavionics on February 03, 2023, 12:36:47 am
Thank you for the heads up JW!
Title: Re: STM32 Timers channels questions?
Post by: kgavionics on February 03, 2023, 12:38:26 am
Thank you ! I installed CubeMx and I’ll use it in conjunction with Keil Arm uvision!