2017-10-13 08:46 AM
Hi,
Currently, I'm trying to implement the Timer to the EXTI.
Especially, I'd like to watch the toggle input signal by EXTI in limited time.
and I want to make a ACK signal like the following image
If I set the count 3 toggle signal but real input signal is 2 then turn on the Timer then what if there is nothing toggling signal in limited time then I want to make ACK is 0.
So I've implemented the Timer which was I could set the time period.
But the problem is my implementation is suck and kill me.
I need your help. How do I implement
watching to the periodic toggle input signal by EXTI in limited time ?
If input toggle signal active high while in limited time, then I want to set ''ack'' to 1, if not ack to 0.
Could you please help me how do I implement this?
...
int toggle_count = 0;
main()
{
...
capture() {
toggle_count = 0;
capture_toggling = 3; // this is start signal as being triggerring once by external.
}
}
void TIM2_IRQHandler(void)
{
if(TIM_GetITStatus(TIM2,TIM_IT_Update) != RESET)
{
ack = 0x00; // there is no capture signal in limited time.
TIM_Cmd(TIM2, DISABLE); // Could I use Timer like this?
//
TIM_ClearITPendingBit(TIM2, TIM_IT_Update); // Clear the interrupt flag
}
}
void EXTI1_IRQHandler(void)
{
if(EXTI_GetITStatus(EXTI_Line1) != RESET)
{
count++;
ack = 0x01; // capture toggling signal
TIM_Cmd(TIM2, ENABLE);
// Could I use Timer like this?
// EXTI watching the toggling signal.
// If capture the toggling signal then TIM_Cmd Eanble
EXTI_ClearITPendingBit(EXTI_Line1);
}
}
Could you help me please?
#trigger-timer2017-10-13 10:55 PM
The needed generated signals and valid trigger is a bit fuzzy to me.
If you want to generate a digital waveform from one trigger edge for a certain time before rearming, the most assisted HW solution I would go for is not to use EXTI. I would look into the datasheet DMA stream table and find a timer which can have its channel updated by DMA. Then take Channel 1 or 2 as trigger signal for the timer to start it and channel 3 or 4 as digital output. First, try without DMA and use the Timer overflow interrupt to update the compares. In the interrupt, update the compare value to prolong the signal more than its period (unless slowing down the timer so it does not need to overflow, which makes things much simpler). Here we assume that when the first trigger is kicked in, no extra trigger will be taken into account until the generated output pulse is completed....