2024-11-29 06:22 AM - edited 2024-12-01 10:28 PM
I have a custom board, which is based on the STEVAL-SPIN3201, it is used to control a low inductance BLDC motor with hall-sensors (100µH).
The motor controller is running and is able to control the motor. Unfortunately the phase currents tell that there is something that needs more care.
There are two problems. The first is that the phase currents are not as neat and harmonic as I might wish, the second (and main problem) is that once in a while every 10 seconds or so I see this iregularity:
The three phase currents:
I am uncertain of how I shall debug this, I suspect it has something to do with the current sensing. I would like to dump the raw current measurements from the ADC, but I do not think the chip is fast enough to do so.
I have tried to filter the current sensing circuit, but without any luck and without a way of quantifying the noise it is hard to compare.
How would you go about debugging this?
Informations:
Motor: BLDC with Hall sensors
Motor Control WorkBench: Version: 6.2.1
MCU: STM32SPINF0
Inverter Board: Custom, based on STEVAL-SPIN3201
Algorithm: FOC
Control Mode: Torque/Speed Control
Other: PWM Freq. 30kHz, REGULATION_EXECUTION_RATE: 2
2024-12-02 05:25 AM
Hello Nikolaj_TL,
Thank you for your question, I will try to give you a few advice on what may be the root cause of your issue.
First of all, try reducing your PWM frequency : 30 kHz, even with an execution rate of 2, is asking a lot for at F0 chip, so I would start with this.
Check that sampling is done correctly : having a PIN set at each ADC conversion will let you look at the sampling instant, that you can compare with the PWM window to see if the sampling is right.
Please consider upgrading your MCSDK to its latest version (6.3.2). This is a general advice as we constantly try to improve our solution to fix any issue we might come across.
2024-12-02 06:01 AM
Hello @Gael A,
Thank you for your advices. Good idea to set a pin on each ADC conversion. How would you set the PIN as each ADC conversion is these are triggerede externally by TIM1 Ch4? Is it possible to setup TIM1 Ch4 to interrupt while being setup as PWM?
2024-12-02 07:14 AM
Hello Nikolaj_TL,
You can check the STM32F0 reference manual to check if that is allowed, or simply try and see.
I personally toggle the pin at the beginning of the CURRENT_REGULATION handler, as it happens at the end of the DMA transfer after the ADC conversion, so knowing your entire sampling time roughly gives you the starting point. It is a bit intrusive and not the most precise but for what you are trying to check it is sufficient.
2024-12-05 06:22 AM - edited 2024-12-05 06:39 AM
Hello @Gael A,
I have set the PWM frequence down to 20kHz in order to ease the chip. This results in significantly larger ripples (due to the low motor inductance) and less frequent distortion in the phase currents, but larger distortion.
I managed to make the measurement you suggested.
I have read the doc about current sampling in the Motor Control SDK (Current sampling in three-shunt topology using one A/D converter), but have a hard time analysing wether the sampling timing is ok.
Ch1: DMA1_Ch1_IRQ (called after the ADC and DMA finishes)
CH2-4: Phase voltages
*OBS: please ignore the noise on ch1 it is due to a quick measurement setup
I also did a measurement with a current probe (I only have a 4-channel oscilloscope)
What can you make out of this?
(full measurements are attached below)