How do I use IC function of eTPU correctly?

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

How do I use IC function of eTPU correctly?

1,457件の閲覧回数
gexiaocheng
Contributor I

Hello,guys. now I get a problem.

First, I configure  eTPU channel 24/25/26/27 as input capture,the code is as follows:

     errorCode = fs_etpu_ic_init(24, FS_ETPU_PRIORITY_HIGH, ETPU_IC_MODE_CONT, FS_ETPU_TCR1, ETPU_IC_ANY_EDGE, 1);

then, I used these channels to calculate the pulse width (T),the principal is as shown below,

picture1:39649_39649.pngpastedImage_1.png

and the code is as follows:

if( edge ==  CONF_EDGE_RISING )

{

       numTcntEnd = 0x00FFFFFFUL & (uint32)fs_etpu_ic_read_final_time(24);

       if(numTcntStart  <= numTcntEnd)

       {

            PW = numTcntEnd - numTcntStart;

       }

       else

       {

            PW = 0x00FFFFFFUL - numTcntStart + numTcntEnd;

       }

}

else

{

     numTcntStart = 0x00FFFFFFUL & (uint32)fs_etpu_ic_read_final_time(24);

}

Later, when MCU was running, PW is calculated correctly.

But when I  configure  eTPU channel 0/1/2/3 as QOM output, and were performed in interrupt2(see picture1),then PW is calculated mistakenly sometimes. The code of set qom output is as follows:

ETPU.CHAN[0].SCR.B.CIS=1;

errorCode=fs_etpu_qom_init(0,FS_ETPU_PRIORITY_HIGH ,FS_ETPU_QOM_SINGLE_SHOT,FS_ETPU_TCR1,CONF_IGN_IDLE,FS_ETPU_QOM_IMMEDIATE ,0,1,2,event.Ign[x]);

 

It's very strange, and I get no idea to solve it, can you help me? 

 

Thank you very much for your attention!

ラベル(1)
タグ(2)
0 件の賞賛
返信
2 返答(返信)

1,232件の閲覧回数
gexiaocheng
Contributor I

I had already solved it, thank you for your attention!

0 件の賞賛
返信

1,232件の閲覧回数
davidtosenovjan
NXP TechSupport
NXP TechSupport

Could you describe some details about faulty behavior? What number have you obtained? Have you tried to change channel priorities?

0 件の賞賛
返信