2025-01-09 07:14 AM
It should be possible?!
I would like to capture a waveform coming in at PA8 (TIM1_CH1) and copy it to the output on PA9 (TIM1_CH2). The signal shortest time is about 8us.
The waveform only needs to be copied from PA8 to PA9.
All smart people would say, use a wire and you can remove the STM32 altogether.
Its purpose is to maintain the connection when it is not needed to intervene, but without burden on of by the firmware.
Can this be done?
2025-01-09 08:42 AM
If your edge rate is limited, you can set up PA8 as an EXTI interrupt and set PA9 in the interrupt. If edges can come quickly (< a few us) you can miss an edge. If you have at least 8us between edges, this can work.
This would provide a one-way connection, whereas connecting them directly would be bidirectional.
2025-01-09 10:18 AM
Dear TDK,
The mentioned approach is possible but still uses interrupt and software and will have a huge impact on the system. I can raise the clock frequency but that is not the direction I’m looking for. It should be possible to setup the timer that input capture and output compare are combined so this is solely handled by the timer…
2025-01-09 11:01 AM - edited 2025-01-09 03:15 PM
Set TIM1_CCMR1.CC1S=0b01 to map TIM1_CH1 as "direct" input. In TIM1_SMCR set TS=0b100 for TI1F_ED, and SMS=0b111 for External Clock Mode 1. Set TIM1_CCMR1.OC2M for PWM mode 2, enable CH2 output by setting TIM1_CCER.CC2E and TIM1_BDTR.MOE. Set TIM1_ARR=1, TIM1_CCR2=1, and enable the counter by setting TIM1_CR1.CEN. Then set GPIOA_AFR[] for both pins to the given AF number for TIM1, and then set GPIOA_MODER for those two pins to AF.
I don't know if this will work, but even if it will, I still think it's a bad idea.
JW