Other Parts Discussed in Thread: CONTROLSUITE
Hi,
I have a switching frequency of 500 kHz on the DC/DC converter and the DSP is a f28335 running at 150 MHz. Due to the high switching frequency I have problems with doing all the calculations needed during one period.
So if I could change how the calculations to the HRPWM register is made from C to Assembly I could save some time, I think.
There is an example in the pdf http://www.ti.com/lit/ug/sprug02b/sprug02b.pdf (see below), which uses assembly code to calculate and update the registers but I don't know how to implement this.
MOVW DP, #_HRBUCK_In
MOVL XAR2,@_HRBUCK_In ; Pointer to Input Q15 Duty (XAR2)
MOVL XAR3,#CMPAHR1 ; Pointer to HRPWM CMPA reg (XAR3)
; Output for EPWM1A (HRPWM)
MOV T,*XAR2 ; T <= Duty
MPYU ACC,T,@_hrbuck_period ; Q15 to Q0 scaling based on Period
MOV T,@_MEP_ScaleFactor ; MEP scale factor (from optimizer s/w)
MPYU P,T,@AL ; P <= T * AL, Optimizer scaling
MOVH @AL,P ; AL <= P, move result back to ACC
ADD ACC, #0x180 ; MEP range and rounding adjustment
MOVL *XAR3,ACC ; CMPA:CMPAHR(31:8) <= ACC
; Output for EPWM1B (Regular Res) Optional - for comparison purpose only
MOV *+XAR3[2],AH ; Store ACCH to regular CMPB
So again, how could you create a callable asm file which have a Duty cycle, D, as input and then updates the PWM and HRPWM register with the least amount of operations.
Thanks in advance // Johan