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 have a DRV8312-C2 Kit and I am running the motor that came with the Kit using DRV8312GUI_Main.c.
Can somebody tell me, how do i modify the code to get 100% duty cycle for the PWMxB signals (the signals fed to the RESET_X input of the DRV8312)? I posted a question regarding current waveform DRV8312 issue on Motor Driver Forum and was asked to modify the PWMxB signals.
Below are some other questions:
Looking at the BLDCPWM_Macro(),
1. what is the function of the variables Tmp and Tmp2?
2. What does half mean in EPwm1Regs.CMPA.half.CMPA = (int16)(Tmp>>15)?
Thanks!
Hi,
/* Convert "Period" (Q15) modulation function to Q0 */\
Tmp = (int32)v.PeriodMax*(int32)v.MfuncPeriod; /* Q15 = Q0xQ15 */\
Period = (int16)(Tmp>>15); /* Q15 -> Q0 (Period) */\
"Tmp" is the period value represented as the % of (Q15) the max period whcih is an integer (Q0)
"Period" is Tmp (% of max period in fractional form, Q15) represented as an integer (Q0) which is required for loading into the period register
Please refer to additional information on IQmath. http://processors.wiki.ti.com/index.php/IQmath_Library_for_C28x
/* Convert "DutyFunc" or "GPR0_BLDC_PWM" (Q15) duty modulation function to Q0 */\
Tmp = (int32)Period*(int32)GPR0_BLDC_PWM; /* Q15 = Q0xQ15 */\
EPwm1Regs.CMPA.half.CMPA = (int16)(Tmp>>15); /* PWM signal on output B of EPWM1 (Q15 -> Q0) */\
"Tmp " is the PWM duty cycle as a % of (fraction, Q15) the Period (integer, Q0). By right-shifting the 32-bit value of TMP by 15 bits, the fractional bits are dropped and are loaded into the 16-bit compare register. There are additional bits in the compare register that are for HRPWM (high-resolution), the "half" symbol is referencing the lower non-HR bits of the compare registers. You can find more on this in the PWM chapter of the device user's guide.
Thanks,
Jeff
Did a reply answer your question? If yes, please click the "Verify Answer" button located at the bottom of that post. |
||
InstaSPIN-FOC/MOTION User's Guide |