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.
Hi,
I'm having some trouble running the ePWM1regs on the F28335 experimenter's kit. When I use the "step over" function in code composer 5.3 I am allowed to write to the register and my program works exactly as it's supposed to. However, when I click the "resume" button (green arrow) all the registers just change values to some default value for some reason and I cannot change them back to my desired values.
TBPRD changes to 0x0EA6, CMPA changes to 0x0753, CMPB changes to 0x0001, AQCTLA remains (changes to?) 0x0060, AQCTLB changes to 0x0000. Does anyone here know of a reason why this might be happening?
My code is:
void main(){ EALLOW; GpioCtrlRegs.GPAMUX1.bit.GPIO0 = 1; // EPWM1A pin GpioCtrlRegs.GPAMUX1.bit.GPIO1 = 1; // EPWM1B pin GpioCtrlRegs.GPAPUD.bit.GPIO0 = 1; // Disable the internal pullup resistance of EPWM1A pin GpioCtrlRegs.GPAPUD.bit.GPIO1 = 1; // Disable the internal pullup resistance of EPWM1B pin GpioCtrlRegs.GPADIR.bit.GPIO0 = 1; // GPIO0 as OUTPUT GpioCtrlRegs.GPADIR.bit.GPIO1 = 1; // GPIO1 as OUTPUT EDIS; EALLOW; SysCtrlRegs.PCLKCR1.bit.EPWM1ENCLK = 1; EDIS; EALLOW; SysCtrlRegs.PCLKCR0.bit.TBCLKSYNC =0; EDIS; EPwm1Regs.TBPRD = 0x0050; // Period = 1200 TBCLK counts EPwm1Regs.TBPHS.half.TBPHS = 0; // Set Phase register to zero EPwm1Regs.TBCTL.bit.CTRMODE = TB_COUNT_UPDOWN; // Symmetrical mode EPwm1Regs.TBCTL.bit.PHSEN = TB_DISABLE; // Master module EPwm1Regs.TBCTL.bit.PRDLD = TB_SHADOW; EPwm1Regs.TBCTL.bit.SYNCOSEL = TB_CTR_ZERO; // Sync down-stream module EPwm1Regs.CMPCTL.bit.SHDWAMODE = CC_SHADOW; EPwm1Regs.CMPCTL.bit.SHDWBMODE = CC_SHADOW; EPwm1Regs.CMPCTL.bit.LOADAMODE = CC_CTR_ZERO; // load on CTR=Zero EPwm1Regs.CMPCTL.bit.LOADBMODE = CC_CTR_ZERO; // load on CTR=Zero EPwm1Regs.AQCTLA.bit.CAD = AQ_CLEAR; // set actions for EPWM1A EPwm1Regs.AQCTLA.bit.CAU = AQ_SET; EPwm1Regs.AQCTLB.bit.CBD = AQ_CLEAR; // set actions for EPWM1B EPwm1Regs.AQCTLB.bit.CBU = AQ_SET; //============================================================ EPwm1Regs.CMPA.half.CMPA = 0x0020; // adjust duty for output EPWM1A & EPWM1B EPwm1Regs.CMPB = 0x0030; // adjust point-in-time for ADCSOC trigger EALLOW; SysCtrlRegs.PCLKCR0.bit.TBCLKSYNC =1; EDIS; while(1) { asm(" nop;"); } }
Yes, exactly. TBPRD changes from 0x0050 to 0x0EA6 and the rest changes too to the values I specified in my original post.
I just tried another experimenter's kit we had and it does the same thing but changes to other values. The first experimenter's kit had a F28335PGFA on it and the new one has a F28335ZJZA on it. The new one changes to the values:
TBPRD = 0x04B0
CMPA = 0x012C
CMPB = 0x0000
AQCTLA = 0x0000
AQCTLB = 0x0000
Any idea what this is? I ran the same code with the new microprocessor by the way.
To me it seems like all the registers revert back to the default values when I try to run my code. I have no idea why this would be happening though.
Christian, I would first like you to check with the sample ePWM code present in controlSuite.
Do let us know your observations.
Regards,
Gautam
Check this project out: epwm_up_aq that can be found here
C:\ti\controlSUITE\device_support\f2833x\v133\DSP2833x_examples_ccsv4\epwm_up_aq
Regards,
Gautam
Hi, sorry for the late reply. I've tried the example code and it works perfectly. I'm gonna compare the two codes and see if I can see where the problem is but if you have any idea I would greatly appreciate your help.
Yes, Christian please compare both the codes. In this way you'll get to know the config. steps. Let me know if you still face any difficulty.
Regards,
Gautam
Thank you for your suggestions. I rewrote my code using the example as basis and now it works perfectly.