CRANK with no CAM function usage in 2-stroke engine

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

CRANK with no CAM function usage in 2-stroke engine

Jump to solution
1,144 Views
turgay_kale
Contributor III

Hi, I want to use the standard ETPU engine control library (AN4907SW or NXP etpu function generator site) to decode a 35-1 teeth with no CAM function and therefore engine cycle is 36 teeth (1 revolution) because the engine is 2-stroke engine and no need for CAM function. I have changed macros in MCU application as below. How can I use the standard ETPU engine control library, do I need to edit the ETPU code in ETPU CRANK function for my case? What do I have to edit/ modify in CRANK function for 2-stroke engine (engine cyle is 360 degree) ?  Would you please help me to handle this problem?

#define SYS_FREQ_HZ                                                150E6 
#define TCR1_FREQ_HZ                                              (SYS_FREQ_HZ/2) 
#define TEETH_TILL_GAP                                            35 
#define TEETH_IN_GAP                                                 1 
#define TEETH_PER_CYCLE                                       36 
#define TCR2_TICKS_PER_TOOTH                           1000
#define TCR2_TICKS_PER_CYCLE                            ((TEETH_PER_CYCLE)*(TCR2_TICKS_PER_TOOTH))
#define MSEC2TCR1(x)                                                (TCR1_FREQ_HZ/1E3*(x)/1E0)
#define USEC2TCR1(x)                                                (TCR1_FREQ_HZ/1E3*(x)/1E3)
#define DEG2TCR2(x)                                                  ((x)*TCR2_TICKS_PER_CYCLE/360
#define UFRACT24(x)                                                  ((x)*0xFFFFFF)

#define TCR12USEC(x)                                                (x / ( TCR1_FREQ_HZ / 1E6 ))

#define TCR2DEG(x)                                                    (360*(x)/TCR2_TICKS_PER_CYCLE) 

/* Tooth Period [TCR1] and RPM */
#define RPM2TP(x)                                                      (TCR1_FREQ_HZ/(x)*60/(TEETH_PER_CYCLE)) 
#define TP2RPM(x)                                                      (TCR1_FREQ_HZ/(x)*60/(TEETH_PER_CYCLE)) 

I also used the formulations used in crank_ratios.xlsx document from the standard ETPU engine library as below;

pastedImage_1.png

P.S. MCU is NXP SPC5644A

Regards,

Turgay Kale

1 Solution
912 Views
nxa17216
NXP Employee
NXP Employee

Hello Turgay,

I checked your configuration and it is correct. You don't need to modify eTPU code. In the engine synchronization procedure you should leave out the CAM function log decoding. Update the TCR2 engine  decoded angle with API call

fs_etpu_crank_set_sync() that updates the TRC2 adjustment and makes the engine position to transfer to

FULL_SYNC state. The engine position decoding should be handled in CRANK function IRQ in application, see the pseudo-code for full engine position decoding (including CAM) below:

********************************************************************************
*
*  Channel Interrupt usage
*    The channel interrupt on the CRANK channel is set when the global Engine
*    Position State is changed and on the first tooth every engine cycle when
*    the global Engine Position State is FULL_SYNC.
*    The Crank channel interrupt handler should follow this example:
*
*    eTPUCrankInterruptHandler()
*    {
*      * Read Engine Position State eng_pos_state.
*      switch(eng_pos_state)
*      {
*      case FS_ETPU_ENG_POS_SEEK:
*        * Crank has stalled. Read Crank error to know the reason.
*        break;
*      case FS_ETPU_ENG_POS_FIRST_HALF_SYNC:
*        * Crank has found the gap, or
*        * Crank did not received CRANK_HSR_SET_SYNC and hence Crank reset
*        * the Cam log to repeat recording the Cam log.
*        break;
*      case FS_ETPU_ENG_POS_PRE_FULL_SYNC:
*        * Cam signal is logged, the log corresponds to a segment of
*        * teeth_per_sync Crank teeth starting from a gap.
*        * NOW THE CPU MUST RECOGNIZE THE LOGGED CAM PATTERN AND
*        * 1) SET tcr2_adjustment
*        * 2) ASSIGN CRANK HSR = CRANK_HSR_SET_SYNC.
*        break;
*      case FS_ETPU_ENG_POS_FULL_SYNC:
*        * Regular interrupt on the first tooth every engine cycle.
*        break;
*      }
*    }
*
*******************************************************************************/

Hope this helps.

Marketa

View solution in original post

3 Replies
913 Views
nxa17216
NXP Employee
NXP Employee

Hello Turgay,

I checked your configuration and it is correct. You don't need to modify eTPU code. In the engine synchronization procedure you should leave out the CAM function log decoding. Update the TCR2 engine  decoded angle with API call

fs_etpu_crank_set_sync() that updates the TRC2 adjustment and makes the engine position to transfer to

FULL_SYNC state. The engine position decoding should be handled in CRANK function IRQ in application, see the pseudo-code for full engine position decoding (including CAM) below:

********************************************************************************
*
*  Channel Interrupt usage
*    The channel interrupt on the CRANK channel is set when the global Engine
*    Position State is changed and on the first tooth every engine cycle when
*    the global Engine Position State is FULL_SYNC.
*    The Crank channel interrupt handler should follow this example:
*
*    eTPUCrankInterruptHandler()
*    {
*      * Read Engine Position State eng_pos_state.
*      switch(eng_pos_state)
*      {
*      case FS_ETPU_ENG_POS_SEEK:
*        * Crank has stalled. Read Crank error to know the reason.
*        break;
*      case FS_ETPU_ENG_POS_FIRST_HALF_SYNC:
*        * Crank has found the gap, or
*        * Crank did not received CRANK_HSR_SET_SYNC and hence Crank reset
*        * the Cam log to repeat recording the Cam log.
*        break;
*      case FS_ETPU_ENG_POS_PRE_FULL_SYNC:
*        * Cam signal is logged, the log corresponds to a segment of
*        * teeth_per_sync Crank teeth starting from a gap.
*        * NOW THE CPU MUST RECOGNIZE THE LOGGED CAM PATTERN AND
*        * 1) SET tcr2_adjustment
*        * 2) ASSIGN CRANK HSR = CRANK_HSR_SET_SYNC.
*        break;
*      case FS_ETPU_ENG_POS_FULL_SYNC:
*        * Regular interrupt on the first tooth every engine cycle.
*        break;
*      }
*    }
*
*******************************************************************************/

Hope this helps.

Marketa

912 Views
turgay_kale
Contributor III

Dear Marketa,

I was trying to find a decoding problem (timeout and extra additional tooth problems). So I wanted to ask for help that I wanted to be sure whether I am making a mistake in somewhere else. But you are right, I didn't modify ETPU code but did modify MCU code for my case. I found the decoding problem. Thank you so much for your help. Appreciated.

Regards, 

0 Kudos
912 Views
turgay_kale
Contributor III

Is there any suggestions for this tittle? Thank you for your help.

0 Kudos