2018-03-22 08:53 PM
Moved to questions as suggested....
2018-03-23 01:49 PM
Timer in One-Pulse mode (whole section about it in datasheet) create waveform as you describe (at picture in another post). Use TIMx_ETR, TIMx_CH1 or TIMx_CH2 as trigger input. Enable interrupt from trigger event. Once you enable 'Trigger mode' in Slave Mode Controller, timer waits for first selected edge and starts. In Interrupt routine disable Slave mode and timer will ignore all next incoming pulses ... interrupt should had higher priority, because you have only about 1.5us to react and deactivate trigger, but it's more then enought.
2018-03-23 05:22 PM
Moved here
https://community.st.com/0D50X00009XkfJFSAZ
2018-03-24 02:53 PM
Thanks Clive. I was out Friday afternoon and did not have a chance to post the link.
2018-03-24 03:16 PM
So from the feedback I have received it sounds like there is really no way to do this without using an interrupt or some external hardware (AND gate / gated buffer and a pull up resistor). Timing is tight so I wanted to avoid software and interrupts if possible to keep the output pulse within the required window. In the question thread I had posted the fact I was looking at using the STMF4 series and that the final part may have usb capabilities. My concern was if I did enable usb then the usb interrupts could interfere with the pulse timing leading to an unwanted second output pulse being triggered. Maybe I'm just being overly cautious with 180 MHz ARM chip where instructions are executed in the 5-6 ns range?
The interrupt version of my previous solution is more or less in line with what you suggested. The only significant difference is that I use the interrupt at the start of the timer to disable the slave mode / repeat rather than wait until the timer completes. This way the window to cancel the next trigger is much larger while the 1925 ns L+H output pulse is generated.
TIM1_ETH triggers on rising edge of external 1 MHz inputsignal which:
1__starts TIM1_CH1 PWM2 OUTPUT LOW->HIGH 2__generates an interrupt when the timer is started TIM1_CH1 CNT_EN 2a____interrupt disables TIM1 slave mode with TIM1 SMCR |= TIM_SLAVEMODE_DISABLEIf no one sees a flaw in this or has a better suggestion I plan to move forward with this method. Again, I was looking for the best way to do this and it is starting to look like a single interrupt is required to achieve my goal without external hardware.
Feedback appreciated
dudka.michal
2018-03-25 05:52 AM
I forgot, there is one another option. You can use DMA to reconfigure timer (disable trigger). Timer can generate DMA request by trigger event... thats may be that you are looking for
BTW: you can give timer IRQ highest priority if you use IRQ based solution ...