Part Number: TMS320F280049C
Other Parts Discussed in Thread: BOOSTXL-DRV8320RS
Hello,
Context x49c launch, BoostXL-drv8320rs motor SDK and (is_05_motor_id.c) __Interrupt mainISR(void) interrupt handler and tick monitor via GPIO-30.
During idle state the PWM high side drives never turned off and GPIO30 never turns off once it has been turned on at the top of the mainISR(). The PWM drives issue is not so bad but the decimation pulse time scope capture is cause to ring alarm bells.
The call to turn off GPIO30 never occurs unless the motor ID is enabled but LED5 is toggling in the same function, so it exits but where? The only time GPI030 (J2 pin13) toggles is during motor ID Exactly to PWM frequency (20Khz). Oddly several calls within mainISR have a forced (return) statement above the last ( } ). So the mainISR is not exiting at the bottom as expected and GPIO30 remains high. Seemingly not giving a correct time span of InstaSpin ROM calls following mostly the PWM period. A 30Mhz digital scope can not detect GPIO30 pulses as LED5 is toggling within mainISR. GPIO30 pulse peaks only inflect slightly downward from 3v3 typical of very rapid GPIO exit from function. One would expect a well defined pulse with thin periods extending downward to ground, that does not occur.
I have noticed similar practice several functions motor SDK where a (return) statement POPs address off the stack prior to the last return ( } ) bottom of function. This case being a false GPIO30 time decimation seems to occur at only the PWM period (50µs 20Khz). Other calls in the mainISR() never seem to add to 50µs decimation time. It would also seem mainISR motor ID loop is re-entrant every time it (returns) from any one of several sub calls in the motor ID stack calls to ROM. If GPIO30 is always toggling with LED5 my 30Mhz scope can not trigger on the ghost pulse that hides from view.
The odder part being if we move the bottom GPIO30 Low call into call LED5 slower rate, it never pulses GPIO30 placed just before or after. It could be some kind of configuration issue GPIO30 but we can not see any conflicting code. Otherwise the way LED5 GPIO port is being asserted On/Off is baffling how it is even working via what appears to be a hook driven into a handle asserting another triggered call! LED5 toggling method seems to be part of the problem with mainISR()...
If mainISR() was working correctly the last call to GPIO30 would always pulse even after motor ID is enabled. How is GPIO30 producing a correct decimation time mainISR() if or when it often exits above the last ( } ) bottom of function?
How can we expect Motor ID to correctly identify motor parameters as mainISR() is thought to be repeatedly entering the call stack far above the last return? Oddly mainISR() does toggle GPIO30 but only when motor ID is enabled can any kind of pulse be captured by 10KSPS deep scope trigger. Again the GPIO30 pulse has V shape leading to apprehension mainISR() decimation time is incorrect. Perhaps this too leads to 100% trapezoidal modulation causing rotor vibration at the SVPWM rotation angle drifts off the vector frame. We feel random rotor oscillations occurring after motor ID flag=1 thus after ID motor (700Hz) only reach 115Hz speed 1.1Krpm, if not held down to large mass rotor starts to vibrate.
__interrupt void mainISR(void)
{
//
// check ISR executing time by toggling the GPIO
//
HAL_setGPIOHigh(halHandle, HAL_GPIO_ISR);
motorVars.pwmISRCount++;
//
// toggle status LED
//
counterLED++;
if(counterLED > (uint32_t)(USER_ISR_FREQ_Hz / LED_BLINK_FREQ_Hz))
{
HAL_toggleLED(halHandle, HAL_GPIO_LED2);//LED5
counterLED = 0;
}
// Motor ID and enable code checks //
//
// write the PWM compare values
//
HAL_writePWMData(halHandle, &pwmData);
//
// Force trig DMA channel to save the data
//
HAL_trigDlogWithDMA(halHandle, 0);
HAL_trigDlogWithDMA(halHandle, 1);
HAL_trigDlogWithDMA(halHandle, 2);
HAL_trigDlogWithDMA(halHandle, 3);
#endif // _DATALOG_EN_
//
// check ISR executing time
//
HAL_setGPIOLow(halHandle, HAL_GPIO_ISR);
return;
} // end of mainISR() function