MPC5574 input signal edges can not be counted

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

MPC5574 input signal edges can not be counted

553 Views
yun_qiu
Contributor I

@Petr StancikCapture2.PNGCapture1.PNG

Capture3.PNG

when using mpc5574 ic(144pin) etimer module, configuration as pictures shows above, I want to count rising edge of the input signal, but it seems that the count regs did not work at all(always equals 0). I want to know if the configuration about etimer is right? rtimer1 ch4 is selected, and input 4 pin is SECSRC , input field of control2 register changes between 0 and 1. PRISRC was first configured as IP Bus clock divide by 2 prescaler(11001), now configured  input 4 pin,  to ensure edge exist.

        I want to know why the counter don't work. 

        Thank u in advance.

0 Kudos
2 Replies

465 Views
PetrS
NXP TechSupport
NXP TechSupport

Hi,

check if channel is enabled in ENBL register.

Also be sure the pin is properly configured to be routed to eTimer Ch4.

Specify the MCU you have, MPC5574 must be typo.

BR, Petr

0 Kudos

465 Views
yun_qiu
Contributor I

Hi Petr,

   I am sure channel is enabled in ENBL register, because I enabled all six channels of eTimer 1.

   MPC type is 5744, wrong type.

   PWM Input from D8 pin, and it is configured to eTimer 1 channel 4. Checked. But it still doesn't work.

   Registers configuration code as follows:

#define ETIMER_1_CHANNEL_4_CONFIG \
       (               ETIMER_Set_Device_Index(0, ETIMER_DEVICE_INDEX_1                  ) | \
                            ETIMER_Set_Channel(0, ETIMER_CHANNEL_4                       ) | \
                  ETIMER_Set_Channel_Direction(0, ETIMER_CHANNEL_INPUT                   ) | \
     ETIMER_Set_Co_Channel_Force_Output_Signal(0, ETIMER_OTHER_CH_FORCE_OFLAG_DISABLE    ) | \
          ETIMER_Set_Co_Channel_Initialization(0, ETIMER_OTHER_CH_FORCE_REINIT_DISABLE   ) | \
   ETIMER_Set_Secondary_Channel_Input_Polarity(0, ETIMER_TRUE_POLARITY                   ) | \
     ETIMER_Set_Primary_Channel_Input_Polarity(0, ETIMER_TRUE_POLARITY                   ) | \
             ETIMER_Set_Output_Signal_Polarity(0, ETIMER_TRUE_POLARITY                   ) | \
                        ETIMER_Set_Output_Mode(0, ETIMER_OFLAG_SOFTWARE_CONTROLLED       ) | \
                  ETIMER_Set_Reload_On_Capture(0, ETIMER_NO_RELOAD_ON_CAPTURE            ) | \
                       ETIMER_Set_Compare_Mode(0, ETIMER_COMP1_COUNT_UP_COMP2_DOWN         ) | \
             ETIMER_Set_Capture_2_Mode_Control(0, ETIMER_CAPTURE_FALLING_EDGES           ) | \
             ETIMER_Set_Capture_1_Mode_Control(0, ETIMER_CAPTURE_RISING_EDGES            ) | \
             ETIMER_Set_Capture_FIFO_Watermark(0, ETIMER_CAPTURE_FIFO_2                  ) | \
              ETIMER_Set_One_Shot_Capture_Mode(0, ETIMER_FREE_RUNNING_MODE_CAPTURE       ) | \
               ETIMER_Set_Input_Capture_Enable(0, ETIMER_INPUT_CAPTURE_ENABLE            ) | \
                  ETIMER_Set_Compare_2_PreLoad(0, ETIMER_COMPARE_NO_PRELOAD2             ) | \
                  ETIMER_Set_Compare_1_PreLoad(0, ETIMER_COMPARE_NO_PRELOAD1             ) | \
          ETIMER_Set_Input_Filter_Sample_Count(0, ETIMER_FILTER_3_SAMPLES                ) | \
                     ETIMER_Set_Capture_Select(0, ETIMER_CAPTURE1_REGISTER_ENABLED  ) )

#define ETIMER_1_COUNTER_CHANNEL_4 \
      (    ETIMER_Set_Device_Index(0, ETIMER_DEVICE_INDEX_1                  ) | \
            ETIMER_Set_Channel(0, ETIMER_CHANNEL_4                       ) | \
            ETIMER_Set_Count_Mode(0, ETIMER_COUNT_RISING_EDGE_PRIMARY_SOURCE) | \
            ETIMER_Set_Primary_Source(0, ETIMER_PRIMARY_COUNTER_IP_BUS_DIV_2  ) | \
            ETIMER_Set_Count_Once(0, ETIMER_COUNT_REPEATEDLY                ) | \
            ETIMER_Set_Count_Length(0, ETIMER_COUNT_TO_ROLL_OVER              ) | \
            ETIMER_Set_Count_Direction(0, ETIMER_COUNT_UP                        ) | \
            ETIMER_Set_Secondary_Source(0, ETIMER_SECONDARY_COUNTER_4_INPUT_PIN   ) )

        Is there anything wrong?    

0 Kudos