Other Parts Discussed in Thread: C2000WARE, SM320F28335-HT
I am using a TMS320F28335 at 105 MHz with the HRPWM.
I am using EPWM blocks 4 and 5 for high resolution PWM, and have elected to use the otherwise unused EPWM block 2 for performing the SFO. The first time I call SFO_MepDis_V5(2) in a loop until it returns non-zero, the function correctly sets MEP_ScaleFactor[2] to 74. But after that, calling SFO_MepDis_V5(2) again in a loop until it returns non-zero causes a floating point exception due to the SFO_MepDis_V5() routine attempting to divide 0 by 0 using FS$$DIV. I have set a breakpoint, and the incoming input register values for FS$$DIV are clearly both 0.
I have left the EPWM2 setup at its default, other than setting TBCTL the same as I am using for EPWM blocks 4 and 5. I am also enabling the peripheral clock for EPWM2. Other than that, I'm not initializing anything (since it is supposed to be an unused PWM).
Am I missing something? I assume I can call SFO_MepDis_V5() as often as I like as long as the PWM block is not using HRPWM.
Thanks
Joel