Hi,
I want use external strobe signal to initialize eQEP encoder. Project is based on lab13e. I have problem that motor sometimes do a huge jerk during strobe event and motor stop moving.
code for initialize eQEP is from lab
// hold the counter in reset QEP_reset_counter(obj->qepHandle[qep]); // set the QPOSINIT register QEP_set_posn_init_count(obj->qepHandle[qep], 0); // disable all interrupts QEP_disable_all_interrupts(obj->qepHandle[qep]); // clear the interrupt flags QEP_clear_all_interrupt_flags(obj->qepHandle[qep]); // clear the position counter QEP_clear_posn_counter(obj->qepHandle[qep]); // setup the max position QEP_set_max_posn_count(obj->qepHandle[qep], (4*USER_MOTOR_ENCODER_LINES)-1); // setup the QDECCTL register QEP_set_QEP_source(obj->qepHandle[qep], QEP_Qsrc_Quad_Count_Mode); QEP_disable_sync_out(obj->qepHandle[qep]); QEP_set_swap_quad_inputs(obj->qepHandle[qep], QEP_Swap_Not_Swapped); QEP_disable_gate_index(obj->qepHandle[qep]); QEP_set_ext_clock_rate(obj->qepHandle[qep], QEP_Xcr_2x_Res); QEP_set_A_polarity(obj->qepHandle[qep], QEP_Qap_No_Effect); QEP_set_B_polarity(obj->qepHandle[qep], QEP_Qbp_No_Effect); QEP_set_index_polarity(obj->qepHandle[qep], QEP_Qip_No_Effect); QEP_set_strobe_polarity(obj->qepHandle[qep], QEP_Qsp_No_Effect); // setup the QEPCTL register QEP_set_emu_control(obj->qepHandle[qep], QEPCTL_Freesoft_Unaffected_Halt); QEP_set_posn_count_reset_mode(obj->qepHandle[qep], QEPCTL_Pcrm_Max_Reset); QEP_set_strobe_event_init(obj->qepHandle[qep], QEPCTL_Sei_Rising_Falling_Edge_Init); QEP_set_index_event_init(obj->qepHandle[qep], QEPCTL_Iei_Nothing); // QEP_set_index_event_latch(obj->qepHandle[qep], QEPCTL_Iel_Rising_Edge); QEP_set_strobe_event_latch(obj->qepHandle[qep], QEPCTL_Sel_Rising_Falling_Edge); QEP_set_soft_init(obj->qepHandle[qep], QEPCTL_Swi_Nothing); QEP_disable_unit_timer(obj->qepHandle[qep]); QEP_disable_watchdog(obj->qepHandle[qep]); // setup the QPOSCTL register QEP_disable_posn_compare(obj->qepHandle[qep]); // setup the QCAPCTL register QEP_disable_capture(obj->qepHandle[qep]); // renable the position counter QEP_enable_counter(obj->qepHandle[qep]);