eTPU2 CRANK and CAM function problem

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

eTPU2 CRANK and CAM function problem

Jump to solution
2,144 Views
Nivek
Contributor I

Hello all,

I'll state my problem on top and describe the setup below.

 

To start with I should say that I am new to eTPU/eTPU2 usage. I do have fairly extensive experience with TPU/TPU3. I have written several fairly complex TPU3 functions so have reasonably good idea how the channel hardware works.

 

On a xPC56xxMB EVAL board with the xPC 564AADPT324S mini-module (MPC5644A, 324 pin), I am unable to make the CRANK (etpu set2) function work. It acts as if it just does not see the input signal. I have tried literally over 100 different configs, channel and engine setup, to no avail. All other functions work normally.

 

Codewarrior 10.4 default 5644 project with no operating system. Main program runs fine with eMIOS200, eQADC, eSCI, Flexcan modules all working.

Using the eTPU Graphical Configuration Tool (gct) for eTPU config and init.

All pads properly set in SIU.

ToothGen function works. Verified by oscilloscope. ToothGen crank jumpered to CRANK (channel 0) on the dev board. ToothGen cam jumpered to CAM on dev board.

PWM function on ch 30 works. Verified by scope.

To check and make sure that ch 0 actually could be configured as an input, assigned the FPM function to ch 0 and jumpered the cam signal to it. Worked and returns the correct frequency.

    NOTE: FPM would not work until I turned off angle mode. Probably normal, I just don't know.

Have read, thoroughly, every AN, I won't list them here, there are too many. Even watched the youtube video.

Studied the eTPU section of  MPC5644ARM. Studied ETPURM and ETPURMAD.

Copied the gct config from AN3769SW for engine and function setup, modifying the TCR1 prescaler to get as close to the demo TCR1 freq as possible.

All init functions return no error, I even went into the source of the fs_etpu_init() and fs_etpu_app_eng_pos_int() functions to bring out all of the internal error codes. Not too surprising, as the eTPU engine does appear to init properly, all other functions work properly.

Checked, manually, all of the config values created by the gct. All seem correct.

In my main app, removed int for eMIOS200, eQADC, Flexcan, and manually disabled each module in it's MCR.

In my main app, I tried inititing only sysclk, SIU, and eTPU only. Etpu init is by running my_system_etpu_init() followed by my_system_etpu_start() (my_system_etpu_start() starts the Global time base).

Have queried the engine position functions CRANK and CAM with all of the read status and read error status functions. Bottom line, CRANK does not get sync.

Oh yea, as I said at the start, have tried over 100 different combinations of parameter settings in the function and engine setup.

 

I'm kind of out of ideas for things to try. I know that TPU stuff can be tricky, but it shouldn't be this hard. The CRANK function is designed to look at a poor input signal and get/maintain sync.

 

My current list of probable suspects is:

1. Evil spirits.

2. Angle mode hardware is actually broken inside the chip (I think that this is probably slightly less probable than the evil spirits theory!).

3. There is something that needs to set/inited prior to eTPU start that I know nothing of. Possibly something related to the angle clock? The manuals nor the demo certainly don't suggest what it could be.

 

Thanks in advance;

 

Kevin

Labels (1)
0 Kudos
1 Solution
1,330 Views
MilanBrejl
NXP Employee
NXP Employee

Hello Kevin,

"ToothGen crank jumpered to CRANK (channel 0) on the dev board."

This might be the issue. The Crank signal should be connected to TCRCLK input. Alternatively, the Crank signal could be connected to channel 1 or channel 2 is specifically set in TBCR.AM.

Regards,

Milan

View solution in original post

0 Kudos
2 Replies
1,331 Views
MilanBrejl
NXP Employee
NXP Employee

Hello Kevin,

"ToothGen crank jumpered to CRANK (channel 0) on the dev board."

This might be the issue. The Crank signal should be connected to TCRCLK input. Alternatively, the Crank signal could be connected to channel 1 or channel 2 is specifically set in TBCR.AM.

Regards,

Milan

0 Kudos
1,330 Views
Nivek
Contributor I

Hi Milan,

Thanks for your help, your suggestion was correct. My code runs perfectly now.

I have a question. Has there been a change in the microcode of the engine position function? Maybe the addition of angle clock functionality to channel 1 and 2 in the eTPU2 caused a re-write of the microcode?

The reason that I had the ToothGen crank output connected to the channel 0 pin is because that is what the documentation all says to do. If there has been a change, perhaps Freescale would like to update their documentation. So far I have found the instructions to connect the ToothGen crank signal to channel 0 input pin in several places.

AN3801-ToothGen, pg 14, paragraph 2, states:

  • "The tooth generator output for the CRANK signal must be connected to the pin assigned the eTPU channel
  • running the CRANK function. Also, the tooth generator output for the CAM signal must be connected to
  • the pin assigned the eTPU channel running the CAM function. The channel assignments are shown in the
  • following table."

The table mentioned above has CRANK ch 0, ToothGen crank ch 1, CAM ch 14, ToothGen cam ch15.

AN3769-CRANK has the exact same paragraph and table.

AN3769SW-Freemaster demo, has the same configuration. There was a youtube video that visually showed the ToothGen crank output jumpered to channel 0 pin on the dev board. It is worth noting that this video has been removed from youtube in the last couple of days.

Thanks again for your help, I might never have found the problem without your assistance.

Kevin

0 Kudos