Part Number:TMS320F28377D
I would like to synchronize the ECAP1 - ECAP6 Clocks on the TMS320F28377D processor. I am measuring phase differences between ECAP1 and other ECAPs, and I think that I am seeing phase differences between ECAPs that do not seem to correspond to physical phase differences. I have yet to confirm that this is the case.
Anyways, I would like to synchronize all ECAP TSCTR Counter Clocks and I'm trying to figure out the best way to do so.
1) I would like to monitor the phase difference between ECAP TSCTR Clocks so as to confirm if the phase between ECAPs is changing.
Would this be measured by reading the following registers:
/* Read and store each TSCTR Register */
Ecap1_Counter = ECap1Regs.TSCTR;
Ecap2_Counter = ECap2Regs.TSCTR;
Ecap3_Counter = ECap3Regs.TSCTR;
Ecap4_Counter = ECap4Regs.TSCTR;
Ecap5_Counter = ECap5Regs.TSCTR;
Ecap6_Counter = ECap6Regs.TSCTR;
/* Calculate TSCTR Deltas */
ECap12_Delta = Ecap1_Counter - Ecap2_Counter;
ECap13_Delta = Ecap1_Counter - Ecap3_Counter;
ECap14_Delta = Ecap1_Counter - Ecap4_Counter;
ECap15_Delta = Ecap1_Counter - Ecap5_Counter;
ECap16_Delta = Ecap1_Counter - Ecap6_Counter;
It is my understanding that these "Delta" calculations should stay at least constant if all ECAPs are synchronized. There should be a steady state offset in these readings because reading these counters takes clock cycles. Is this a correct way to quantify the synchronization of all the ECAPs?
2) I would like to software synchronize the ECAPs.
On initialization, I need to set the following Registers;
/* Set up ECAPs 1 - 6 for SWSYNC Input */
EALLOW;
ECap1Regs.ECCTL2.SYNCO_SEL.bit = 0U;
ECap2Regs.ECCTL2.SYNCO_SEL.bit = 0U;
ECap3Regs.ECCTL2.SYNCO_SEL.bit = 0U;
ECap4Regs.ECCTL2.SYNCO_SEL.bit = 0U;
ECap5Regs.ECCTL2.SYNCO_SEL.bit = 0U;
ECap6Regs.ECCTL2.SYNCO_SEL.bit = 0U;
/* Enable SYNC Input on ECAP 1 */
ECap1Regs.ECCTL2.SYNCI_EN.bit = 1U;
EDIS;
When I need to synchronize, I need to trigger a SWSYNC event.
/* Synchronize all ECAPs */
EALLOW;
ECap1Regs.ECCTL2.SWSYNC = 1U;
EDIS;
So my questions are:
- Will this work to synchronize the TSCTR clocks between all the ECAPs? Are there other registers that I need to set.
- Will this synchronize the TSCTR counters with zero delay? i.e. Phase difference is zero between counters. If not, is there a value I can insert into the CTRPHS Register to account for the delay?