From 2e1b449c8874f44e870e2ee8cd67c55f066a46cf Mon Sep 17 00:00:00 2001 From: seklyuts Date: Fri, 7 Jun 2024 09:46:14 +0300 Subject: [PATCH] =?UTF-8?q?=D1=82=D0=B5=D0=BC=D0=BF=D0=B5=D1=80=D0=B0?= =?UTF-8?q?=D1=82=D1=83=D1=80=D0=B0=20=D1=87=D0=B8=D1=82=D0=B0=D0=B5=D1=82?= =?UTF-8?q?=D1=81=D1=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Projects/epwm_test_biss_c_cpu2/Start_rfm.pmp | Bin 46837 -> 47513 bytes .../src/Peripherals/pwm_interrupts.c | 4 +- .../epwm_test_biss_c_cpu2/src/temperature.c | 38 ++++++++++++------ Projects/epwm_test_biss_c_cpu2/src/vector.c | 1 - 4 files changed, 27 insertions(+), 16 deletions(-) diff --git a/Projects/epwm_test_biss_c_cpu2/Start_rfm.pmp b/Projects/epwm_test_biss_c_cpu2/Start_rfm.pmp index 8c2c456c489b60d37f9e6e7d7a1e8f0b934e4691..a57e5ef86c7e6ba32e64039b5eb3b63beb775bd7 100644 GIT binary patch delta 3381 zcmZvedvHv56vy}6#Jb5Y$>!dhwUX>g)`~ngiO?E}3L*)TSdxlI9-d7IR#7d&#=EM7 zLkJN;B$R};iMCXun9=DN?WpQhOQnOV8T2tVold9vyEogjyEFEW-Ou-X&i&nU&+q*1 z?4M7#x<9y@cvy%~v>Y4lNjq*D;Wj!8nz0VT;d@3_d;qzSrX)Cu6YyJZC)nM}ioyO8 z{J^r7qodf0_W5eO;jf1~%xS`HJuHy^|H4?K3&7cGJv>#`Y$y~kNaw)eJ>y^m%V|L! z9|a|tWR5{=TqrK#(_pmgG(Q+1o`sunYhW~2)Q0xLM7&p!t=w&@Mh|8s*heeDU8>@y z)&Tt#e^)O9SQIMgZGZs^i9r&?F>1o=L4#lnp5~9@`#LSUf(`J@tF|NXtCw|GP(ZhyB{ErD*rnC5ack`h{5InG#W!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Z|Z74q?zX(g8$$i8Mq*h%Lrd(bvkx3Q?oQJ>2y3NwL1BJ^vw+3rE~me_jm98X6BpweKWK9 zANKE`tTq-l;w7uA?t2SpFgMACn_(ybPuZ{+(&1C|WR;;KCk~IZH=tG?iXpxtFh%x4 zKRn`V03Uv26K)(31>MT{ZT5Jq4fV$beg+Vfb2+nh7#!-rNdreiE+6g2Q0;J7jq%nP zw2ju|Qf(qEkalXv16<~(aN&l4Xtulq?b-L^nXD8(0~o@>S4QIW8`??Tg|mSjm|2vHH{;5g_AX=b@lao^e0VfkY~e6S?h&4~{Qw7e-{fs$!<+;gJKT1Hf_JUu-D8>RkEux_TtS%SR-%weB3z~D7>}+| zR6kjS>lDqOBEpTn$P70re_^T!w|qL&rL;)TPN`g0sAs2DPAt;1U*t<4U}xmN4m|jR$j+)5U!c9ES^d4jW7K2bZ?FA>-km2+Pd*j1IomkR8f%3jXvDqBhfc0*-hslaZ^+{bRI znZK3^?6%6zGJ)NZuhfdA%Z>aaQI+pPN3kD1xWdRk6nCRLD~#yKcPo{HD~5Smlht@Rtw8lvA#PR7qM*O5;aF2jbQZwmO zQYT3wb&x(H?IXEJyGfsr+^VMVmGnMO9xAtydPpCVx=A0)PhjO*bBIRY$Xiy;jp`I7=kqez=cgGt`q q8%jAHdUorQCQ$548chlyHIVx4JDj&$XYoFX-j|a1`Ab9ic+-D!mgyY; diff --git a/Projects/epwm_test_biss_c_cpu2/src/Peripherals/pwm_interrupts.c b/Projects/epwm_test_biss_c_cpu2/src/Peripherals/pwm_interrupts.c index 23c0638..f493367 100644 --- a/Projects/epwm_test_biss_c_cpu2/src/Peripherals/pwm_interrupts.c +++ b/Projects/epwm_test_biss_c_cpu2/src/Peripherals/pwm_interrupts.c @@ -39,7 +39,7 @@ typedef struct volatile strPWMABC PWM_motor = {PERIOD_2, PERIOD_2, PERIOD_2}; int16_t A_proc,B_proc,C_proc; -uint16_t PWM_Vent = PERIOD_MOTOR; +uint16_t PWM_Vent = PERIOD_FAN; uint16_t PWM_Chop = 0; void pwm_set_volt_3F(float phaseA, float phaseB, float phaseC, float Udc) @@ -76,7 +76,7 @@ void pwm_set_volt_3F(float phaseA, float phaseB, float phaseC, float Udc) EPwmRegs[PWM_B]->CMPA.bit.CMPA = PERIOD_MOTOR - PWM_motor.UB; EPwmRegs[PWM_C]->CMPA.bit.CMPA = PERIOD_MOTOR - PWM_motor.UC; - EPwmRegs[3]->CMPA.bit.CMPA = PERIOD_MOTOR - PWM_Vent; + EPwmRegs[3]->CMPA.bit.CMPA = PERIOD_FAN - PWM_Vent; EPwmRegs[3]->CMPB.bit.CMPB = PERIOD_MOTOR - PWM_Chop; } diff --git a/Projects/epwm_test_biss_c_cpu2/src/temperature.c b/Projects/epwm_test_biss_c_cpu2/src/temperature.c index 90fb73f..f09e8d7 100644 --- a/Projects/epwm_test_biss_c_cpu2/src/temperature.c +++ b/Projects/epwm_test_biss_c_cpu2/src/temperature.c @@ -41,21 +41,33 @@ uint16_t temperature_calc(uint16_t Imp) void temperatureTest(void) { - temperatureTic[0] = TemperatureImpCount; - if(temperatureTic[0] != 0) + if(TemperatureInitDone) { - if(temperatureTic[1] == temperatureTic[0]) temperatureTic[2]++; - else temperatureTic[2] = 0; - temperatureTic[1] = temperatureTic[0]; + PieCtrlRegs.PIEIER5.bit.INTx9 = 0; + PieCtrlRegs.PIEIER5.bit.INTx10 = 0; + XintRegs.XINT2CR.bit.ENABLE = 1; + temperatureTic[0] = TemperatureImpCount; + if(temperatureTic[0] != 0) + { + if(temperatureTic[1] == temperatureTic[0]) temperatureTic[2]++; + else temperatureTic[2] = 0; + temperatureTic[1] = temperatureTic[0]; - if(temperatureTic[2] > Temperature_TimeMax) - { - if(TemperatureInitDone) Temperature = ((temperatureTic[0]-1)>>4) - 50; - else TemperatureInitDone = 1; - temperatureTic[1] = TemperatureImpCount = 0; - } + if(temperatureTic[2] > Temperature_TimeMax) + { + if(TemperatureInitDone == 2) Temperature = ((temperatureTic[0]-1)>>4) - 50; + else TemperatureInitDone = 2; + temperatureTic[1] = TemperatureImpCount = 0; + } + } + } + else + { + XintRegs.XINT2CR.bit.ENABLE = 0; + temperatureTic[1] = TemperatureImpCount = 0; + PieCtrlRegs.PIEIER5.bit.INTx9 = 1; // SDFM1 interrupt enabled + PieCtrlRegs.PIEIER5.bit.INTx10 = 1; // SDFM2 interrupt enabled } - } @@ -71,7 +83,7 @@ void temperatureInit(void) EDIS; XintRegs.XINT2CR.bit.POLARITY = 0; - XintRegs.XINT2CR.bit.ENABLE = 1; + XintRegs.XINT2CR.bit.ENABLE = 0; } diff --git a/Projects/epwm_test_biss_c_cpu2/src/vector.c b/Projects/epwm_test_biss_c_cpu2/src/vector.c index 6a46c52..ea42096 100644 --- a/Projects/epwm_test_biss_c_cpu2/src/vector.c +++ b/Projects/epwm_test_biss_c_cpu2/src/vector.c @@ -110,7 +110,6 @@ void vectorControl(int16_t CurrentA, int16_t CurrentB, int16_t CurrentC, int16_t CurrLoop.piId.Ref = 0; if(Mode) {XintRegs.XINT2CR.bit.ENABLE = 0; temperature_deInit();} - else {XintRegs.XINT2CR.bit.ENABLE = 1;} switch(Mode) {