This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

reading the index pulse

Genius 5910 points
Other Parts Discussed in Thread: DRV8301

Hi,

For homing I want to read the index pulse. I think QEP_read_posn_index_latch will do the trick. It always return 0. I have the correct signal connected. So the index pulse probably not configured. Now the big search is where is it done. Can't find anything in hal.c . So where is it and why isn't in hal.c?

 Thanks!

 

  • Evs,

    I agree that is the function that you should use to read the latched position counter when the index line is triggered.

    The index pulse should be setup in the hal.c file.  I checked the hal.c file for the DRV8301 with the 2806x processor and it was configured by the function HAL_setupGpios.  Can you look in that function on your hal.c and confirm that it is present?  If you are using QEP1 it should be on pin 23.

  • Adam,

    Thanks for the reply. The pin definition is in Hal.c and is correct ( i think). But the QEP configuration is done in enc.c . So now I have to find out what I have to change. So why is QPOSILAT not updated.

    Pin definition:
    // EQEPA
    GPIO_setMode(obj->gpioHandle,GPIO_Number_20,GPIO_20_Mode_EQEP1A);

    // EQEPB
    GPIO_setMode(obj->gpioHandle,GPIO_Number_21,GPIO_21_Mode_EQEP1B);
    // EQEP1I
    GPIO_setMode(obj->gpioHandle,GPIO_Number_23,GPIO_23_Mode_EQEP1I);
  • In the QEP setup code we should be setting the index event as follows:

    QEP_set_index_event_init(obj->qepHandle[qep], QEPCTL_Iei_Nothing);
    QEP_set_index_event_latch(obj->qepHandle[qep], QEPCTL_Iel_Rising_Edge);

    This should latch the pos count when the index goes from 0 to 1.  I've tested this functionality without issues.  It is possible that there is an electrical issue with your index pin?

  • Adam,

     It was a problem in my code.

     Thanks for the help.