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.

TMS320F28035: When is the CNTL_2P2Z called in HVPSFB_PCMC ?

Part Number: TMS320F28035

Hi team,

I am working with my customer to achieve a peak current mode control on their F28032 platform. So your work HVPSFB_PCMC is a great referrence to us.

So far, we are able to achieve most of functions and the converter can work under a light load. However, we still do not fully understand how the code works.

In the control loop, we used CNTL_2P2Z in the DPL lib as the voltage loop controller. Pointers are used to link the CNTL_2P2Z variables with the converter vairables.

eg:

// 2P2Z connections for the outer Voltage Loop
CNTL_2P2Z_Ref1 = &VfbSetSlewed; // Slewed Voltage command
CNTL_2P2Z_Out1 = &Iref; // Reference command to the current loop
CNTL_2P2Z_Fdbk1 = &Avg_Vout; // Avg. FB O/P Voltage feedback
CNTL_2P2Z_Coef1 = &CNTL_2P2Z_CoefStruct1.b2; // point to first coeff.

But my question is: After linking the variables, how is the 2P2Z compensator called and the calculation is executed? I did not see any operations doing this.

Thanks for your help!

  • Weiqi,

    The compesator is called when the EPWM1 triggers its ISR based on the settings at line 563 in the HVPSFB-Main.c

            EALLOW;
    	PieVectTable.EPWM1_INT = &DPL_ISR;			// Map Interrupt
    	EDIS;																					
    	PieCtrlRegs.PIEIER3.bit.INTx1 = 1;			// PIE level enable, Grp3 / Int1
    	EPwm1Regs.ETSEL.bit.INTSEL = ET_CTRU_CMPA;	// INT on CMPA event
    	EPwm1Regs.ETSEL.bit.INTEN = 1;				// Enable INT
    	EPwm1Regs.ETPS.bit.INTPRD = ET_1ST;			// Generate INT every event
    

    The function DPL_ISR is in the HVPSFB-DPL-ISR.asm file.  Since this is part of the ISR, that is why you don't see an explicit function call in the source code.

    Please let me know if you need more information on this issue.

    Best,

    Matthew

  • Hi Matthew,

    Glad to meet via E2E.
    Yes, we generally understand how the code works. And I know they DPL_ISR is triggered by EPWM1.
    However, in DPL_ISR, I can only see code related to EPWM actions which is prepared for next DPL_ISR trigger and switch PWM toggle. But I cannot see any code called the controller.

    In this .asm, you did included the CNTL_2P2Z.asm. Dose this mean the CNTL_2P2Z.asm will be executed in the ISR?

    Regards,
    Brian
  • Weiqi,

    Yes, the last statement you have is correct; the call to the CNTL_2P2Z assembly macro is at line 544 in the HVPSFB-DPL-ISR.asm copied here:

    .if(INCR_BUILD = 2)
    		.ref	_No_2p2z
    		MOVW	DP, #(_No_2p2z)
    		MOV		AL, @(_No_2p2z)		
    		CMPB 	AL,#0x1				
    		B		EXIT_ISR, EQ			; If equal - coefficients are being changed --> don't execute 2P2Z
    
    		CNTL_2P2Z	 		1			; PSFB Voltage Controller 
    	.endif

    The .if is a compile time directive, so this section will only be part of the final code if we are at the stage 2 build.  

    Best,

    Matthew

  • Hi Matthew,

    This really solved my questions.
    Thanks for your reply!

    Brian