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.

TMS570LC4357: TMS570LC47x - eCAP unit, dynamical prescaler changing

Part Number: TMS570LC4357

Hello,

i've got some problems with speed measuring via eQEP and eCAP units.

The is no problem with typical use of the peripherals, but i'm using dynamical prescale changing.

Everytime I change the prescaler, the is a peak that results to incorrect measurement.

I've tried to study this event at eCAP unit and I think there is a problem which cause to generate EVT1 interrupt in incorrect time,

so the counter value is wrong.

Can you please give me some advice how to use dynamical prescaler changing at eCAP unit or tell me if there are some problems which should be treated?

BR

Jan

  • Hi Jan,

    The QCAPCTL[UPPS] prescaler should not be modified dynamically (such as switching the unit event prescaler from QCLK/4 to QCLK/8). Doing so may result in undefined behavior.

    The QCAPCTL[CPPS] prescaler can be modified dynamically (such as switching CAPCLK prescaling mode from VCLK3/4 to VCLK3/8) only after the capture unit is disabled.
  • Hi Wang,

    I readed that and realize that, but I'm talking about eCAP unit and register ECCTL1[PRESCALE].

    I didnt find any information about dynamical switching of that prescaler.

    Jan

  • Hi Wang,

    i've got one point to QCAPCTL[CPPS] - if I can change dynamically VCLK3 prescaler only when the capture unit is disabled,
    i can't be called dynamicall changing yet. I need speed measuring every moment but when i disable the unit i can loose some
    values for controlling.

    Jan

  • Hi Jan,

    The eCAP is driven by sysclk. Changing the EVENT prescaler in ECCTL1 register doesn't affect the counter, but it affects the frequency (period) of the input signal to event qualifier.

    If your setup is MOD4, and you change the prescaler in the CEVT4 ISR, the following CAP1 (trigger by EVT1) will not correct.
  • Hi Wang,

    thank you for your response. I have decided to use eCAP unit for evaluation of speed because of 32-bit counters.

    The dynamical changing of range seems to be okay.

    At eQEP unit i have problems with untreated overflowing of 16-bit CAP counter.

    Jan

  • Jan,

    Thanks. You are right that the eQEP counter is 16-bit. If the position counter is equal to QPOSMAX, then the position counter is reset to 0 on the next eQEP clock for forward movement and position counter overflow flag is set.
  • Hello,

    after some test and debug i've decided to use POS register from eQEP unit and measuring of speed from eCAP unit.

    I've disabled eQEP and it's capture unit.

    Consider this threat as resolved.

    Thank

    Jan

  • Thank you, Jan