cancel
Showing results for 
Search instead for 
Did you mean: 

STM32 event system – connection to timers

EThom.3
Associate III

I have an STM32G473 on an existing board, and now the need to trigger Timer 2 in "One Pulse Mode" from a hardware input has come up. No problem, I thought, as I knew that the MCU has an event system. I simply assumed that I could generate an event with the EXTI, and use that as a trigger for Timer 2.

Yeah, I know. Never assume.

As I read the manual, the events generated by EXTI cannot be connected to the trigger input on the timers. In order to do this, I apparently need to use one of the TIMx_ETR inputs. Otherwise, I am pretty much stuck with what is available in the manual's table 272 - 277.

If I am wrong about this, please let me know. That would save me some impractical hardware changes with super-thin wires on teeny-tiny component pins, and such.

2 REPLIES 2
TDK
Guru

You should be able to use the DMA to trigger the timer if you want.

Set up DMA/DMAMUX to trigger from the EXTIx event and have it write to the TIMx->CR1 register to turn on CEN bit. You'll have to write the entire CR1 register, not just a single bit.

If you feel a post has answered your question, please click "Accept as Solution".
EThom.3
Associate III

That is an interesting approach that I certainly did not think of. Will look into it.

Thanks!