Tool/software: Code Composer Studio
Hi,
I am using the eCAP Peripheral Module with a TMS320F28069 microcontroller for reading the Hall Sensor input signals from a PMSM. I am using the ECAP1, ECAP2 and ECAP3 peripherals to do this task. It is too important to have the inner counter (TSCTR) synchronized for all of them. For this proposal, I have configured the peripherals according to the next lines to generate a chain where a software event will trigger a software synchronization, starting from the eCAP1 peripheral until the eCAP3 peripheral (the other lines for the initial configuration are not added here):
// ========= CAP1 configuration ========= //
ECap1Regs.ECCTL2.bit.SYNCO_SEL = 0; // Sync-in = Sync-out
ECap1Regs.ECCTL2.bit.SYNCI_EN = 1; // Enable TSCTR = CTRPHS after a SYNCI event
// ========= CAP2 configuration ========= //
ECap2Regs.ECCTL2.bit.SYNCO_SEL = 0; // Sync-in = Sync-out
ECap2Regs.ECCTL2.bit.SYNCI_EN = 1; // Enable TSCTR = CTRPHS after a SYNCI event
// ========= CAP3 configuration ========= //
ECap3Regs.ECCTL2.bit.SYNCO_SEL = 2; // Sync-in disable
ECap3Regs.ECCTL2.bit.SYNCI_EN = 1; // Enable TSCTR = CTRPHS after a SYNCI event
Once the three peripherals are configured, the next lines are included to do theoretically the software synchronization. After the synchronization event is done I disable the possibility to synchronize the peripheral from other events as it could be from the ePWM1 peripheral.
// ======== ECAP modules synchronization ======= //
ECap1Regs.ECCTL2.bit.SWSYNC = 1;
ECap1Regs.ECCTL2.bit.SYNCI_EN = 0;
ECap2Regs.ECCTL2.bit.SYNCI_EN = 0;
ECap3Regs.ECCTL2.bit.SYNCI_EN = 0;
We have observed according to this configuration that only the eCAP1 peripheral counter is reset with the CTRPHS value, but the eCAP2 and the eCAP3 counters are not loaded with its respective CTRPHS values. In all cases the CTRPHS values are zero.
I have solved this problem adding the software synchronization lines for each peripheral, but I do not think this is the correct way to behave. Also in each eCAP peripheral it is disabled the chance to create a synchronization chain.
// ========= CAP1 configuration ========= //
ECap1Regs.ECCTL2.bit.SYNCO_SEL = 2; // Sync-out disable
ECap1Regs.ECCTL2.bit.SYNCI_EN = 1; // Enable TSCTR = CTRPHS after a SYNCI event
// ========= CAP2 configuration ========= //
ECap2Regs.ECCTL2.bit.SYNCO_SEL = 2; // Sync-out disable
ECap2Regs.ECCTL2.bit.SYNCI_EN = 1; // Enable TSCTR = CTRPHS after a SYNCI event
// ========= CAP3 configuration ========= //
ECap3Regs.ECCTL2.bit.SYNCO_SEL = 2; // Sync-out disable
ECap3Regs.ECCTL2.bit.SYNCI_EN = 1; // Enable TSCTR = CTRPHS after a SYNCI event
// ======== ECAP modules synchronization ======= //
ECap1Regs.ECCTL2.bit.SWSYNC = 1;
ECap2Regs.ECCTL2.bit.SWSYNC = 1;
ECap3Regs.ECCTL2.bit.SWSYNC = 1;
ECap1Regs.ECCTL2.bit.SYNCI_EN = 0;
ECap2Regs.ECCTL2.bit.SYNCI_EN = 0;
ECap3Regs.ECCTL2.bit.SYNCI_EN = 0;
Is there any solution for this issue?
Best regards.