MPC563M eTPU, why doesn't engine position(cam and crank channels) work?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

MPC563M eTPU, why doesn't engine position(cam and crank channels) work?

Jump to solution
793 Views
XChan
Contributor I

Hello, i am using MPC563M, CodeWarrior 2.10 and eTPU GCT 1.4.0.4. With reference to AN3769SW, I wrote a engine position program.When the crank tooth come in, TCR2 just count 1, but fs_etpu_app_eng_pos_init() sets 100 TCR2 counts per tooth. The GCT settings are as follows.

630022588550eaa6edb6f28bab90353.png

 

e4522f8e98a32da1ef21d71be947424.png

 

08b83770481e502e38dd0bd6d0b3dee.png

 

0 Kudos
1 Solution
755 Views
johndiener
Contributor IV

It looks like you have your configuration set up correctly - TBCR.TCR2CTL is set to falling edge of TCRCLK and your crank function config shows matching falling edge detection.  As David mentions above, you just need to make sure the crank signal is routed to TCRCLK rather than A0, but it seems likely that is all good as you are seeing TCR2 increment to 1.

During startup, before the crank signal has been synchronized (i.e. gap found), the TICKS field in the TPR register is set to 0 (which means 1 TCR2 count/tooth).  So on crank teeth before sync, you will see TCR2 increment to 1, and then very quickly the eTPU software sets it back to 0.  Here is what TCR2 looks like vs. crank teeth on startup, AN4907 engine code:

AN4907_startup.png

I am not sure which version of engine code you are using, but the older set 2 engine code also behaves like this:

set2_startup.png

John Diener

View solution in original post

6 Replies
756 Views
johndiener
Contributor IV

It looks like you have your configuration set up correctly - TBCR.TCR2CTL is set to falling edge of TCRCLK and your crank function config shows matching falling edge detection.  As David mentions above, you just need to make sure the crank signal is routed to TCRCLK rather than A0, but it seems likely that is all good as you are seeing TCR2 increment to 1.

During startup, before the crank signal has been synchronized (i.e. gap found), the TICKS field in the TPR register is set to 0 (which means 1 TCR2 count/tooth).  So on crank teeth before sync, you will see TCR2 increment to 1, and then very quickly the eTPU software sets it back to 0.  Here is what TCR2 looks like vs. crank teeth on startup, AN4907 engine code:

AN4907_startup.png

I am not sure which version of engine code you are using, but the older set 2 engine code also behaves like this:

set2_startup.png

John Diener
754 Views
XChan
Contributor I

Thank you for answering me on the weekend.Maybe I didn't make it clear, TCR2 accumulates 1 per tooth(use etpu_set), but I have set 100 TCR2 ticks per tooth.

When I use etpu_set2, TCR2 counting 100 per tooth. Obviously both etpu_set have engine position application, why engine position function run incorrectly in set but run correctly in set2?

0 Kudos
730 Views
johndiener
Contributor IV

Ok, that is interesting. Do you know what "etpu_set.h" is compiled from?  It would seem that whatever engine code is in that build is not exactly equivalent to what is in your "etpu_set2.h" build.  Does the crank function (or overall engine position) run otherwise as you expect, when using etpu_set.h?

John Diener
0 Kudos
722 Views
XChan
Contributor I

Oh I see what you mean, I also suspect that the problem is the difference between set and set2. The TCR counting is just like your picture one(AN4907 Stratup.png).

I've outlined two possible reasons before.

(1)As reference to AN4907 Startup, it most likely the program can't find the gap.The crank signal came from sinal generator instead of Tooth Generator, so the gap is not strictly equal to an integral multiple of the physical tooth. I have tried to modify the ratio of gap finding, the TCR2 still count 1/tooth.

(2)I copied the set from professor instead of compiling it from some file. I thought the function and application with √ represented it can run properly. So I decide to use etpu_set2. 

0 Kudos
773 Views
davidtosenovjan
NXP TechSupport
NXP TechSupport

Do you have properly set up TCRCLKA pin in the SIU module (i.e. eTPUA[0] as on this device signals are interconnected)?

davidtosenovjan_0-1669897544316.png

 

0 Kudos
752 Views
XChan
Contributor I

Hi David, thank u for your answer.I will check the TCRCLK pin later. Maybe I didn’t make it clear. Now the error is TCR2 just accumulate 1 per tooth.

I think the reason for the error is the difference between etpu_set and etpu_set2.When I use set2 like the example in application note, TCR2 run correctly, but it run incorrectly by using set.

0 Kudos