Hello community,
I'm working on a project using a s12zvm for a pmsm motor controller. It is based on the PMSM app note for this device.
I have something that works very well but not always.
The goal now is to disconnect the computer (debugger (p&e multilink universal) and the rs-232 for freemaster) to have something that can work by itself.
My software does everything correctly when I just flashed the code (ctrl-f11 in CW) but if the system power is cycled it doesn't work so well. The main problem is the PMF signal not getting out. I have pwm only on "C" outputs, but nothing on A and B. It is the same code that worked well when just flashed and runned from CW. I did not see other things failing in the code, I still have access to it with freemaster.
Any suggestions ?
Jasmin
Solved! Go to Solution.
I got it...
I'm not using the GDU to drive the FETs but an external gate driver (system voltage is to high for GDU) so I must change the MODRR1 register to route pwm on i/o instead of GDU. MODRR register are write-once in normal mode (anytime in SSC) . I was doing:
MODRR1_PWM54RR=1; //PWM to I/O instead of GDU
MODRR1_PWM32RR=1;
MODRR1_PWM10RR=1;
instead of :
MODRR1|=0x07;
This is why only one phase was activated in Normal mode ...
Hi, I face the same problem like you,there have no pwm in i/o port.And my code as follow: Can you give me same advice?
void initPMF(void){
PMFCFG0_EDGEA = 1;
PMFCFG0_EDGEB = 1;
PMFCFG0_EDGEC = 1; //01 23 45 complementary pwm pair and edge-aligned pwm
PMFCFG0_INDEPA = 1; //independent mode
PMFCFG0_INDEPB = 1;
PMFCFG0_INDEPC = 1;
PMFCFG2_REV0 = 1; // 01 PWM generator A generates reload event.
PMFCFG2_REV1 = 0;
PMFOUTB = 0x2A; // Low MOSFETs ON while SW control (Unipolar PWM) 01 23 45 complementary pwm pair
PMFCFG3_VLMODE = 0x01; // Writing to value register zero also writes to value registers one to five
//PMFFEN = 0 // Fault disabled
// .... (other fault registers)
PMFFQCA = 0; // Reload every PWM, Half-cycle disabled, f core / 1(25Mhz)
PMFMODA = 1250;
PMFDTMA = 13; //dead time
PMFCFG2 |= 0x3f; // mask all PWM outputs
PMFOUTC_OUTCTL = 0x3f; // all outputs in Software mode
PMFENCA_LDOKA = 1; // apply PMF Modulo value
PMFENCA_RSTRTA = 1; // 1 = PWM restart at commutation event
PMFENCA_PWMENA = 1;
//PMFENCA_PWMRIEA = 1; // Reload Interrupt - Used only for debugging
PMFCFG1_ENCE = 0; // buffered PMFOUTC, PMFOUTB, SWAPx and MSKx (change on commutation event)
PMFENCA_GLDOKA = 1; // 0 = Local LDOKA controls buffered registers / 1 = external Load OK controls buffered registers
MODRR1_PWMPRR =0x01; //PWM router
MODRR1_PWM54RR = 1;
MODRR1_PWM32RR = 1;
MODRR1_PWM10RR = 1;
}
Hi,
I don't remember everything from this project but for sure in normal mode, you cannot do what you are doing at the end of your function.
[...]
MODRR1_PWMPRR =0x01; //PWM router <--- only this write is executed
MODRR1_PWM54RR = 1; <-- no effect
MODRR1_PWM32RR = 1; <-- no effect
MODRR1_PWM10RR = 1; <-- no effect
From datasheet, I think you should do a write like this: MODRR1|=0x0f;
Jasmin
I got it...
I'm not using the GDU to drive the FETs but an external gate driver (system voltage is to high for GDU) so I must change the MODRR1 register to route pwm on i/o instead of GDU. MODRR register are write-once in normal mode (anytime in SSC) . I was doing:
MODRR1_PWM54RR=1; //PWM to I/O instead of GDU
MODRR1_PWM32RR=1;
MODRR1_PWM10RR=1;
instead of :
MODRR1|=0x07;
This is why only one phase was activated in Normal mode ...