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.

TMS320F28379D: Count number of index pulses from CLA

Part Number: TMS320F28379D
Other Parts Discussed in Thread: SYSCONFIG, TMS320F28377D

Hello ,

Is there a quick and easy way to count the number of index pulses from CLA, coming from an encoder.

At the moment i am polling the CLA_QEP_FLAG_IEL_EVENT flag in a CLA task and manually counting the index pulses. But i dont think this is reliable at high rotation speeds.

if (fclVars[1].ptrQEP->QFLG.all & CLA_QEP_FLAG_IEL_EVENT)
{
    indexCount[1]++;
}

Is there a better way to do this from the QEP module directly?

Thanks!

  • Hi AK,

    How many eQEP modules will you be planning to use?

    One possible solution to capture the number of index pulses could be using CLB.

    Configuration for this:

    1. Input selection

    In order to route the index pulse to the CLB you will have to use the Input-XBAR and CLB-XBAR. 

    2. Configuring the CLB

    After setting up the input-XBAR and clb-XBAR, you can configure a CLB instance and set the input type to use the global mux option in order to select the AUX SIG. You can then attach a tile to configure the Counter 0. The counter 0 can be enabled by the boundary input 0 and the direction set to One. This will set the counter to count up based on the boundary input rising edge. Set the input filter to rising edge detect. 

    These configurations all can be done easily through SysConfig which provides a GUI option.

    Best,

    Ryan Ma

  • Hi Ryan, I am using 2 QEP modules to read 2 encoders.

    The GPIO is already set to as index pin , so can it still be given to the input xbar?

    // GPIO13->EQEP1I->CHB_RES_NM
    GPIO_setMasterCore(13, GPIO_CORE_CPU1);
    GPIO_setPinConfig(GPIO_13_EQEP1I);
        
    // GPIO81->EQEP2I->CHA_RES_NM
    GPIO_setMasterCore(81, GPIO_CORE_CPU1);
    GPIO_setPinConfig(GPIO_81_EQEP2I);

  • Yes, you can still have access the GPIO signal using input xbar.

    Best,

    Ryan Ma

  • Thanks Ryan, In the future we plan to use the TMS320F28377D, which by the datasheet does not have CLB.

    Is there any other alternate to the CLB counter? 

  • Hi AK,

    Unfortunately there is not another way. 

    Best,

    Ryan Ma

  • Is it possible to have a GPIO interrupt on the same pin, so that i can count the number of edges? How accurate is this if this is possible, any possibility of adding hysterysis ?

  • Hi AK,

    If you want to accurately count the number of edges, the CLB is helpful. Instead of using a gpio interrupt to count the number of edges. Could you consider using the eCAP to capture a rising and falling edge and generate an interrupt after the second event to add to a counter variable?

    Best,

    Ryan Ma