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.

[28075, ECap] REARMING allows only Cap1 to capture the counter?

Dear all,

Setting

ECap1Regs.ECCTL2.bit.REARM = 1; in capture mode

allows only CAP1 to capture the counter?

The manual says

REARM =1h (R/W)

=> Arms the one-shot sequence as follows:

1) Resets the Mod4 counter to zero
2) Unfreezes the Mod4 counter
3) Enables capture register loads

But it is NOT specified that WHEN THE MOD4 COUNTER RESETS.

I am finding some ways to let only Cap1 capture its counter value. For more specific, I would like to get the counter of ePWM1 module, from the ECap1Regs.CAP1, at the every rising edge of eCAP1 pin.

1. ECap1 module has been synchronized with ePWM1 module by

EALLOW;
SyncSocRegs.SYNCSELECT.bit.ECAP1SYNCIN = 0; // EPWM1Syncout selected

EDIS;

ECap1Regs.CTRPHS = 0;

2. The rising edge on the eCAP1 pin always occurs once, during the period of EPWM1 and ECAP1 module.

3. So, I would like to save all the captured registers to CAP1 and then read it the next switching period.

4. However, because MOD4 counter freely runs in continuous mode (0->1->2->3->0), I have to access CAP1, 2, 3, and 4 according to MOD4 counter value.

5. So, from the technical reference manual, I thought that re-arming the ECAP module would reset the MOD4 counter every capture event, so that I can get the every captured value by reading CAP1 register.

IS THIS RIGHT? 

Since I am now waiting for the 28075 on the way, and in a hurry, I would like to get the solution before its arriving.

  •  

    Welcome to the E2E forums!

    You can find all of this information in the technical reference manual, I would really suggest reading at least the eCAP chapter.

    How one-shot works:

    The “One-Shot” mode of operation is just that, one shot. When the eCAP module is setup in one-shot mode it will capture until it reaches the stop value (ECCTL2[STOP_WRAP]). At that point the eCAP module will sit idle and not capture anymore timestamps. You’re free to take as much time as you want to read CAP1-4 because they will never be overwritten. After reading the registers you can then use the “REARM” bit to capture another burst of signals.

     

    To directly answer your questions:

                    The mod4 counter resets when the REARM bit it written to a 1.

     

    1. I did not check that the value you have written is correct, but yes you should select EPWM1SYNCOUT if you want to sync to ePWM1

    2. Please rephrase.

    3. I’m unsure what you mean by “switching period”, however using one-shot mode no values will be overwritten so you should be OK to read the values some time later as long as you haven’t written to the REARM bit.

    4. Yes, that is one way. It is sometimes possible to look at the timestamp to see which one was last written(higher numbers are newer), this isn’t 100% true if you reset or overflow your timestamp counter.

    5. No this is incorrect. Setting the “REARM” bit will only reset the MOD4 counter once.

     

    If you have more questions feel free to ask.

     

    Regards,
    Cody

     

  • Dear Cody,

    Thank you very much for your answers. I understood that 1.One-shot operation means capture-and-hold operation. 2."WRITING '1' ON REARM BIT" resets the mod4 counter and enables to capture again.

    Then I think using one-shot operation, read the eCAP1 register, and than writing 1 on REARM will work as I wanted. IS IT RIGHT?

    I will be able to find every captured value from eCAP1 register everytime. In my circuit, ePWM1-bridge circuit(phase difference occurs here)-CMPSS1-eCAP1 have the same operating frequency with some phase difference, what I wanted to know was just the phase difference between ePWM1 CTR=ZERO and rising edge of CMPSS1, by reading the CAP1 value.

    Thank you very much!

    Regards,

    Jong-Woo Kim

  • Very interesting! Yes I think that should work.

    Best of luck, let me know how it goes!

    Regards,
    Cody