AnsweredAssumed Answered

Kinetis FTM: Control triac with zero detection

Question asked by arnogir on Apr 10, 2015
Latest reply on Apr 15, 2015 by arnogir

Hello

 

I'm using a Kinetis K60.

 

I need to command a Triac with a specific delay after the Zero detection to adjust output power:

triac.jpg

 

To do this, I have a hardware which generate a pulse when signal is 0.

Then from this time, I must generate a pulse a (configurable) time after.

 

My first Idea was:

ZeroDetection pulse connected to an GPIO which generate an interrupt on the edge. In this interrupt, I get the FTM counter and Set CnV and Cn+1V (Combine mode) to generate a pulse of certain time in a controlled delay:

CnV = Current FTM + Delay

Cn+1V = Current FTM + Delay + Pulse wide

Generate IT on Cn1V compare to disable Output (ElsnA, ElsnB = 0)

Bad: Delay between input rise and Get FTM counter (due to interrupt save context time)

 

My second Idea was:

ZeroDetection pulse is connected on CH0 of FTMx. CH0 is configured in Capture Input mode and generate an interrupt.

In this interrupt, I have the Real timer value when input was Rised.

Then I made the same operation on FTMx (CH2+CH3)

CnV = Current FTM + Delay

Cn+1V = Current FTM + Delay + Pulse wide

Generate IT on Cn1V compare to disable Output (ElsnA, ElsnB = 0)

But this system require software operation. (Input compare IT + calcul to set CnV and  Cn1V and then in Cn1V IT, disable output..)

 

Are they a way to generate a pulse (with configurable wide) a certain time (configurable) after an input rise without any software intervention (except in initialization time)?

 

Thank

 

Regards

 

 

 

 

Outcomes