AnsweredAssumed Answered

FTM signal start conditions

Question asked by Frank Schuetz on Feb 25, 2016
Latest reply on Feb 29, 2016 by xiangjun.rong



I have written an driver that generates 2 digital signals with FTM.

Blue signal has a frequency with 1.6 MHz and is generated with FTM0.

Red signal has a frequency with 750 Hz and is generated with FTM1.


Both FTM instances are synchronized with the global time base (GTB).

So it works fine.

But there is a problem on starting signals (picture below).


The blue signal should be start (user defined time) earlier as the red signal!

I have tried a lot, e.g. start PWM instance (FTM1) for red signal later (with sleep 1msec) as the blue signal on FTM0.

Or enable the specified channel later...

But the main problem is the enabling of GTB, because the signals are switched on (almost) simultaneously if GTB is enabled (so as in the picture above).

And if the GTB is enabled then some register values can no more be written because there are locked.


Is there a way to solve this problem?


Thanks in advance!

Here is a code snippet:


    FTM_HAL_SetGlobalTimeBaseCmd(FTM0, true);   //enable FTM0 GTBEEN

    FTM_HAL_SetGlobalTimeBaseCmd(FTM3, true);   //enable FTM3 GTBEEN





    FTM_HAL_SetCounter(FTM0, 0000U);        //clear FTM0 counter value to 0

    FTM_HAL_SetCounter(FTM3, 0000U);        //clear FTM3 counter value to 0

    FTM_HAL_SetGlobalTimeBaseOutputCmd(FTM0, true);      //Enable FTM0 GTBEOUT