cancel
Showing results for 
Search instead for 
Did you mean: 

One Pulse Mode Timer from EXTI

amoli.1
Associate II

STM32L431

I have a SPI Slave Clock connected to PB3 and I would like to start a Retriggerable one Pulse Mode Timer with this pin. Right now i connected PB3 also to a EXTI line and properly generate it's own interrupt. It works but now I would like to start the timer with hardware instead software.

Is it possible to trigger the timer One Pulse Mode whit EXTI or another hardware line?

Thanks a lot for your help

Alex

4 REPLIES 4

"On Pulse Mode" is just that timer stops automatically (TIMx_CR1.CEN is cleared) when CNT reaches ARR. So you generally want to start the timer (i.e. set TIMx_CR1.CEN) by hardware. The slave-mode controller in TIM does this, read the TIM chapter in RM. This won't work from any pin, only from those which you can use as inputs (TRGI) into slave-mode controller - see TIMx_SMCR.TS. The basic option is to use a pin which is TIMx_CH1 or TIMx_CH2, set up that channel as input in TIMx_CCMR1.CCxS and set TIMx_SMCR.TS to 0b101 or 0b110 for TI1FP1/TI2FP2 as needed. Set TIMx_SMCR.SMS to 0b0110 for Trigger mode or to 0b1000 for Combined reset+trigger mode, as needed (note that SMS field is not continguous and its highmost bit is bit 16 in TIMx_SMCR).

JW

amoli.1
Associate II

Hi waclawek.jan

Thanks for your reply. Sorry but it is not steel clear to me if I can connect TIMxCH1 or TIMx_CH2 to an already connected second function external pin. As mentioned before I have a SPI Slave Clock connected to a PB3 and with the same input I would like to start a timer. From your explanation it seems that I can connect more than one alternate function to the same pin.

Right now I am able to connect a SPI SCLK pin to the EXTI Internal Line. I can generate an interrupt but can also this line be connected to TI1 or TI2?

Thanks a lot for your really NEEDED help

Alex

Oh, I was under the impression that you want to connect two pins *externally*.

> From your explanation it seems that I can connect more than one alternate function to the same pin.

No, that is not possible in 'L4.

If you don't want to use another pin, then indeed, your only option is to use an EXTI interrupt to start the timer.

Sorry for the confusion.

JW

amoli.1
Associate II

Thanks guy, I’ll going on with this way 😉

Alex