Skip to main content
msingh
Senior
October 20, 2020
Solved

position control randomly stopped working

  • October 20, 2020
  • 14 replies
  • 4696 views

Hi,

I had successfully created a project using the AN5464 application note using the following hardware:

  • NUCLEO-F303RE
  • X-NUCLEO-IHM08M1

I have create the project using MotorControl Workbench 5.4.4 and managed to achieve rotation on the motor, however this doesn't seem to be a reliable code, it works for a while and then suddenly stops working, I have debugged the code and I have realised that it never goes beyond the "while(MC_GetAlignmentStatusMotor1()!=TC_ALIGNMENT_COMPLETED){}" eventhough it has worked for the past week! I have also noticed the motor doesn't take any current (0.01A) which means it doesn't even try to move if I don't power the microcontroller but only the ihm08m1 board it takes 0.04A when I plug in the microcontroller it goes down to 0.01A. Previously it was using 0.045A - 0.4A of current while driving the motor and 0.45A when in locked rotor mode. I cannot understand why did it suddenly stop?! I have checked the encoder and all 3 channels work fine. any help is much appreciated.

Kind regards

Manpreet Singh

This topic has been closed for replies.
Best answer by msingh

Good morning,

So here's an update. I have gone back by 2 backups to get motor rotates again. I do not know what happened to my latest backup as it was working fine when I did the back up. However it didn't work straight away but I had to create a new work space, clean the project and built it, while last week I only cleaned and build the project and none of my back ups worked. This week I decided to create a completely new workspace for each version of my backup and one of the backups worked, does anyone know how changing the workspace helped? and it doesn't work with the latest backup but the previous ONLY. (I still don't understand why it stopped in the first place).

Manpreet

14 replies

Laurent Ca...
Senior III
October 20, 2020

Dear @msingh​ 

You wrote " it works for a while and then suddenly stops working".

By that, do you mean that it is a regular behavior (systematically this is what happens) or do you mean that it works for several weeks and suddenly it does not work at all?

Best regards

Laurent Ca...

msingh
msinghAuthor
Senior
October 20, 2020

It doesn't work at all now!!! According to the application note AN5464 the "MC_startMoro1" is supposed to "performs an auto-start of the driving with both the encoder alignment procedure and the encoder zero reset" however nothing is actually moving and then obviously the code remains stuck in the" while(MC_GetAlignmentStatusMotor1()!=TC_ALIGNMENT_COMPLETED){} ". This was all working yesterday and this morning nothing works I am really confused about what's going on here.

Laurent Ca...
Senior III
October 20, 2020

Dear @msingh​ 

If you haven't changed the code, and if it worked for a while and suddenly it doesn't work at all, then you probably have an HW problem.

Therefor I suggest you to:

  • 1. check your connections
  • 2. check your power board
  • 3. and check your motor (by the way,what is the motor you use?)

Best regards

Laurent Ca...

msingh
msinghAuthor
Senior
October 20, 2020

I had tried to implement the printf function which is when I noticed this issue. Then, I went back to the previous version of the code and it still didn't work.

1) Connections are fine

2) I checked some voltages according to the ihm08m1 schematic and it looks good.

3) Maxon EC-I 40 50 Watt

Laurent Ca...
Senior III
October 20, 2020

Dear @msingh​ 

And did you check your motor is still working and with the same characteristics?

Best regards

Laurent ca...

msingh
msinghAuthor
Senior
October 20, 2020

I had 2 motors, I had tried both of them and them left one on the side. Neither of them works with the set up I have anymore. I can try driving them with the maxon controller but I'm 95% sure they'll both work. If anything was happened yesterday then I'd think the motor is burnt or any other issue but yesterday it was working all good.

msingh
msinghAuthor
Senior
October 20, 2020

I do not see any PWM signals being generated I'm guessing that's the reason for it not to move? can the debugger configurations affect this? I had changed them to try implement printf. Here's what they look like now.

msingh
msinghAuthor
Senior
October 20, 2020

0693W000004KQSbQAO.jpg

Laurent Ca...
Senior III
October 20, 2020

Dear @msingh (Community Member)​ 

Did you try:

  • 1. to come back to the previous configuration of the debugger (just in case of)
  • 2. and to run you board without physical connection to the debugger

 ?

