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.
Dear team:
A customer of mine added some code to realize position loop and speed loop control based on the routine Proj_lab13b of F28069M.
he speed loop is running normally, the board is designed by himself, and the hardware is no problem, because the speed loop control based on the incremental encoder can run normally.
But with the increase of his own code, the location loop does not work anymore. The specific situation is that after “servo on”, you can hear the noise similar to the current flowing in the motor, but the actual performance of the motor is that there is no “servo on”, that is, there is no torque on the motor shaft, and it can be easily turned by hand.
Observe that the state of gmotorVars.spintac.posctlstate is idle, not busy. Since the motor position control is effective when the state of this variable is busy in the original routine, he feels that this part of the code is not working now. He checked his program according to the original routine, but did not find the problem.
The picture below is a screenshot of “spintac” when the motor has current noise but no torque actually occurs after "servo on". Please help analyze it. What might be wrong?
Best regards
Part Number: TMS320F28069M
Hello,
I am using 28069M with my customized PCB board. Initially, I write my source code based on the TI example proj_lab13b. This example project is used to realize position control, originally it works. But when I add more and more my source code on it, the position control does not work when servo on. In position control mode, the current noise on the motor can be heard when servo on, the motor rotor is free, it looks that there isn't any torque generated on the rotor, at this moment, when I examine the Spintac.posctlstatus, it is "st_ctl_idle", but not "st_ctl_busy". Since when I initially start the source code programming on the board, I have examined that when servo on, the Spintac.posctlstatus is "st_ctl_busy", the motor work in position control mode. So, currently, it is "st_ctl_idle", I believe something wrong. But I have looked through the whole source code, the most of them are similar to the original source code of proj_lab13b. The figure below is the screen shot when servo on.
I have tried every methods to try to fix that, but I failed. I believe something wrong in the source code, because when I run the motor in velocity mode, it works.
The CCS9.0 and incremental encoder is used in the project.
Looking forward to your response and appreciated for any comment.
Thank you.
Hi,
I have merged these two threads as they are the same request.
Regards,
Vince
Thank you. I am stuck here for more than one week. Expect TI expert to help me on that.
Make sure that the motor parameters are identified correctly with lab02, and the inertia and friction are identified with lab12a before running lab13b.
1. Tune the control bandwidth (USER_SYSTEM_BANDWIDTH) according to the system.
2. Tune the trajectory curve.
Thank you. Yanming,
Actually, I know the motor parameters and defined them directly in user_j1.h without necessary to identify them, shown as below:
#define USER_MOTOR_TYPE MOTOR_Type_Pm
#define USER_MOTOR_NUM_POLE_PAIRS (4)
#define USER_MOTOR_Rr (NULL)
#define USER_MOTOR_Rs (0.165)
#define USER_MOTOR_Ls_d (0.00045)
#define USER_MOTOR_Ls_q (0.00045)
#define USER_MOTOR_RATED_FLUX (0.081)
#define USER_MOTOR_MAGNETIZING_CURRENT (NULL) // not needed for PM motor, always NULL.
#define USER_MOTOR_RES_EST_CURRENT (1.5)
#define USER_MOTOR_IND_EST_CURRENT (-1.5)
#define USER_MOTOR_MAX_CURRENT (15.0)
#define USER_MOTOR_RATED_CURRENT (7.5)
#define USER_MOTOR_FLUX_EST_FREQ_Hz (20.0)
#define USER_MOTOR_MAX_SPEED_KRPM (5.0)
#define USER_MOTOR_RATED_SPEED_KRPM (3.0)
#define USER_MOTOR_FREQ_LOW (20.0) // Hz - suggested to set to 10% of rated motor frequency
#define USER_MOTOR_FREQ_HIGH (200.0) // Hz - suggested to set to 100% of rated motor frequency (3000rpm = 200 ElecHz)
#define USER_MOTOR_FREQ_MAX (240.0) // Hz - suggested to set to 120% of rated motor frequency
#define USER_MOTOR_VOLT_MIN (10.0) // Volt - suggested to set to 15% of rated motor voltage
#define USER_MOTOR_VOLT_MAX (36.0) // Volt - suggested to set to 100% of rated motor voltage
#define USER_MOTOR_ENCODER_LINES (2500.0)
#define USER_SYSTEM_INERTIA (0.00488) //default value 0.01; unit: A/(krpm/s)
#define USER_SYSTEM_FRICTION (0.01) //default value 0.01;
As for USER_SYSTEM_BANDWIDTH tuning, yes, I have tried it but useless to the issue.
for " Tune the trajectory curve" you mentioned, how to tune? in original proj_lab13b exmaple, where can I find it so as to tune?
In addition, I have thought about to comment out some my source codes so as to make the project similar to the original proj_lab13b to have a test whether it can works in position mode, but I find it is hard to me to do that, since I have added and modified a lot of codes and related definitions including .h files based on proj_lab13b example. Now the whole code size is so big that it have to be implemented in Flash.
Continue Asking TI expert to help me to solve the issue.
Currently, all jobs are stuck here. including firmware coding, next version PCB layout due to the position control does not work.
I have tried all kinds of methods to try to solve the issue. for example, I have tried different CCS version, like CCS8.0, CCS9.0, etc. I have tried using different compiling tool versions in CCS, like version 6.2, version 15.2, version 20.xx, etc. But all fails.
Hope someone comment on that and may be your single word can notify me to do something about it.
Thank you.
I know the motor parameters and defined them directly in user_j1.h without necessary to identify them
Recommend you'd better identify the motor parameters on your own board.
Now the whole code size is so big that it have to be implemented in Flash.
Do you copy the time-critical code and Flash setup code to RAM?
ok, thank you. To identify the motor parameters on my board, I need to run proj_lab2 that TI provided. I will run it.
For the time-critical code and Flash setup code to RAM, I think it is copied because I haven't changed any code related it.
The below is the code before main():
The below is code in the start of main()
The below is the code in F28069M.cmd
I have use proj_lab2a to identify motor parameters.
But the results looks big error than the true values from motor datasheet.
The identified Rs=0.38 ohm; the true Rs = 0.165 ohm;
The identified Ls = 4.1*10^-6 H; the true Ls= 0.00045 H;
The identified flux = 0.39; the true flux = 0.081 V/Hz;
And sometimes, the identified Ls = 1.2*10^-9 H;
Sometimes, when flux identified is over, the "CTRL_STATE_ERROR" AND "EST_STATE_ERROR" are reported, then the identification is halted.
I have tried increasing PWM freq. but the identification result looks unchanged greatly.
Is the identification process normal?
You might try to use the lab02c since the motor is a low inductance motor. And tune the following identification parameters according to the motor specification.
#define USER_MOTOR_RES_EST_CURRENT (1.0) // A - 10-30% of rated current of the motor
#define USER_MOTOR_IND_EST_CURRENT (-1.0) // A - 10-30% of rated current of the motor, just enough to enable rotation
#define USER_MOTOR_MAX_CURRENT (5.0) // A - 30~150% of rated current of the motor
#define USER_MOTOR_FLUX_EST_FREQ_Hz (20.0) // Hz - 10~30% rated frequency of the motor
OK, thank you . Actually I have tried yesterday using lab02c for low inductance motor identification. Today I will try again and tune the parameters. Any result will let you know.
I have a test using lab02c, the pwm freq.=45kHz;
The identified motor para. are as below:
Rs= 0.09 ohm (datasheet value is: 0.165 ohm)
Ls=0.0002 H (datasheet value is 0.00045 H)
Flux=0.04 vPhz (datasheet value is 0.081)
I use the identified motor parameters in my project, the position control loop does not work as before. The "PosCtlStatus" is still "ST_CTL_IDLE" but not "ST_CTL_BUSY".
So the root cause of position control loop fails are still not known. Now it looks that is not caused by wrong motor parameter settings at least.
I got the reason.
Today, I find gmotorvars.spintac.error_id =2; the error ID sometimes is 2 but sometimes display 0; 0 means no error. 2 means cfg.velmax is beyond (0, 1);
So I find the settings:
STPOSCTL_setVelocityMaximum(obj->posCtlHandle, _IQ24(USER_MOTOR_MAX_SPEED_KRPM * ST_SPEED_PU_PER_KRPM));
for term "USER_MOTOR_MAX_SPEED_KRPM * ST_SPEED_PU_PER_KRPM" , the result should not be higher than 1.0; if it is >1.0, then error id =2;
Since in my setting,
USER_MOTOR_MAX_SPEED_KRPM =5;
ST_SPEED_PU_PER_KRPM = (USER_MOTOR_NUM_POLE_PAIRS / (0.001 * 60.0 * USER_IQ_FULL_SCALE_FREQ_Hz));
USER_IQ_FULL_SCALE_FREQ_Hz= 300;
Therefore, ST_SPEED_PU_PER_KRPM= 0.222;
then, USER_MOTOR_MAX_SPEED_KRPM * ST_SPEED_PU_PER_KRPM = 5*0.222 = 1.11 >1, therefore, which result in the cfg.velmax >1; then error ioccurs.
when setting the USER_IQ_FULL_SCALE_FREQ_Hz = 500 ( or higher), then the position loop can works.
But, these days, the error_id is always displayed 0 in CCS watch windows. Today, it is displayed as "2" sometimes for a very short time; then I captured that moment. But why it is not always displayed as "2" ? CCS watch window is continuous refresh setting.
Anyway, the issue is fixed, I am glad and thanks for your TI engineer's comments. Thank you.