Part Number: C2000WARE
Hi, an exerpt from the technical manual for the F2837xD device says:
"For variable frequency applications, there is a need for simultaneous writes of TBPRD and CMPx registers between ePWM modules. This prevents situations where a CTR = 0 or CTR = PRD pulse forces a shadow to active load of these registers before all registers are updated between ePWM modules (resulting in some registers being loaded from new shadow values while others are loaded from old shadow values). To support this, an ePWM register linking scheme for TBPRD:TBPRDHR, CMPA:CMPAHR, CMPB:CMPBHR, CMPC, and CMPD registers between PWM modules has been added. For a particular ePWM module # A , user code writes “B+1”, to the linked register bit-field in EPWMXLINK. “B” is the ePWM module # being linked to (that is, writes to the ePWM module “B” TBPRD:TBPRDHR, CMPA:CMPAHR, CMPB:CMPBHR, or CMPC will simultaneously be written to corresponding register in ePWM module “A”). For instance if ePWM3 EPWMXLINK register is configured so that CMPA:CMPAHR are linked to ePWM1, then a write to CMPA:CMPAHR in ePWM 1 will simultaneously write the same value to CMPA:CMPAHR in ePWM3. If ePWM4 also has its CMPA:CMPAHR registers linked to ePWM1, then a write to ePWM 1 will write the same value to the CMPA:CMPAHR registers in both ePWM3 and ePWM4. The register description for EPWMXLINK clearly explains the linked register bit-field values for corresponding ePWM."
First of all, does this mean that we need to initialise a new PWM module solely for the purpose of simultaneous loading of these two registers?
Is there any example at all in C2000Ware, preferably with direct register access method, which shows how to do this SIMULTANEOUSLY?
If the CPU is executing instruction from top to bottom, the only way to simultaneously update these registers would be through the use of a CLA, or something that runs in parallel with the CPU?
Here is some code I have in an ISR which receives a modulation signal from the remote CPU which executes it's CLA which uses a DF22 control law and passed the info back to CPU1. I then bound the error signal and modulate the registers in a very simplistic fashion:
"
interrupt void ipc0_isr(void)
{
// Read IPC reply from the remote CPU and write to variable
collectorMod = (Uint16) IpcRegs.IPCREMOTEREPLY; // Read data on IPC ADDR register
// Bound the returned control value to between 1 and 2.1
// Gives the minimum and maximum frequency bounds
if(collectorMod < 1)
{
collectorMod = 1;
}
if(collectorMod > 2.1)
{
collectorMod = 2.1;
}
// Scale modulation output according to the minimum switching frequency
collectorMod = collectorMod*RES_PERIOD_MAX;
// Modulate the TBPRD register of the resonant converter
// We need to write CMPA and TBPRD simultaneously, using the PWM linker method outlined in the PDF document... not done here
RES_PERIOD = collectorMod;
EPwm4Regs.CMPA.bit.CMPA = RES_PERIOD/2; // CMPA sets duty cycle
// Return from interrupt
IpcRegs.IPCACK.bit.IPC0 = 1; // Clear IPC0 bit
PieCtrlRegs.PIEACK.all = PIEACK_GROUP1; // Acknowledge PIE group 1 to enable further interrupts
}
"
What would I need to add to this exerpt to enable the simultaneous writes to both registers rather than the way I have it laid out now?
Thanks in advance!
Joel