рабочая версия ПО для REF0 и REF1

This commit is contained in:
seklyuts 2024-07-24 10:07:23 +03:00
parent 4fcc1b54f8
commit df2c9499d0
11 changed files with 48 additions and 53 deletions

View File

@ -117,6 +117,13 @@ void PWMGpioInit(void)//<2F><><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>
GpioCtrlRegs.GPACSEL2.bit.GPIO8 = 2;//to cpu2
GpioCtrlRegs.GPACSEL2.bit.GPIO9 = 2;
GpioCtrlRegs.GPAPUD.bit.GPIO6 = 1; // Disable pull-up on GPIO6 (EPWM4A)
GpioCtrlRegs.GPAPUD.bit.GPIO7 = 1; // Disable pull-up on GPIO7 (EPWM4B)
GpioCtrlRegs.GPAMUX1.bit.GPIO6 = 1; // Configure GPIO6 as EPWM4A
GpioCtrlRegs.GPAMUX1.bit.GPIO7 = 1; // Configure GPIO7 as EPWM4B
GpioCtrlRegs.GPACSEL1.bit.GPIO6 = 2;//to cpu2
GpioCtrlRegs.GPACSEL1.bit.GPIO7 = 2;
GpioCtrlRegs.GPAPUD.bit.GPIO12 = 1; // Disable pull-up on GPIO12 (EPWM7A)
GpioCtrlRegs.GPAPUD.bit.GPIO13 = 1; // Disable pull-up on GPIO13 (EPWM7B)
GpioCtrlRegs.GPAMUX1.bit.GPIO12 = 1; // Configure GPIO12 as EPWM7A

View File

@ -104,6 +104,7 @@ void InitPerif(void)
CONNECT_SD2(TO_CPU2);
CONNECT_PWM1(TO_CPU2);
CONNECT_PWM2(TO_CPU2);
CONNECT_PWM4(TO_CPU2);
CONNECT_PWM5(TO_CPU2);
CONNECT_PWM7(TO_CPU2);
CONNECT_PWM8(TO_CPU2);

View File

@ -2,54 +2,29 @@
<configurations XML_version="1.2" id="configurations_0">
<configuration XML_version="1.2" id="Texas Instruments XDS100v2 USB Debug Probe_0">
<instance XML_version="1.2" desc="Texas Instruments XDS100v2 USB Debug Probe_0" href="connections/TIXDS100v2_Connection.xml" id="Texas Instruments XDS100v2 USB Debug Probe_0" xml="TIXDS100v2_Connection.xml" xmlpath="connections"/>
<connection XML_version="1.2" id="Texas Instruments XDS100v2 USB Debug Probe_0">
<instance XML_version="1.2" href="drivers/tixds100v2icepick_c.xml" id="drivers" xml="tixds100v2icepick_c.xml" xmlpath="drivers"/>
<instance XML_version="1.2" href="drivers/tixds100v2c28x.xml" id="drivers" xml="tixds100v2c28x.xml" xmlpath="drivers"/>
<instance XML_version="1.2" href="drivers/tixds100v2cla2.xml" id="drivers" xml="tixds100v2cla2.xml" xmlpath="drivers"/>
<instance XML_version="1.2" href="drivers/tixds100v2cs_child.xml" id="drivers" xml="tixds100v2cs_child.xml" xmlpath="drivers"/>
<instance XML_version="1.2" href="drivers/tixds100v2cs_dap.xml" id="drivers" xml="tixds100v2cs_dap.xml" xmlpath="drivers"/>
<instance XML_version="1.2" href="drivers/tixds100v2cortexM.xml" id="drivers" xml="tixds100v2cortexM.xml" xmlpath="drivers"/>
<instance XML_version="1.2" href="drivers/tixds510ajsm.xml" id="drivers" xml="tixds510ajsm.xml" xmlpath="drivers"/>
<configuration XML_version="1.2" id="Texas Instruments XDS2xx USB Debug Probe_0">
<instance XML_version="1.2" desc="Texas Instruments XDS2xx USB Debug Probe_0" href="connections/TIXDS2XXUSB_Connection.xml" id="Texas Instruments XDS2xx USB Debug Probe_0" xml="TIXDS2XXUSB_Connection.xml" xmlpath="connections"/>
<connection XML_version="1.2" id="Texas Instruments XDS2xx USB Debug Probe_0">
<instance XML_version="1.2" href="drivers/tixds560icepick_c.xml" id="drivers" xml="tixds560icepick_c.xml" xmlpath="drivers"/>
<instance XML_version="1.2" href="drivers/tixds560c28x.xml" id="drivers" xml="tixds560c28x.xml" xmlpath="drivers"/>
<instance XML_version="1.2" href="drivers/tixds560cla2.xml" id="drivers" xml="tixds560cla2.xml" xmlpath="drivers"/>
<instance XML_version="1.2" href="drivers/tixds560cs_child.xml" id="drivers" xml="tixds560cs_child.xml" xmlpath="drivers"/>
<instance XML_version="1.2" href="drivers/tixds560cs_dap.xml" id="drivers" xml="tixds560cs_dap.xml" xmlpath="drivers"/>
<instance XML_version="1.2" href="drivers/tixds560cortexM.xml" id="drivers" xml="tixds560cortexM.xml" xmlpath="drivers"/>
<instance XML_version="1.2" href="drivers/tixds560ajsm.xml" id="drivers" xml="tixds560ajsm.xml" xmlpath="drivers"/>
<platform XML_version="1.2" id="platform_0">
<instance XML_version="1.2" desc="TMS320F28388D_0" href="devices/f28388d.xml" id="TMS320F28388D_0" xml="f28388d.xml" xmlpath="devices"/>
<device HW_revision="1" XML_version="1.2" description="" id="TMS320F28388D_0" partnum="TMS320F28388D" simulation="no">
<device HW_revision="1" XML_version="1.2" description="" id="TMS320F28388D_0" partnum="TMS320F28388D">
<router HW_revision="1.0" XML_version="1.2" description="ICEPick_C router" id="IcePick_C_0" isa="ICEPICK_C">
<subpath id="Subpath_1">
<property Type="numericfield" Value="0x11" desc="Port Number_0" id="Port Number"/>
</subpath>
<subpath id="CM">
<property Type="numericfield" Value="0x12" desc="Port Number_1" id="Port Number"/>
</subpath>
</router>
</device>
</platform>
</connection>
</configuration>
</configurations>