Best regards

Laurent ca...

msingh
msinghAuthor
Senior
October 20, 2020

Dear @Laurent Ca...​ ,

Since I am using the nucleo-f303re the debugger is in the same PCB, but I have moved the JP5 jumper to power the MCU from the IHM08M1 instead of USB, This results in more current used, 0.085A (probably because now I also supply the control board and not only power board) but still no movement is achieved. I have actually noticed something now. The PWM was being generated but with 100% duty cycle on the "TIM1_CHxN" channels while 0% duty cycle on the "TIM1_CHx" channels. I have noticed this because after 2/3 minutes of drawing 0.085A it jumped to 0.126A but still no movement is achieved. and the motor rotor is harder to rotate compared to before. It seems like the programmer on board is faulty? I have an additional ST-LINK/V2 which I could try using to program? what do you suggest doing next?

Hope this will help you identify the issue. I really appreciate your quick replies and effort to help.

msingh
msinghAuthor
Senior
October 20, 2020

I forgot to write than when it started using more current the PWM changed from 100% to 52.3% for the "TIM_CHxN" channels and from 0 to 47.7% for the "TIM1_CHx" CHANNELS

Laurent Ca...
Senior III
October 21, 2020

Dear @msingh​ 

I guess you don't have a lot of customized code for te moment.

Have you tried starting again the project from scratch with the MC SDK, just in case your code got corrupted without doing it on purpose?

Best regards

Laurent Ca...

msingh
msinghAuthor
Senior
October 21, 2020

Dear Laurent,

I have tried creating a new project from scratch and it still wouldn't work. To confirm the hardware and motor work correctly I used the Motor Profiler 5.4.4 to get a motor profile and yes they work, the motor started rotating. Would you be able to suggest anything else?

Kind Regards

Manpreet Singh

Laurent Ca...
Senior III
October 21, 2020

Dear @msingh​ 

Just a question, what version of CubeMX do you use?

Best regards

Laurent Ca...

msingh
msinghAuthor
Senior
October 22, 2020

Dear @Laurent Ca...​ ,

I am using the STM32CubeMX 5.5.0. I have ordered a new IHM08M1 and NUCLEO-F303RE so I confirm the issue is on the hardware or software (even though I am sure the hardware works because I am able to rotate the motor using Motor Profiler 5.4.4) but just to clear the doubt I've bought another pair. Either ways I would like to find out what caused my current set up to stop working, because it doesn't seem to be much reliable this way.

Kind Regards

Manpreet Singh

Laurent Ca...
Senior III
October 22, 2020

Dear @msingh​ 

Please, keep us in touch and good luck.

Best regards

Laurent Ca...

KKuma.3
Associate
October 22, 2020

0693W00000591eyQAA.png@msingh​ " STM32 Motor Control "I have used a similar set up as you have used, same controller and power board.

The motor is also very similar , and it works perfectly fine with the position control application of 5.4.4.

ST link could not provide live watch variables , hence I changed to Segger using a script provided at ST website/ segger website I do not remember.

I have attached the screenshot of the debugger configuration.

The only step which I perform is clear the build after any changes to the code and rebuild the project to generate the flash.

I am using Atollic studio,

msingh
msinghAuthor
Senior
October 22, 2020

@KKuma.3​  Thanks for sharing your debug configurations, I assume the frequency depends on the debugger ? as I do not have 400kHz available in my list. I have tried doing a clean that didn't help.

KKuma.3
Associate
October 22, 2020

@msingh​  You are right , I am using the STlink but on borad Jlink . refer this https://www.segger.com/products/debug-probes/j-link/models/other-j-links/st-link-on-board/

msingh
msinghAuthorBest answer
Senior
October 27, 2020

Good morning,

So here's an update. I have gone back by 2 backups to get motor rotates again. I do not know what happened to my latest backup as it was working fine when I did the back up. However it didn't work straight away but I had to create a new work space, clean the project and built it, while last week I only cleaned and build the project and none of my back ups worked. This week I decided to create a completely new workspace for each version of my backup and one of the backups worked, does anyone know how changing the workspace helped? and it doesn't work with the latest backup but the previous ONLY. (I still don't understand why it stopped in the first place).

Manpreet