cancel
Showing results for 
Search instead for 
Did you mean: 

position control randomly stopped working

msingh
Senior

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

25 REPLIES 25

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.

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...
Lead II

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...

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...
Lead II

Dear @msingh​ 

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

Best regards

Laurent Ca...

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...
Lead II

Dear @msingh​ 

Please, keep us in touch and good luck.

Best regards

Laurent Ca...

KKuma.3
Associate III

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,

@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.

@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/