Hello I have developed a Custom MC-LVPMSM PCBA essentially based on the FRDM-MC-LVPMSM and FRDM KV11 Eval board. There are a few minor changes such as I am using a smaller pin count MCU in the KV11Z64VFM7 as we are looking for a small form factor and I have changed the OpAmp to a TLV9062 and modified some of the power management outside of that I am using the same FET Driver and FETs that are used on the MC-LVPMSM FRDM board.
One other change that is noteworthy is I have changed the 10MHz XTAL to a 8MHz MEMs OSC though I have updated the clock settings and from what I can tell this is working fine.
Project Setup:
Compiler = IAR
Project = frdmkv10f/pmsm_ref_sol
What has been verified:
FRDM KV11
1) I have successfully used the frdmkv10F project with the FRDM KV11 Eval + MC-LVPMSM boars to successfully tune and drive my motor.
a) IAR Project 'General Options' Device = NXP MKV11Z64xxx7
CUSTOM PCB with Same Project:
1) I can successfully connect/program & debug the KV11 on my custom PCB with a Segger J-LINK with custom PCB
2) I can successfully establish communication with the Freemaster pmsm_ref_sol.pmp project with custom PCB.
3) Freemaster GUI successfully reads V_DCB and display correct DCB Voltage with custom PCB.
4) Usr SW2 successfully generates Interrupt and starts 'Demo'. I have SW2 connected to PTB0
5) RED/GREEN LED's turn on when expected RED=PTE24, GRN=PTE25
6) The critical pin assignments for the PWM Channels and ADC inputs are the exact same between the FRDM KV11 and Custom PCB. You can see the attached spreadsheet with the Pinouts and schematic.
7) Verified the 8MHz MEMs OSC is operational and that I have PWM's being output from the KV11 though the frequency appears rather low for the PWM's at ~8KHz.
8) I have configured the Clock Settings to make use of an External Reference Clock as shown below...
const osc_config_t oscConfig = {.freq = BOARD_XTAL0_CLK_HZ,
.capLoad = 0,
.workMode = kOSC_ModeExt,
.oscerConfig = {
.enableMode = kOSC_ErClkEnable,
#if (defined(FSL_FEATURE_OSC_HAS_EXT_REF_CLOCK_DIVIDER) && FSL_FEATURE_OSC_HAS_EXT_REF_CLOCK_DIVIDER)
.erclkDiv = 0U,
#endif
}};
9) Set the BOARD_XTAL0_CLK_Hz = 8000000 // Set to 8MHz for MEMs OSC
10) I can measure ADC Midpoint Ref = 1.65 and other Testpoints all are within expected levels when not trying to drive the motor.
WHAT IS HAPPENING:
1) When I try to start the motor from the FMSTR GUI very quickly the DCB drops to a very low voltage and I_DCB Fault occurs in which I see large spikes on the I_DCB line. If repeated attempts are made the Dual N-FET on the Phase A line dramatically fails in a poof of smoke.
2) I still somewhat believe that this is all related to a clocking issue since I am using an 8MHz MEMs oscillator vs. a 10MHz XTAL but I have changed all the clock settings that appear to be needed to be changed? Maybe there is something I am missing here...?
3) Another possible scenario though seems unlikely is that there is some sort of pin map issue. I don't believe this is the case though as all my PWM & ADC inputs are the exact same GPIO/PORTx definititions that are used on the FRDM KV11 which uses a 64pin QFP vs. a 32pin QFN on my custom PCB but the PORTx assignments are all the same...
4) Outside of those items the only thing I am left with is something that I have completely overlooked in the Schematic that is not wired/connected as expected that maybe a 2nd set of eyes can uncover...
I can provide a schematic but I am not allowed to post it publicly to the forum...
Any insight or suggestions to verify, test, debug would be greatly appreciated as I have already fried 2 PCB's and only built up 6 on this initial prototype build.
Regards,
Frank
Adding the Scope plot of the V_DCB Voltage Divider output spike once the system tries to drive the motor....
Hello to narrow down the variables I have replaced the 8MHz MEMs oscillator with a 10MHz Oscillator and measured the BUSCLK, OSCERCLK, and PWM_FREQ all of which match the clocks measured with the FRDM KV11 setup.
Everything is functional but I am getting a massive voltage swings(positive and negative(below GND) on the outputs of V_DCB and I_DCB measuring circuits when I go to run the motor. All the parameters in the MCAT/PMSM Freemaster tool are the same as when I run the motor with the FRDM KV11 board. I recently went to try and see if I could just get the motor to spin using the Parameters Measurement tab and I ended up frying another PCB/n-FET combo.
I got permission to share the schematic to try and expedite this process as we are pretty much stuck scratching our head as to why we can't get this operational...
Regards,
Frank
In your clock change to 8 MHz you must change the FRDIV to divide by 256 which gives you a reference clock of 31.25 KHz input to the FLL. You have reduced the maximum frequency you can run from 75 MHz to 68.65 MHz using a FLL multiplier of 2197. Any faster and you violate the maximum clock of the MCU.
I find the MCUXpresso Config tools very useful in changing clock settings. The clocks tool is very complete and will check all of your changes to the clock.
If you want to verify you clock changes, you can turn on your clockout and select bus clock (all from the clocks tool).
The PWM and ADC assignments are the same so there is no issue with incorrect pin assignment there.
How stable is your 3.3V and 15V power?
If you still have your reference design , FRDM-KV11 and FRDM-MC-LVPMSM try you software on that reference design..
Did you happen to put in the Test Points that were on the FRDM-MC-LVPMSM. If so you can check you VREF div 2, current and voltage levels so make sure they are in range. If you used the same op-amp then all should be ok.
I've done my share of Letting the smoke out of current measurement resistors. It happens more often than we expect for sure. One thing more to check might be the deadtime setting in the application. Without deadtime the shoot through current of the FETs is massive and will burn out a
Are the parameters set in the MCAT default working for you. When you do the measure of electrical parameters does it finish?
You need to verify the phase currents and voltages before trying to spin your motor. This could be done using the parameter measuring tool in MCAT.
You also can go to the MCAT tab "Control Struc" and select scalar control. without driving a set speed you should see your three phases look similar to above figure.
Below - anytime you make a parameter change do and update target and Store Data. And note that until you have recompiled your code will the changes become default.
In the Speed Loop tab you can change the Speed Ramp down from the default 10000 to say 1000 or 3000.
In the current Loop Tab you can change the Loop Parameters. (If you hover over each of the symbols it pops up with a parameter definition and it's range. ) I very often will slow down the loop bandwidth and reduce the value of attenuation from 1 to .8.
Where did you source your project? Was it from the SDK? In the project that is sourced by the KV11 SDK the Mechanical Measurement is not an option. I'll be looking for a version that includes that as an option.
I hope this helps as a start.
Philip
Hello Philip,
Thanks for the response. So here is an update...
1) My project is from PMSM V1.2.0 and I am using the frdmkv10z Project in the 'build_ref_solutions' folder. This EXACT same project outside of the External Clock settings shown below vs. running from a XTAL with the ONLY other changes being LED & SW2 Pin Assignment changes runs perfectly fine with the FRDM KV11+LVPMSM board. The LED & User PB changes are below...
Custom PCB:
RED LED = PTE24
GRN LED = PTE25
BLU LED = PTA1 (not used in PMSM project but connected on PCB to RGB)
USR PB = PTB0
All of these are functional and I see the interrupt occur using PTB0 as the Usr PB.
2) Please Note that I changed the 8MHz MEMs OSC to a 10MHz version to keep the Clocks the Same as the FRDM_KV11. The ONLY difference is that in the function void_InitOSc0() I have updated the OSC Config for an External Clock vs a XTAL as shown below...
void BOARD_InitOsc0(void)
{
#ifdef KV11_EVAL
const osc_config_t oscConfig = {.freq = BOARD_XTAL0_CLK_HZ,
.capLoad = 0,
.workMode = kOSC_ModeOscLowPower,
.oscerConfig = {
.enableMode = kOSC_ErClkEnable,
#if (defined(FSL_FEATURE_OSC_HAS_EXT_REF_CLOCK_DIVIDER) && FSL_FEATURE_OSC_HAS_EXT_REF_CLOCK_DIVIDER)
.erclkDiv = 0U,
#endif
}};
#else
const osc_config_t oscConfig = {.freq = BOARD_XTAL0_CLK_HZ,
.capLoad = 0,
.workMode = kOSC_ModeExt,
.oscerConfig = {
.enableMode = kOSC_ErClkEnable,
#if (defined(FSL_FEATURE_OSC_HAS_EXT_REF_CLOCK_DIVIDER) && FSL_FEATURE_OSC_HAS_EXT_REF_CLOCK_DIVIDER)
.erclkDiv = 0U,
#endif
}};
#endif
CLOCK_InitOsc0(&oscConfig);
/* Passing the XTAL0 frequency to clock driver. */
CLOCK_SetXtal0Freq(BOARD_XTAL0_CLK_HZ);
}
I have measured the FRDM_KV11 BusClock and the BusClock on my custom PCB and they are the same 25MHz.
I also see the same PWM Frequency at 10KHz.
Unless there is something that is not obvious that needs to be changed when running from an External Clock vs. XTAL this seems to be working as expected.
3) I did find an error in my design in which my U4 & U3 OpAmps did not have a 3.3V Net attached to the supply rail. This has been fixed via Jumper Wires. I am measuring 1.65V on the output of all my OpAmps when not driving the motor as expected.
4) So when I try to run the motor I get a MASSIVE Voltage Spike on the Voltage Divider used to measure V_DCB(33V). It spikes up to ~8.2V and then swings well below GND. I of course don't see this massive spike on the FRDM_KV11 setup. This seems crazy as this would imply that V_DCB is ~152V and then goes all the way negative?
What would cause this massive Voltage Swing on the V_DCB Voltage Divider?
5) My Power Supplies are the same supplies I use for the V_DCB when I use the FRDM_KV11 setup...
6) I can see the PWM's Coming out of the KV11 and out of the Drivers on the FAN7888.
Any Additional insight would be greatly appreciated.
Regards,
Frank