cancel
Showing results for 
Search instead for 
Did you mean: 

Find STM32 with 5 encoders input timers,

Vidicon
Associate II

For a project, I need to find a stm32 that has a minimum of 5 timers that can read encoders, and it has to have a CAN-bus peripheral.

Is there a way to do this in the part selectors? I can select the minimum number of 16bit timers, but not all 16bit counters seem to support encoder input. Any way to do this without manually reading all the datasheets?

I did try to automate this using the XML files in the data folder of stm32cube, but I did not really find a way to detect if a 16bit counter support encoder input.

17 REPLIES 17

I know these tools, but as mentioned in my question, I don't see a way to do a parametric select on timers with encoder input.


@Vidicon wrote:

I know these tools


Oh well - you didn't mention that.

Have you tried any distributors  parametric searches?

 

EDIT:

AN4013 seems to suggest that any 'General-Purpose' or 'Advanced' Timer can do it:

AndrewNeil_0-1708338583582.png

 

You have to do by hand. As a general rule, newer devices (L4/G4/U5) have more timers and so a better chance. A larger package also has better chance to find the needed number of encoder channels.

This was my first impression but found this to not the case (according stm32cubeMX) 

As an example, the STM32F407IETx has 14 timers:

  • TIM1 Advanced-Timer: does have encoder Mode.
  • TIM2 General-Purpose-Timer:  does have encoder Mode.
  • TIM3 General-Purpose-Timer:  does have encoder Mode.
  • TIM4 General-Purpose-Timer:  does have encoder Mode.
  • TIM5 General-Purpose-Timer:  does have encoder Mode.
  • TIM6 Basic-Timer: Doesn't have encoder Mode.
  • TIM7 Basic-Timer: Doesn't have encoder Mode.
  • TIM8 Advanced-Timer: does have encoder Mode.
  • TIM9 General-Purpose-Timer: Doesn't have encoder Mode.
  • TIM10 General-Purpose-Timer: Doesn't have encoder Mode.
  • TIM11 General-Purpose-Timer: Doesn't have encoder Mode.
  • TIM12 General-Purpose-Timer: Doesn't have encoder Mode.
  • TIM13 General-Purpose-Timer: Doesn't have encoder Mode.
  • TIM14 General-Purpose-Timer: Doesn't have encoder Mode.

I don't know where cube gets this information from, otherwise I could write a script to list all devices with 5 or more timers with the encoder mode.

I did find the STM32F407I(E-G)Tx.xml file in STM32cubeMX/db/mcu, but it only has:

    <IP ConfigFile="TIM-STM32F4xx" InstanceName="TIM1" Name="TIM1_8" Version="gptimer2_v2_x_Cube"/>
    <IP ConfigFile="TIM-STM32F4xx" InstanceName="TIM2" Name="TIM1_8" Version="gptimer2_v2_x_Cube"/>
    <IP ConfigFile="TIM-STM32F4xx" InstanceName="TIM3" Name="TIM1_8" Version="gptimer2_v2_x_Cube"/>
    <IP ConfigFile="TIM-STM32F4xx" InstanceName="TIM4" Name="TIM1_8" Version="gptimer2_v2_x_Cube"/>
    <IP ConfigFile="TIM-STM32F4xx" InstanceName="TIM5" Name="TIM1_8" Version="gptimer2_v2_x_Cube"/>
    <IP ConfigFile="TIM-STM32F4xx" InstanceName="TIM6" Name="TIM6_7" Version="gptimer2_v2_x_Cube"/>
    <IP ConfigFile="TIM-STM32F4xx" InstanceName="TIM7" Name="TIM6_7" Version="gptimer2_v2_x_Cube"/>
    <IP ConfigFile="TIM-STM32F4xx" InstanceName="TIM8" Name="TIM1_8" Version="gptimer2_v2_x_Cube"/>
    <IP ConfigFile="TIM-STM32F4xx" InstanceName="TIM9" Name="TIM1_8" Version="gptimer2_v2_x_Cube"/>
    <IP ConfigFile="TIM-STM32F4xx" InstanceName="TIM10" Name="TIM1_8" Version="gptimer2_v2_x_Cube"/>
    <IP ConfigFile="TIM-STM32F4xx" InstanceName="TIM11" Name="TIM1_8" Version="gptimer2_v2_x_Cube"/>
    <IP ConfigFile="TIM-STM32F4xx" InstanceName="TIM12" Name="TIM1_8" Version="gptimer2_v2_x_Cube"/>
    <IP ConfigFile="TIM-STM32F4xx" InstanceName="TIM13" Name="TIM1_8" Version="gptimer2_v2_x_Cube"/>
    <IP ConfigFile="TIM-STM32F4xx" InstanceName="TIM14" Name="TIM1_8" Version="gptimer2_v2_x_Cube"/>


 


@Vidicon wrote:

according stm32cubeMX


does the datasheet agree?

Uwe Bonnes
Principal III

Well, F407 is not a recent family. Encoder mode need a time with two channels.WhatsApp Image 2024-02-19 at 12.08.52.jpegAt least there are timers 1/2/4/5/8/9/12 with two channels. If all channel gpios are available is another question.

> At least there are timers 1/2/4/5/8/9/12 with two channels.

Two channels is not a sufficient precondition. TIM9 and TIM12 don't have Encoder mode.

Only TIM1/8/20 and TIM2/3/4/5 have Encoder mode, across all STM32 families, as far as I know. Probably most if not all 'F1/'F2/'F3/'F4/'F7/'G4 and higher-end 'L4 (i.e. 'L47x and up) will have 5 timers with encoders; maybe also some of the 'G0/'F0, I did not check (I recommend against using the ancient 'F1 family, though).

Then, you have to choose a model which has enough pins so that all those timers do have CH1 and CH2 brought out on non-overlapping pins. I'd expect a 64-pin (xR) package, although the selection of higher families usually does not have lower pin-count packages anyway.

JW

 

Mostly yes,
but it does not mention encoder mode for the Advanced-control timers TIM1, TIM8.