I have the KEA128BLDCRD demo board. No problems getting it up and running with the included motor.
I am trying to drive a custom sensor-less BLDC motor - 3 phase, 10 magnetic poles. I cannot get it to start reliably. Regardless of how I set the various parameters in the Freemaster app, the best I have been able to do is to get it to start one time in 5 or so. If I push-start the motor, it runs fine, but I can't get it through the open-loop start-up process. More often than not, it runs in the opposite direction slowly until a stall error is generated.
(The motor runs fine on a Turnigy PLUSH-80A controller.)
How do I determine the various parameters to get it to start reliably? I have been through the "Sensorless BLDC Control on Kinetis KV" app note (AN5263), the only one I could find with any details on how to tune the system, but the only instructions I find there are in the flow chart:
"Motor starts and smoothly switches to closed loop: False
Sensorless tab:
- Tune Integ thr corr constant
- click update"
I need a little more help than that...
Hi Carlos,
Unfortunatelly, there is not document dealing with setting of these parameters. So yes for now it is just a try and check apporach. But anyway you can find good explanation and description of these parameters in chapter 4 of DRM151 document.
Try to
Align Voltage = 1 V - This is enough regarding small stator resistance
Align Duration = 1 sec - Keep rotor aligned for 1 s
Do not change parameter Timer freq !.. It has to be set according to the FTM clock source in ftm.c file
Speed min = OL speed lim = 600 - these parameters have to be same since you want to leave open loop control mode with the same speed as starting speed of sensorless mode.
Freewheel time = 1s this paramter is not important now
CMT count = 100 - try higher number to slow down acceleration. Start_acceleration parameter should be close to 1, means that it will reach target speed slower.
1st cmt period = minimum - this time means how long it should stay in current commutation sector
Time off = 30% decay or freewheeling period. As soon as the phase is disconnected from the power by the commutation event, there is still a current flowing through the freewheeling diode. The conducting freewheeling diode connects the released phase to either a positive or a negative DC bus voltage. The conduction time depends on the momentary load of the motor
Integ thr.corr. - doesn't take effect since you are using different sensorless technique Table 4-4 in DRM151
Once you push "Update Target button", your new seeting is saved into "the Otput file" of MCAT tool. Once you push "Generate Configuration File", new appconfig.h is generated into your SW project located in Sorces/Config/appconfig.h
Carlos I will be on vacation next two weeks so I cannot support you in that time. The best way it would be to have your BLDC motor here to test it in my own.
Marek,
You asked for a motor to test with. Where do I need to ship it to you? I’ll need an address.
Carlos
Starting from the values I sent last night, I’ve been experimenting with various values.
I increased the align time to 1 sec, keeping the align voltage at 4V, and it starts almost every time. I reduced the align voltage and find that anything below 3.9V and it rarely starts.
I’m leaving the align voltage at 4V and time at 1 sec for now.
Changing the “Speed min” and “OL speed lim” didn’t seem to affect things so I left them at 600 as you suggest.
I increased “Cmt.count” to 100 and it started pretty reliably. Less reliably at 75 and only half the time at 50. Set it back to 100.
“1st cmt period” – 0.0034 was the minimum I could set it to without errors. The motor would not start. I found it would not start until I brought it back up to 0.01. At this point, it starts pretty reliably.
I went back, leaving the “Cmt.count” and “1st cmt period” at 100 and 0.01, and reduced the align voltage to 3.5. Motor would not start. Set it back to 4V and starts pretty reliably.
I did a “store data” in FreeMASTER followed by a “Generate Configuration File”, recompiled in CW, and re-flashed the CPU. FreeMASTER indicated “The map file has changed, would you like to reload it?” and I answered “Yes”.
As before, EVERY SINGLE TIME I try to start the motor, it IMMEDIATELY generates an “Idcb HI” fault. No matter how many times I try it. Whether I use the FreeMASTER “App Control” page or use SW1 on the demo board.
As before, without changing any parameters, I hit “Update Target”. Once I do this, I no longer get the “Idcb HI” fault. So again, doing the “Update Target” is doing SOMETHING, even though I have not changed any parameters. Something changes on the demo board when I hit that button.
Further confusion: Only the “Update Target” button on the “Parameters” tab “fixes” this issue. Hitting the “Update Target” buttons on either the “Control Loop” or “Sensorless” tabs does NOT affect this problem.
However, now the motor is not starting again. I have checked all the parameters I was changing, and they’re at the values I had chosen. In fact ALL the parameters on all three tabs hold the values I had recorded. As far as I can tell, nothing has changed except for the recompile cycle. I even went through and re-entered every single parameter on all 3 tabs. No change. Motor will not start. Jogs around a bit and eventually the “Stall” fault occurs.
This is getting VERY frustrating!!!
I went back to the BLDC_appconfig.h file from last night. Recompiled, re-flashed, and “Update Target”. Now it’s running again, with the most recent values I list above.
I have attached the two .h files – last nights (BLDC_appconfig eod2016-08-23.h) and the one I just generated (BLDC_appconfig.2016-08-26.h). The differences are the date comment and:
BLDC_appconfig.2016-08-26.h
#define ALIGN_DURATION (1000)
BLDC_appconfig.eod2016-08-25.h
#define ALIGN_DURATION (250)
*****
BLDC_appconfig.2016-08-26.h
#define N_MIN FRAC16(0.075000000000)
#define N_START_TRH FRAC16(0.075000000000)
#define STARTUP_CMT_CNT (100)
#define STARTUP_CMT_PER (7500)
#define CMT_T_OFF FRAC16(0.100000000000)
BLDC_appconfig.eod2016-08-25.h
#define N_MIN FRAC16(0.125000000000)
#define N_START_TRH FRAC16(0.040625000000)
#define STARTUP_CMT_CNT (2)
#define STARTUP_CMT_PER (15000)
*****
BLDC_appconfig.2016-08-26.h
#define START_CMT_ACCELER FRAC16(0.988964251792)
BLDC_appconfig.eod2016-08-25.h
#define START_CMT_ACCELER FRAC16(0.307692307692)
*****
I switched back and forth a couple of times, and it’s consistent. Using the BLDC_appconfig.eod2016-08-25.h file, once I “Update Target”, it works just about every time. When I use the BLDC_appconfig2016-08-25.h, it won’t work at all, even though I do the “Update Target” with the current values.
When it was working with the BLDC_appconfig.eod2016-08-25.h file, I once again generated the output file and the new file was identical to BLDC_appconfig.2016-08-26.h, so at least it’s consistent.
So although I can get the motor to run consistently using FreeMASTER, it won’t run without FreeMASTER – every time the CPU gets reset, it generates the “Idcb HI” fault every time until I use FreeMASTER to “Update Target”.
Could you sent me video record of your startup before we made a changes ?
This video is rather long, but it shows 13 attempts to start the motor. Tries #1, 10, and 11 were successful, with the RPMs set to 1000. The remainder are pretty representative of what I see. The only thing is that with the short jumpers (as you can see in the video), the motor rarely seems to go in the wrong direction. With the longer alligator clip jumpers, most of the times when the motor failed to start, it would jog in the wrong direction.
Each time it failed, I pressed SW1 and SW2 to clear the fault and then SW1 to start again. When it succeeded, I also pressed SW1 and SW2 to stop it, and then SW1 to start it again.
Have you change parameter Cmt Count to 20 in FreeMASTER tool ? If yes try to increase it more for example to 100. Please sent me again video record.
Carlos, are you able to measure phase resitance? But be careful if you measure one phase resitance or two phase resitance considering star connection.
I’ve played around with the various parameters again, now with the shorter wires connecting the board and the motor. It seems that when the motor is warm, it is easier to start, and more difficult when it’s cooler.
In any case, with the parameters shown in the attached BLDC_appconfig.h file, I find that it starts about half the time.
I’ve also attached screen shots of the three configuration screens, since they don’t seem to have a 1:1 correspondence with the .h file.
I still see the effect that after resetting the board, including when it gets reprogrammed, it will not run until I do an “update target” from FreeMASTER. Prior to that, it immediately indicates an “Idcb HI” fault. Once I do an “update target”, even without changing any of the parameters, it then starts about 50% of the time, and jogs around, back and forth, until it indicates a stall the rest of the time.
What happens when you hit the “update target” button? Something changes even if I don’t change any of the values.
Is it documented anywhere what logic would lead to selecting, or tuning, any of the given parameters? Or is it just a seat-of-the-pants / experience-driven process?
I have varied several of them around the values shown, and have concluded that it seems to operate least badly using the values shown. The values I’ve varied are:
Align Voltage 1.0 to 4.0 V
Align Duration 0.1 to 0.4 sec
CMT count 2-6
1st cmt period 0.01 to 0.03 sec
Integ thr.corr. 0 to 100%
I’ve tried to vary just one at a time and settled on the value for each that seems to correspond with the best (or least bad!) operation, but I don’t have any deeper logic behind any of the values. I would very much LIKE to have some logic behind the choices.
The good news is that the motor is starting half the time. The bad news is that it’s only starting half the time…
Thanks,
Carlos
I just found something else interesting. I had been using 20 inch alligator clip leads to connect from the KEA128_BLDC board to the motor leads. I replaced them with about 4 inches 22 gauge wire each with fast-on crimped connectors at the board end.
With the short wires in place, as soon as I try to start the motor, I get a quick “click” and then an immediate “Idcb HI” fault. If I replace the alligator clip jumpers, it behaves as before. So it appears that my 20” alligator clip jumpers are making a substantial difference.
I checked the jumpers and found them to be about 0.26 ohms and about 7 uH. The short wires measure at about 0.1 uH and 0.01 ohms, basically at the low limit of my measurement range.
The measurements I gave you earlier for the motor phases were taken at the motor leads, without the alligator jumpers attached.
I found by accident that if I use FreeMASTER and “update target” even if I haven’t actually changed any parameters, that the motor then again behaves as in the videos. If I reset the board, then try to start it, I get the immediate “Idcb fault”. If I again do the “update target”, it again behaves as in the videos.
I tried re-generating the BLDC_appconfig.h file and recompiling/reprogramming, but nothing changed. It still gives me the fault after a reset, but if I do the update target, it then behaves as in the video.
I’m not sure what this tells us, but it is certainly interesting, at least to me.
I take it based on the email that arrived at 4 am that you’re in Europe somewhere? What hours do you work?
Carlos
Hi Marek,
I measured between phases, so like you point out, I’m measuring two phases in series given the star configuration. I would have to disassemble the motor to access individual phases. The values I measure are:
0.141 ohms 42.8 uH
0.143 ohms 42.7 uH
0.144 ohms 42.2 uH
Two videos are attached – with STARTUP_CMT_CNT set to 20, and set to 100. Each one shows two cycles.
Carlos
Ok Carlos we will try a simple test. Follow these steps:
1) Replace AppStart(void) function by this one:
/*******************************************************************************
*
* Function: void AppStart(void)
*
* Description: BLDC application START state function
*
*******************************************************************************/
static void AppStart(void)
{
if(driveStatus.B.AfterCMT == 1)
{
timeZC = NextCmtPeriod >> 1;
startCMTcounter--;
if(startCMTcounter > 0)
{
driveStatus.B.AfterCMT = 0;
NextCmtPeriod = MLIB_Mul(NextCmtPeriod,mcat_startCmtAcceler);
}
}
if(startCMTcounter == 0)
{
//AppStartToRun();
duty_cycle = 0;
FTM2_C1V = duty_cycle;
FTM2_C3V = duty_cycle;
FTM2_C5V = duty_cycle;
FTM2_PWMLOAD |= FTM_PWMLOAD_LDOK_MASK;
}
}
2) Replace AppAlignmentToStart(void) function by this one
/*******************************************************************************
*
* Function: void AppAlignmentToStart(void)
*
* Description: BLDC application ALIGN to START state transition function
*
*******************************************************************************/
static void AppAlignmentToStart(void)
{
driveStatus.B.Alignment = 0;
driveStatus.B.EnableCMT = 1;
driveStatus.B.AfterCMT = 0;
NextCmtSector = 0; /* Starting sector */
NextCmtPeriod = mcat_startCmtPer;
startCMTcounter = mcat_startCmtCnt - 1;
/* Prepare PWM settings for initial commutation sector */
FTM2_OUTMASK = ui8FTM2OutmaskVal[rotationDir][NextCmtSector];
FTM2_SWOCTRL = ui16FTM2SwOctrlVal[rotationDir][NextCmtSector];
FTM0_SC &= ~FTM_SC_CLKS_MASK; /* Stop FTM0 counter */
FTM0_CNT = 0x0000; /* Force commutation sector 0 PWM settings */
FTM0_MOD = STARTUP_CMT_PER;
FTM0_SC |= FTM_SC_CLKS(1); /* Start FTM0 counter */
NextCmtSector++;
/* Prepare PWM settings for the next commutation sector */
FTM2_OUTMASK = ui8FTM2OutmaskVal[rotationDir][NextCmtSector];
FTM2_SWOCTRL = ui16FTM2SwOctrlVal[rotationDir][NextCmtSector];
//NextCmtPeriod = MLIB_Mul(NextCmtPeriod,mcat_startCmtAcceler);
NextCmtPeriod = MLIB_Mul(NextCmtPeriod,1);
appState = APP_START;
}
3) Change parameter Cmt Count = 20 in FreeMASTER tool
4) Update Output File, debug your application, and push start button in FreeMASTER
5) Let me know what's going on.
OK, put that code in, compiled and flashed the CPU. When I hit the start switch, the motor jogs around a bit. I have attached an mp4 file showing two cycles. Note that I have to reset the CPU in order to re-start – once I hit the start switch and let the process go, when it stops, it becomes unresponsive, both to FreeMASTER and to the on-board switches. Reset is the only way to try again.
The clip shows two cycles – for the first one, I started recording and hit the start button immediately. Once it stopped, I hit the reset switch and then start again.
The video does not appear aliased – it faithfully re-creates the behavior of the motor.
No I believe that motor is ok. But try to verify whether you are able to "step" your motor forcing commutation sectors and applying some voltage. It can be also align voltage that is in the range 1 to 2 volts. Just change sectors manually in freemaster application.
I added several variables to the watch window, including “Start Commutation Counter”. When I reduced that to 2, it seems to be starting more often – occasionally several times in a row. Many of the times it does NOT start, it is running slowly (and noisily) in the wrong direction. (Sounding a bit like a stepper motor.) This has always been the case – where if it fails to start, it most often runs the wrong way.
I don’t know what this means, but it seems like it should be a clue.
Sorry, I just don’t see where in FreeMASTER I can do that. I see where I can change the various parameters on the three tabs you asked for screen captures of, then there’s the “Output File” tab which allows me to generate a new BLDC_appconfig.h file, and the “App Control” tab, but it only has a “Start/Stop” switch and a button to “Clear Faults”. Then there are the various “Scope” screens, but they are just displays, as far as I can tell.
Do you mean through the “Variable Watch” window? I added the variable “ActualCmtSector” to the watch window, and I can change its value, but it doesn’t appear to do anything – I assume because the motor isn’t on. If I turn on the motor via the “App Control” switch, I see the ActualCmtSector values changing, but it stalls before I can actually change it and see anything.
Hi Carlos,
I was trying to find 10 pole motor here, unfortunately I could not find such a machine. It is difficult to understand what's wrong, since I cannot test your application here.
Try to spin your motor
Have you tried to spin your motor just by applying voltage and changing commutation sectors ?
I’m not sure what you mean – apply voltage and change commutation sectors. How would I do this?
If your concern is whether the motor runs at all, it runs (and starts) fine with an off-the-shelf Turnigy PLUSH-80A controller.
Have you already tried to increase parameter Time off from 15% to for example 30% in Sensorless Control tab?
Please after this change sent me screen shot of the appconfig.h.
Any progress?