Skip to main content
ketchup
Associate III
May 15, 2020
Question

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

  • May 15, 2020
  • 13 replies
  • 5305 views

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

This topic has been closed for replies.

13 replies

Gigi
ST Employee
May 21, 2020

​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
May 25, 2020

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

Gigi
ST Employee
May 25, 2020
ketchup
ketchupAuthor
Associate III
May 25, 2020

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
May 25, 2020
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
ketchupAuthor
Associate III
May 25, 2020

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
May 25, 2020
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
ketchupAuthor
Associate III
May 25, 2020

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

chaaalyy
Senior II
May 25, 2020

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 ;)

ketchup
ketchupAuthor
Associate III
May 25, 2020

@Karl Hönemann​ 

On the different controllers (TI), I had set position to 0, and then I had tried to rotate the motor by hand.

I could see the raisening current to few Amps. The controller tried to back to 0 position incressing current.

I need to work with low speed (600RPM) and need much more power from start, than 3W.

Sorry, but I cant understand, why I need "high" rpm, to use more current.

chaaalyy
Senior II
May 25, 2020

Also with ST controller, the "pulled" current (from power supply) is rising, when you try to "hold" 0-position and move the motor away by hand. But anyway, it never will rise up to 3A at 36V … If you would do so with the motor from the kit, you would blow it up within parts of seconds. Try to measure the current and the voltage directly at the motor and you get the expected (and rated values). It´s just a physical law: The power you deliver into a system has to be "used" somewhere… Either by mechanical work or by conversion into heat… If you need more mechanical power (torque / rpm), you´ll need a motor, which is capable of doing so. The motor from the robot-1 kit is rated at 100W and it can deliver it within it´s specifications. Imagine your (maybe turbocharged…) car: If you try to accelerate at low rpm (idle rpm), there´s nearly no power. Just if you choose the right gear, it will work. Electric cars for example have completely different motors than that little Maxxon. They are constructed to deliver high torques at even low speeds (large diameters at less "lenght", more pole pairs, much more amps per coil and so on …

Watts are a unit of mechanical performance… Torque is just a mechanical force. A BIG difference ;)

Gigi
ST Employee
May 26, 2020

​I absolutely agree with @Karl Hönemann​ 

Thanks, maybe you explain better than me this concept.

100W indicated in the motor datasheet is considering a speed of more than  4000 rpm and with less than 3A, if you want to reach the same power but at lower speed you need a lot of current and this can't be sustained by the board and the motor.

So in your case is better to consider first the application requirements in term of torque instead of power to select the proper motor.

Ciao

Gigi

Gigi
ST Employee
May 26, 2020

​Whitout an HW modification what you can get maximum is 3.7A of phase current that you can get changing to 32182 the three define I mention in my firt post.

I tested this value and I didn't get over current, this will increase a little bit the provided torque.

The limitation in this case is in the maxium readable current of the board that is in the range of 3.7A. If you increse more probably you get the over current protection because the reading of the current will be saturated. You are providing more than nominal current of the motor but probably this condition can be sustanied temporarily by the motor. To increase more you have to modify the HW and in this case is better to switch to another board.

Ciao

Gigi 

0693W000001pREkQAM.jpg