2024-02-19 01:44 AM
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.
2024-02-19 01:47 AM
https://www.st.com/en/development-tools/st-mcu-finder-pc.html
https://www.st.com/en/development-tools/stm32-finder.html
Also, many distributors have useful parametric searches
2024-02-19 02:00 AM
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.
2024-02-19 02:20 AM - edited 2024-02-19 02:31 AM
@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:
2024-02-19 02:21 AM
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.
2024-02-19 03:03 AM
This was my first impression but found this to not the case (according stm32cubeMX)
As an example, the STM32F407IETx has 14 timers:
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"/>
2024-02-19 03:07 AM
@Vidicon wrote:according stm32cubeMX
does the datasheet agree?
2024-02-19 03:12 AM
Well, F407 is not a recent family. Encoder mode need a time with two channels.At least there are timers 1/2/4/5/8/9/12 with two channels. If all channel gpios are available is another question.
2024-02-19 03:28 AM - edited 2024-02-19 03:29 AM
> 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
2024-02-19 03:52 AM
Mostly yes,
but it does not mention encoder mode for the Advanced-control timers TIM1, TIM8.