View File

@ -19,6 +19,7 @@
#include "frmmstr_run.h"
#include "adc_init.h"
#include "biss.h"
#include "rele.h"
void main(void)
{
@ -29,6 +30,7 @@ void main(void)
{
// asm (" NOP");
frmmstr_run();
rele_run();
// Gpio_rainbow(diod);
// AdcRun();
// BissClkgenRun();

View File

@ -119,6 +119,7 @@ void PWMInitEnable(void)
EALLOW;
CpuSysRegs.PCLKCR2.bit.EPWM1=1;
CpuSysRegs.PCLKCR2.bit.EPWM2=1;
CpuSysRegs.PCLKCR2.bit.EPWM4=1;
CpuSysRegs.PCLKCR2.bit.EPWM5=1;
CpuSysRegs.PCLKCR2.bit.EPWM7=1;
CpuSysRegs.PCLKCR2.bit.EPWM8=1;

View File

@ -59,7 +59,11 @@ void pwm_set_volt_3F(float phaseA, float phaseB, float phaseC, float Udc)
PWM_motor.UA = PERIOD_2 + A_proc;
PWM_motor.UB = PERIOD_2 + B_proc;
#ifdef REF0
PWM_motor.UC = PERIOD_2 - C_proc;
#else
PWM_motor.UC = PERIOD_2 + C_proc;
#endif
// FaultABC = FaultPWM;
if(FaultABC) FaultABCFix = FaultABC;
@ -77,8 +81,8 @@ 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_FAN - PWM_Vent;
EPwmRegs[3]->CMPB.bit.CMPB = PERIOD_MOTOR - PWM_Chop;
// EPwmRegs[PWM_FAN]->CMPA.bit.CMPA = PERIOD_FAN - PWM_Vent;
// EPwmRegs[3]->CMPB.bit.CMPB = PERIOD_MOTOR - PWM_Chop;
}
@ -143,12 +147,12 @@ __interrupt void epwm2_isr(void)
PWM_motor.UB = PERIOD_2;
PWM_motor.UC = PERIOD_2;
vectorFault();
EPwmRegs[3]->CMPA.bit.CMPA = PERIOD_MOTOR - PWM_Vent;
EPwmRegs[3]->CMPB.bit.CMPB = PERIOD_MOTOR - PWM_Chop;
EPwmRegs[PWM_FAN]->CMPA.bit.CMPA = PERIOD_MOTOR - PWM_Vent;
// EPwmRegs[3]->CMPB.bit.CMPB = PERIOD_MOTOR - PWM_Chop;
Test_ADC_PWM_Synch1++;
if(TestStopSync == 2) TestStopSync = 3;
if(rele_isReleOn()) GpioTurnOnRele();
else GpioTurnOffRele();
// if(rele_isReleOn()) ReleOut(1);//GpioTurnOnRele();
// else ReleOut(0);//GpioTurnOffRele();
}
else Test_ADC_PWM_Synch2++;
//

View File

@ -78,14 +78,13 @@ void InitPerif(void)
FRMUartInit();
#ifdef REF0
temperatureInit();
#else
eqep_init();
#endif
rele_initRele();
//
// Enable global Interrupts and higher priority real-time debug events:
@ -97,5 +96,6 @@ void InitPerif(void)
faultInit();
rele_initRele();
}

View File

@ -27,7 +27,7 @@ void ReleOut(uint16_t out_bit)
}
#endif
#ifdef REF0
void GpioTurnOnRele(void)
{
GpioDataRegs.GPCDAT.bit.GPIO95 = 1;
@ -37,6 +37,8 @@ void GpioTurnOffRele(void)
{
GpioDataRegs.GPCDAT.bit.GPIO95 = 0;
}
#endif
uint16_t rele_isReleOn(void)
{
@ -55,13 +57,15 @@ void rele_initRele(void)
ReleOut(0);
}
void rele_run(int16_t UdcFiltered)
void rele_run(void)
{
if(Rele.State != Rele.StateChange) {Rele.StateChange = Rele.State; ReleOut(Rele.State);}
}
if(!Rele.State)
void rele_control(int16_t UdcFiltered)
{
if((!Rele.State) || (!Rele.StateChange))
{
vectorFault();
Rele.ReleCounter = 0;

View File

@ -14,7 +14,8 @@
uint16_t rele_isReleOn(void);
void rele_initRele(void);
void rele_run(int16_t UdcFiltered);
void rele_run(void);
void rele_control(int16_t UdcFiltered);
void ReleOut(uint16_t out_bit);
typedef struct

View File

@ -116,7 +116,7 @@ void vectorControl(int16_t CurrentA, int16_t CurrentB, int16_t CurrentC, int16_t
Step = Step + Nstep;
CurrLoop.piId.Ref = 0;
rele_run(UdcFiltered);
rele_control(UdcFiltered);
if(Mode) {XintRegs.XINT2CR.bit.ENABLE = 0; temperature_deInit();}