Hi. Can I get an example code of MPC5xxx family?
I have MPC5553 and use eTPU to decode the Encoder Signals.
But I can't reset the position counter when the Index signal is received.
And I can't get the revolution counter.
However, the position counter with A & B signals is working well.
I can't know what I'm missing.
err_code = fs_etpu_qd_init (QD0_PRIMARY, /* engine: A; channel: 10 */
ETPU_CHAN_NOT_USED, /* This channel is not used */
QD0_INDEX, /* engine: A; channel: 12 */
FS_ETPU_QD_PRIM_SEC_INDEX, /* Index, primary and secondary. */
FS_ETPU_PRIORITY_HIGH, /* priority: High */
FS_ETPU_QD_CONFIGURATION_1, /* configuration: Both QD pins are 1 when the INDEX is reached. */
FS_ETPU_TCR1, /* timer: FS_ETPU_TCR1 */
0, /* pc_max: 0 */
0, /* slow_normal_threshold: 0 */
0, /* normal_slow_threshold: 0 */
0, /* normal_fast_threshold: 0 */
0, /* fast_normal_threshold: 0 */
0, /* window_ratio1: 0 */
0, /* window_ratio2: 0 */
FS_ETPU_QD_HOME_TRANS_LOW_HIGH, /* home_transition: Detection of low-high transition. */
FS_ETPU_QD_INDEX_PULSE_POSITIVE, /* index_pulse: Index pulse of positive polarity. */
FS_ETPU_QD_INDEX_PC_RESET, /* index_pc_reset: Position Counter is reset on Index transition. */
FS_ETPU_QD_ETPU_A_TCR1_FREQ, /* etpu_tcr_freq: frequency of eTPU engine A - TCR1 */
0); /* pc_per_rev: 0 */
mnew2 = fs_etpu_qd_get_pc(QD0_PRIMARY);
dirEnc = fs_etpu_qd_get_direction(QD0_PRIMARY);
EncZCnt = fs_etpu_qd_get_rc(QD0_PRIMARY);
testEnc = fs_etpu_qd_get_pc_sc(QD0_PRIMARY);
QD0_PRIMARY is 10th channel of eTPU_A .
QD0_INDEX is 12th channel of eTPU_A.
Please, check this.
I'm waiting for your comment.
Thanks,
Heesun.