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.

read encoder position from eqep module

Other Parts Discussed in Thread: HALCOGEN

Hi,

I'm trying to use the eQEP module to read position from an encoder.  This seems like something that should be simple, but I can't get a non-zero reading from the QPOSCNT register.  I'm using the TMS570LS07xx.

In halcogen (4.05) I have the module enabled, selected the module on the pinmux tab and have the module position counter mode set to quadrature count.

I have verified that I can read from the registers, since I read 0x800 from the QDECCTL register, which makes sense.  However, when I try to read the position count I always read zero, and yes, I'm spinning the motor :) 

I'm working to verify electrically that that signals are ok.

[EDIT] It looks like the A and B signals are always high (3.1V).  Calling the Halcogen generated qep init function should be all that is needed to enable the module, right?  There is nothing that would hold those signals high?

Is there anything else that has to be done to do a read?  my main code is below. 

Thanks,

David

	QEPInit();

	qepCTL = eqepREG1->QDECCTL;

	qep1 = eqepReadPosnCount(eqepREG1);
	qep2 = eqepReadPosnCount(eqepREG2);

  • Hi David,

    Can you post a picture of the eQEP tab in Halcogen so we can see how you have it configured?
  • As I've been digging through the documentation and generated code, I had missed that there is a eqepEnableCounter function. If this function isn't called, would that keep the counter position register from changing?

    If so, I would still expect electrically to see the pulses if I put a scope on the line, is that true?

    [EDIT]

    I just noticed that the max position counter defaults to 0...which would make sense then why 0 is always returned...I'll test with a different max value once I have my hardware back.

    Also, just a Halcogen UI bug I found...If I check the box for Enable SW Initialization, then change to a different tab and come back, the box looks like it is unchecked.  When I move my mouse over the box the check mark appears again.

    Thanks,
    David

  • It looks like in addition to needing to change the max position count there were hardware issues.

    I am able to read counts now, although it increment at a much slower rate than expected and what the scope shows, maybe there is a multiplication factor somewhere that is not correct. It also only will start counting if it starts in the counter clockwise direction, but again, I assume this is a configuration issue.

    Thanks,
    David
  • Hi David,

    The position counter is supposed to count each pulse coming from the quadrature encoder so it should match the what you see on the scope. What frequency do you have VCLK4 set to vs. what frequency are you seeing from the QEPA and QEPB pins? Is the count some interval of the frequency on QEPA/B?