0
\$\begingroup\$

I have an application where I need to send send signals to 8 stepper drivers on my STM32F407 Discovery board. Each stepper driver requires an independent PULSE, DIRECTION, and SLEEP signal. DIRECTION and SLEEP are trivial GPIOs high/low. I have used timers in the past to drive the PULSE pins for these stepper drivers with success.

I am wondering if I can control all 8 independent PULSE pins with a single board. There are 8 timers on the STM32F4 . TIM2, TIM5 TIM9 and TIM14 are General-purpose timers and TIM1 and TIM8 are Advanced-control timers. I am confident I can drive 6 independent PULSE signals with these 6 timers. TIM6 and TIM7 are basic timers without input/output functionality.

Is there is a way to drive two other pins with the basic timers 6 and 7? If not, is there any other way to get up to 8 independent PULSE signals with a single board using timers?

asked Apr 19, 2024 at 20:02
\$\endgroup\$
4
  • \$\begingroup\$ How independent signals you need? The two advanced control timers TIM1 and TIM8 already provide 8 compare channels. So do timers 2, 5, 3 and 4. \$\endgroup\$ Commented Apr 19, 2024 at 20:06
  • \$\begingroup\$ I need 8 independent channels. I though there was only a single counting element for each timer so channels can't run at different frequencies? @Justme \$\endgroup\$ Commented Apr 19, 2024 at 20:31
  • \$\begingroup\$ You might want to look at projects like GRBL to see how they do it. What you’re considering is a naive implementation and not necessarily the best solution. \$\endgroup\$ Commented Apr 20, 2024 at 3:51
  • \$\begingroup\$ you can use these timers to generate pulse signals for 6 stepper drivers. While TIM6 and TIM7 do not have output compare channels like the other timers, you can still use them in conjunction with GPIOs to generate pulse signals. You can configure the GPIO pins to toggle when a TIM6/TIM7 overflow event occurs. \$\endgroup\$ Commented Apr 21, 2024 at 5:40

1 Answer 1

1
\$\begingroup\$

Look at datasheet https://www.st.com/resource/en/datasheet/stm32f405rg.pdf on "Table 4". There you can see that you have up to 12 timers (least one output each). You can use for example:

  • PA0 - TIM5_CH1
  • PA1 - TIM2_CH2
  • PA2 - TIM9_CH1
  • PA6 - TIM13_CH1
  • PA7 - TIM14_CH1
  • PA8 - TIM1_CH1
  • PB0 - TIM3_CH3
  • PB6 - TIM4_CH1
  • PB8 - TIM10_CH1
  • PC6 - TIM8_CH1
  • PB14 - TIM12_CH1

and there is much more alternatives to use.

answered Apr 20, 2024 at 4:26
\$\endgroup\$

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.