2016-12-25 11:17 AM
I
want
using STM32F407
Discovery with CubeMX to initialize of Timer 2 in Gated mode with capture on Channel 1. In manual RM090 Rev 13 on page 618 and 619 there is settingto
work in this mode. But if you use CubeMX, this settings could not be implemented. I mean Tim2_SMCR register and bits SMS=101 with TS=101 (SMS = Gated mode, TS= Filtered Timer input 1 (TI1FP1)). Because of gray field for TI1FP1 in CubeMX (position Trigered Source TI1FP1 is grayed, but active TI1FP2). CubeMX explain this : �An active Slave mode should be select first. This option may be unavailable if Channel 1 is used�. Where is mistake in RM090 or CubeMX?Ok. Lets set Triger Source as TI1FP2 and try to use Timer 5 in the same mode as Timer 2. And you will see another grayed and red fields in options, that mean - you couldn�t use Timer 5 in so manner as Timer 2. Why? Timer 2 and Timer 5 are not fully independent? They use the same hardware?
#stm32-timer #stm32f42016-12-26 08:18 AM
Hi
har.valery
,1- In TIM2 configuration, TI1FP1 is grayed because channel 1 is already configured in 'Input Capture direct mode'. If you disable Channel 1, you will be able to select TI1FP1 as trigger source.
2- In TIM5 configuration:
So you have to look for a new mapping of pins to avoid these conflicts.
-Amel-
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
2016-12-27 02:27 AM
Hi Amel.
Thank you for answer. As I understand you content the primer in RM090 Rev 13 is not correct. As for pin PA0. I have change it connection and can select Channel 1 for capture signal of Timer 5. But still I couldn’t use TI1FP2 as Trigger Source for Tim 5. And reason of that is “Conflict with TIM2�. It has used that signal (TI1FP2) for it’s own triggering. That means - Signal TI1FP1 and TI1FP2 are really the one in all timers hardware. Are you sure? Are you hardware developer of STM32F407 chip? If that right we cannot use Timer 2 and Time 5 in one mode never. It very bad news for developers.
2016-12-27 04:19 AM
Hi Valery,
It seems that my explanation wasn't enough understandable.
There is no error in RM0090.
You have to refer to relevant datasheet of your product to know the correct combination of pins.
If you start from the chip STM32F407 (not the discovery board), to generate your project you will see less conflicts.
Now, look at
and based on CubeMX interface:- to select TI2FP2 as trigger source for TIM2 or TIM5, you have to select correct pin for the channel 2.
- both TIM2_CH2 and TIM5_CH2 are mapped on the same pin PA1. This is source of conflict.
If you want to discard this conflict, you have to set a new mapping for TIM2_CH2 (Only choice is PB3 on LQFP100 package) and keep PA1 for TIM5_CH2.
Hope it is more understandable now.
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
2016-12-28 03:40 AM
Hi Amel,
Thank you for your patience and answer. I have resolved the problem with the independence of TIM2 and TIM5, just assigned a different input pins for timers. That is a good news? But still has one unclear question with Gated mode. As I wrote earlier in manual RM090 Rev 13 there is a primer to set register of timer for working in that regime. Hire is a brief settings of it for TIM2:
Register TIM2_CCMR1: CC1S=01 (CC1 channel is configured as input, IC1 is mapped on TI1).
Register TIM2_CCER: CC1P=1 (OC1 active low).
Register TIM2_SMCR: TS=101 (Filtered Timer input 1 (TI1FP1)), SMS-101 (Gated mode).
Well. In CubeMX I chuse next option:
Slave mode: Gated mode.
Trigger Source: Disable.
Clock source: Internal Clock.
Channel 1: Input Capture direct mode.
As you can see, that settings will set all bits in the same value as mentioned foregoing. But when you check Configuration tab in CubeMX you can see for Timer 2 a curious message: “Please select a Trigger Source in the Pinout view�. OK, lets try to select Trigger Source. For sorry there is only TI1FP2 active option TI1FP1 is dimmed. That means you have used one more input pin for TIM2 to work in Gated mode. But in RM090 Rev 13 has not one word about timer needs Trigger Source for working in Gated mode. May be you know why CubeMX wants a Trigger Source for Gated mode? And if it is right why TI1FP1 (the same pin for capture and for triggering) cannot be used for that? For example: UP front is used for triggering and DOWN front for capture signal.