Author Topic: Problems with STM32 PMSM FOC SDK  (Read 67259 times)

0 Members and 1 Guest are viewing this topic.

Offline psyke

  • Contributor
  • Posts: 11
  • Country: ar
Re: Problems with STM32 PMSM FOC SDK
« Reply #350 on: November 06, 2019, 02:09:44 pm »
Thank you for answering guys.

I'd first verify both ppr and counting direction of the encoder. You can also use one of the DAC outputs to monitor the electrical angle along with one of the phase voltages, while spinning the motor manually. If these stay in sync after a few revolutions then you can tick that off. Regarding the encoder I channel: in earlier versions that's something that you have to code by yourself - set up an interrupt for that signal in your MCU and let the ISR manually set the correct offset (to be measured once).

Ok, going to try the DAC output when I get close to an oscilloscope. Regarding to the encoder I channel, the motor should work anyways even if I dont implement the interrupt for that channel?

Thing that you need to do the "encoder align" first and only then you mus click on "start motor".
Have you tried this?

If you never align the encoder, the control stage will know where the rotor is and will probably get stuck.

PS: In these new versions I don't know if the "start motor" already makes the encoder alignment, but it makes no sense to me.

In new versions, if you click "Start motor" for the first time, it does an encoder alignment, and after that, it starts the motor. Successive "Start motor" commands just start the motor without alignment, as it is already aligned.

I already tried hitting encoder alignment before starting, I think I tried everything available in the library  |O

I also got inside the code of the library, trying to know why it doesn't spin the motor... but got no success finding the problem.
« Last Edit: November 06, 2019, 02:13:02 pm by psyke »
 

Offline Dave_PT

  • Frequent Contributor
  • **
  • Posts: 282
  • Country: pt
    • DavidMartinsEngineering
Re: Problems with STM32 PMSM FOC SDK
« Reply #351 on: November 06, 2019, 03:56:02 pm »
Stupid question: the phases order, number of pole pairs, etc are correct, right?

You can run the motor in sensorless mode, so all parameters must be correct, but you never know ...  :-//
 

Offline psyke

  • Contributor
  • Posts: 11
  • Country: ar
Re: Problems with STM32 PMSM FOC SDK
« Reply #352 on: November 06, 2019, 04:18:56 pm »
I measured number of pole pairs with ST’s method, energizing 2 phases and counting the amount of snaps in a single revolution

I tried changing two phases order with no success, it does the same
 

Offline tatus1969

  • Super Contributor
  • ***
  • Posts: 1237
  • Country: de
  • Resistance is futile - We Are The Watt.
    • keenlab
Re: Problems with STM32 PMSM FOC SDK
« Reply #353 on: November 06, 2019, 06:19:22 pm »
Ok, going to try the DAC output when I get close to an oscilloscope.
I'd say that having one is a must when developing a motor controller. When having a problem, I first hook that up. I only start debugging the code when it doesn't look like an electrical problem.

Regarding to the encoder I channel, the motor should work anyways even if I dont implement the interrupt for that channel?
The I channel based alignment is a substitute for the software alignment that the library does. If your application is fine with the motor being 'hard' turned each time the system powers up, and you can guarantee that there is no shaft torque during this time, then you don't need that.
We Are The Watt - Resistance Is Futile!
 
The following users thanked this post: Dave_PT

Offline psyke

  • Contributor
  • Posts: 11
  • Country: ar
Re: Problems with STM32 PMSM FOC SDK
« Reply #354 on: November 06, 2019, 07:01:13 pm »
Ok, going to try the DAC output when I get close to an oscilloscope.
I'd say that having one is a must when developing a motor controller. When having a problem, I first hook that up. I only start debugging the code when it doesn't look like an electrical problem.

Regarding to the encoder I channel, the motor should work anyways even if I dont implement the interrupt for that channel?
The I channel based alignment is a substitute for the software alignment that the library does. If your application is fine with the motor being 'hard' turned each time the system powers up, and you can guarantee that there is no shaft torque during this time, then you don't need that.

Ok, so the I channel isn't going to be used for now. First I need to make the motor spin with encoder.

Regarding to the oscilloscope, we have some for students use in the university. I know its very important to have one, but I don't.
Maybe tomorrow I can go use one of those. I will post updates after that
 

Offline psyke

  • Contributor
  • Posts: 11
  • Country: ar
Re: Problems with STM32 PMSM FOC SDK
« Reply #355 on: November 06, 2019, 07:17:17 pm »
I just did some tests with another motor, this one has 6 pole pairs (the original one that I need to use has 8 pole pairs), but I have the same results... I feel there is a problem with the library. Hope we can find out the problem soon
 

Offline Dave_PT

  • Frequent Contributor
  • **
  • Posts: 282
  • Country: pt
    • DavidMartinsEngineering
