2024-08-26 11:01 AM
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.
2024-08-26 11:52 AM - edited 2024-08-26 11:53 AM
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.
2024-08-27 09:50 PM
That is an interesting approach that I certainly did not think of. Will look into it.
Thanks!