Hi ,
I'm a newer to the MPC5644A chips . I used eTPU module as input capture function to measure speed signal . I learn AN2851SW example1.c ,but the function does not work. the drive as follows:
SIU.PCR[191].R = 0x1100; /* Initialize pad for eTPU_A[27] input */
fs_gpio_config ( FS_GPIO_ETPUA27, FS_GPIO_PRIMARY_FUNCTION + ETPU_INPUT_PAD_CONFIG);
fs_etpu_init( my_etpu_config, (uint32_t *)etpu_code, sizeof(etpu_code),
(uint32_t *)etpu_globals, sizeof(etpu_globals));
/* enable all timebases */
fs_timer_start();
SIU.ISEL8.B.ESEL3=1;
/* run eTPU IC function */
error_code = fs_etpu_ic_init(IC_1, FS_ETPU_PRIORITY_MIDDLE, ETPU_IC_MODE_SINGLE,
FS_ETPU_TCR1, ETPU_IC_RISING_EDGE, 1);
while (ETPU.CISR_A.B.CIS27 != 1){} //Wait for IC_1 (eTPU CH0 to complete)
final_time = fs_etpu_ic_read_final_time (IC_1); //Read value when last IC occurred
while(1)
{
if(SysClk_ctPIT == 1000)
{
SysClk_ctPIT = 0; //定时计数清零
final_time = fs_etpu_ic_read_final_time (IC_1); //Read value when last IC occurred
timelen=final_time ;
CANA_TxData[0] = (uint8_t)((timelen&0xFF000000)>>24);
CANA_TxData[1] = (uint8_t)((timelen&0x00FF0000)>>16);
CANA_TxData[2] = (uint8_t)((timelen&0x0000FF00)>>8);
CANA_TxData[3] = (uint8_t)(timelen&0x000000FF);
CANA_TxMsg();
}
}
It stop at while (ETPU.CISR_A.B.CIS27 != 1){} . finnal_time is always 0x0055C90B .
How to configure eTPU to realize capture function.
Best regards,