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.
Hello,
I'm trying to initialize the ePWM7 on a 28035 to output a high signal on EPWM7A. To do so I'm trying to use the Action Qualifier register "AQCSFRC" to assert the output high continuously. See the code snippet below for what I'm doing.
EALLOW; SysCtrlRegs.PCLKCR0.bit.TBCLKSYNC = 0; SysCtrlRegs.PCLKCR1.bit.EPWM7ENCLK = 1; EDIS; //Time Base Period Register EPwm7Regs.TBPRD = 1; // Period = 1201 TBCLK counts //Time Base Control Register //Time Base Phase Register EPwm7Regs.TBPHS.half.TBPHS = 0; // Set Phase register to zero //Counter Compare Registers //Action Qualifier Registers //Clear the whole register to disable action based on the compare register EPwm7Regs.AQCTLA.bit.CBD = 0; EPwm7Regs.AQCTLA.bit.CBU = 0; EPwm7Regs.AQCTLA.bit.CAD = 0; EPwm7Regs.AQCTLA.bit.CBU = 0; EPwm7Regs.AQCTLA.bit.PRD = 0; EPwm7Regs.AQCTLA.bit.ZRO = 0; //Action Qualifier Software Force Register EPwm7Regs.AQSFRC.bit.RLDCSF = 0x03;//Load immediately EPwm7Regs.AQSFRC.bit.ACTSFA = 0x03;//On one-time software forced event, toggle the output //Not using the deadband submodule //PWM-Chopper Control Register EPwm7Regs.PCCTL.bit.CHPEN = 0; //Disable chopping module //Trip zone submodule registers EPwm7Regs.TZCTL.bit.DCBEVT2 = 0x03; //Disable trip action EPwm7Regs.TZCTL.bit.DCBEVT1 = 0x03; EPwm7Regs.TZCTL.bit.DCAEVT2 = 0x03; EPwm7Regs.TZCTL.bit.DCAEVT1 = 0x03; EPwm7Regs.TZCTL.bit.TZB = 0x03; EPwm7Regs.TZCTL.bit.TZA = 0x03; Gpio_SetMux(40, 1); /* Set GPIO40 to EPWM7A */ EPwm7Regs.AQCSFRC.bit.CSFA = 0x02; //Force a continuous high on output A EPwm7Regs.AQCSFRC.bit.CSFB = 0x02; //Force a continuous high on output B
Up to this point I've tried following the application note examples, (I.E. Controlling Multiple Buck Converters With Independent Frequencies from spruge9e) with no success.
I was able to toggle the output high when I had it configured as a GPIO, but for my application I need to use the PWM peripheral.
Clearly I've missed something, can someone correct me?
Thanks.
Hi,
Jason Riordan said:I'm trying to initialize the ePWM7 on a 28035 to output a high signal on EPWM7A.
The simplest way to achieve this is to configure ePWM in a up count mode and then keep the duty at max ie CMPA value = TBPRD. You'll get logic 1 signal.
Regards,
Gautam
Gautam,
I've tried to implement your suggestion to achieve a logic high but to no avail.
EALLOW; SysCtrlRegs.PCLKCR1.bit.EPWM7ENCLK = 1; EDIS; Gpio_SetMux(40, 1); //Macro to set the mode on the I/O to ePWM EPwm7Regs.TBCTL.bit.PRDLD = TB_IMMEDIATE; EPwm7Regs.TBCTL.bit.CTRMODE = TB_COUNT_UP; EPwm7Regs.TBPRD = 1; EPwm7Regs.CMPA.half.CMPA = 1;
I commented out the initialization of the other registers to try to simplify things as you said, but I'm still only ever seeing a low signal. I've JTAG'd to the device and I can see the registers changing and I can see the peripheral being enabled as ePWM, but I still don't see a change on the output.
Jay
This is still unresolved. If anyone else has had experiences with this problem, sharing them would be greatly appreciated.
Roger44834 said:Did you
EALLOW;
SysCtrlRegs.PCLKCR0.bit.TBCLKSYNC = 1;
EDIS;
after init?Roger
I was not. However, I did add it at the end of the init routine, but still no change.
Did you init more than shown ore just what you posted?
What I see:
If you debug, do you see TBCTR change?
I'm only initializing what I'm showing.
For this application, some of the features of the PWM are not important. I'm not using the PWM as you would expect. Because of register availability in the CLA of this device, I'm looking to control the output of the PWM in software rather than output a wave form. The code snippets I've posted and experimenting up to this point have been outside the CLA to avoid needless complexity while establishing that the methodology works.
As I expressed in the OP, I'm looking to drive the output high and low in software. I.E. 100% duty or 0% duty. Therefore, I'm not overly concerned with the deadband settings or the clock division etc.
I will verify that I am seeing TBCTR change.
Hi Jason,
Sorry for the delayed response.
The AQCSFRC register is EALLOW protected. You will need to execute EALLOW instruction in your code before writing to this register. After you are done writing to this register, you can execute EDIS instruction.
Let me know if this doesn't work.
Hrishi
Jason,
It looks like this register is not EALLOW protected. My suggestion above will not help. Sorry for the confusion.
Please enable (Set) TBCLKSYNC before writing to the AQCSFRC register. Also, did you try any other values for the period register other than 1? Try a higher value (say) 100. Because of the way this peripheral is being used, the period register value should not matter.
Let me know how this goes.
Hrishi
Any updates on this? I am having the same issue.
I am trying to use the PWM to profile my CLA code. I can use the AQCSFRC.CSFA bit to set and clear the PWM output in my main loop (on the c28), but it does not work in my CLA task code. I have tried all of the above suggestions, but no luck.
Any thoughts? I don't mean to steal the thread, this just seemed very close to my problem.
Thanks.
Jason,
Thanks for your response, but I'm still very confused. I don't really understand how "flushing" the memory helps (also, I'm not really sure how to do that or what that means... the functions you mentioned are not TI standard ones that I could view).
I found that I am even able to successfully change the DAC value of the comparator from the CLA. Also, I can write ONE change to EPwm1Regs.AQCSFRC.bit.CSFA in the CLA (ie. I can either set or clear it, but not both). So it seems that the memory link is there for the peripheral registers, but with restrictions.
Any thoughts?
Thanks again.