Tool/software: Code Composer Studio
Hello,
I have an issue with my microcontroller. I'm trying to adjust the frequency of the pwms to run at 2kHz by setting:
InitFlash(); EPwm2Regs.TBCTL.all = 0; // clear all bits in TBCTL EPwm2Regs.TBCTL.bit.CLKDIV = 0; // CLKDIV = “div by 1”; EPwm2Regs.TBCTL.bit.HSPCLKDIV = 0; // HSPCLKDIV = “div by 1” EPwm2Regs.TBCTL.bit.CTRMODE = 2; // count mode = up-down mode EPwm2Regs.AQCTLA.all = 0x0006; // ZRO=set; PRD=clear EPwm2Regs.TBPRD = 37500; // 2 kHz PWM frequency // TBPRD = fcpu / (2* fpwm * CLKDIV * HSPCLKDIV) // TBPRB = 150 MHz / (2 * 2 kHz * 1 * 1)
but they run at a different frequency. When I disconnect the card from ccs and reconnect it to run from flash it runs at the correct 2kHz frequency. Does anyone have an idea where the problem might be?
The switches on the card for BOOT are as follows
1-down
2-down
3-down
4-down