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.
Tool/software: Code Composer Studio
We are getting consistent overcurrent situations with two different motors when we try to run an higher speeds.
One motor trips the over current at about 450 Hz and the other one at about 560 Hz.
We have ascertained that the it is NOT the DRV8320 nFAULT that trips the error, instead it is internal to the F280049C.
In 'is07_speed_control.c' line 536 call to function HAL_getTripFaults() return 12 which indicates that
EPWM_TZ_FLAG_OST and EPWM_TZ_FLAG_DCAEVT1 are set for one or more of the PWMs.
But I have a hard time following the code and CPU datasheet to see what is the actual mechanism
how the over current is detected.
When the over current is detected the average current used by the DRV8320 is 2 Amps at 24V and the
Idq_in_A[1] indicates about 6 amps while the Vdq_outV indicates about 6 V so both indicate around 40W ... 50
watts which makes sense to me and is nowhere near what is the max for that motor.
An additional data point which maybe related is that at low rpm (<20 Hz) the motor/system has hard time
starting the motor at correct direction and speed, instead the motorVar.speed_Hz wanders around -12..10 Hz.
I include the user.h motor settings for reference:
#elif (USER_MOTOR == WONSMART_WS9250_24_240_X200)
#define USER_MOTOR_TYPE MOTOR_TYPE_PM
#define USER_MOTOR_NUM_POLE_PAIRS (2)
#define USER_MOTOR_Rr_Ohm (NULL)
#define USER_MOTOR_Rs_Ohm (0.1378)
#define USER_MOTOR_Ls_d_H (0.0001216)
#define USER_MOTOR_Ls_q_H (0.0001216)
#define USER_MOTOR_RATED_FLUX_VpHz (0.01284)
#define USER_MOTOR_MAGNETIZING_CURRENT_A (NULL)
#define USER_MOTOR_RES_EST_CURRENT_A (1.0)
#define USER_MOTOR_IND_EST_CURRENT_A (-1.0)
#define USER_MOTOR_MAX_CURRENT_A (10.0)
#define USER_MOTOR_FLUX_EXC_FREQ_Hz (5.0)
#define USER_MOTOR_FLUX_EST_FREQ_HZ (20.0)
#define USER_MOTOR_FREQ_LOW_HZ (10.0) // Hz - suggested to set to 10% of rated motor frequency
#define USER_MOTOR_FREQ_HIGH_HZ (100.0) // Hz - suggested to set to 100% of rated motor frequency
#define USER_MOTOR_FREQ_MAX_HZ (1200.0) // Hz - suggested to set to 120% of rated motor frequency
#define USER_MOTOR_VOLT_MIN_V (3.0) // Volt - suggested to set to 15% of rated motor voltage
#define USER_MOTOR_VOLT_MAX_V (24.0) // Volt - suggested to set to 100% of rated motor voltage
#define USER_MOTOR_NUM_ENC_SLOTS (NULL)
There is two overcurrent protection for these kits, one over signal is from the nFAULT pin of the DRV8320RS, one is from the internal analog comparators of the F280049C. You can change the related codes or variables to set the over-current limitation value.
1. Change the VDS comparator threshold in the control register of the DRV8320RS.
drvSPI8320Vars.Ctrl_Reg_05.VDS_LVL = DRV8320_VDS_LEVEL_1P300_V;
drvSPI8320Vars.Ctrl_Reg_05.DEAD_TIME = DRV8320_DEADTIME_100_NS;
drvSPI8320Vars.writeCmd = 1;
HAL_writeDRVData(halHandle, &drvSPI8320Vars);
2. Change the value of the motorVars.dacValH and motorVars.dacValL variables, these two variables are used in the code below in the project. The limitation current is zero if both variables equal to 2048. so increasing motorVars.dacValH and decreasing motorVars.dacValL to set a higher over-current limitation value.
//
// set internal DAC value for on-chip comparator for current protection
//
{
uint16_t cmpssCnt;
for(cmpssCnt = 0; cmpssCnt < HAL_NUM_CMPSS_CURRENT; cmpssCnt++)
{
HAL_setCMPSSDACValueHigh(halHandle,
cmpssCnt, motorVars.dacValH);
HAL_setCMPSSDACValueLow(halHandle,
cmpssCnt, motorVars.dacValL);
}
}
Thanks! That answered the question, unfortunately changing the values made no difference to the problem ie the system still trips the overcurrent . :(
You have to check if there is really over current protection when you run the motor. You might capture the phase current of the motor by using the oscilloscope with a current probe. And monitor the "motorVars.faultNow.bit.moduleOverCurrent" in the expression watch window of the CCS. If the flag is set, you have to increase the overcurrent limitation value again. Or if the motor current is over the maximum current of the board.
Btw, please make sure that the motor parameters are identified correctly using lab05 and set in the file of the user.h for running the motor in other labs.
Managed to beg, borrow and steel the scope with current probe and here are some results,
definitely not looking as if everything is correct.
This is current over one of the phases.
Strange 'peaks' at lower rpm, totally weird at higher rpm, no wonder the over current protection trips.
What should be our next step?
Is this a current measurement problem? Too coars current scale making FAST to fail?
Or the current/torque PID oscillating?
It seems like it's really over current and the motor didn't run well. You might try to increase the dc bus voltage to see what happens.
What's the rated frequency, power, and current of the motor?
I increased the input voltage to the BOOSTXL DRV8320RS board to 30 V => no change in behaviour.
Please use a higher PWM frequency as the settings in the file of the user.h
#define USER_PWM_FREQ_kHz ((float32_t)(45.0))
#define USER_NUM_PWM_TICKS_PER_ISR_TICK (3)
And please follow the steps below to add the library and code to your project. 8686.flux_hf.zip
1. Add the patch library (fluxHF_coff.lib or fluxHF_eabi.lib ) into the project, and include the header file (fluxHF.h) in the file (labs.h) of the project
2. Add the codes below after “EST_setFlag_enableRsRecalc(estHandle, motorVars.flagEnableRsRecalc);” in main file.
// set the scale factor for high frequency motor
EST_setOneOverFluxGain_sf(estHandle, &userParams, USER_EST_FLUX_HF_SF);
EST_setFreqLFP_sf(estHandle, &userParams, USER_EST_FREQ_HF_SF);
EST_setBemf_sf(estHandle, &userParams, USER_EST_BEMF_HF_SF);
3. Add the macro definitions below in user.h
//! \brief Defines the scale factor for the flux estimation
//! the default value is 1.0f, change the value between 0.1f and 1.25f
#define USER_EST_FLUX_HF_SF ((float32_t)(0.125f))
//! \brief Defines the scale factor for the frequency estimation
//! the default value is 1.0f, change the value between 0.5f and 1.5f
#define USER_EST_FREQ_HF_SF ((float32_t)(1.0f))
//! \brief Defines the scale factor for the bemf estimation
//! the default value is 1.0f, change the value between 0.50f and 1.25f
#define USER_EST_BEMF_HF_SF ((float32_t)(1.0f))
Thanks I will try that next.
For the record please see below some data I captured using CCS Graph tool.
To capture the data I inserted following code to is07_speed_control.c, the data was capture with motorVars.speedRef_Hz = 300,100 and 200 Hz
float32_t g_capture[1024]; int g_capture_idx=0; ... __interrupt void mainISR(void) { motorVars.pwmISRCount++; ... g_capture[g_capture_idx] = adcData.I_A.value[0]; g_capture_idx = (g_capture_idx+1)%(sizeof(g_capture)/sizeof(g_capture[0]));
I added the fluxHF_coff.lib and all the rest of it and it did not make any observable difference.
Are you using the TI EVM kits? launchpad-F280049C + DRV8320RS BoosterPak? Or your own board? Any loading on the motor during it is running at high speed? Can you also post the current waveforms captured by the oscilloscope?
Can you check the "motorVars.Vs_V" "motorVars.VsRef_V", "motorVars.VdcBus_V", and "motorVars.Is_A" when the motor can't run well at the high speed.
And can you try to tune the Kp and Ki of the speed PI controller? Decreasing these two gains of the speed controller.
Close this thread since I can't repeat the issue you reported if you add the patch library into the project and tune the speed controller. Thanks!