Исправлен баг с прерываниями сигмадельты
This commit is contained in:
parent
6c12d60296
commit
20a535566d
@ -21,7 +21,7 @@
|
||||
|
||||
#define EPWM_DB (EPWM_DB_mkS*SYS_PWM_FREQUENCY/1000000)
|
||||
|
||||
#define SDFM_DELAY_mkS 72.0 //mkS
|
||||
#define SDFM_DELAY_mkS 70.0 //mkS
|
||||
#define SDFM_DELAY (SDFM_DELAY_mkS*SYS_PWM_FREQUENCY/1000000)
|
||||
|
||||
#define PERIOD_2 (PERIOD_MOTOR/2)
|
||||
|
@ -103,7 +103,7 @@ __interrupt void epwm1_isr(void)
|
||||
|
||||
__interrupt void epwm2_isr(void)
|
||||
{
|
||||
// Gpio54out(1);
|
||||
Gpio57out(1);
|
||||
|
||||
// EALLOW;
|
||||
// Sdfm1Regs.SDDFPARM4.bit.FEN = 1;
|
||||
@ -127,7 +127,7 @@ __interrupt void epwm2_isr(void)
|
||||
//
|
||||
PieCtrlRegs.PIEACK.all = PIEACK_GROUP3;
|
||||
// GpioDataRegs.GPADAT.bit.GPIO0 = 0;
|
||||
// Gpio54out(0);
|
||||
Gpio57out(0);
|
||||
|
||||
}
|
||||
|
||||
|
@ -309,6 +309,10 @@ void sdfmGet(uint16_t N)
|
||||
uint16_t i = 0;
|
||||
int32_t OffsetCount = 0;
|
||||
|
||||
if(N == SDFM_IA) Gpio54out(1);
|
||||
if(N == SDFM_IB) Gpio55out(1);
|
||||
if(N == SDFM_IC) Gpio56out(1);
|
||||
|
||||
FilterResult[N][loopCounter[N]] = *SdfmReadData[N];
|
||||
sdfmAdc[N] = FilterResult[N][loopCounter[N]] - sdfmOffset[N];
|
||||
if(loopCounter[N] < MAX_SAMPLES) loopCounter[N]++;
|
||||
@ -330,7 +334,10 @@ void sdfmGet(uint16_t N)
|
||||
SDCPARM_Reg_arr[N]->bit.MFIE = 1;
|
||||
SDDFPARM_Reg_arr[N]->bit.AE = 0;
|
||||
EDIS;
|
||||
sdfmAdcErr[0] = 0;
|
||||
sdfmAdcErr[N] = 0;
|
||||
if(N == SDFM_IA) Gpio54out(0);
|
||||
if(N == SDFM_IB) Gpio55out(0);
|
||||
if(N == SDFM_IC) Gpio56out(0);
|
||||
}
|
||||
|
||||
|
||||
@ -351,10 +358,10 @@ sdfm_check_all_current_measurements_was_done(void)
|
||||
{
|
||||
if((sdfmIndex & SDFM_ALL_CURRENTS) == SDFM_ALL_CURRENTS)
|
||||
{
|
||||
Gpio54out(1);
|
||||
Gpio15out(1);
|
||||
sdfmIndex = 0;
|
||||
vectorControl(sdfmAdc[SDFM_IA],sdfmAdc[SDFM_IB],sdfmAdc[SDFM_IC]);
|
||||
Gpio54out(0);
|
||||
Gpio15out(0);
|
||||
}
|
||||
}
|
||||
|
||||
@ -362,13 +369,13 @@ sdfm_check_all_current_measurements_was_done(void)
|
||||
__interrupt void Sdfm1_ISR(void)
|
||||
{
|
||||
uint16_t i;
|
||||
uint32_t IntFlags;
|
||||
uint16_t IntFlags;
|
||||
|
||||
IntFlags = Sdfm_readFlagRegister(SDFM1);
|
||||
sdfmIndex |= (IntFlags & 0xF000)>>12;
|
||||
|
||||
for(i = 0; i < 4; i++) if(IntFlags & (0x1000 << i)) sdfmGet(i);
|
||||
for(i = 0; i < 4; i++) if(IntFlags & (0x100 << i)) sdfmErr(i);
|
||||
for(i = 0; i < 4; i++) if((uint16_t)IntFlags & (0x1000 << i)) sdfmGet(i);
|
||||
for(i = 0; i < 4; i++) if((uint16_t)IntFlags & (0x100 << i)) sdfmErr(i);
|
||||
|
||||
Sdfm_clearFlagRegister(SDFM1,IntFlags);
|
||||
sdfm_check_all_current_measurements_was_done();
|
||||
@ -385,8 +392,8 @@ uint32_t IntFlags;
|
||||
IntFlags = Sdfm_readFlagRegister(SDFM2);
|
||||
sdfmIndex |= (IntFlags & 0xF000)>>8;
|
||||
|
||||
for(i = 0; i < 4; i++) if(IntFlags & (0x1000 << i)) sdfmGet(i+4);
|
||||
for(i = 0; i < 4; i++) if(IntFlags & (0x100 << i)) sdfmErr(i+4);
|
||||
for(i = 0; i < 4; i++) if((uint16_t)IntFlags & (0x1000 << i)) sdfmGet(i+4);
|
||||
for(i = 0; i < 4; i++) if((uint16_t)IntFlags & (0x100 << i)) sdfmErr(i+4);
|
||||
|
||||
Sdfm_clearFlagRegister(SDFM2,IntFlags);
|
||||
sdfm_check_all_current_measurements_was_done();
|
||||
|
@ -283,9 +283,8 @@ void vector_klark_park(uint16_t SectorOn, int16_t CurrentA, int16_t CurrentB, in
|
||||
vectorIdq.d = _IQmpy(vectorI2ph.Alfa,vectorSinCos.cos) + _IQmpy(vectorI2ph.Beta,vectorSinCos.sin);
|
||||
vectorIdq.q = _IQmpy(vectorI2ph.Beta,vectorSinCos.cos) - _IQmpy(vectorI2ph.Alfa,vectorSinCos.sin);
|
||||
|
||||
Gpio55out(1);
|
||||
Angle_test = Atan(sin_int, cos_int);
|
||||
Gpio55out(0);
|
||||
|
||||
|
||||
// CurrLoop.piIq.Ref = Inputs->IqRef;//Çàäàííîå
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user