I am using the 28035 Control Stick and am working from a code base that is using a #define approach for register access rather than the TI bit field and union header files, and I am having trouble accessing the EPWM CMPA register from the CLA. The follwoing is a portion of my assembly code to simply change the duty cycle of my PWM task.
.include piccolo_cla.inc
.cdecls C,LIST,"cla_shared.h"
.sect "ClaProg"
.align 2
_ClaTask3:
MMOVXI MR0,#0x0177
MMOV16 @CMPA1,MR0
MSTOP
MNOP
MNOP
MNOP
_ClaT3End:
And the assosiated .inc file section
; EPWM
EPWM1_BASE .set 0x6800
TBSTS1 .set EPWM1_BASE+0x1
TBPHSHR1 .set EPWM1_BASE+0x2
TBPHS1 .set EPWM1_BASE+0x3
TBCTR1 .set EPWM1_BASE+0x4
TBPRD1 .set EPWM1_BASE+0x5
CMPAHR1 .set EPWM1_BASE+0x8
CMPA1 .set EPWM1_BASE+0x9
CMPB1 .set EPWM1_BASE+0xA
DBRED1 .set EPWM1_BASE+0x10
DBFED1 .set EPWM1_BASE+0x11
TZSEL1 .set EPWM1_BASE+0x12
TZCTL1 .set EPWM1_BASE+0x14
TZEINT1 .set EPWM1_BASE+0x15
TZFLG1 .set EPWM1_BASE+0x16
TZCLR1 .set EPWM1_BASE+0x17
TZFRC1 .set EPWM1_BASE+0x18
ETSEL1 .set EPWM1_BASE+0x19
ETPS1 .set EPWM1_BASE+0x1A
ETFLG1 .set EPWM1_BASE+0x1B
ETCLR1 .set EPWM1_BASE+0x1C
ETFRC1 .set EPWM1_BASE+0x1D
The task seems to be running. I have set up and interrupt to toggle a GPIO line when the CLA interrupt is generated. The register does not seem to be updating though as the PWM duty cycle never changes.
I am able to make this work with the following code when using the TI bit field and union, but the person I am writing this for does not want to use the TI supplied header files. Is there a way for me to update the CMPA register using the above method? Is ther an error I am not seeing?
_ClaTask3:
MMOVXI MR0,#0x0177
MMOV16 @_EPwm1Regs.CMPA.half.CMPA,MR0
MSTOP
MNOP
MNOP
MNOP
_ClaT3End:
Thanks,
James