TMS320F28335: 为什么QEP的QEPSTS.bit.COEF一直为1?

Part Number: TMS320F28335

器件:TMS320F28335

模块:QEP

设置:

EQep1Regs.QUPRD = UNIT_TIME_REG; // Unit Timer for 5kHz at 150 MHz SYSCLKOUT
EQep1Regs.QUTMR = 0;
EQep1Regs.QDECCTL.bit.QSRC = 1; // Direction-count Mode
EQep1Regs.QEPCTL.bit.FREE_SOFT = 2;
EQep1Regs.QEPCTL.bit.PCRM = POS_RST_MAX; // PCRM=00 mode - QPOSCNT reset on index event
// index event
EQep1Regs.QEPCTL.bit.UTE = 1; // Unit Timeout Enable
EQep1Regs.QEPCTL.bit.QCLM = 1; // Latch on unit time out
EQep1Regs.QPOSMAX = MAX_POS_CUNT;
EQep1Regs.QEPCTL.bit.QPEN = 1; // QEP enable
EQep1Regs.QCAPCTL.bit.UPPS = 2; // 1/4 for unit position
EQep1Regs.QCAPCTL.bit.CCPS = 7; // 1/128 for CAP clock, 1.171875MHz
EQep1Regs.QCAPCTL.bit.CEN = 1; // QEP Capture Enable
EQep1Regs.QEINT.bit.UTO = 1;

问题:

运行时,使用UTO事件,在中断内处理低速计算。然而,处理UPEVNT事件时,QEPSTS为0x8C写入0x80时也没办法清除COEF、 CDEF位,

以上问题,请帮助解决。谢谢大家。

  • 您好

    需要时间为您调查,请等待回复。

  • QEP1,用于方向和速度控制,用的是 Direction-count Mode。

    QEP2,接电机的正交编码器,其设置如下:

    EQep2Regs.QUPRD = UNIT_TIME_REG; // SYSCLKOUT
    EQep2Regs.QUTMR = 789;

    EQep2Regs.QDECCTL.bit.QSRC = 00; // QEP quadrature count mode
    EQep2Regs.QDECCTL.bit.XCR = 1;
    EQep2Regs.QEPCTL.bit.FREE_SOFT = 2;
    EQep2Regs.QEPCTL.bit.PCRM = POS_RST_MAX; // PCRM=00 mode - QPOSCNT reset on index event, PCRM=01 Position counter reset on the maximum position
    EQep2Regs.QEPCTL.bit.QCLM = 1; // Latch on unit time out. QPOSLAT, QCTMRLAT and QCPRDLAT

    EQep2Regs.QEPCTL.bit.QPEN = 1; // QEP enable
    EQep2Regs.QCAPCTL.bit.UPPS = 2; // QCLK 1/4 for unit position,
    EQep2Regs.QCAPCTL.bit.CCPS = 7; // 1/128 for CAP clock, 1.171875MHz
    EQep2Regs.QCAPCTL.bit.CEN = 1; // QEP Capture Enable
    EQep2Regs.QEINT.bit.UTO = 1;
    // Unit timer
    EQep2Regs.QEPCTL.bit.UTE = 1; // Unit Timeout Enable
    EQep2Regs.QPOSMAX = MAX_POS_CUNT; // 16*revolution, Convenient speed measurement at low speeds

    两个定义MAX_POS_CUNT=0xFFFFFFFF,UNIT_TIME_REG=15000

    两个QEP的UPEVNT事件均是溢出。

  • F2833x eQEP指南了解更多信息:

    www.ti.com/.../sprug05b.pdf