cancel
Showing results for 
Search instead for 
Did you mean: 

Example for STEVAL-ROBOT-1 (EVALKIT_ROBOT_1_SDK543_Positioning_LL) - two main issues.

ketchup
Associate III

Hi,

I'm try to use example provided by ST - EVALKIT_ROBOT_1_SDK543_Positioning_LL.

After few little correction the project (i.e. modbus was added to project using absolute path, not relative using project location), example is working, but:

1.

On the start, motor sets 0 position (I'm reading this position using function MC_GetCurrentPosition1()) and motor stays at this position. But if I rotate motor by hand over 20.5 radians, then motor suddenly run in this direction and stops at 40.84 radians. I can do it once more time, in the same direction, and result is that motor stops at 82.03 rad, and so on. When I do the same thing to 0 position direction it returns with the same few steps and returns exactly in 0 rad pos.

2.

The example configuration STEVAL-ROBOT-1 us very low current, something 0.07A.

Do You know, how to fix those issues?

Lukasz Lecki

20 REPLIES 20
Gigi
ST Employee

​Ciao Ketchup,

For point 1 you can try to move the ENC_SetMecAngle call present in the function TC_EncoderReset in the file trajectory_ctrl.c, inside the if block to avoid to call it each interrupt service routine.

void TC_EncoderReset(PosCtrl_Handle_t *pHandle) {
	if ((!pHandle->EncoderAbsoluteAligned) && (pHandle->AlignmentStatus == TC_ZERO_ALIGNMENT_START))
		{
		pHandle->MecAngleOffset = pHandle->pENC->_Super.hMecAngle;
		pHandle->pENC->_Super.wMecAngle = 0;
		pHandle->EncoderAbsoluteAligned = true;
		pHandle->AlignmentStatus = TC_ALIGNMENT_COMPLETED;
		pHandle->PositionCtrlStatus = TC_READY_FOR_COMMAND;
		pHandle->Theta = 0.0f;
		ENC_SetMecAngle(pHandle->pENC , pHandle->MecAngleOffset);
	}
}

This modification will be present in the next version of the MC SDK and should avoid some problems. But I don’t know if can solve your problem. Let me know the behavior after this modification. In case I can try to arrange the system in lab an replicate from my side.

For point 2 you can increase the torque provided increasing the value on Nominal Current of the motor in the Workbench or manually in the generated files:

pmsm_motor_parameters.h

#define NOMINAL_CURRENT ***
#define ID_DEMAG -***

drive_parameters.h

#define IQMAX ***

If you use the WB these value are computed automatically. In the user manual of the library you should fined the right formula to calculate these values starting from the requested value in Ampere. Anyhow it is linear so if you double the default value you get double value of the current (do not exceed 32767)

If you still get low torque another possibility is that the PID reaction is slow so you can try for example to increase proportionally Kp, Ki and Kd and see the effect.

Ciao

Gigi

Gigi
ST Employee

Dear community member,

Since the problem of the forum seems solved (I hope), I prefer to continue the discussion here instead of in private messages so other people can take benefit to this answer.

I verified also from my side that the proposed modification of TC_EncoderReset is not required and also is not solving the issue.

For what concern the problem of low current I double checked running the system with the original STSW-ROBOT-1 (https://www.st.com/content/st_com/en/products/embedded-software/evaluation-tool-software/stsw-robot-1.html) downloaded by ST web site without any modification, just compile it with IAR 8.42.1 and supply the board with 36V.

I have only removed the generated file that is indicated in the attached picture “ToBeRemoved.JPG�?. These files should be replaced by your compilation, but to start with a clean environment I prefer to delete all the not required files.

In this condition the motor is producing a current peak of 1.5A in the motor phases (take care not from the power supply) and modifying the two files: drive_parameters.h and pmsm_motor_parameters.h (that I’m attaching) the motor is producing a current peak of 3A.

To verify it I just run the FW, wait for the alignment to the zero position and then I moved by hand the rotor looking to the produced current using a current probe put on motor phases A. And I get the two attached captures.

I have also seen that is no necessary to modify the tuning of the position PID (suggested by me in my previous replay).

Finally, I think that just changing the absolute value of numerator and denominator of the Kp of the position control PID can solve (or mitigate) the problem that you get and show in your video.

Instead of having Kp = 10000/1024, I set Kp = 625/64, that is the same value for the Kp (9.765625) but this avoid the overflow of the computation in the code

wProportional_Term = pHandle->hKpGain * wProcessVarError;

inside the PI_Controller

With this modification, that is still included in the provided files drive_parameters.h, I was able to turn more than fifty times the motor without the issue. Of course, the problem is still there and can occur maybe if you turn 100 times the rotor, and is due to the integer arithmetic used by the FW.

I hope that with this information you will be able to continue your evaluation.

Best regards

Gigi

0693W000001pNfcQAE.jpg0693W000001pLy8QAE.jpg0693W000001pLy3QAE.jpg

 
ketchup
Associate III

Dear Gigi,

I have download new project from ST.

Everything is as previous - max current 0.07A. Check on two computers, two diffrent Power supplies. The same is on STM32CubeIDE and IAR.

I have checked on the oryginal project, and with replaced headers (with replaced headers max current was little greater ~ 0.2A).

Do You think, my EVALKIT-ROBOT-1 is broken? Its new, and this problem is from beginning.

Gigi
ST Employee
Dear Lukasz
Before to give up to the idea that the board is broken I tested you code with CubeIDE and the behavior is the one expected with the default value of current, changing with double Nominal Current I get double current to the motor and so 3A of phase current.
Moreover I have also modified the code to produce the very low current that you mention and the motor don’t move because the current is too low. Since I see in you video the motor moving and generating a torque I can imagine that the current that flows into the motor phase current is bigger. Even increasing to 0.5A the produced torque is not able to move correctly the motor. So if you see your motor moving is not possible that the motor phase current is 0.07A.
Just to be more clear in my case I see when the current that flows into the motor phases is 3A (output of the board) the current that is absorbed by the power supply (input of the board) is 0.23A
In case of the default setting I have 1.5A (Out of the board) that goes into the motor phase and 0.07A in input absorbed by power supply. Maybe you are referring to the input current?
Please, before to proceed, check which is the current that goes in input to the board and which is the current that goes in output when you force a position that is different from the zero position.
Ciao
Gigi
ketchup
Associate III

I use labolatory power supply. Output voltage is 36V DC. I always read output current from power supply.

This power supply (readings from it) works porfectly with another controllers.

I read current and power from power supply, and max readings is 0.07A/3W. Very lower than 1.5A, which You are talking.

MAXON in this kit is 36V/120W. How to get 3,33A/120W which motor is cappable?

Ciao

�?ukasz

Gigi
ST Employee
Ciao Ketchup
As I mention in my mail, when you read 0.23A from your power supply it means that you are providing 3A to the motor.
If you connect a current probe to the motor phases you should get similar result of mine.
In the datasheet of the motor the nominal current is 2.72A. This mean that, in this condition, you are already providing more current respect the one that motor can afford.
Say that, and verified that the problem is not in a wrong configuration of the FW or board damaged, I suggest to verify if the torque provided by the motor in this condition is sufficient for your application… if not, I fear that you have to another motor and maybe also the board.
Ciao
Gigi
ketchup
Associate III

Ciao Gigi

You said: "As I mention in my mail, when you read 0.23A from your power supply it means that you are providing 3A to the motor."

I think, it's not correct.

When I read 3W from the power supply, than its 3W, not 120W.

When I'm powering motor by 36V, and output current on power supply is 0,07A, than motor (with controller ofcource) consuming 2.5W of power.

If the power is 2.5W, and the current is 1.5A, than voltage should be 1.6V, but it's not true. Voltage is 36V.

My question is: how tu enable 120W from this motor, not 3w, or even 10W?

Ciao

Ketchup

Very easy: Use the settings, provided by @Community member​ , give the motor a command to move at "high" rpm´s and try to "brake" it during the movement… THEN (and just then !) you will see the input current increasing. It´s a simple calculation: At "motor stop" condition, it´s more or less just and resistive load. Measure the ohm´s of the coil and you will see, that just a very low voltage can be put in without exeeding the given current of 3A. So maybe now you can imagine, why it consumes just a few mA at 36V.... You just mistake input current and output current ;)