Re: Problems with STM32 PMSM FOC SDK
« Reply #356 on: November 06, 2019, 07:36:39 pm »
Therefore, you cannot guarantee under what conditions the AB signal reaches the MCU ...

When possible check the AB signals with the oscilloscope. Just to make sure the feedback is working correctly.
 

Offline r0d3z1

  • Regular Contributor
  • *
  • Posts: 97
  • Country: it
Re: Problems with STM32 PMSM FOC SDK
« Reply #357 on: November 11, 2019, 08:22:57 am »
what library version are you using ? I am currently using the 5.4 with only encoder as feedback and it works. For sure your motor phase order have to be correct.
 

Offline psyke

  • Contributor
  • Posts: 11
  • Country: ar
Re: Problems with STM32 PMSM FOC SDK
« Reply #358 on: November 12, 2019, 02:15:16 pm »
Well... yesterday I recorded some videos showing the oscilloscope and the motor control workbench, and I came here to post them, but when I read r0d3z1 comment, I thought: I'm going to try a last thing, so I interchanged the connection of two phases.... and it worked  |O  :palm:  :scared:

Thank you to all who helped me
 

Offline Dave_PT

  • Frequent Contributor
  • **
  • Posts: 282
  • Country: pt
    • DavidMartinsEngineering
Re: Problems with STM32 PMSM FOC SDK
« Reply #359 on: November 12, 2019, 02:28:12 pm »
Story Summary:

Stupid question: the phases order, number of pole pairs, etc are correct, right?

I tried changing two phases order with no success, it does the same

I'm going to try a last thing, so I interchanged the connection of two phases.... and it worked  |O  :palm:  :scared:

Glad to know it already works ;)
 
The following users thanked this post: psyke

Offline r0d3z1

  • Regular Contributor
  • *
  • Posts: 97
  • Country: it
Re: Problems with STM32 PMSM FOC SDK
« Reply #360 on: November 12, 2019, 05:10:33 pm »
Well... yesterday I recorded some videos showing the oscilloscope and the motor control workbench, and I came here to post them, but when I read r0d3z1 comment, I thought: I'm going to try a last thing, so I interchanged the connection of two phases.... and it worked  |O  :palm:  :scared:

Thank you to all who helped me

I am pleased that it worked.
I would like to ask you if you are using the library with the ihm08m1 board ? i am currently using it and the current reading are very noisy due to the switching noise induced by the buck converter. Anyone notice this ?
 

Offline psyke

  • Contributor
  • Posts: 11
  • Country: ar
Re: Problems with STM32 PMSM FOC SDK
« Reply #361 on: November 13, 2019, 12:04:08 am »
I am pleased that it worked.
Thank you  :)

I started with a P-NUCLEO-IHM001 (NUCLEO board with STM32F302R8 and an IHM07M1). After testing the library with that board, I designed my own PCB based in IHM08M1 schematics. I literally copied the current sensing part, and it's working nice on my board.

How much current does your motor consume?

If you get noisy current reading, I would start increasing T-noise and/or Trise in "Current Sensing" block in ST Motor Control Workbench, and recompile.
« Last Edit: November 13, 2019, 03:40:49 am by psyke »
 

Offline psyke

  • Contributor
  • Posts: 11
  • Country: ar
Re: Problems with STM32 PMSM FOC SDK
« Reply #362 on: November 19, 2019, 05:01:47 pm »
Hi, I'm back again, but this time I don't have any problem, just a question.

Does anyone know if you can do position control with this library? Because I can't find a way to do that, only speed control

Thank you
 

Offline r0d3z1

  • Regular Contributor
  • *
  • Posts: 97
  • Country: it
Re: Problems with STM32 PMSM FOC SDK
« Reply #363 on: November 20, 2019, 11:31:48 am »
As far as I know position control is not supported by the library, but you can add it by yourself.
 

Offline r0d3z1

  • Regular Contributor
  • *
  • Posts: 97
  • Country: it
Re: Problems with STM32 PMSM FOC SDK
« Reply #364 on: January 13, 2020, 10:51:55 am »
Anyone using this library with encoder is having oscillation problem on speed loop ?
I have seen that there is no LPF of speed feedback and the sampling is very slow (1ms).
 

Offline psyke

  • Contributor
  • Posts: 11
  • Country: ar
Re: Problems with STM32 PMSM FOC SDK
« Reply #365 on: January 13, 2020, 03:27:25 pm »
Hi r0d3z1

I have a little oscilation in speed feedback but it isn't significant.
Does it get unstable due to the oscilation in speed feedback?
If you are using encoder you can increase the input filter in the workbench.
Maybe you could also post a short video showing the behavior.
Also check if changing motor parameters you get better results
« Last Edit: January 13, 2020, 04:34:33 pm by psyke »
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf