Update repo

This commit is contained in:
hangpersonal committed 2026-08-30 23:04:35 -07:00
1 parent 749dab5721
commit ce65a0f59a
14950 files changed
+4408250 -1

No files matched your search

@@ -0,0 +1,29 @@
<projectSpec>
<project
name="F280013x_DF22"
device="TMS320F2800137"
cgtVersion="22.6.0.LTS"
outputFormat="ELF"
launchWizard="False"
linkerCommandFile=""
>
<configuration name="CPU1_RAM" compilerBuildOptions="--opt_level=2 -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} -I${DCL_INCLUDE} -v28 -ml -mt --float_support=fpu32 --tmu_support=tmu0 --define=DEBUG --define RAM --diag_warning=225 --diag_suppress=10063" linkerBuildOptions="--entry_point code_start --stack_size=0x200 --heap_size=0x100 "/>
<pathVariable name="C2000WARE_DLIB_ROOT" path="../../../../../../../driverlib/f280013x/driverlib/" scope="project"/>
<pathVariable name="DCL_INCLUDE" path="../../../include" scope="project"/>
<pathVariable name="C2000WARE_DEVICE_SUPPORT" path="../../../../../../../device_support" scope="project"/>
<file action="copy" path="C2000WARE_DEVICE_SUPPORT/f280013x/common/include/driverlib.h" targetDirectory="device"/>
<file action="copy" path="C2000WARE_DEVICE_SUPPORT/f280013x/common/include/device.h" targetDirectory="device"/>
<file action="copy" path="C2000WARE_DEVICE_SUPPORT/f280013x/common/source/device.c" targetDirectory="device"/>
<file action="copy" path="C2000WARE_DEVICE_SUPPORT/f280013x/common/source/f280013x_codestartbranch.asm" targetDirectory="device"/>
<file action="copy" path="C2000WARE_DEVICE_SUPPORT/f280013x/common/targetConfigs/TMS320F2800137.ccxml" targetDirectory="targetConfigs"/>
<file action="link" path="C2000WARE_DLIB_ROOT/ccs/Debug/driverlib.lib" targetDirectory=""/>
<file action="copy" path="../Example_DF22.c" targetDirectory=""/>
<file action="copy" path="../../../source/DCL_error.c" targetDirectory=""/>
<file action="copy" path="../../../source/DCL_clamp_C1.asm" targetDirectory="" />
<file action="copy" path="../../../source/DCL_DF22_C1.asm" targetDirectory="" />
<file action="copy" path="../../../source/DCL_DF22_C2C3.asm" targetDirectory="" />
<file action="copy" path="../DF22_edata.dat" targetDirectory="" />
<file action="copy" path="C2000WARE_DEVICE_SUPPORT/f280013x/common/cmd/280013x_generic_ram_lnk.cmd" targetDirectory=""/>
<file action="copy" path="../../../cmd/F280013x_DCL.cmd" targetDirectory=""/>
</project>
</projectSpec>
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,168 @@
/* Example_DF22.c
*
* Copyright (C) 2020 Texas Instruments Incorporated - http://www.ti.com/
* ALL RIGHTS RESERVED
*
*/
#include "driverlib.h"
#include "device.h"
#include "DCLF32.h"
#include "DCL_fdlog.h"
#define DATA_LENGTH 1601
// input data
#pragma DATA_SECTION(e_array, "PDataLogSection")
float e_array[DATA_LENGTH];
FDLOG eBuf = FDLOG_DEFAULTS;
// full controller results
#pragma DATA_SECTION(u1_array, "QDataLogSection")
float u1_array[DATA_LENGTH];
FDLOG u1Buf = FDLOG_DEFAULTS;
// pre-computed controller results
#pragma DATA_SECTION(u2_array, "RDataLogSection")
float u2_array[DATA_LENGTH];
FDLOG u2Buf = FDLOG_DEFAULTS;
// controller difference data
#pragma DATA_SECTION(d_array, "SDataLogSection")
float d_array[DATA_LENGTH];
FDLOG dBuf = FDLOG_DEFAULTS;
// function prototypes
void initCPUTimer0(float freq, float period);
extern interrupt void control_Isr(void);
// global variables
long IdleLoopCount = 0;
long IsrCount = 0;
int complete = 0;
float ek;
float u1k;
float u2k;
float dk;
float upperLim;
float lowerLim;
uint16_t v;
DCL_DF22 controller1 = DF22_DEFAULTS;
DCL_DF22 controller2 = DF22_DEFAULTS;
/* main */
main()
{
// device initialization
Device_init();
Interrupt_initModule();
Interrupt_initVectorTable();
// initialize CPU timer0 & interrupt
Interrupt_register(INT_TIMER0, &control_Isr);
initCPUTimer0( DEVICE_SYSCLK_FREQ, 1000);
CPUTimer_enableInterrupt(CPUTIMER0_BASE);
Interrupt_enable(INT_TIMER0);
// initialise data arrays
DCL_initLog(&eBuf, e_array, DATA_LENGTH);
DCL_initLog(&u1Buf, u1_array, DATA_LENGTH);
DCL_initLog(&u2Buf, u2_array, DATA_LENGTH);
DCL_initLog(&dBuf, d_array, DATA_LENGTH);
DCL_clearLog(&u1Buf);
DCL_clearLog(&u2Buf);
DCL_fillLog(&dBuf, 1.234567f);
// initialise full controller
controller1.a1 = -1.9417f;
controller1.a2 = 0.9417f;
controller1.b0 = 9.8549f;
controller1.b1 = -19.4165f;
controller1.b2 = 9.5636f;
// initialise pre-computed controller
controller2.a1 = controller1.a1;
controller2.a2 = controller1.a2;
controller2.b0 = controller1.b0;
controller2.b1 = controller1.b1;
controller2.b2 = controller1.b2;
// clamp limits
upperLim = 1000.0f;
lowerLim = -1000.0f;
// enable global interrupts
EINT;
ERTM;
CPUTimer_startTimer(CPUTIMER0_BASE);
while(1)
{
IdleLoopCount++;
if (complete == 1)
{
DCL_BREAK_POINT;
}
}
}
// initialize CPU timer0
void initCPUTimer0(float freq, float period)
{
uint32_t temp;
temp = (uint32_t)(freq / 1000000 * period);
CPUTimer_setPeriod(CPUTIMER0_BASE, temp);
CPUTimer_setPreScaler(CPUTIMER0_BASE, 0);
CPUTimer_stopTimer(CPUTIMER0_BASE);
CPUTimer_reloadTimerCounter(CPUTIMER0_BASE);
CPUTimer_setEmulationMode(CPUTIMER0_BASE,
CPUTIMER_EMULATIONMODE_STOPAFTERNEXTDECREMENT);
CPUTimer_enableInterrupt(CPUTIMER0_BASE);
}
/* control ISR: triggered by CPU timer 0 */
interrupt void control_Isr(void)
{
// read data & run controllers
if (complete == 0)
{
// read input data
ek = DCL_readLog(&eBuf);
// run full controller
u1k = DCL_runDF22_C1(&controller1, ek);
// run pre-computed controller
u2k = DCL_runDF22_C2(&controller2, ek);
v = DCL_runClamp_C1(&u2k, upperLim, lowerLim);
if (0U == v)
{
DCL_runDF22_C3(&controller2, ek, u2k);
}
// compute difference
dk = u1k - u2k;
// store results
DCL_writeLog(&u1Buf, u1k);
DCL_writeLog(&u2Buf, u2k);
DCL_writeLog(&dBuf, dk);
// check if data log is full
if FDLOG_START(&dBuf)
{
complete = 1;
}
}
IsrCount++;
Interrupt_clearACKGroup(INTERRUPT_ACK_GROUP1);
}
/* end of file */
@@ -0,0 +1,29 @@
<projectSpec>
<project
name="F280015x_DF22"
device="TMS320F2800157"
cgtVersion="22.6.0.LTS"
outputFormat="ELF"
launchWizard="False"
linkerCommandFile=""
>
<configuration name="CPU1_RAM" compilerBuildOptions="--opt_level=2 -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} -I${DCL_INCLUDE} -v28 -ml -mt --float_support=fpu32 --tmu_support=tmu0 --define=DEBUG --define RAM --diag_warning=225 --diag_suppress=10063" linkerBuildOptions="--entry_point code_start --stack_size=0x200 --heap_size=0x100 "/>
<pathVariable name="C2000WARE_DLIB_ROOT" path="../../../../../../../driverlib/f280015x/driverlib/" scope="project"/>
<pathVariable name="DCL_INCLUDE" path="../../../include" scope="project"/>
<pathVariable name="C2000WARE_DEVICE_SUPPORT" path="../../../../../../../device_support" scope="project"/>
<file action="copy" path="C2000WARE_DEVICE_SUPPORT/f280015x/common/include/driverlib.h" targetDirectory="device"/>
<file action="copy" path="C2000WARE_DEVICE_SUPPORT/f280015x/common/include/device.h" targetDirectory="device"/>
<file action="copy" path="C2000WARE_DEVICE_SUPPORT/f280015x/common/source/device.c" targetDirectory="device"/>
<file action="copy" path="C2000WARE_DEVICE_SUPPORT/f280015x/common/source/f280015x_codestartbranch.asm" targetDirectory="device"/>
<file action="copy" path="C2000WARE_DEVICE_SUPPORT/f280015x/common/targetConfigs/TMS320F2800157.ccxml" targetDirectory="targetConfigs"/>
<file action="link" path="C2000WARE_DLIB_ROOT/ccs/Debug/driverlib.lib" targetDirectory=""/>
<file action="copy" path="../Example_DF22.c" targetDirectory=""/>
<file action="copy" path="../../../source/DCL_error.c" targetDirectory=""/>
<file action="copy" path="../../../source/DCL_clamp_C1.asm" targetDirectory="" />
<file action="copy" path="../../../source/DCL_DF22_C1.asm" targetDirectory="" />
<file action="copy" path="../../../source/DCL_DF22_C2C3.asm" targetDirectory="" />
<file action="copy" path="../DF22_edata.dat" targetDirectory="" />
<file action="copy" path="C2000WARE_DEVICE_SUPPORT/f280015x/common/cmd/280015x_generic_ram_lnk.cmd" targetDirectory=""/>
<file action="copy" path="../../../cmd/F280015x_DCL.cmd" targetDirectory=""/>
</project>
</projectSpec>
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,168 @@
/* Example_DF22.c
*
* Copyright (C) 2020 Texas Instruments Incorporated - http://www.ti.com/
* ALL RIGHTS RESERVED
*
*/
#include "driverlib.h"
#include "device.h"
#include "DCLF32.h"
#include "DCL_fdlog.h"
#define DATA_LENGTH 1601
// input data
#pragma DATA_SECTION(e_array, "PDataLogSection")
float e_array[DATA_LENGTH];
FDLOG eBuf = FDLOG_DEFAULTS;
// full controller results
#pragma DATA_SECTION(u1_array, "QDataLogSection")
float u1_array[DATA_LENGTH];
FDLOG u1Buf = FDLOG_DEFAULTS;
// pre-computed controller results
#pragma DATA_SECTION(u2_array, "RDataLogSection")
float u2_array[DATA_LENGTH];
FDLOG u2Buf = FDLOG_DEFAULTS;
// controller difference data
#pragma DATA_SECTION(d_array, "SDataLogSection")
float d_array[DATA_LENGTH];
FDLOG dBuf = FDLOG_DEFAULTS;
// function prototypes
void initCPUTimer0(float freq, float period);
extern interrupt void control_Isr(void);
// global variables
long IdleLoopCount = 0;
long IsrCount = 0;
int complete = 0;
float ek;
float u1k;
float u2k;
float dk;
float upperLim;
float lowerLim;
uint16_t v;
DCL_DF22 controller1 = DF22_DEFAULTS;
DCL_DF22 controller2 = DF22_DEFAULTS;
/* main */
main()
{
// device initialization
Device_init();
Interrupt_initModule();
Interrupt_initVectorTable();
// initialize CPU timer0 & interrupt
Interrupt_register(INT_TIMER0, &control_Isr);
initCPUTimer0( DEVICE_SYSCLK_FREQ, 1000);
CPUTimer_enableInterrupt(CPUTIMER0_BASE);
Interrupt_enable(INT_TIMER0);
// initialise data arrays
DCL_initLog(&eBuf, e_array, DATA_LENGTH);
DCL_initLog(&u1Buf, u1_array, DATA_LENGTH);
DCL_initLog(&u2Buf, u2_array, DATA_LENGTH);
DCL_initLog(&dBuf, d_array, DATA_LENGTH);
DCL_clearLog(&u1Buf);
DCL_clearLog(&u2Buf);
DCL_fillLog(&dBuf, 1.234567f);
// initialise full controller
controller1.a1 = -1.9417f;
controller1.a2 = 0.9417f;
controller1.b0 = 9.8549f;
controller1.b1 = -19.4165f;
controller1.b2 = 9.5636f;
// initialise pre-computed controller
controller2.a1 = controller1.a1;
controller2.a2 = controller1.a2;
controller2.b0 = controller1.b0;
controller2.b1 = controller1.b1;
controller2.b2 = controller1.b2;
// clamp limits
upperLim = 1000.0f;
lowerLim = -1000.0f;
// enable global interrupts
EINT;
ERTM;
CPUTimer_startTimer(CPUTIMER0_BASE);
while(1)
{
IdleLoopCount++;
if (complete == 1)
{
DCL_BREAK_POINT;
}
}
}
// initialize CPU timer0
void initCPUTimer0(float freq, float period)
{
uint32_t temp;
temp = (uint32_t)(freq / 1000000 * period);
CPUTimer_setPeriod(CPUTIMER0_BASE, temp);
CPUTimer_setPreScaler(CPUTIMER0_BASE, 0);
CPUTimer_stopTimer(CPUTIMER0_BASE);
CPUTimer_reloadTimerCounter(CPUTIMER0_BASE);
CPUTimer_setEmulationMode(CPUTIMER0_BASE,
CPUTIMER_EMULATIONMODE_STOPAFTERNEXTDECREMENT);
CPUTimer_enableInterrupt(CPUTIMER0_BASE);
}
/* control ISR: triggered by CPU timer 0 */
interrupt void control_Isr(void)
{
// read data & run controllers
if (complete == 0)
{
// read input data
ek = DCL_readLog(&eBuf);
// run full controller
u1k = DCL_runDF22_C1(&controller1, ek);
// run pre-computed controller
u2k = DCL_runDF22_C2(&controller2, ek);
v = DCL_runClamp_C1(&u2k, upperLim, lowerLim);
if (0U == v)
{
DCL_runDF22_C3(&controller2, ek, u2k);
}
// compute difference
dk = u1k - u2k;
// store results
DCL_writeLog(&u1Buf, u1k);
DCL_writeLog(&u2Buf, u2k);
DCL_writeLog(&dBuf, dk);
// check if data log is full
if FDLOG_START(&dBuf)
{
complete = 1;
}
}
IsrCount++;
Interrupt_clearACKGroup(INTERRUPT_ACK_GROUP1);
}
/* end of file */
@@ -0,0 +1,32 @@
<projectSpec>
<project
name="F280049_ERAD"
device="TMS320F280049"
configurations="DEBUG"
launchWizard="False"
linkerCommandFile=""
compilerBuildOptions="--opt_level=off -I${C2000WARE_F28004X_ROOT1} -I${C2000WARE_F28004X_ROOT2} -I${C2000WARE_DCL_INCLUDE_ROOT} -I${C2000WARE_F28004X_ERAD_INCLUDE} -v28 -ml -mt --float_support=fpu32 --define=DEBUG --diag_warning=225 --diag_suppress=10063 --display_error_number"
linkerBuildOptions="--stack_size=0x400 --heap_size=0x200 --define RAM"
>
<pathVariable name="C2000WARE_F28004X_ROOT1" path="../../../../../../../device_support/f28004x/headers/include" scope="project" />
<pathVariable name="C2000WARE_F28004X_ROOT2" path="../../../../../../../device_support/f28004x/common/include" scope="project" />
<pathVariable name="C2000WARE_F28004X_ERAD_INCLUDE" path="../" scope="project" />
<pathVariable name="C2000WARE_DCL_INCLUDE_ROOT" path="../../../include" scope="project" />
<file action="copy" path="../../../../../../../device_support/f28004x/common/source/f28004x_codestartbranch.asm" targetDirectory="" />
<file action="copy" path="../../../../../../../device_support/f28004x/common/source/f28004x_cputimers.c" targetDirectory="" />
<file action="copy" path="../../../../../../../device_support/f28004x/common/source/f28004x_defaultisr.c" targetDirectory="" />
<file action="copy" path="../../../../../../../device_support/f28004x/headers/source/f28004x_globalvariabledefs.c" targetDirectory="" />
<file action="copy" path="../../../../../../../device_support/f28004x/common/source/f28004x_gpio.c" targetDirectory="" />
<file action="copy" path="../../../../../../../device_support/f28004x/common/source/f28004x_piectrl.c" targetDirectory="" />
<file action="copy" path="../../../../../../../device_support/f28004x/common/source/f28004x_pievect.c" targetDirectory="" />
<file action="copy" path="../../../../../../../device_support/f28004x/common/source/f28004x_sysctrl.c" targetDirectory="" />
<file action="copy" path="../../../../../../../device_support/f28004x/common/source/f28004x_usdelay.asm" targetDirectory="" />
<file action="copy" path="../../../../../../../device_support/f28004x/headers/cmd/f28004x_headers_nonbios.cmd" targetDirectory="" />
<file action="copy" path="../../../cmd/F280049_stdmem.cmd" targetDirectory="" />
<file action="copy" path="../../../cmd/F280049_ERAD.cmd" targetDirectory="" />
<file action="copy" path="../f28004x_usdelay_erad.asm" targetDirectory="" />
<file action="copy" path="../Example_F280049_erad.c" targetDirectory="" />
<file action="copy" path="../f28004x_dcl_erad.c" targetDirectory="" />
<file action="copy" path="../../../source/DCL_error.c" targetDirectory="" />
</project>
</projectSpec>
@@ -0,0 +1,317 @@
// main.c
#include "F28x_Project.h"
#include "DCLF32.h"
#include "f28004x_erad.h"
#include "f28004x_dcl_erad.h"
// controllers
DCL_PID F1 = PID_DEFAULTS;
DCL_PI F2 = PI_DEFAULTS;
DCL_PI F3 = PI_DEFAULTS;
DCL_GSM F4 = GSM_DEFAULTS;
DCL_DF11 F5 = DF11_DEFAULTS;
DCL_DF22 F6 = DF22_DEFAULTS;
DCL_DF23 F7 = DF23_DEFAULTS;
DCL_DF23_SPS F7sps = DF23_SPS_DEFAULTS;
DCL_CSS F7css = DCL_CSS_DEFAULTS;
// program constants
#define DECIM_F1 10
#define DECIM_F6 3
#define DECIM_F7 9
#define PAYLOAD_F7 2000
// variables
uint16_t i = 0;
uint32_t IdleLoopCount = 0UL;
uint16_t IsraCount = 0;
uint16_t IsrbCount = 0;
uint16_t IsrcCount = 0;
int16_t DecimF1 = DECIM_F1;
int16_t DecimF6 = DECIM_F6;
volatile float32_t r1, y1, u1;
volatile float32_t y2, u2;
volatile float32_t r3, y3, u3;
volatile float32_t r4, y4, u4;
volatile float32_t u5;
volatile float32_t r6, u6;
volatile float32_t r7, y7, u7;
float32_t x = 0.0f;
// ISR declarations
interrupt void ISRa(void);
interrupt void ISRb(void);
interrupt void ISRc(void);
void func_label(void);
void F28x_usDelayErad(long LoopCount);
void EradConfig(void);
uint32_t MaxWindowCycles = 0;
uint32_t MaxISRCycles = 0;
void main(void)
{
InitSysCtrl();
InitGpio();
// interrupt configuration
DINT;
InitPieCtrl();
IER = 0x0000;
IFR = 0x0000;
InitPieVectTable();
EALLOW;
PieVectTable.TIMER0_INT = &ISRa;
PieVectTable.TIMER1_INT = &ISRb;
PieVectTable.TIMER2_INT = &ISRc;
// configure CPU timers
InitCpuTimers();
ConfigCpuTimer(&CpuTimer0, 100.0f, 100.0f);
ConfigCpuTimer(&CpuTimer1, 100.0f, 3.952f);
ConfigCpuTimer(&CpuTimer2, 100.0f, 16.67f);
// controller initialization
// PID controller (F1)
F1.Kp = 9.0623f;
F1.Ki = 0.012f;
F1.Kd = 3.5f;
F1.c1 = 0.99f;
F1.c2 = 0.1221f;
F1.Umax = 15.4665f;
F1.Umin = -16.22f;
r1 = 0.754f;
y1 = 0.0f;
u1 = 0.0f;
// PI controller (F2)
F2.Kp = 0.1234f;
F2.Ki = 0.02389f;
F2.Umax = 15.4665f;
F2.Umin = -16.22f;
F2.Imax = 1.465f;
F2.Imin = -1.2f;
y2 = 0.0f;
// PI controller (F3)
F3.Kp = 0.1234f;
F3.Ki = 0.02389f;
F3.Umax = 15.4665f;
F3.Umin = -16.22f;
F3.Imax = 1.465f;
F3.Imin = -1.2f;
r3 = -0.125f;
y3 = 0.0f;
// GSM (F4)
for (i=1; i<=GSM_N; i++)
{
x += F4.h;
F4.sps->c[i] = x*x;
}
DCL_loadGSMgains(&F4);
DCL_REQUEST_UPDATE(&F4);
DCL_updateGSM(&F4);
r4 = 0.0899f;
y4 = -0.106f;
// DF11 (F5)
F5.b0 = 5.106;
F5.b1 = -5.094;
F5.a1 = -1;
// DF22 (F6)
F6.b0 = 9.8549f;
F6.b1 = -19.4165f;
F6.b2 = 9.5636f;
F6.a1 = -1.9417f;
F6.a2 = 0.9417f;
r6 = 0.95f;
// DF23 (F7)
F7.sps = &F7sps;
F7.css = &F7css;
F7.sps->b0 = 9.658f;
F7.sps->b1 = -9.158f;
F7.sps->b2 = -9.6521f;
F7.sps->b3 = 9.1639f;
F7.sps->a1 = -2.128f;
F7.sps->a2 = 1.3968f;
F7.sps->a3 = -0.2689f;
DCL_REQUEST_UPDATE(&F7);
DCL_updateDF23(&F7);
r7 = 0.5f;
y7 = 0.0f;
// enable interrupts
PieCtrlRegs.PIEIER1.bit.INTx7 = 1;
IER |= M_INT1;
IER |= M_INT13;
IER |= M_INT14;
ERTM;
EINT;
// Configure ERAD for profiling
EradConfig();
// start CPU timers
StartCpuTimer1();
StartCpuTimer2();
StartCpuTimer0();
while(1)
{
DCL_REQUEST_UPDATE(&F7);
DCL_updateDF23(&F7);
asm(" NOP");
IdleLoopCount++;
if(IdleLoopCount == 1000)
{
CpuTimer0Regs.TCR.bit.TSS = 1;
CpuTimer1Regs.TCR.bit.TSS = 1;
CpuTimer2Regs.TCR.bit.TSS = 1;
ERAD_setGlobalCTMDisable(CTM1_INST | CTM2_INST);
ERAD_globalHWBPDisable(HWBP1_INST | HWBP2_INST | HWBP3_INST);
MaxWindowCycles = ERAD_counterGetMaxCount(CTM2_INST);
MaxISRCycles = ERAD_counterGetMaxCount(CTM1_INST);
while(1);
}
}
}
/* control loop (a) - CPU timer 0 @ 10 kHz */
#pragma CODE_SECTION(ISRa, "interruptSection")
interrupt void ISRa(void)
{
CpuTimer0Regs.TCR.bit.TIF = 1;
PieCtrlRegs.PIEACK.all = PIEACK_GROUP1;
EINT;
if (0 > --DecimF1)
{
u1 = DCL_runPID_C2(&F1, r1, y1, 1.0f);
DecimF1 = DECIM_F1;
}
u2 = DCL_runPI_C2(&F2, u1, y2);
u3 = DCL_runPI_C2(&F3, r3, y3);
IsraCount++;
DINT;
}
/* control loop (b) - CPU timer 1 @ 253 kHz */
#pragma CODE_SECTION(ISRb, "interruptSection")
interrupt void ISRb(void)
{
CpuTimer1Regs.TCR.bit.TIF = 1;
u4 = DCL_runGSM_C1(&F4, r4 - y4);
u5 = DCL_runDF11_C2(&F5, u4);
if (0 > --DecimF6)
{
u6 = DCL_runDF22_C4(&F6, r6);
DecimF6 = DECIM_F6;
}
IsrbCount++;
}
/* control loop (c) - CPU timer 2 @ 60 kHz */
#pragma CODE_SECTION(ISRc, "interruptSection")
interrupt void ISRc(void)
{
CpuTimer2Regs.TCR.bit.TIF = 1;
u7 = DCL_runDF23_C4(&F7, r7 - y7);
IsrcCount++;
if (0 == (IsrcCount + IsrbCount) % DECIM_F7)
{
F28x_usDelayErad(PAYLOAD_F7);
}
}
/* ERAD configuration */
void EradConfig()
{
hwbpConfig hwbpConfig1,hwbpConfig2,hwbpConfig3;
counterConfig counterConfig1,counterConfig2;
// Disable all comparator and counter units
ERAD_setGlobalCTMDisable(CTM1_INST | CTM2_INST);
ERAD_globalHWBPDisable(HWBP1_INST | HWBP2_INST | HWBP3_INST);
// Setup BC-1 for VPC Match when code is executing interrupts
// Configure BC-1 for tracing any match for the following "0x9800 - 0x9FFF" i.e. LS3
hwbpConfig1.BUS_SEL = VPC;
hwbpConfig1.COMP_MODE = EQ;
hwbpConfig1.DBGEVT = DISABLED;
hwbpConfig1.MASK = 0x000007FF;
hwbpConfig1.REF = 0x00009800;
hwbpConfig1.RTOSINT = DISABLED;
ERAD_HWBPConfig(HWBP1_INST,hwbpConfig1);
// Setup BC-2 for VPC Match when ISR + 2 instruction start
hwbpConfig2.BUS_SEL = VPC;
hwbpConfig2.COMP_MODE = EQ;
hwbpConfig2.DBGEVT = DISABLED;
hwbpConfig2.MASK = 0x00000000;
hwbpConfig2.REF = ((uint32_t)&(ISRa)) + 0x1;
hwbpConfig2.RTOSINT = DISABLED;
ERAD_HWBPConfig(HWBP2_INST,hwbpConfig2);
// Setup BC-3 for VPC Match when ISRa starts
hwbpConfig3.BUS_SEL = VPC;
hwbpConfig3.COMP_MODE = EQ;
hwbpConfig3.DBGEVT = DISABLED;
hwbpConfig3.MASK = 0x00000000;
hwbpConfig3.REF = (uint32_t)&(ISRa);
hwbpConfig3.RTOSINT = DISABLED;
ERAD_HWBPConfig(HWBP3_INST,hwbpConfig3);
// Setup CNT-1 in START STOP mode with START = BC-2, STOP=BC-3, COUNTER ENABLE = BC-1
counterConfig1.RTOSINT = DISABLED;
counterConfig1.DBGEVT = DISABLED;
counterConfig1.EDGE_LEVEL_CFG = LEVEL;
counterConfig1.START_STOP_MODE = ENABLED;
counterConfig1.START_INP_SEL = BUS_COMP2_EVENT;
counterConfig1.STOP_INP_SEL = BUS_COMP3_EVENT;
counterConfig1.CNT_INP_SEL_EN = ENABLED;
counterConfig1.CNT_INP_SEL = BUS_COMP1_EVENT;
counterConfig1.HW_CNT_RST = DISABLED;
counterConfig1.RST_INP_SEL = BUS_COMP1_EVENT; // This is don't care since HW_CNT_RST is Disabled
counterConfig1.RST_ON_MATCH = DISABLED;
ERAD_counterConfig(CTM1_INST,counterConfig1);
// Setup CNT-2 in START STOP mode with START = BC-2, STOP=BC-3, COUNTER ENABLE = Always / CPU_CYCLES
counterConfig2.RTOSINT = DISABLED;
counterConfig2.DBGEVT = DISABLED;
counterConfig2.EDGE_LEVEL_CFG = LEVEL;
counterConfig2.START_STOP_MODE = ENABLED;
counterConfig2.START_INP_SEL = BUS_COMP2_EVENT;
counterConfig2.STOP_INP_SEL = BUS_COMP3_EVENT;
counterConfig2.CNT_INP_SEL_EN = DISABLED;
counterConfig2.CNT_INP_SEL = BUS_COMP1_EVENT; //T his is don't care since CNT_INP_SEL_EN is Disabled
counterConfig2.HW_CNT_RST = DISABLED;
counterConfig2.RST_INP_SEL = BUS_COMP1_EVENT; // This is don't care since HW_CNT_RST is Disabled
counterConfig2.RST_ON_MATCH = DISABLED;
ERAD_counterConfig(CTM2_INST,counterConfig2);
// Enable all comparator and counter units
ERAD_setGlobalCTMEnable(CTM1_INST | CTM2_INST);
ERAD_globalHWBPEnable(HWBP1_INST | HWBP2_INST | HWBP3_INST);
}
/* end of file */
@@ -0,0 +1,665 @@
//###########################################################################
//
// FILE: f28004x_dcl_erad.c
//
// TITLE: ERAD driver functions for DCL suite.
//
//###########################################################################
// $TI Release: $
// $Release Date: $
// $Copyright:
// Copyright (C) 2018 Texas Instruments Incorporated - http://www.ti.com/
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
//
// Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
//
// Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the
// distribution.
//
// Neither the name of Texas Instruments Incorporated nor the names of
// its contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// $
//###########################################################################
//***********************************************************************************
//
// Included Files
//
//***********************************************************************************
#include "f28004x_dcl_erad.h"
#include "f28004x_erad.h"
//***********************************************************************************
//
//ERAD_setGlobalCTMEnable - This function is used to enable the Counters.
// Inputs can be CTM1_INST,CTM2_INST etc.
// Returns false if the unit is not owned by Application.
//
//***********************************************************************************
bool ERAD_setGlobalCTMEnable(Uint16 counterInstances)
{
//Check if Application owns the ERAD, else return false
if(EradGlobalRegs.GLBL_OWNER.bit.OWNER == DEBUGGER)
{
return false;
}else
{
Uint16 shiftedCounterInstance,temp;
shiftedCounterInstance = counterInstances << 8;
EALLOW;
temp = (EradGlobalRegs.GLBL_ENABLE.all) | shiftedCounterInstance;
EradGlobalRegs.GLBL_ENABLE.all = temp;
EDIS;
return true;
}
}
//***********************************************************************************
//
//ERAD_setGlobalCTMDisable -This function is used to disable the Counters.
// Inputs can be CTM1_INST,CTM2_INST etc.
// Returns false if the unit is not owned by Application.
//
//***********************************************************************************
bool ERAD_setGlobalCTMDisable(Uint16 counterInstances)
{
//Check if Application owns the ERAD, else return false
if(EradGlobalRegs.GLBL_OWNER.bit.OWNER == DEBUGGER)
{
return false;
}else
{
Uint16 shiftedCounterInstance,temp;
shiftedCounterInstance = counterInstances << 8;
EALLOW;
temp = (EradGlobalRegs.GLBL_ENABLE.all) & (~shiftedCounterInstance);
EradGlobalRegs.GLBL_ENABLE.all = temp;
EDIS;
return true;
}
}
//***********************************************************************************
//
//ERAD_setGlobalCTMReset - This function is used to reset the Counters.
// Inputs can be CTM1_INST,CTM2_INST etc.
//***********************************************************************************
void ERAD_setGlobalCTMReset(Uint16 counterInstances)
{
EALLOW;
EradGlobalRegs.GLBL_CTM_RESET.all = counterInstances;
EDIS;
}
//***********************************************************************************
//
//ERAD_getCTMEventStat - This function is used to read the Counter event stats.
// Outputs can be checked against CTM1_INST,CTM2_INST etc.
//
//***********************************************************************************
Uint16 ERAD_getCTMEventStat()
{
Uint16 shiftedCounterInstance;
shiftedCounterInstance = ((EradGlobalRegs.GLBL_EVENT_STAT.all) & 0xF00)>>8;
return(shiftedCounterInstance);
}
//***********************************************************************************
//
//ERAD_getCTMHaltStat - This function is used to read the Counter halt stats.
// Outputs can be checked against CTM1_INST,CTM2_INST etc.
//
//***********************************************************************************
Uint16 ERAD_getCTMHaltStat()
{
Uint16 shiftedCounterInstance;
shiftedCounterInstance = ((EradGlobalRegs.GLBL_HALT_STAT.all) & 0xF00)>>8;
return(shiftedCounterInstance);
}
//***********************************************************************************
//
//ERAD_globalHWBPEnable - This function is used to enable the Enhanced Bus Comparator
// units.
// Inputs can be HWBP1_INST,HWBP2_INST etc.
// Returns false if the unit is not owned by Application.
//
//***********************************************************************************
bool ERAD_globalHWBPEnable(Uint16 hwbpInstances)
{
//Check if Application owns the ERAD, else return false
if(EradGlobalRegs.GLBL_OWNER.bit.OWNER == DEBUGGER)
{
return false;
}else
{
Uint16 temp;
EALLOW;
temp = (EradGlobalRegs.GLBL_ENABLE.all) | hwbpInstances;
EradGlobalRegs.GLBL_ENABLE.all = temp;
EDIS;
return true;
}
}
//***********************************************************************************
//
//ERAD_globalHWBPDisable - This function is used to disable the Enhanced Bus comparator
// units.
// Inputs can be HWBP1_INST,HWBP2_INST etc.
// Returns false if the unit is not owned by Application.
//
//***********************************************************************************
bool ERAD_globalHWBPDisable(Uint16 hwbpInstances)
{
//Check if Application owns the ERAD, else return false
if(EradGlobalRegs.GLBL_OWNER.bit.OWNER == DEBUGGER)
{
return false;
}else
{
Uint16 temp;
EALLOW;
temp = (EradGlobalRegs.GLBL_ENABLE.all) & (~hwbpInstances);
EradGlobalRegs.GLBL_ENABLE.all = temp;
EDIS;
return true;
}
}
//***********************************************************************************
//
//ERAD_getHWBPEventStat - This function is used to get the Enhanced Bus comparator
// event stats
// Outputs can be checked against HWBP1_INST,HWBP2_INST etc.
//
//***********************************************************************************
Uint16 ERAD_getHWBPEventStat()
{
Uint16 shiftedCounterInstance;
shiftedCounterInstance = ((EradGlobalRegs.GLBL_EVENT_STAT.all) & 0x00FF);
return(shiftedCounterInstance);
}
//***********************************************************************************
//
//ERAD_getHWBPHaltStat - This function is used to get the Enhanced Bus comparator
// halt stats
// Outputs can be checked against HWBP1_INST,HWBP2_INST etc.
//
//***********************************************************************************
Uint16 ERAD_getHWBPHaltStat()
{
Uint16 shiftedCounterInstance;
shiftedCounterInstance = ((EradGlobalRegs.GLBL_HALT_STAT.all) & 0x00FF);
return(shiftedCounterInstance);
}
//***********************************************************************************
//
//ERAD_counterSetRef - This function is used to set the reference match count for the
// counter.
// Inputs can be CTM1_INST,CTM2_INST etc and the
// counter reference count.
//
//***********************************************************************************
void ERAD_counterSetRef(Uint16 counterInstance,Uint32 referenceCount)
{
EALLOW;
if(counterInstance == CTM1_INST)
{
EradCounter1Regs.CTM_REF = referenceCount;
}else if(counterInstance == CTM2_INST)
{
EradCounter2Regs.CTM_REF = referenceCount;
}else if(counterInstance == CTM3_INST)
{
EradCounter3Regs.CTM_REF = referenceCount;
}else if(counterInstance == CTM4_INST)
{
EradCounter4Regs.CTM_REF = referenceCount;
}
EDIS;
}
//***********************************************************************************
//
//ERAD_counterSetCurCount - This function is used to set the current count for the
// counter to a predetermined value.
// Inputs can be CTM1_INST,CTM2_INST etc and the current
// counter count.
//
//***********************************************************************************
void ERAD_counterSetCurCount(Uint16 counterInstance,Uint32 currentCount)
{
EALLOW;
if(counterInstance == CTM1_INST)
{
EradCounter1Regs.CTM_COUNT = currentCount;
}else if(counterInstance == CTM2_INST)
{
EradCounter2Regs.CTM_COUNT = currentCount;
}else if(counterInstance == CTM3_INST)
{
EradCounter3Regs.CTM_COUNT = currentCount;
}else if(counterInstance == CTM4_INST)
{
EradCounter4Regs.CTM_COUNT = currentCount;
}
EDIS;
}
//***********************************************************************************
//
//ERAD_counterSetMaxCount - This function is used to set the max count for the
// counter to a predetermined value.
// Inputs can be CTM1_INST,CTM2_INST etc and the counter
// max count.
//
//***********************************************************************************
void ERAD_counterSetMaxCount(Uint16 counterInstance,Uint32 maxCount)
{
EALLOW;
if(counterInstance == CTM1_INST)
{
EradCounter1Regs.CTM_MAX_COUNT = maxCount;
}else if(counterInstance == CTM2_INST)
{
EradCounter2Regs.CTM_MAX_COUNT = maxCount;
}else if(counterInstance == CTM3_INST)
{
EradCounter3Regs.CTM_MAX_COUNT = maxCount;
}else if(counterInstance == CTM4_INST)
{
EradCounter4Regs.CTM_MAX_COUNT = maxCount;
}
EDIS;
}
//***********************************************************************************
//
//ERAD_counterGetCurCount - This function is used to get the current count for
// the counter.
// Inputs can be CTM1_INST,CTM2_INST etc.
// Returns the current count value.
//
//***********************************************************************************
Uint32 ERAD_counterGetCurCount(Uint16 counterInstance)
{
Uint32 currentCount;
if(counterInstance == CTM1_INST)
{
currentCount = EradCounter1Regs.CTM_COUNT;
}else if(counterInstance == CTM2_INST)
{
currentCount = EradCounter2Regs.CTM_COUNT ;
}else if(counterInstance == CTM3_INST)
{
currentCount = EradCounter3Regs.CTM_COUNT ;
}else if(counterInstance == CTM4_INST)
{
currentCount = EradCounter4Regs.CTM_COUNT ;
}
return(currentCount);
}
//***********************************************************************************
//
//ERAD_counterGetMaxCount - This function is used to get the max count for the
// counter.
// Inputs can be CTM1_INST,CTM2_INST etc.
// Returns the count max value.
//
//***********************************************************************************
Uint32 ERAD_counterGetMaxCount(Uint16 counterInstance)
{
Uint32 maxCount;
if(counterInstance == CTM1_INST)
{
maxCount = EradCounter1Regs.CTM_MAX_COUNT;
}else if(counterInstance == CTM2_INST)
{
maxCount = EradCounter2Regs.CTM_MAX_COUNT ;
}else if(counterInstance == CTM3_INST)
{
maxCount = EradCounter3Regs.CTM_MAX_COUNT ;
}else if(counterInstance == CTM4_INST)
{
maxCount = EradCounter4Regs.CTM_MAX_COUNT ;
}
return(maxCount);
}
//***********************************************************************************
//
//ERAD_counterGetStatus - This function is used to get the current status for the
// counter.
// Inputs can be CTM1_INST,CTM2_INST etc.
// Returns CTM_EVENT_FIRED or CTM_EVENT_OVERFLOW or both.
//
//***********************************************************************************
Uint16 ERAD_counterGetStatus(Uint16 counterInstance)
{
if(counterInstance == CTM1_INST)
{
return( ( (EradCounter1Regs.CTM_STATUS.bit.OVERFLOW << 1) | EradCounter1Regs.CTM_STATUS.bit.EVENT_FIRED) );
}else if(counterInstance == CTM2_INST)
{
return( ( (EradCounter2Regs.CTM_STATUS.bit.OVERFLOW << 1) | EradCounter2Regs.CTM_STATUS.bit.EVENT_FIRED) );
}else if(counterInstance == CTM3_INST)
{
return( ( (EradCounter3Regs.CTM_STATUS.bit.OVERFLOW << 1) | EradCounter3Regs.CTM_STATUS.bit.EVENT_FIRED) );
}else if(counterInstance == CTM4_INST)
{
return( ( (EradCounter4Regs.CTM_STATUS.bit.OVERFLOW << 1) | EradCounter4Regs.CTM_STATUS.bit.EVENT_FIRED) );
}else
{
return(0);
}
}
//***********************************************************************************
//
//ERAD_counterClearStatus - This function is used to clear the current status for the
// counter.
// Inputs can be CTM1_INST,CTM2_INST etc and the event
// to clear(CTM_EVENT_FIRED or CTM_EVENT_OVERFLOW or both).
//
//***********************************************************************************
void ERAD_counterClearStatus(Uint16 counterInstance,Uint16 clearFlags)
{
EALLOW;
if(counterInstance == CTM1_INST)
{
if(clearFlags && CTM_EVENT_FIRED == 0x1)
{
EradCounter1Regs.CTM_CLEAR.bit.EVENT_CLEAR = 1;
}
if(clearFlags && CTM_EVENT_FIRED == 0x2)
{
EradCounter1Regs.CTM_CLEAR.bit.OVERFLOW_CLEAR = 1;
}
}else if(counterInstance == CTM2_INST)
{
if(clearFlags && CTM_EVENT_FIRED == 0x1)
{
EradCounter2Regs.CTM_CLEAR.bit.EVENT_CLEAR = 1;
}
if(clearFlags && CTM_EVENT_FIRED == 0x2)
{
EradCounter2Regs.CTM_CLEAR.bit.OVERFLOW_CLEAR = 1;
}
}else if(counterInstance == CTM3_INST)
{
if(clearFlags && CTM_EVENT_FIRED == 0x1)
{
EradCounter3Regs.CTM_CLEAR.bit.EVENT_CLEAR = 1;
}
if(clearFlags && CTM_EVENT_FIRED == 0x2)
{
EradCounter3Regs.CTM_CLEAR.bit.OVERFLOW_CLEAR = 1;
}
}else if(counterInstance == CTM4_INST)
{
if(clearFlags && CTM_EVENT_FIRED == 0x1)
{
EradCounter4Regs.CTM_CLEAR.bit.EVENT_CLEAR = 1;
}
if(clearFlags && CTM_EVENT_FIRED == 0x2)
{
EradCounter4Regs.CTM_CLEAR.bit.OVERFLOW_CLEAR = 1;
}
}
EDIS;
}
//***********************************************************************************
//
//ERAD_counterConfig - This function is used to configure the counter.
// Inputs can be CTM1_INST,CTM2_INST etc and
// configurations can be passed via a structure of type counterConfig.
//
//***********************************************************************************
void ERAD_counterConfig(Uint16 counterInstance,counterConfig counterCfg)
{
EALLOW;
if(counterInstance == CTM1_INST)
{
EradCounter1Regs.CTM_CNTL.bit.START_STOP_MODE = counterCfg.START_STOP_MODE;
EradCounter1Regs.CTM_CNTL.bit.EVENT_MODE = counterCfg.EDGE_LEVEL_CFG;
EradCounter1Regs.CTM_CNTL.bit.RST_ON_MATCH = counterCfg.RST_ON_MATCH;
EradCounter1Regs.CTM_CNTL.bit.STOP = counterCfg.DBGEVT;
EradCounter1Regs.CTM_CNTL.bit.RTOSINT = counterCfg.RTOSINT;
EradCounter1Regs.CTM_CNTL.bit.RST_EN = counterCfg.HW_CNT_RST;
EradCounter1Regs.CTM_CNTL.bit.RST_INP_SEL = counterCfg.RST_INP_SEL;
EradCounter1Regs.CTM_INPUT_SEL.bit.CNT_INP_SEL = counterCfg.CNT_INP_SEL;
EradCounter1Regs.CTM_INPUT_SEL.bit.STA_INP_SEL = counterCfg.START_INP_SEL;
EradCounter1Regs.CTM_INPUT_SEL.bit.STO_INP_SEL = counterCfg.STOP_INP_SEL;
EradCounter1Regs.CTM_INPUT_SEL.bit.CTM_INP_SEL_EN = counterCfg.CNT_INP_SEL_EN;
}else if(counterInstance == CTM2_INST)
{
EradCounter2Regs.CTM_CNTL.bit.START_STOP_MODE = counterCfg.START_STOP_MODE;
EradCounter2Regs.CTM_CNTL.bit.EVENT_MODE = counterCfg.EDGE_LEVEL_CFG;
EradCounter2Regs.CTM_CNTL.bit.RST_ON_MATCH = counterCfg.RST_ON_MATCH;
EradCounter2Regs.CTM_CNTL.bit.STOP = counterCfg.DBGEVT;
EradCounter2Regs.CTM_CNTL.bit.RTOSINT = counterCfg.RTOSINT;
EradCounter2Regs.CTM_CNTL.bit.RST_EN = counterCfg.HW_CNT_RST;
EradCounter2Regs.CTM_CNTL.bit.RST_INP_SEL = counterCfg.RST_INP_SEL;
EradCounter2Regs.CTM_INPUT_SEL.bit.CNT_INP_SEL = counterCfg.CNT_INP_SEL;
EradCounter2Regs.CTM_INPUT_SEL.bit.STA_INP_SEL = counterCfg.START_INP_SEL;
EradCounter2Regs.CTM_INPUT_SEL.bit.STO_INP_SEL = counterCfg.STOP_INP_SEL;
EradCounter2Regs.CTM_INPUT_SEL.bit.CTM_INP_SEL_EN = counterCfg.CNT_INP_SEL_EN;
}else if(counterInstance == CTM3_INST)
{
EradCounter3Regs.CTM_CNTL.bit.START_STOP_MODE = counterCfg.START_STOP_MODE;
EradCounter3Regs.CTM_CNTL.bit.EVENT_MODE = counterCfg.EDGE_LEVEL_CFG;
EradCounter3Regs.CTM_CNTL.bit.RST_ON_MATCH = counterCfg.RST_ON_MATCH;
EradCounter3Regs.CTM_CNTL.bit.STOP = counterCfg.DBGEVT;
EradCounter3Regs.CTM_CNTL.bit.RTOSINT = counterCfg.RTOSINT;
EradCounter3Regs.CTM_CNTL.bit.RST_EN = counterCfg.HW_CNT_RST;
EradCounter3Regs.CTM_CNTL.bit.RST_INP_SEL = counterCfg.RST_INP_SEL;
EradCounter3Regs.CTM_INPUT_SEL.bit.CNT_INP_SEL = counterCfg.CNT_INP_SEL;
EradCounter3Regs.CTM_INPUT_SEL.bit.STA_INP_SEL = counterCfg.START_INP_SEL;
EradCounter3Regs.CTM_INPUT_SEL.bit.STO_INP_SEL = counterCfg.STOP_INP_SEL;
EradCounter3Regs.CTM_INPUT_SEL.bit.CTM_INP_SEL_EN = counterCfg.CNT_INP_SEL_EN;
}else if(counterInstance == CTM4_INST)
{
EradCounter4Regs.CTM_CNTL.bit.START_STOP_MODE = counterCfg.START_STOP_MODE;
EradCounter4Regs.CTM_CNTL.bit.EVENT_MODE = counterCfg.EDGE_LEVEL_CFG;
EradCounter4Regs.CTM_CNTL.bit.RST_ON_MATCH = counterCfg.RST_ON_MATCH;
EradCounter4Regs.CTM_CNTL.bit.STOP = counterCfg.DBGEVT;
EradCounter4Regs.CTM_CNTL.bit.RTOSINT = counterCfg.RTOSINT;
EradCounter4Regs.CTM_CNTL.bit.RST_EN = counterCfg.HW_CNT_RST;
EradCounter4Regs.CTM_CNTL.bit.RST_INP_SEL = counterCfg.RST_INP_SEL;
EradCounter4Regs.CTM_INPUT_SEL.bit.CNT_INP_SEL = counterCfg.CNT_INP_SEL;
EradCounter4Regs.CTM_INPUT_SEL.bit.STA_INP_SEL = counterCfg.START_INP_SEL;
EradCounter4Regs.CTM_INPUT_SEL.bit.STO_INP_SEL = counterCfg.STOP_INP_SEL;
EradCounter4Regs.CTM_INPUT_SEL.bit.CTM_INP_SEL_EN = counterCfg.CNT_INP_SEL_EN;
}
EDIS;
}
//***********************************************************************************
//
//ERAD_HWBPGetStatus - This function is used to get the current status for the
// Enhanced Bus comparator unit.
// Inputs can be HWBP1_INST, HWBP2_INST etc.
// Returns HWBP_EVENT_FIRED, if fired.
//
//***********************************************************************************
Uint16 ERAD_HWBPGetStatus(Uint16 hwbpInstance)
{
if(hwbpInstance == HWBP1_INST)
{
return (EradHWBP1Regs.HWBP_STATUS.bit.EVENT_FIRED);
}else if(hwbpInstance == HWBP2_INST)
{
return (EradHWBP2Regs.HWBP_STATUS.bit.EVENT_FIRED);
}else if(hwbpInstance == HWBP3_INST)
{
return (EradHWBP3Regs.HWBP_STATUS.bit.EVENT_FIRED);
}else if(hwbpInstance == HWBP4_INST)
{
return (EradHWBP4Regs.HWBP_STATUS.bit.EVENT_FIRED);
}else if(hwbpInstance == HWBP5_INST)
{
return (EradHWBP5Regs.HWBP_STATUS.bit.EVENT_FIRED);
}else if(hwbpInstance == HWBP6_INST)
{
return (EradHWBP6Regs.HWBP_STATUS.bit.EVENT_FIRED);
}else if(hwbpInstance == HWBP7_INST)
{
return (EradHWBP7Regs.HWBP_STATUS.bit.EVENT_FIRED);
}else if(hwbpInstance == HWBP8_INST)
{
return (EradHWBP8Regs.HWBP_STATUS.bit.EVENT_FIRED);
}else
{
return (0);
}
}
//***********************************************************************************
//
//ERAD_HWBPClearStatus - This function is used to clear the current status for the
// Enhanced Bus comparator unit.
// Inputs can be HWBP1_INST, HWBP2_INST etc and the event to
// clear(HWBP_EVENT_FIRED).
//
//***********************************************************************************
void ERAD_HWBPClearStatus(Uint16 hwbpInstance,Uint16 clearFlags)
{
EALLOW;
if(clearFlags == HWBP_EVENT_FIRED)
{
if(hwbpInstance == HWBP1_INST)
{
EradHWBP1Regs.HWBP_CLEAR.bit.EVENT_CLR = 1;
}else if(hwbpInstance == HWBP2_INST)
{
EradHWBP2Regs.HWBP_CLEAR.bit.EVENT_CLR = 1;
}else if(hwbpInstance == HWBP3_INST)
{
EradHWBP3Regs.HWBP_CLEAR.bit.EVENT_CLR = 1;
}else if(hwbpInstance == HWBP4_INST)
{
EradHWBP4Regs.HWBP_CLEAR.bit.EVENT_CLR = 1;
}else if(hwbpInstance == HWBP5_INST)
{
EradHWBP5Regs.HWBP_CLEAR.bit.EVENT_CLR = 1;
}else if(hwbpInstance == HWBP6_INST)
{
EradHWBP6Regs.HWBP_CLEAR.bit.EVENT_CLR = 1;
}else if(hwbpInstance == HWBP7_INST)
{
EradHWBP7Regs.HWBP_CLEAR.bit.EVENT_CLR = 1;
}else if(hwbpInstance == HWBP8_INST)
{
EradHWBP8Regs.HWBP_CLEAR.bit.EVENT_CLR = 1;
}
}
EDIS;
}
//***********************************************************************************
//
//ERAD_HWBPConfig - This function is used to configure the Enhanced Bus comparator unit.
// Inputs can be HWBP1_INST, HWBP2_INST etc and the
// configurations can be passed via a structure of type hwbpConfig.
//
//***********************************************************************************
void ERAD_HWBPConfig(Uint16 hwbpInstance,hwbpConfig hwbpCfg)
{
EALLOW;
if(hwbpInstance == HWBP1_INST)
{
EradHWBP1Regs.HWBP_CNTL.bit.BUS_SEL = hwbpCfg.BUS_SEL;
EradHWBP1Regs.HWBP_CNTL.bit.COMP_MODE = hwbpCfg.COMP_MODE;
EradHWBP1Regs.HWBP_REF = hwbpCfg.REF;
EradHWBP1Regs.HWBP_MASK = hwbpCfg.MASK;
EradHWBP1Regs.HWBP_CNTL.bit.STOP = hwbpCfg.DBGEVT;
EradHWBP1Regs.HWBP_CNTL.bit.RTOSINT = hwbpCfg.RTOSINT;
}else if(hwbpInstance == HWBP2_INST)
{
EradHWBP2Regs.HWBP_CNTL.bit.BUS_SEL = hwbpCfg.BUS_SEL;
EradHWBP2Regs.HWBP_CNTL.bit.COMP_MODE = hwbpCfg.COMP_MODE;
EradHWBP2Regs.HWBP_REF = hwbpCfg.REF;
EradHWBP2Regs.HWBP_MASK = hwbpCfg.MASK;
EradHWBP2Regs.HWBP_CNTL.bit.STOP = hwbpCfg.DBGEVT;
EradHWBP2Regs.HWBP_CNTL.bit.RTOSINT = hwbpCfg.RTOSINT;
}else if(hwbpInstance == HWBP3_INST)
{
EradHWBP3Regs.HWBP_CNTL.bit.BUS_SEL = hwbpCfg.BUS_SEL;
EradHWBP3Regs.HWBP_CNTL.bit.COMP_MODE = hwbpCfg.COMP_MODE;
EradHWBP3Regs.HWBP_REF = hwbpCfg.REF;
EradHWBP3Regs.HWBP_MASK = hwbpCfg.MASK;
EradHWBP3Regs.HWBP_CNTL.bit.STOP = hwbpCfg.DBGEVT;
EradHWBP3Regs.HWBP_CNTL.bit.RTOSINT = hwbpCfg.RTOSINT;
}else if(hwbpInstance == HWBP4_INST)
{
EradHWBP4Regs.HWBP_CNTL.bit.BUS_SEL = hwbpCfg.BUS_SEL;
EradHWBP4Regs.HWBP_CNTL.bit.COMP_MODE = hwbpCfg.COMP_MODE;
EradHWBP4Regs.HWBP_REF = hwbpCfg.REF;
EradHWBP4Regs.HWBP_MASK = hwbpCfg.MASK;
EradHWBP4Regs.HWBP_CNTL.bit.STOP = hwbpCfg.DBGEVT;
EradHWBP4Regs.HWBP_CNTL.bit.RTOSINT = hwbpCfg.RTOSINT;
}else if(hwbpInstance == HWBP5_INST)
{
EradHWBP5Regs.HWBP_CNTL.bit.BUS_SEL = hwbpCfg.BUS_SEL;
EradHWBP5Regs.HWBP_CNTL.bit.COMP_MODE = hwbpCfg.COMP_MODE;
EradHWBP5Regs.HWBP_REF = hwbpCfg.REF;
EradHWBP5Regs.HWBP_MASK = hwbpCfg.MASK;
EradHWBP5Regs.HWBP_CNTL.bit.STOP = hwbpCfg.DBGEVT;
EradHWBP5Regs.HWBP_CNTL.bit.RTOSINT = hwbpCfg.RTOSINT;
}else if(hwbpInstance == HWBP6_INST)
{
EradHWBP6Regs.HWBP_CNTL.bit.BUS_SEL = hwbpCfg.BUS_SEL;
EradHWBP6Regs.HWBP_CNTL.bit.COMP_MODE = hwbpCfg.COMP_MODE;
EradHWBP6Regs.HWBP_REF = hwbpCfg.REF;
EradHWBP6Regs.HWBP_MASK = hwbpCfg.MASK;
EradHWBP6Regs.HWBP_CNTL.bit.STOP = hwbpCfg.DBGEVT;
EradHWBP6Regs.HWBP_CNTL.bit.RTOSINT = hwbpCfg.RTOSINT;
}else if(hwbpInstance == HWBP7_INST)
{
EradHWBP7Regs.HWBP_CNTL.bit.BUS_SEL = hwbpCfg.BUS_SEL;
EradHWBP7Regs.HWBP_CNTL.bit.COMP_MODE = hwbpCfg.COMP_MODE;
EradHWBP7Regs.HWBP_REF = hwbpCfg.REF;
EradHWBP7Regs.HWBP_MASK = hwbpCfg.MASK;
EradHWBP7Regs.HWBP_CNTL.bit.STOP = hwbpCfg.DBGEVT;
EradHWBP7Regs.HWBP_CNTL.bit.RTOSINT = hwbpCfg.RTOSINT;
}else if(hwbpInstance == HWBP8_INST)
{
EradHWBP8Regs.HWBP_CNTL.bit.BUS_SEL = hwbpCfg.BUS_SEL;
EradHWBP8Regs.HWBP_CNTL.bit.COMP_MODE = hwbpCfg.COMP_MODE;
EradHWBP8Regs.HWBP_REF = hwbpCfg.REF;
EradHWBP8Regs.HWBP_MASK = hwbpCfg.MASK;
EradHWBP8Regs.HWBP_CNTL.bit.STOP = hwbpCfg.DBGEVT;
EradHWBP8Regs.HWBP_CNTL.bit.RTOSINT = hwbpCfg.RTOSINT;
}
EDIS;
}
@@ -0,0 +1,656 @@
//###########################################################################
//
// FILE: f28004x_dcl_erad.h
//
// TITLE: ERAD driver header file for DCL suite.
//
//###########################################################################
// $TI Release: $
// $Release Date: $
// $Copyright:
// Copyright (C) 2018 Texas Instruments Incorporated - http://www.ti.com/
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
//
// Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
//
// Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the
// distribution.
//
// Neither the name of Texas Instruments Incorporated nor the names of
// its contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// $
//###########################################################################
#ifndef F28004x_DCL_ERAD_DEFINES_H
#define F28004x_DCL_ERAD_DEFINES_H
//*****************************************************************************
//
// If building with a C++ compiler, make all of the definitions in this header
// have a C binding.
//
//*****************************************************************************
#ifdef __cplusplus
extern "C" {
#endif
//*****************************************************************************
//
//! \addtogroup f28004x_dcl_erad_api F28004x_DCL_ERAD
//! @{
//
//*****************************************************************************
#include "f28004x_device.h"
//*****************************************************************************
//
// The following defines are used by the Counter, Enhanced bus comparator APIs
// to configure the corresponding instances.
//
//*****************************************************************************
#define CTM1_INST 0x00000001
#define CTM2_INST 0x00000002
#define CTM3_INST 0x00000004
#define CTM4_INST 0x00000008
#define HWBP1_INST 0x00000001
#define HWBP2_INST 0x00000002
#define HWBP3_INST 0x00000004
#define HWBP4_INST 0x00000008
#define HWBP5_INST 0x00000010
#define HWBP6_INST 0x00000020
#define HWBP7_INST 0x00000040
#define HWBP8_INST 0x00000080
//*****************************************************************************
//
// The following defines are used by the Counter APIs
// ERAD_counterClearStatus and ERAD_counterGetStatus.
//
//*****************************************************************************
#define CTM_EVENT_FIRED 0x1
#define CTM_EVENT_OVERFLOW 0x2
//*****************************************************************************
//
// The following defines are used by the Enhanced bus comparator APIs
// ERAD_HWBPClearStatus and ERAD_HWBPGetStatus.
//
//*****************************************************************************
#define HWBP_EVENT_FIRED 0x1
//*****************************************************************************
//
//! Values passed onto counterConfig and and hwbpConfig structs
//! to enable/disable the selected features.
//
//*****************************************************************************
typedef enum {
ENABLED=1,
DISABLED=0
}modeConfig;
//*****************************************************************************
//
//! Values passed onto ERAD_setGlobalOwner() or returned from ERAD_getGlobalOwner API
//! These values are used to select the owner or return the owner
//
//*****************************************************************************
typedef enum{
NO_OWNER=0,
APPLICATION=1,
DEBUGGER=2
}globalOwner;
//*****************************************************************************
//
//! Values passed onto counterConfig struct
//! These values are used to select the event on which the counter will
//! start,stop,reset,count.
//
//*****************************************************************************
typedef enum {
BUS_COMP1_EVENT=0,
BUS_COMP2_EVENT=1,
BUS_COMP3_EVENT=2,
BUS_COMP4_EVENT=3,
BUS_COMP5_EVENT=4,
BUS_COMP6_EVENT=5,
BUS_COMP7_EVENT=6,
BUS_COMP8_EVENT=7,
COUNTER1_EVENT=8,
COUNTER2_EVENT=9,
COUNTER3_EVENT=10,
COUNTER4_EVENT=11,
PIE_INT1=12,
PIE_INT2=13,
PIE_INT3=14,
PIE_INT4=15,
PIE_INT5=16,
PIE_INT6=17,
PIE_INT7=18,
PIE_INT8=19,
PIE_INT9=20,
PIE_INT10=21,
PIE_INT11=22,
PIE_INT12=23,
TIMER1_TINT1=24,
TIMER2_TINT2=25,
CLA_INTERRUPT1=26,
CLA_INTERRUPT2=27,
CLA_INTERRUPT3=28,
CLA_INTERRUPT4=29,
CLA_INTERRUPT5=30,
CLA_INTERRUPT8=31
}eventInputs;
//*****************************************************************************
//
//! Values passed onto hwbpConfig struct.
//! These values are used to select which CPU buses will be used for
//! comparison to generate the match events.
//
//*****************************************************************************
typedef enum{
PAB=0,
DRAB=3,
DWAB=2,
VPC=1,
DWDB=4
}busSel;
//*****************************************************************************
//
//! Values passed onto hwbpConfig struct.
//! These values are used to select the comparison Mode of the bus that is
//! selected.
//
//*****************************************************************************
typedef enum{
GT=4,
GE=5,
LT=6,
LE=7,
EQ=0
}compMode;
//*****************************************************************************
//
//! Values that can be passed onto counterConfig struct.
//! These values are used to configure the counter to count on the edge
//! or level event.
//
//*****************************************************************************
typedef enum
{
LEVEL=0,
EDGE=1
}edgeLevel;
//*****************************************************************************
//
//! Data structure that can be passed onto ERAD_counterConfig API.
//! The structure is used to configure the counter to count on
//! the required event.
//
//*****************************************************************************
typedef struct
{
modeConfig HW_CNT_RST;
eventInputs RST_INP_SEL;
modeConfig RTOSINT;
modeConfig DBGEVT;
modeConfig RST_ON_MATCH;
edgeLevel EDGE_LEVEL_CFG;
modeConfig START_STOP_MODE;
eventInputs START_INP_SEL;
eventInputs STOP_INP_SEL;
modeConfig CNT_INP_SEL_EN;
eventInputs CNT_INP_SEL;
}counterConfig;
//*****************************************************************************
//
//! Data structure that can be passed onto ERAD_HWBPConfig API.
//! The structure is used to configure the Enhanced Bus Comparator unit.
//
//*****************************************************************************
typedef struct
{
busSel BUS_SEL;
compMode COMP_MODE;
Uint32 REF;
Uint32 MASK;
modeConfig RTOSINT;
modeConfig DBGEVT;
}hwbpConfig;
//*****************************************************************************
//
// Prototypes for the APIs.
//
//*****************************************************************************
//*****************************************************************************
//
//! This function is used to enable the Counter unit(s).
//!
//! \param counterInstances is the counter instance to be enabled.
//!
//! The \e counterInstances parameter is the logical OR of any of the following:
//! - \b CTM1_INST - Counter unit1
//! - \b CTM2_INST - Counter unit2
//! - \b CTM3_INST - Counter unit3
//! - \b CTM4_INST - Counter unit4
//!
//! \return Returns \b true if the ERAD is owned by Application.Returns
//! \b false if the ERAD is owned by Debugger.
//
//*****************************************************************************
extern bool ERAD_setGlobalCTMEnable(Uint16 counterInstances);
//*****************************************************************************
//
//! This function is used to disable the Counter unit(s).
//!
//! \param counterInstances is the counter instance to be disabled.
//!
//! The \e counterInstances parameter is the logical OR of any of the following:
//! - \b CTM1_INST - Counter unit1
//! - \b CTM2_INST - Counter unit2
//! - \b CTM3_INST - Counter unit3
//! - \b CTM4_INST - Counter unit4
//!
//! \return Returns \b true if the ERAD is owned by Application.Returns
//! \b false if the ERAD is owned by Debugger.
//
//*****************************************************************************
extern bool ERAD_setGlobalCTMDisable(Uint16 counterInstances);
//*****************************************************************************
//
//! This function is used to reset the Counter unit(s).
//!
//! \param counterInstances is the counter instance to be reset.
//!
//! The \e counterInstances parameter is the logical OR of any of the following:
//! - \b CTM1_INST - Counter unit1
//! - \b CTM2_INST - Counter unit2
//! - \b CTM3_INST - Counter unit3
//! - \b CTM4_INST - Counter unit4
//!
//! \return None.
//
//*****************************************************************************
extern void ERAD_setGlobalCTMReset(Uint16 counterInstances);
//*****************************************************************************
//
//! This function is used to read the Global Counter event stats.
//!
//! \param None.
//!
//! \return Returns
//! -\b CTM1_INST if the event is fired from Counter1.
//! -\b CTM2_INST if the event is fired from Counter2.
//! -\b CTM3_INST if the event is fired from Counter3.
//! -\b CTM4_INST if the event is fired from Counter4.
//
//*****************************************************************************
extern Uint16 ERAD_getCTMEventStat();
//*****************************************************************************
//
//! This function is used to read the Global Counter halt stats.
//!
//! \param None.
//!
//! \return Returns
//! -\b CTM1_INST if the count event of Counter1 is generated.
//! -\b CTM2_INST if the count event of Counter2 is generated.
//! -\b CTM3_INST if the count event of Counter3 is generated.
//! -\b CTM4_INST if the count event of Counter4 is generated.
//
//*****************************************************************************
extern Uint16 ERAD_getCTMHaltStat();
//*****************************************************************************
//
//! This function is used to enable the Enhanced Bus Comparator unit(s).
//!
//! \param hwbpInstances is the Enhanced Bus Comparator instance to be enabled.
//!
//! The \e hwbpInstances parameter is the logical OR of any of the following:
//! - \b HWBP1_INST - Enhanced Bus Comparator unit1
//! - \b HWBP2_INST - Enhanced Bus Comparator unit2
//! - \b HWBP3_INST - Enhanced Bus Comparator unit3
//! - \b HWBP4_INST - Enhanced Bus Comparator unit4
//! - \b HWBP5_INST - Enhanced Bus Comparator unit5
//! - \b HWBP6_INST - Enhanced Bus Comparator unit6
//! - \b HWBP7_INST - Enhanced Bus Comparator unit7
//! - \b HWBP8_INST - Enhanced Bus Comparator unit8
//!
//! \return Returns \b true if the ERAD is owned by Application.Returns
//! \b false if the ERAD is owned by Debugger.
//
//*****************************************************************************
extern bool ERAD_globalHWBPEnable(Uint16 hwbpInstances);
//*****************************************************************************
//
//! This function is used to disable the Enhanced Bus Comparator unit(s).
//!
//! \param hwbpInstances is the Enhanced Bus Comparator instance to be disabled.
//!
//! The \e hwbpInstances parameter is the logical OR of any of the following:
//! - \b HWBP1_INST - Enhanced Bus Comparator unit1
//! - \b HWBP2_INST - Enhanced Bus Comparator unit2
//! - \b HWBP3_INST - Enhanced Bus Comparator unit3
//! - \b HWBP4_INST - Enhanced Bus Comparator unit4
//! - \b HWBP5_INST - Enhanced Bus Comparator unit5
//! - \b HWBP6_INST - Enhanced Bus Comparator unit6
//! - \b HWBP7_INST - Enhanced Bus Comparator unit7
//! - \b HWBP8_INST - Enhanced Bus Comparator unit8
//!
//! \return Returns \b true if the ERAD is owned by Application.Returns
//! \b false if the ERAD is owned by Debugger.
//
//*****************************************************************************
extern bool ERAD_globalHWBPDisable(Uint16 hwbpInstances);
//*****************************************************************************
//
//! This function is used to read the Global Enhanced Bus Comparator event stats.
//!
//! \param None.
//!
//! \return Returns
//! -\b HWBP1_INST if the event is fired from Enhanced Bus Comparator unit1.
//! -\b HWBP2_INST if the event is fired from Enhanced Bus Comparator unit2.
//! -\b HWBP3_INST if the event is fired from Enhanced Bus Comparator unit3.
//! -\b HWBP4_INST if the event is fired from Enhanced Bus Comparator unit4.
//! -\b HWBP5_INST if the event is fired from Enhanced Bus Comparator unit5.
//! -\b HWBP6_INST if the event is fired from Enhanced Bus Comparator unit6.
//! -\b HWBP7_INST if the event is fired from Enhanced Bus Comparator unit7.
//! -\b HWBP8_INST if the event is fired from Enhanced Bus Comparator unit8.
//
//*****************************************************************************
extern Uint16 ERAD_getHWBPEventStat();
//*****************************************************************************
//
//! This function is used to read the Global Enhanced Bus Comparator halt stats.
//!
//! \param None.
//!
//! \return Returns
//! -\b HWBP1_INST if the Enhanced Bus Comparator unit1 is completed.
//! -\b HWBP2_INST if the Enhanced Bus Comparator unit2 is completed.
//! -\b HWBP3_INST if the Enhanced Bus Comparator unit3 is completed.
//! -\b HWBP4_INST if the Enhanced Bus Comparator unit4 is completed.
//! -\b HWBP5_INST if the Enhanced Bus Comparator unit5 is completed.
//! -\b HWBP6_INST if the Enhanced Bus Comparator unit6 is completed.
//! -\b HWBP7_INST if the Enhanced Bus Comparator unit7 is completed.
//! -\b HWBP8_INST if the Enhanced Bus Comparator unit8 is completed.
//
//*****************************************************************************
extern Uint16 ERAD_getHWBPHaltStat();
//*****************************************************************************
//
//! This function is used to set the reference match count for the counter to
//! a predetermined value.
//!
//! \param counterInstances is the counter instance.
//! \param referenceCount is the counter reference for comparison
//!
//! The \e counterInstances parameter is one of the following:
//! - \b CTM1_INST - Counter unit1
//! - \b CTM2_INST - Counter unit2
//! - \b CTM3_INST - Counter unit3
//! - \b CTM4_INST - Counter unit4
//!
//! \return None.
//
//*****************************************************************************
extern void ERAD_counterSetRef(Uint16 counterInstance,Uint32 referenceCount);
//*****************************************************************************
//
//! This function is used to set the current count for the counter to
//! a predetermined value.
//!
//! \param counterInstances is the counter instance.
//! \param currentCount is the current counter value to be set.
//!
//! The \e counterInstances parameter is one of the following:
//! - \b CTM1_INST - Counter unit1
//! - \b CTM2_INST - Counter unit2
//! - \b CTM3_INST - Counter unit3
//! - \b CTM4_INST - Counter unit4
//!
//! \return None.
//
//*****************************************************************************
extern void ERAD_counterSetCurCount(Uint16 counterInstance,Uint32 currentCount);
//*****************************************************************************
//
//! This function is used to set the maximum count for the counter to
//! a predetermined value.
//!
//! \param counterInstances is the counter instance.
//! \param maxCount is the maximum counter value to be set.
//!
//! The \e counterInstances parameter is one of the following:
//! - \b CTM1_INST - Counter unit1
//! - \b CTM2_INST - Counter unit2
//! - \b CTM3_INST - Counter unit3
//! - \b CTM4_INST - Counter unit4
//!
//! \return None.
//
//*****************************************************************************
extern void ERAD_counterSetMaxCount(Uint16 counterInstance,Uint32 maxCount);
//*****************************************************************************
//
//! This function is used to get the current count of the counter.
//!
//! \param counterInstances is the counter instance.
//!
//! The \e counterInstances parameter is one of the following:
//! - \b CTM1_INST - Counter unit1
//! - \b CTM2_INST - Counter unit2
//! - \b CTM3_INST - Counter unit3
//! - \b CTM4_INST - Counter unit4
//!
//! \return Returns the current counter value.
//
//*****************************************************************************
extern Uint32 ERAD_counterGetCurCount(Uint16 counterInstance);
//*****************************************************************************
//
//! This function is used to get the maximum count of the counter.
//!
//! \param counterInstances is the counter instance.
//!
//! The \e counterInstances parameter is one of the following:
//! - \b CTM1_INST - Counter unit1
//! - \b CTM2_INST - Counter unit2
//! - \b CTM3_INST - Counter unit3
//! - \b CTM4_INST - Counter unit4
//!
//! \return Returns the Max count value.
//
//*****************************************************************************
extern Uint32 ERAD_counterGetMaxCount(Uint16 counterInstance);
//*****************************************************************************
//
//! This function is used to get the current status for the counter.
//!
//! \param counterInstances is the counter instance.
//!
//! The \e counterInstances parameter is one of the following:
//! - \b CTM1_INST - Counter unit1
//! - \b CTM2_INST - Counter unit2
//! - \b CTM3_INST - Counter unit3
//! - \b CTM4_INST - Counter unit4
//!
//! \return Returns
//! -\b CTM_EVENT_FIRED if the event is fired.
//! -\b CTM_EVENT_OVERFLOW if the counter has overflown.
//
//*****************************************************************************
extern Uint16 ERAD_counterGetStatus(Uint16 counterInstance);
//*****************************************************************************
//
//! This function is used to clear the current status for the counter.
//!
//! \param counterInstances is the counter instance.
//! \param clearFlags is the flag to be cleared
//!
//! The \e counterInstances parameter is one of the following:
//! - \b CTM1_INST - Counter unit1
//! - \b CTM2_INST - Counter unit2
//! - \b CTM3_INST - Counter unit3
//! - \b CTM4_INST - Counter unit4
//!
//! The \e clearFlags parameter is the one of the following:
//! - \b CTM_EVENT_FIRED - To clear the event fired status
//! - \b CTM_EVENT_OVERFLOW - To clear the event overflow status
//!
//! \return None.
//
//*****************************************************************************
extern void ERAD_counterClearStatus(Uint16 counterInstance,Uint16 clearFlags);
//*****************************************************************************
//
//! This function is used to configure the counter to count on certain event.
//!
//! \param counterInstances is the counter instance.
//! \param counterCfg is the data struture that is used to configure
//! the counter to count on
//!
//! The \e counterInstances parameter is one of the following:
//! - \b CTM1_INST - Counter unit1
//! - \b CTM2_INST - Counter unit2
//! - \b CTM3_INST - Counter unit3
//! - \b CTM4_INST - Counter unit4
//!
//! \return None.
//
//*****************************************************************************
extern void ERAD_counterConfig(Uint16 counterInstance,counterConfig counterCfg);
//*****************************************************************************
//
//! This function is used to get the current status for the Enhanced Bus Comparator unit.
//!
//! \param hwbpInstance is the Enhanced Bus Comparator instance.
//!
//! The \e hwbpInstance parameter is one of the following:
//! - \b HWBP1_INST - Enhanced Bus Comparator unit1
//! - \b HWBP2_INST - Enhanced Bus Comparator unit2
//! - \b HWBP3_INST - Enhanced Bus Comparator unit3
//! - \b HWBP4_INST - Enhanced Bus Comparator unit4
//! - \b HWBP5_INST - Enhanced Bus Comparator unit5
//! - \b HWBP6_INST - Enhanced Bus Comparator unit6
//! - \b HWBP7_INST - Enhanced Bus Comparator unit7
//! - \b HWBP8_INST - Enhanced Bus Comparator unit8
//!
//! \return Returns
//! -\b HWBP_EVENT_FIRED if the event is fired.
//
//*****************************************************************************
extern Uint16 ERAD_HWBPGetStatus(Uint16 hwbpInstance);
//*****************************************************************************
//
//! This function is used to clear the status for the Enhanced Bus Comparator unit.
//!
//! \param hwbpInstance is the Enhanced Bus Comparator instance.
//! \param clearFlags is the flag to be cleared
//!
//! The \e hwbpInstance parameter is one of the following:
//! - \b HWBP1_INST - Enhanced Bus Comparator unit1
//! - \b HWBP2_INST - Enhanced Bus Comparator unit2
//! - \b HWBP3_INST - Enhanced Bus Comparator unit3
//! - \b HWBP4_INST - Enhanced Bus Comparator unit4
//! - \b HWBP5_INST - Enhanced Bus Comparator unit5
//! - \b HWBP6_INST - Enhanced Bus Comparator unit6
//! - \b HWBP7_INST - Enhanced Bus Comparator unit7
//! - \b HWBP8_INST - Enhanced Bus Comparator unit8
//!
//! The \e clearFlags parameter is the one of the following:
//! -\b HWBP_EVENT_FIRED - To clear the event fired status.
//!
//! \return None.
//
//*****************************************************************************
extern void ERAD_HWBPClearStatus(Uint16 hwbpInstance,Uint16 clearFlags);
//*****************************************************************************
//
//! This function is used to configure the Enhanced Bus Comparator unit.
//!
//! \param hwbpInstance is the Enhanced Bus Comparator unit instance.
//! \param hwbpCfg is the data struture that is used to configure
//! the Enhanced Bus Comparator unit.
//!
//! The \e hwbpInstance parameter is one of the following:
//! - \b HWBP1_INST - Enhanced Bus Comparator unit1
//! - \b HWBP2_INST - Enhanced Bus Comparator unit2
//! - \b HWBP3_INST - Enhanced Bus Comparator unit3
//! - \b HWBP4_INST - Enhanced Bus Comparator unit4
//! - \b HWBP5_INST - Enhanced Bus Comparator unit5
//! - \b HWBP6_INST - Enhanced Bus Comparator unit6
//! - \b HWBP7_INST - Enhanced Bus Comparator unit7
//! - \b HWBP8_INST - Enhanced Bus Comparator unit8
//!
//! \return None.
//
//*****************************************************************************
extern void ERAD_HWBPConfig(Uint16 hwbpInstance,hwbpConfig hwbpCfg);
//*****************************************************************************
//
// Close the Doxygen group.
//! @}
//
//*****************************************************************************
//*****************************************************************************
//
// Mark the end of the C bindings section for C++ compilers.
//
//*****************************************************************************
#ifdef __cplusplus
}
#endif
#endif // - end of F28004x_DCL_ERAD_DEFINES_H
@@ -0,0 +1,92 @@
;;#############################################################################
;;
;; FILE: f28004x_usdelay.asm
;;
;; TITLE: Simple Delay Function
;;
;; DESCRIPTION:
;;
;; This is a simple delay function that can be used to insert a specified
;; delay into code.
;; This function is only accurate if executed from internal zero-waitstate
;; SARAM. If it is executed from waitstate memory then the delay will be
;; longer then specified.
;; To use this function:
;; 1 - update the CPU clock speed in the f28004x_examples.h
;; file.
;; 2 - Call this function by using the DELAY_US(A) macro
;; that is defined in the f28004x_device.h file. This macro
;; will convert the number of microseconds specified
;; into a loop count for use with this function.
;; This count will be based on the CPU frequency you specify.
;; 3 - For the most accurate delay
;; - Execute this function in 0 waitstate RAM.
;; - Disable interrupts before calling the function
;; If you do not disable interrupts, then think of
;; this as an "at least" delay function as the actual
;; delay may be longer.
;; The C assembly call from the DELAY_US(time) macro will
;; look as follows:
;; extern void Delay(long LoopCount);
;; MOV AL,#LowLoopCount
;; MOV AH,#HighLoopCount
;; LCR _Delay
;; Or as follows (if count is less then 16-bits):
;; MOV ACC,#LoopCount
;; LCR _Delay
;;#############################################################################
;; $TI Release: F28004x Support Library v1.03.00.00 $
;; $Release Date: Thu Dec 7 18:46:47 CST 2017 $
;; $Copyright:
;// Copyright (C) 2017 Texas Instruments Incorporated - http://www.ti.com/
;//
;// Redistribution and use in source and binary forms, with or without
;// modification, are permitted provided that the following conditions
;// are met:
;//
;// Redistributions of source code must retain the above copyright
;// notice, this list of conditions and the following disclaimer.
;//
;// Redistributions in binary form must reproduce the above copyright
;// notice, this list of conditions and the following disclaimer in the
;// documentation and/or other materials provided with the
;// distribution.
;//
;// Neither the name of Texas Instruments Incorporated nor the names of
;// its contributors may be used to endorse or promote products derived
;// from this software without specific prior written permission.
;//
;// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
;// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
;// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
;// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
;// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
;// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
;// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
;// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
;// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
;// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
;// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
;// $
;;#############################################################################
.def _F28x_usDelayErad
.sect "interruptSection"
.global __F28x_usDelayErad
_F28x_usDelayErad:
SUB ACC,#1
BF _F28x_usDelayErad,GEQ ;; Loop if ACC >= 0
LRETR
;There is a 9/10 cycle overhead and each loop
;takes five cycles. The LoopCount is given by
;the following formula:
; DELAY_CPU_CYCLES = 9 + 5*LoopCount
; LoopCount = (DELAY_CPU_CYCLES - 9) / 5
; The macro DELAY_US(A) performs this calculation for you
;;#############################################################################
;; End of file
;;#############################################################################
@@ -0,0 +1,31 @@
<projectSpec>
<project
name="F28069_DF22"
device="TMS320F28069"
configurations="DEBUG"
launchWizard="False"
linkerCommandFile=""
compilerBuildOptions="--opt_level=off -I${C2000WARE_F2806X_ROOT1} -I${C2000WARE_F2806X_ROOT2} -I${C2000WARE_DCL_INCLUDE_ROOT} -v28 -ml -mt --float_support=fpu32 --define=DEBUG --diag_warning=225 --diag_suppress=10063 --display_error_number"
linkerBuildOptions="--stack_size=0x400 --heap_size=0x200 --define RAM"
>
<pathVariable name="C2000WARE_F2806X_ROOT1" path="../../../../../../../device_support/f2806x/headers/include" scope="project" />
<pathVariable name="C2000WARE_F2806X_ROOT2" path="../../../../../../../device_support/f2806x/common/include" scope="project" />
<pathVariable name="C2000WARE_DCL_INCLUDE_ROOT" path="../../../include" scope="project" />
<file action="copy" path="../../../../../../../device_support/f2806x/common/source/F2806x_CpuTimers.c" targetDirectory="" />
<file action="copy" path="../../../../../../../device_support/f2806x/common/source/F2806x_DefaultIsr.c" targetDirectory="" />
<file action="copy" path="../../../../../../../device_support/f2806x/headers/source/F2806x_GlobalVariableDefs.c" targetDirectory="" />
<file action="copy" path="../../../../../../../device_support/f2806x/common/source/F2806x_PieCtrl.c" targetDirectory="" />
<file action="copy" path="../../../../../../../device_support/f2806x/common/source/F2806x_PieVect.c" targetDirectory="" />
<file action="copy" path="../../../../../../../device_support/f2806x/common/source/F2806x_SysCtrl.c" targetDirectory="" />
<file action="copy" path="../../../../../../../device_support/f2806x/common/source/F2806x_DisInt.asm" targetDirectory="" />
<file action="copy" path="../../../../../../../device_support/f2806x/common/source/F2806x_usDelay.asm" targetDirectory="" />
<file action="copy" path="../../../../../../../device_support/f2806x/headers/cmd/F2806x_Headers_nonBIOS.cmd" targetDirectory="" />
<file action="copy" path="../../../cmd/F28069_stdmem.cmd" targetDirectory="" />
<file action="copy" path="../../../cmd/F28069_DCL.cmd" targetDirectory="" />
<file action="copy" path="../../../source/DCL_clamp_C1.asm" targetDirectory="" />
<file action="copy" path="../../../source/DCL_DF22_C1.asm" targetDirectory="" />
<file action="copy" path="../../../source/DCL_DF22_C2C3.asm" targetDirectory="" />
<file action="copy" path="../Example_F28069_DF22.c" targetDirectory="" />
<file action="copy" path="../DF22_edata.dat" targetDirectory="" />
</project>
</projectSpec>
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,154 @@
/* Example_F28069_DF22.c
*
* Copyright (C) 2020 Texas Instruments Incorporated - http://www.ti.com/
* ALL RIGHTS RESERVED
*
*/
#include "F2806x_Device.h"
#include "F2806x_Examples.h"
#include "F2806x_GlobalPrototypes.h"
#include "DCLF32.h"
#include "DCL_fdlog.h"
#define DATA_LENGTH 1601
// input data
#pragma DATA_SECTION(e_array, "PDataLogSection")
float e_array[DATA_LENGTH];
FDLOG eBuf = FDLOG_DEFAULTS;
// full controller results
#pragma DATA_SECTION(u1_array, "QDataLogSection")
float u1_array[DATA_LENGTH];
FDLOG u1Buf = FDLOG_DEFAULTS;
// pre-computed controller results
#pragma DATA_SECTION(u2_array, "RDataLogSection")
float u2_array[DATA_LENGTH];
FDLOG u2Buf = FDLOG_DEFAULTS;
// controller difference data
#pragma DATA_SECTION(d_array, "SDataLogSection")
float d_array[DATA_LENGTH];
FDLOG dBuf = FDLOG_DEFAULTS;
extern interrupt void control_Isr(void);
// global variables
long IdleLoopCount = 0;
long IsrCount = 0;
float ek;
float u1k;
float u2k;
float dk;
float upperLim;
float lowerLim;
uint16_t v;
DCL_DF22 controller1 = DF22_DEFAULTS;
DCL_DF22 controller2 = DF22_DEFAULTS;
/* main */
main()
{
// initialise system
InitSysCtrl();
DINT;
IER = 0x0000;
IFR = 0x0000;
InitPieCtrl();
InitPieVectTable();
EALLOW;
PieVectTable.TINT0 = &control_Isr;
EDIS;
// configure CPU timer 0
InitCpuTimers();
ConfigCpuTimer(&CpuTimer0, 90.0, 1.0e+03);
// initialise data arrays
DCL_initLog(&eBuf, e_array, DATA_LENGTH);
DCL_initLog(&u1Buf, u1_array, DATA_LENGTH);
DCL_initLog(&u2Buf, u2_array, DATA_LENGTH);
DCL_initLog(&dBuf, d_array, DATA_LENGTH);
DCL_clearLog(&u1Buf);
DCL_clearLog(&u2Buf);
DCL_fillLog(&dBuf, 1.234567f);
// initialise full controller
controller1.a1 = -1.9417f;
controller1.a2 = 0.9417f;
controller1.b0 = 9.8549f;
controller1.b1 = -19.4165f;
controller1.b2 = 9.5636f;
// initialise pre-computed controller
controller2.a1 = controller1.a1;
controller2.a2 = controller1.a2;
controller2.b0 = controller1.b0;
controller2.b1 = controller1.b1;
controller2.b2 = controller1.b2;
// clamp limits
upperLim = 1000.0f;
lowerLim = -1000.0f;
// enable interrupts
PieCtrlRegs.PIEIER1.bit.INTx7 = 1;
IER |= M_INT1;
EINT;
StartCpuTimer0();
// idle loop
while(1)
{
IdleLoopCount++;
}
}
/* control ISR: triggered by CPU timer 0 */
interrupt void control_Isr(void)
{
// clear timer flag & acknowledge interrupt
CpuTimer0Regs.TCR.bit.TIF = 1;
PieCtrlRegs.PIEACK.all = PIEACK_GROUP1;
// read data & run controllers
if (eBuf.dptr < eBuf.lptr)
{
// read input data
ek = DCL_readLog(&eBuf);
// run full controller
u1k = DCL_runDF22_C1(&controller1, ek);
// run pre-computed controller
u2k = DCL_runDF22_C2(&controller2, ek);
v = DCL_runClamp_C1(&u2k, upperLim, lowerLim);
if (0U == v)
{
DCL_runDF22_C3(&controller2, ek, u2k);
}
// compute difference
dk = u1k - u2k;
// store results
DCL_writeLog(&u1Buf, u1k);
DCL_writeLog(&u2Buf, u2k);
DCL_writeLog(&dBuf, dk);
}
else
{
// place break-point here
asm(" NOP");
}
IsrCount++;
}
/* end of file */
@@ -0,0 +1,33 @@
<projectSpec>
<project
name="F28069_DF23"
device="TMS320F28069"
configurations="DEBUG"
launchWizard="False"
linkerCommandFile=""
compilerBuildOptions="--opt_level=off -I${C2000WARE_F2806X_ROOT1} -I${C2000WARE_F2806X_ROOT2} -I${C2000WARE_DCL_INCLUDE_ROOT} -I${PROJECT_INCLUDE_ROOT} -v28 -ml -mt --float_support=fpu32 --define=DEBUG --diag_warning=225 --diag_suppress=10063,303 --display_error_number"
linkerBuildOptions="--stack_size=0x400 --heap_size=0x200 --define RAM"
>
<pathVariable name="C2000WARE_F2806X_ROOT1" path="../../../../../../../device_support/f2806x/headers/include" scope="project" />
<pathVariable name="C2000WARE_F2806X_ROOT2" path="../../../../../../../device_support/f2806x/common/include" scope="project" />
<pathVariable name="C2000WARE_DCL_INCLUDE_ROOT" path="../../../include" scope="project" />
<pathVariable name="PROJECT_INCLUDE_ROOT" path="../" scope="project" />
<file action="copy" path="../../../../../../../device_support/f2806x/common/source/F2806x_CpuTimers.c" targetDirectory="" />
<file action="copy" path="../../../../../../../device_support/f2806x/common/source/F2806x_DefaultIsr.c" targetDirectory="" />
<file action="copy" path="../../../../../../../device_support/f2806x/headers/source/F2806x_GlobalVariableDefs.c" targetDirectory="" />
<file action="copy" path="../../../../../../../device_support/f2806x/common/source/F2806x_PieCtrl.c" targetDirectory="" />
<file action="copy" path="../../../../../../../device_support/f2806x/common/source/F2806x_PieVect.c" targetDirectory="" />
<file action="copy" path="../../../../../../../device_support/f2806x/common/source/F2806x_SysCtrl.c" targetDirectory="" />
<file action="copy" path="../../../../../../../device_support/f2806x/common/source/F2806x_DisInt.asm" targetDirectory="" />
<file action="copy" path="../../../../../../../device_support/f2806x/common/source/F2806x_usDelay.asm" targetDirectory="" />
<file action="copy" path="../../../../../../../device_support/f2806x/headers/cmd/F2806x_Headers_nonBIOS.cmd" targetDirectory="" />
<file action="copy" path="../../../cmd/F28069_stdmem.cmd" targetDirectory="" />
<file action="copy" path="../../../cmd/F28069_DCL.cmd" targetDirectory="" />
<file action="copy" path="../../../source/DCL_clamp_L1.asm" targetDirectory="" />
<file action="copy" path="../../../source/DCL_DF23_L1.asm" targetDirectory="" />
<file action="copy" path="../../../source/DCL_DF23_L2L3.asm" targetDirectory="" />
<file action="copy" path="../Example_F28069_DF23.c" targetDirectory="" />
<file action="copy" path="../F28069_DF23_CLA.cla" targetDirectory="" />
<file action="copy" path="../DF23_edata.dat" targetDirectory="" />
</project>
</projectSpec>
@@ -0,0 +1,47 @@
/* CLA_shared.h */
#ifndef _C_CLA_SHARED_H
#define _C_CLA_SHARED_H
#include "DCLCLA.h"
#include "F2806x_Cla_typedefs.h"
#define CLA_PROG_ENABLE 0x0001
#define CLARAM0_ENABLE 0x0010
#define CLARAM1_ENABLE 0x0020
#define CLARAM2_ENABLE 0x0040
#define CLA_RAM0CPUE 0x0100
#define CLA_RAM1CPUE 0x0200
#define CLA_RAM2CPUE 0x0400
/* shared CLA vars */
extern float ek;
extern float u1k;
extern float u2k;
// CLA memory address symbols
extern Uint16 Cla1funcsLoadStart;
extern Uint16 Cla1funcsLoadEnd;
extern Uint16 Cla1funcsLoadSize;
extern Uint16 Cla1funcsRunStart;
extern Uint16 Cla1Prog_Start;
// CLA math table symbols
extern Uint16 Cla1mathTablesLoadStart;
extern Uint16 Cla1mathTablesLoadEnd;
extern Uint16 Cla1mathTablesLoadSize;
extern Uint16 Cla1mathTablesRunStart;
// CLA C Tasks
__interrupt void Cla1Task1();
__interrupt void Cla1Task2();
__interrupt void Cla1Task3();
__interrupt void Cla1Task4();
__interrupt void Cla1Task5();
__interrupt void Cla1Task6();
__interrupt void Cla1Task7();
__interrupt void Cla1Task8();
#endif // _C_CLA_SHARED_H
/* end of file */
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,171 @@
/* Example_F28069_DF23.c
*
* Copyright (C) 2020 Texas Instruments Incorporated - http://www.ti.com/
* ALL RIGHTS RESERVED
*
*/
// header files
#include "F2806x_Device.h"
#include "F2806x_Examples.h"
#include "F2806x_GlobalPrototypes.h"
#include "DCLCLA.h"
#include "DCL_fdlog.h"
#include "CLA_shared.h"
#define DATA_LENGTH 1601
// input data
#pragma DATA_SECTION(e_array, "PDataLogSection")
float e_array[DATA_LENGTH];
FDLOG eBuf = FDLOG_DEFAULTS;
// full controller results
#pragma DATA_SECTION(u1_array, "QDataLogSection")
float u1_array[DATA_LENGTH];
FDLOG u1Buf = FDLOG_DEFAULTS;
// pre-computed controller results
#pragma DATA_SECTION(u2_array, "RDataLogSection")
float u2_array[DATA_LENGTH];
FDLOG u2Buf = FDLOG_DEFAULTS;
// controller difference data
#pragma DATA_SECTION(d_array, "SDataLogSection")
float d_array[DATA_LENGTH];
FDLOG dBuf = FDLOG_DEFAULTS;
// function prototypes
interrupt void control_Isr(void);
// shared variables
#pragma DATA_SECTION(ek, "CpuToCla1MsgRAM")
#pragma DATA_SECTION(u1k, "Cla1ToCpuMsgRAM")
#pragma DATA_SECTION(u2k, "Cla1ToCpuMsgRAM")
float ek;
float u1k;
float u2k;
// global variables
long IdleLoopCount = 0;
long IsrCount = 0;
float dk;
main()
{
// initialise system
InitSysCtrl();
DINT;
IER = 0x0000;
IFR = 0x0000;
InitPieCtrl();
InitPieVectTable();
EALLOW;
PieVectTable.TINT0 = &control_Isr;
EDIS;
// configure CPU timer 0
InitCpuTimers();
ConfigCpuTimer(&CpuTimer0, 90.0, 1.0e+03);
// initialise data arrays
DCL_initLog(&eBuf, e_array, DATA_LENGTH);
DCL_initLog(&u1Buf, u1_array, DATA_LENGTH);
DCL_initLog(&u2Buf, u2_array, DATA_LENGTH);
DCL_initLog(&dBuf, d_array, DATA_LENGTH);
DCL_clearLog(&u1Buf);
DCL_clearLog(&u2Buf);
DCL_fillLog(&dBuf, 1.234567f);
// compute CLA task vectors
EALLOW;
Cla1Regs.MVECT1 = (Uint16)((Uint32)&Cla1Task1 -(Uint32)&Cla1Prog_Start);
Cla1Regs.MVECT2 = (Uint16)((Uint32)&Cla1Task2 -(Uint32)&Cla1Prog_Start);
Cla1Regs.MVECT3 = (Uint16)((Uint32)&Cla1Task3 -(Uint32)&Cla1Prog_Start);
Cla1Regs.MVECT4 = (Uint16)((Uint32)&Cla1Task4 -(Uint32)&Cla1Prog_Start);
Cla1Regs.MVECT5 = (Uint16)((Uint32)&Cla1Task5 -(Uint32)&Cla1Prog_Start);
Cla1Regs.MVECT6 = (Uint16)((Uint32)&Cla1Task6 -(Uint32)&Cla1Prog_Start);
Cla1Regs.MVECT7 = (Uint16)((Uint32)&Cla1Task7 -(Uint32)&Cla1Prog_Start);
Cla1Regs.MVECT8 = (Uint16)((Uint32)&Cla1Task8 -(Uint32)&Cla1Prog_Start);
// CLA task triggers
Cla1Regs.MPISRCSEL1.bit.PERINT1SEL = CLA_INT1_NONE;
Cla1Regs.MPISRCSEL1.bit.PERINT2SEL = CLA_INT2_NONE;
Cla1Regs.MPISRCSEL1.bit.PERINT3SEL = CLA_INT3_NONE;
Cla1Regs.MPISRCSEL1.bit.PERINT4SEL = CLA_INT4_NONE;
Cla1Regs.MPISRCSEL1.bit.PERINT5SEL = CLA_INT5_NONE;
Cla1Regs.MPISRCSEL1.bit.PERINT6SEL = CLA_INT6_NONE;
Cla1Regs.MPISRCSEL1.bit.PERINT7SEL = CLA_INT7_NONE;
Cla1Regs.MPISRCSEL1.bit.PERINT8SEL = CLA_INT8_NONE;
Cla1Regs.MIER.all = 0x00FF;
/* Switch the CLA program space to the CLA and enable software forcing
* Also switch over CLA data ram 0,1 and 2
* CAUTION: The RAMxCPUE bits can only be enabled by writing to the register
* and not the individual bit field. Furthermore, the status of these bitfields
* is not reflected in either the watch or register views - they always read as
* zeros. This is a known bug and the user is advised to test CPU accessibilty
* first before proceeding
*/
Cla1Regs.MMEMCFG.all = CLA_PROG_ENABLE|CLARAM0_ENABLE|CLARAM1_ENABLE|CLARAM2_ENABLE|CLA_RAM1CPUE;
Cla1Regs.MCTL.bit.IACKE = 1;
EDIS;
// enable CLA interrupts and run task 8
Cla1Regs.MIER.bit.INT3 = 1;
Cla1Regs.MIER.bit.INT8 = 1;
Cla1ForceTask8andWait();
// enable CPU interrupts & start timer 0
PieCtrlRegs.PIEIER1.bit.INTx7 = 1;
IER |= M_INT1;
EINT;
StartCpuTimer0();
// idle loop
while(1)
{
IdleLoopCount++;
}
}
/* control ISR: triggered by timer 0 */
interrupt void control_Isr(void)
{
// clear timer flag & acknowledge interrupt
CpuTimer0Regs.TCR.bit.TIF = 1;
PieCtrlRegs.PIEACK.all = PIEACK_GROUP1;
// read data & run controllers
if (eBuf.dptr < eBuf.lptr)
{
// read input data
ek = DCL_readLog(&eBuf);
// run DF23 controllers on CLA
EALLOW;
Cla1ForceTask3andWait();
EDIS;
// compute difference in controller results
dk = u1k - u2k;
// store results
DCL_writeLog(&u1Buf, u1k);
DCL_writeLog(&u2Buf, u2k);
DCL_writeLog(&dBuf, dk);
}
else
{
// place break-point here
asm(" NOP");
}
IsrCount++;
}
/* end of file */
@@ -0,0 +1,106 @@
/* control_F28069_DF23_CLA.cla
*
* Copyright (C) 2020 Texas Instruments Incorporated - http://www.ti.com/
* ALL RIGHTS RESERVED
*
*/
#include "CLA_shared.h"
#include "F2806x_Cla_typedefs.h"
#include "F2806x_Device.h"
// CLA variables
DCL_DF23_CLA ctrl1;
DCL_DF23_CLA ctrl2;
float vk;
float upperLim;
float lowerLim;
__interrupt void Cla1Task1 ( void )
{
}
__interrupt void Cla1Task2 ( void )
{
}
// task 3 contains the DF23 controller
__interrupt void Cla1Task3 ( void )
{
// __mdebugstop();
// run the full DF23 controller
u1k = DCL_runDF23_L1(&ctrl1, ek);
// run the pre-computed DF23 controller with clamp
u2k = DCL_runDF23_L2(&ctrl2, ek);
vk = DCL_runClamp_L1(&u2k, upperLim, lowerLim);
if (0.5f > vk)
{
DCL_runDF23_L3(&ctrl2, ek, u2k);
}
__mnop();
__mnop();
__mnop();
}
__interrupt void Cla1Task4 ( void )
{
}
__interrupt void Cla1Task5 ( void )
{
}
__interrupt void Cla1Task6 ( void )
{
}
__interrupt void Cla1Task7 ( void )
{
}
//Task 8 will initialize the variables used in Task 3
__interrupt void Cla1Task8 ( void )
{
// __mdebugstop();
// initialise DF23 controller coefficients
ctrl1.a1 = -2.1280f;
ctrl1.a2 = 1.3968f;
ctrl1.a3 = -0.2689f;
ctrl1.b0 = 9.6580f;
ctrl1.b1 = -9.1580f;
ctrl1.b2 = -9.6521f;
ctrl1.b3 = 9.1639f;
ctrl1.x1 = 0.0f;
ctrl1.x2 = 0.0f;
ctrl1.x3 = 0.0f;
ctrl2.a1 = ctrl1.a1;
ctrl2.a2 = ctrl1.a2;
ctrl2.a3 = ctrl1.a3;
ctrl2.b0 = ctrl1.b0;
ctrl2.b1 = ctrl1.b1;
ctrl2.b2 = ctrl1.b2;
ctrl2.b3 = ctrl1.b3;
ctrl2.x1 = ctrl1.x1;
ctrl2.x2 = ctrl1.x2;
ctrl2.x3 = ctrl1.x3;
// clamp limits
upperLim = 1001.0f;
lowerLim = -1001.0f;
}
// end of file
@@ -0,0 +1,23 @@
<projectSpec>
<project
name="F28069_GSM"
device="TMS320F28069"
configurations="DEBUG"
launchWizard="False"
linkerCommandFile=""
compilerBuildOptions="--opt_level=off -I${C2000WARE_F2806X_ROOT1} -I${C2000WARE_F2806X_ROOT2} -I${C2000WARE_DCL_INCLUDE_ROOT} -v28 -ml -mt --float_support=fpu32 --define=DEBUG --diag_warning=225 --diag_suppress=10063 --display_error_number"
linkerBuildOptions="--stack_size=0x400 --heap_size=0x200 --define RAM"
>
<pathVariable name="C2000WARE_F2806X_ROOT1" path="../../../../../../../device_support/f2806x/headers/include" scope="project" />
<pathVariable name="C2000WARE_F2806X_ROOT2" path="../../../../../../../device_support/f2806x/common/include" scope="project" />
<pathVariable name="C2000WARE_DCL_INCLUDE_ROOT" path="../../../include" scope="project" />
<file action="copy" path="../../../../../../../device_support/f2806x/common/source/F2806x_DefaultIsr.c" targetDirectory="" />
<file action="copy" path="../../../../../../../device_support/f2806x/headers/source/F2806x_GlobalVariableDefs.c" targetDirectory="" />
<file action="copy" path="../../../../../../../device_support/f2806x/common/source/F2806x_SysCtrl.c" targetDirectory="" />
<file action="copy" path="../../../../../../../device_support/f2806x/common/source/F2806x_usDelay.asm" targetDirectory="" />
<file action="copy" path="../../../../../../../device_support/f2806x/headers/cmd/F2806x_Headers_nonBIOS.cmd" targetDirectory="" />
<file action="copy" path="../../../cmd/F28069_stdmem.cmd" targetDirectory="" />
<file action="copy" path="../../../cmd/F28069_DCL.cmd" targetDirectory="" />
<file action="copy" path="../Example_F28069_GSM.c" targetDirectory="" />
</project>
</projectSpec>
@@ -0,0 +1,87 @@
/* Example_F28069_GSM.c
*
* Copyright (C) 2020 Texas Instruments Incorporated - http://www.ti.com/
* ALL RIGHTS RESERVED
*
*/
// header files
#include "F2806x_Device.h"
#include "F2806x_Examples.h"
#include "F2806x_GlobalPrototypes.h"
#include "DCLF32.h"
#include "DCL_fdlog.h"
// function prototypes
float32_t GSM_target_fcn(float32_t x);
// global variables
uint16_t i = 0;
float32_t dx, xk, yk;
// controller
DCL_GSM F = GSM_DEFAULTS;
DCL_CSS Fcss = DCL_CSS_DEFAULTS;
DCL_GSM_SPS Fsps = GSM_SPS_DEFAULTS;
// result buffer
#pragma DATA_SECTION(s_array, "SDataLogSection")
float32_t s_array[FDLOG_DEFAULT_SIZE];
FDLOG sBuf = FDLOG_DEFAULTS;
/* main */
main()
{
/* initialise system */
InitSysCtrl(); // [F2806x_SysCtrl.c]
DINT; // disable interrupts
/* result buffer initialization */
DCL_initLog(&sBuf, s_array, FDLOG_DEFAULT_SIZE);
DCL_clearLog(&sBuf);
/* initialize GSM support structures */
F.sps = &Fsps;
F.css = &Fcss;
/* load GSM offset coefficients */
xk = 0;
for (i=1; i<=GSM_N; i++)
{
xk += F.h;
F.sps->c[i] = GSM_target_fcn(xk);
}
/* load GSM gain table */
DCL_loadGSMgains(&F);
/* load active GSM */
DCL_REQUEST_UPDATE(&F);
DCL_updateGSM(&F);
/* load input-output curve */
dx = 2.2f / FDLOG_DEFAULT_SIZE;
for (xk=-1.1f; xk<1.1f; xk+=dx)
{
yk = DCL_runGSM_C1(&F, xk);
DCL_writeLog(&sBuf, yk);
}
/* infinite loop */
while(1)
{
asm(" NOP");
} // while
} // main
/* target function for gain scheduler profile */
float32_t GSM_target_fcn(float32_t x)
{
return(x*x);
}
/* end of file */
@@ -0,0 +1,33 @@
<projectSpec>
<project
name="F28069_NLPID"
device="TMS320F28069"
configurations="DEBUG"
launchWizard="False"
linkerCommandFile=""
compilerBuildOptions="--opt_level=off -I${C2000WARE_F2806X_ROOT1} -I${C2000WARE_F2806X_ROOT2} -I${C2000WARE_DCL_INCLUDE_ROOT} -v28 -ml -mt --float_support=fpu32 --define=DEBUG --diag_warning=225 --diag_suppress=10063 --display_error_number"
linkerBuildOptions="--stack_size=0x400 --heap_size=0x200 --define RAM"
>
<pathVariable name="C2000WARE_F2806X_ROOT1" path="../../../../../../../device_support/f2806x/headers/include" scope="project" />
<pathVariable name="C2000WARE_F2806X_ROOT2" path="../../../../../../../device_support/f2806x/common/include" scope="project" />
<pathVariable name="C2000WARE_DCL_INCLUDE_ROOT" path="../../../include" scope="project" />
<file action="copy" path="../../../../../../../device_support/f2806x/common/source/F2806x_Adc.c" targetDirectory="" />
<file action="copy" path="../../../../../../../device_support/f2806x/common/source/F2806x_CpuTimers.c" targetDirectory="" />
<file action="copy" path="../../../../../../../device_support/f2806x/common/source/F2806x_DefaultIsr.c" targetDirectory="" />
<file action="copy" path="../../../../../../../device_support/f2806x/common/source/F2806x_EPwm.c" targetDirectory="" />
<file action="copy" path="../../../../../../../device_support/f2806x/headers/source/F2806x_GlobalVariableDefs.c" targetDirectory="" />
<file action="copy" path="../../../../../../../device_support/f2806x/common/source/F2806x_Gpio.c" targetDirectory="" />
<file action="copy" path="../../../../../../../device_support/f2806x/common/source/F2806x_PieCtrl.c" targetDirectory="" />
<file action="copy" path="../../../../../../../device_support/f2806x/common/source/F2806x_PieVect.c" targetDirectory="" />
<file action="copy" path="../../../../../../../device_support/f2806x/common/source/F2806x_SysCtrl.c" targetDirectory="" />
<file action="copy" path="../../../../../../../device_support/f2806x/common/source/F2806x_DBGIER.asm" targetDirectory="" />
<file action="copy" path="../../../../../../../device_support/f2806x/common/source/F2806x_DisInt.asm" targetDirectory="" />
<file action="copy" path="../../../../../../../device_support/f2806x/common/source/F2806x_usDelay.asm" targetDirectory="" />
<file action="copy" path="../../../../../../../device_support/f2806x/headers/cmd/F2806x_Headers_nonBIOS.cmd" targetDirectory="" />
<file action="copy" path="../../../cmd/F28069_stdmem.cmd" targetDirectory="" />
<file action="copy" path="../../../cmd/F28069_DCL.cmd" targetDirectory="" />
<file action="copy" path="../Example_F28069_NLPID.c" targetDirectory="" />
<file action="copy" path="../../../source/DCL_error.c" targetDirectory="" />
</project>
</projectSpec>
@@ -0,0 +1,182 @@
/* Example_F28069_PID.c
*
* Copyright (C) 2020 Texas Instruments Incorporated - http://www.ti.com/
* ALL RIGHTS RESERVED
*
*/
// header files
#include "F2806x_Device.h"
#include "F2806x_Examples.h"
#include "F2806x_GlobalPrototypes.h"
#include "DCLF32.h"
#include "DCL_NLPID.h"
// function prototypes
extern interrupt void control_Isr(void);
// global variables
long IdleLoopCount = 0;
long IsrCount = 0;
float rk = 0.25f;
float yk;
float lk;
float uk;
DCL_NLPID nlpid1 = NLPID_DEFAULTS;
DCL_NLPID_SPS sps1 = NLPID_SPS_DEFAULTS;
DCL_CSS css1 = DCL_CSS_DEFAULTS;
float Duty;
volatile uint16_t calFlag = 0;
float upperlim = 0.95f;
float lowerlim = 0.05f;
unsigned int clampactive;
/* main */
main()
{
/* initialise system */
InitSysCtrl(); // [F2806x_SysCtrl.c]
DINT; // disable interrupts
IER = 0x0000;
IFR = 0x0000;
InitPieCtrl(); // initialise PIE control registers [F2806x_PieCtrl.c]
InitPieVectTable(); // initialise PIE vector table [F2806x_PieVect.c]
EALLOW;
PieVectTable.ADCINT1 = &control_Isr; // [F28069_PID_cisr.c]
EDIS;
/* configure ePWM1 */
EALLOW;
SysCtrlRegs.PCLKCR0.bit.TBCLKSYNC = 0;
EDIS;
InitEPwm(); // [F2806x_EPwm.c]
EPwm1Regs.TBCTL.bit.CTRMODE = 3; // freeze TB counter
EPwm1Regs.TBCTL.bit.PRDLD = 1; // immediate load
EPwm1Regs.TBCTL.bit.PHSEN = 0; // disable phase loading
EPwm1Regs.TBCTL.bit.SYNCOSEL = 3; // disable SYNCOUT signal
EPwm1Regs.TBCTL.bit.HSPCLKDIV = 0; // TBCLK = SYSCLKOUT
EPwm1Regs.TBCTL.bit.CLKDIV = 0; // clock divider = /1
EPwm1Regs.TBCTL.bit.FREE_SOFT = 2; // free run on emulation suspend
EPwm1Regs.TBPRD = 0x2328; // set period for ePWM1 (0x2328 = 10kHz)
EPwm1Regs.TBPHS.all = 0; // time-base Phase Register
EPwm1Regs.TBCTR = 0; // time-base Counter Register
EPwm1Regs.ETSEL.bit.SOCAEN = 1; // enable SOC on A group
EPwm1Regs.ETSEL.bit.SOCASEL = 1; // select SOC from zero match
EPwm1Regs.ETPS.bit.SOCAPRD = 1; // generate pulse on 1st event
EPwm1Regs.CMPCTL.bit.SHDWAMODE = 0; // enable shadow mode
EPwm1Regs.CMPCTL.bit.LOADAMODE = 2; // reload on CTR=zero
EPwm1Regs.CMPA.half.CMPA = 0x0080; // set compare A value
EPwm1Regs.AQCTLA.bit.CAU = AQ_SET; // HIGH on CMPA up match
EPwm1Regs.AQCTLA.bit.ZRO = AQ_CLEAR; // LOW on zero match
EALLOW;
SysCtrlRegs.PCLKCR0.bit.TBCLKSYNC = 1;
EDIS;
/* configure ADC */
InitAdc(); // [F2806x_Adc.c]
EALLOW;
AdcRegs.ADCCTL1.bit.INTPULSEPOS = 0; // early interrupt generation
AdcRegs.INTSEL1N2.bit.INT1E = 1; // enabled ADCINT1
AdcRegs.INTSEL1N2.bit.INT1CONT = 0; // disable ADCINT1 continuous mode
AdcRegs.INTSEL1N2.bit.INT1SEL = 1; // setup EOC1 to trigger ADCINT1
AdcRegs.INTSEL1N2.bit.INT2E = 0; // enable ADCINT2
AdcRegs.INTSEL1N2.bit.INT2CONT = 0; // disable ADCINT1 continuous mode
AdcRegs.INTSEL1N2.bit.INT2SEL = 0; // setup EOC1 to trigger ADCINT2
AdcRegs.ADCSOC0CTL.bit.CHSEL = 0; // set SOC0 channel select to ADCINA0
AdcRegs.ADCSOC1CTL.bit.CHSEL = 8; // set SOC1 channel select to ADCINB0
AdcRegs.ADCSOC0CTL.bit.TRIGSEL = 5; // set SOC0 start trigger on EPWM1A, due to round-robin SOC0 converts first then SOC1
AdcRegs.ADCSOC1CTL.bit.TRIGSEL = 5; // set SOC1 start trigger on EPWM1A, due to round-robin SOC0 converts first then SOC1
AdcRegs.ADCSOC0CTL.bit.ACQPS = 6; // set SOC0 S/H Window to 7 ADC Clock Cycles, (6 ACQPS plus 1)
AdcRegs.ADCSOC1CTL.bit.ACQPS = 6; // set SOC1 S/H Window to 7 ADC Clock Cycles, (6 ACQPS plus 1)
EDIS;
/* configure GPIO */
InitGpio(); // [F2806x_Gpio.c]
EALLOW;
GpioCtrlRegs.GPBMUX1.bit.GPIO34 = 0; // GPIO34 = I/O pin
GpioCtrlRegs.GPBDIR.bit.GPIO34 = 1; // GPIO34 = output
GpioDataRegs.GPBSET.bit.GPIO34 = 1; // GPIO34 = 1
GpioCtrlRegs.GPBMUX1.bit.GPIO39 = 0; // GPIO39 = I/O pin
GpioCtrlRegs.GPBDIR.bit.GPIO39 = 1; // GPIO39 = output
GpioDataRegs.GPBCLEAR.bit.GPIO39 = 1; // GPIO39 = 0
EDIS;
/* initialise controller variables */
nlpid1.sps = &sps1;
nlpid1.css = &css1;
nlpid1.sps->Kp = 3.5f;
nlpid1.sps->Ki = 0.004f;
nlpid1.sps->Kd = 0.35f;
nlpid1.sps->alpha_p = 0.8f;
nlpid1.sps->alpha_i = 0.95f;
nlpid1.sps->alpha_d = 1.0f;
nlpid1.sps->delta_p = 0.15f;
nlpid1.sps->delta_i = 0.15f;
nlpid1.sps->delta_d = 0.15f;
nlpid1.i7 = 0.0f;
nlpid1.i16 = 0.0f;
nlpid1.d2 = 0.0f;
nlpid1.d3 = 0.0f;
nlpid1.sps->c1 = 151.7093985989552f;
nlpid1.sps->c2 = 0.517093985989552f;
nlpid1.sps->Umax = 0.31f;
nlpid1.sps->Umin = -0.27f;
// set the gamma variables from the SPS
DCL_setNLPIDgamma(&nlpid1);
DCL_REQUEST_UPDATE(&nlpid1);
DCL_updateNLPID(&nlpid1);
rk = 0.25f; // initial value for control reference
lk = 1.0f; // control loop initially not saturated
/* enable interrupts */
PieCtrlRegs.PIEIER1.bit.INTx1 = 1; // enable PIE INT 1.1 (ADCINT1) - [adcisr]
IER |= M_INT1; // enable core interrupt 1 (ADC) - [control_isr]
SetDBGIER(0x0001); // enable real-time debug interupts
EINT; // enable global interrupt mask
EALLOW;
EPwm1Regs.TBCTL.bit.CTRMODE = 0; // PWM1 timer: count up and start
EDIS;
/* idle loop */
while(1)
{
// update linear gains if new NL parameters
DCL_updateNLPID(&nlpid1);
IdleLoopCount++; // increment loop counter
asm(" NOP");
} // while
} // main
/* control ISR: triggered by ADC EOC */
interrupt void control_Isr(void)
{
PieCtrlRegs.PIEACK.all = PIEACK_GROUP1;
AdcRegs.ADCINTFLGCLR.bit.ADCINT1 = 1;
// read ADC channel
yk = ((float) AdcResult.ADCRESULT0 - 2048.0f) / 2047.0f;
// run non-linear PID controller
uk = DCL_runNLPID_C1(&nlpid1, rk, yk, lk);
// external clamp for anti-windup reset
clampactive = DCL_runClamp_C2(&uk, upperlim, lowerlim);
lk = (clampactive == 0U) ? 1.0f : 0.0f;
// write u(k) to PWM
Duty = (uk / 2.0f + 0.5f) * (float) EPwm1Regs.TBPRD;
EPwm1Regs.CMPA.half.CMPA = (Uint16) Duty;
IsrCount++;
}
/* end of file */
@@ -0,0 +1,33 @@
<projectSpec>
<project
name="F28069_PID"
device="TMS320F28069"
configurations="DEBUG"
launchWizard="False"
linkerCommandFile=""
compilerBuildOptions="--opt_level=off -I${C2000WARE_F2806X_ROOT1} -I${C2000WARE_F2806X_ROOT2} -I${C2000WARE_DCL_INCLUDE_ROOT} -v28 -ml -mt --float_support=fpu32 --define=DEBUG --diag_warning=225 --diag_suppress=10063 --display_error_number"
linkerBuildOptions="--stack_size=0x400 --heap_size=0x200 --define RAM"
>
<pathVariable name="C2000WARE_F2806X_ROOT1" path="../../../../../../../device_support/f2806x/headers/include" scope="project" />
<pathVariable name="C2000WARE_F2806X_ROOT2" path="../../../../../../../device_support/f2806x/common/include" scope="project" />
<pathVariable name="C2000WARE_DCL_INCLUDE_ROOT" path="../../../include" scope="project" />
<file action="copy" path="../../../../../../../device_support/f2806x/common/source/F2806x_Adc.c" targetDirectory="" />
<file action="copy" path="../../../../../../../device_support/f2806x/common/source/F2806x_CpuTimers.c" targetDirectory="" />
<file action="copy" path="../../../../../../../device_support/f2806x/common/source/F2806x_DefaultIsr.c" targetDirectory="" />
<file action="copy" path="../../../../../../../device_support/f2806x/common/source/F2806x_EPwm.c" targetDirectory="" />
<file action="copy" path="../../../../../../../device_support/f2806x/headers/source/F2806x_GlobalVariableDefs.c" targetDirectory="" />
<file action="copy" path="../../../../../../../device_support/f2806x/common/source/F2806x_Gpio.c" targetDirectory="" />
<file action="copy" path="../../../../../../../device_support/f2806x/common/source/F2806x_PieCtrl.c" targetDirectory="" />
<file action="copy" path="../../../../../../../device_support/f2806x/common/source/F2806x_PieVect.c" targetDirectory="" />
<file action="copy" path="../../../../../../../device_support/f2806x/common/source/F2806x_SysCtrl.c" targetDirectory="" />
<file action="copy" path="../../../../../../../device_support/f2806x/common/source/F2806x_DBGIER.asm" targetDirectory="" />
<file action="copy" path="../../../../../../../device_support/f2806x/common/source/F2806x_DisInt.asm" targetDirectory="" />
<file action="copy" path="../../../../../../../device_support/f2806x/common/source/F2806x_usDelay.asm" targetDirectory="" />
<file action="copy" path="../../../../../../../device_support/f2806x/headers/cmd/F2806x_Headers_nonBIOS.cmd" targetDirectory="" />
<file action="copy" path="../../../cmd/F28069_stdmem.cmd" targetDirectory="" />
<file action="copy" path="../../../cmd/F28069_DCL.cmd" targetDirectory="" />
<file action="copy" path="../../../source/DCL_clamp_C1.asm" targetDirectory="" />
<file action="copy" path="../../../source/DCL_PID_C4.asm" targetDirectory="" />
<file action="copy" path="../Example_F28069_PID.c" targetDirectory="" />
</project>
</projectSpec>
@@ -0,0 +1,162 @@
/* Example_F28069_PID.c
*
* Copyright (C) 2020 Texas Instruments Incorporated - http://www.ti.com/
* ALL RIGHTS RESERVED
*
*/
// header files
#include "F2806x_Device.h"
#include "F2806x_Examples.h"
#include "F2806x_GlobalPrototypes.h"
#include "DCLF32.h"
// function prototypes
extern interrupt void control_Isr(void);
// global variables
long IdleLoopCount = 0;
long IsrCount = 0;
float rk = 0.25f;
float yk;
float lk;
float uk;
DCL_PID pid1 = PID_DEFAULTS;
float Duty;
float upperlim = 0.95f;
float lowerlim = 0.05f;
unsigned int clampactive;
/* main */
main()
{
/* initialise system */
InitSysCtrl(); // [F2806x_SysCtrl.c]
DINT; // disable interrupts
IER = 0x0000;
IFR = 0x0000;
InitPieCtrl(); // initialise PIE control registers [F2806x_PieCtrl.c]
InitPieVectTable(); // initialise PIE vector table [F2806x_PieVect.c]
EALLOW;
PieVectTable.ADCINT1 = &control_Isr; // [F28069_PID_cisr.c]
EDIS;
/* configure ePWM1 */
EALLOW;
SysCtrlRegs.PCLKCR0.bit.TBCLKSYNC = 0;
EDIS;
InitEPwm(); // [F2806x_EPwm.c]
EPwm1Regs.TBCTL.bit.CTRMODE = 3; // freeze TB counter
EPwm1Regs.TBCTL.bit.PRDLD = 1; // immediate load
EPwm1Regs.TBCTL.bit.PHSEN = 0; // disable phase loading
EPwm1Regs.TBCTL.bit.SYNCOSEL = 3; // disable SYNCOUT signal
EPwm1Regs.TBCTL.bit.HSPCLKDIV = 0; // TBCLK = SYSCLKOUT
EPwm1Regs.TBCTL.bit.CLKDIV = 0; // clock divider = /1
EPwm1Regs.TBCTL.bit.FREE_SOFT = 2; // free run on emulation suspend
EPwm1Regs.TBPRD = 0x2328; // set period for ePWM1 (0x2328 = 10kHz)
EPwm1Regs.TBPHS.all = 0; // time-base Phase Register
EPwm1Regs.TBCTR = 0; // time-base Counter Register
EPwm1Regs.ETSEL.bit.SOCAEN = 1; // enable SOC on A group
EPwm1Regs.ETSEL.bit.SOCASEL = 1; // select SOC from zero match
EPwm1Regs.ETPS.bit.SOCAPRD = 1; // generate pulse on 1st event
EPwm1Regs.CMPCTL.bit.SHDWAMODE = 0; // enable shadow mode
EPwm1Regs.CMPCTL.bit.LOADAMODE = 2; // reload on CTR=zero
EPwm1Regs.CMPA.half.CMPA = 0x0080; // set compare A value
EPwm1Regs.AQCTLA.bit.CAU = AQ_SET; // HIGH on CMPA up match
EPwm1Regs.AQCTLA.bit.ZRO = AQ_CLEAR; // LOW on zero match
EALLOW;
SysCtrlRegs.PCLKCR0.bit.TBCLKSYNC = 1;
EDIS;
/* configure ADC */
InitAdc(); // [F2806x_Adc.c]
EALLOW;
AdcRegs.ADCCTL1.bit.INTPULSEPOS = 0; // early interrupt generation
AdcRegs.INTSEL1N2.bit.INT1E = 1; // enabled ADCINT1
AdcRegs.INTSEL1N2.bit.INT1CONT = 0; // disable ADCINT1 continuous mode
AdcRegs.INTSEL1N2.bit.INT1SEL = 1; // setup EOC1 to trigger ADCINT1
AdcRegs.INTSEL1N2.bit.INT2E = 0; // enable ADCINT2
AdcRegs.INTSEL1N2.bit.INT2CONT = 0; // disable ADCINT1 continuous mode
AdcRegs.INTSEL1N2.bit.INT2SEL = 0; // setup EOC1 to trigger ADCINT2
AdcRegs.ADCSOC0CTL.bit.CHSEL = 0; // set SOC0 channel select to ADCINA0
AdcRegs.ADCSOC1CTL.bit.CHSEL = 8; // set SOC1 channel select to ADCINB0
AdcRegs.ADCSOC0CTL.bit.TRIGSEL = 5; // set SOC0 start trigger on EPWM1A, due to round-robin SOC0 converts first then SOC1
AdcRegs.ADCSOC1CTL.bit.TRIGSEL = 5; // set SOC1 start trigger on EPWM1A, due to round-robin SOC0 converts first then SOC1
AdcRegs.ADCSOC0CTL.bit.ACQPS = 6; // set SOC0 S/H Window to 7 ADC Clock Cycles, (6 ACQPS plus 1)
AdcRegs.ADCSOC1CTL.bit.ACQPS = 6; // set SOC1 S/H Window to 7 ADC Clock Cycles, (6 ACQPS plus 1)
EDIS;
/* configure GPIO */
InitGpio(); // [F2806x_Gpio.c]
EALLOW;
GpioCtrlRegs.GPBMUX1.bit.GPIO34 = 0; // GPIO34 = I/O pin
GpioCtrlRegs.GPBDIR.bit.GPIO34 = 1; // GPIO34 = output
GpioDataRegs.GPBSET.bit.GPIO34 = 1; // GPIO34 = 1
GpioCtrlRegs.GPBMUX1.bit.GPIO39 = 0; // GPIO39 = I/O pin
GpioCtrlRegs.GPBDIR.bit.GPIO39 = 1; // GPIO39 = output
GpioDataRegs.GPBCLEAR.bit.GPIO39 = 1; // GPIO39 = 0
EDIS;
/* initialise controller variables */
pid1.Kp = 9.0f;
pid1.Ki = 0.015f;
pid1.Kd = 0.35f;
pid1.Kr = 1.0f;
pid1.c1 = 188.0296600613396f;
pid1.c2 = 0.880296600613396f;
pid1.d2 = 0.0f;
pid1.d3 = 0.0f;
pid1.i10 = 0.0f;
pid1.i14 = 1.0f;
pid1.Umax = 1.0f;
pid1.Umin = -1.0f;
rk = 0.25f; // initial value for control reference
lk = 1.0f; // control loop not saturated
/* enable interrupts */
PieCtrlRegs.PIEIER1.bit.INTx1 = 1; // enable PIE INT 1.1 (ADCINT1) - [adcisr]
IER |= M_INT1; // enable core interrupt 1 (ADC) - [control_isr]
SetDBGIER(0x0001); // enable real-time debug interupts
EINT; // enable global interrupt mask
EALLOW;
EPwm1Regs.TBCTL.bit.CTRMODE = 0; // PWM1 timer: count up and start
EDIS;
/* idle loop */
while(1)
{
IdleLoopCount++; // increment loop counter
asm(" NOP");
} // while
} // main
/* control ISR: triggered by ADC EOC */
interrupt void control_Isr(void)
{
PieCtrlRegs.PIEACK.all = PIEACK_GROUP1;
AdcRegs.ADCINTFLGCLR.bit.ADCINT1 = 1;
// read ADC channel
yk = ((float) AdcResult.ADCRESULT0 - 2048.0f) / 2047.0f;
// run PID controller
uk = DCL_runPID_C4(&pid1, rk, yk, lk);
// external clamp for anti-windup reset
clampactive = DCL_runClamp_C1(&uk, upperlim, lowerlim);
lk = (clampactive == 0U) ? 1.0f : 0.0f;
// write u(k) to PWM
Duty = (uk / 2.0f + 0.5f) * (float) EPwm1Regs.TBPRD;
EPwm1Regs.CMPA.half.CMPA = (Uint16) Duty;
IsrCount++;
}
/* end of file */
@@ -0,0 +1,33 @@
<projectSpec>
<project
name="F28069_PI"
device="TMS320F28069"
configurations="DEBUG"
launchWizard="False"
linkerCommandFile=""
compilerBuildOptions="--opt_level=off -I${C2000WARE_F2806X_ROOT1} -I${C2000WARE_F2806X_ROOT2} -I${C2000WARE_DCL_INCLUDE_ROOT} -I${PROJECT_INCLUDE_ROOT} -v28 -ml -mt --float_support=fpu32 --define=DEBUG --diag_warning=225 --diag_suppress=10063,303 --display_error_number"
linkerBuildOptions="--stack_size=0x400 --heap_size=0x200 --define RAM"
>
<pathVariable name="C2000WARE_F2806X_ROOT1" path="../../../../../../../device_support/f2806x/headers/include" scope="project" />
<pathVariable name="C2000WARE_F2806X_ROOT2" path="../../../../../../../device_support/f2806x/common/include" scope="project" />
<pathVariable name="C2000WARE_DCL_INCLUDE_ROOT" path="../../../include" scope="project" />
<pathVariable name="PROJECT_INCLUDE_ROOT" path="../" scope="project" />
<file action="copy" path="../../../../../../../device_support/f2806x/common/source/F2806x_Adc.c" targetDirectory="" />
<file action="copy" path="../../../../../../../device_support/f2806x/common/source/F2806x_CpuTimers.c" targetDirectory="" />
<file action="copy" path="../../../../../../../device_support/f2806x/common/source/F2806x_DefaultIsr.c" targetDirectory="" />
<file action="copy" path="../../../../../../../device_support/f2806x/common/source/F2806x_EPwm.c" targetDirectory="" />
<file action="copy" path="../../../../../../../device_support/f2806x/headers/source/F2806x_GlobalVariableDefs.c" targetDirectory="" />
<file action="copy" path="../../../../../../../device_support/f2806x/common/source/F2806x_Gpio.c" targetDirectory="" />
<file action="copy" path="../../../../../../../device_support/f2806x/common/source/F2806x_PieCtrl.c" targetDirectory="" />
<file action="copy" path="../../../../../../../device_support/f2806x/common/source/F2806x_PieVect.c" targetDirectory="" />
<file action="copy" path="../../../../../../../device_support/f2806x/common/source/F2806x_SysCtrl.c" targetDirectory="" />
<file action="copy" path="../../../../../../../device_support/f2806x/common/source/F2806x_DisInt.asm" targetDirectory="" />
<file action="copy" path="../../../../../../../device_support/f2806x/common/source/F2806x_usDelay.asm" targetDirectory="" />
<file action="copy" path="../../../../../../../device_support/f2806x/headers/cmd/F2806x_Headers_nonBIOS.cmd" targetDirectory="" />
<file action="copy" path="../../../cmd/F28069_stdmem.cmd" targetDirectory="" />
<file action="copy" path="../../../cmd/F28069_DCL.cmd" targetDirectory="" />
<file action="copy" path="../../../source/DCL_PI_L1.asm" targetDirectory="" />
<file action="copy" path="../Example_F28069_PI.c" targetDirectory="" />
<file action="copy" path="../F28069_PI_CLA.cla" targetDirectory="" />
</project>
</projectSpec>
@@ -0,0 +1,50 @@
/* CLA_shared.h */
#ifndef _C_CLA_SHARED_H
#define _C_CLA_SHARED_H
#include "DCLCLA.h"
#include "F2806x_Cla_typedefs.h"
#define CLA_PROG_ENABLE 0x0001
#define CLARAM0_ENABLE 0x0010
#define CLARAM1_ENABLE 0x0020
#define CLARAM2_ENABLE 0x0040
#define CLA_RAM0CPUE 0x0100
#define CLA_RAM1CPUE 0x0200
#define CLA_RAM2CPUE 0x0400
/* shared controller data */
extern float rk;
extern float yk;
extern float uk;
extern DCL_PI_CLA pi1;
// CLA memory address symbols
extern Uint16 Cla1funcsLoadStart;
extern Uint16 Cla1funcsLoadEnd;
extern Uint16 Cla1funcsLoadSize;
extern Uint16 Cla1funcsRunStart;
extern Uint16 Cla1Prog_Start;
// CLA math table symbols
extern Uint16 Cla1mathTablesLoadStart;
extern Uint16 Cla1mathTablesLoadEnd;
extern Uint16 Cla1mathTablesLoadSize;
extern Uint16 Cla1mathTablesRunStart;
// CLA C Tasks
__interrupt void Cla1Task1();
__interrupt void Cla1Task2();
__interrupt void Cla1Task3();
__interrupt void Cla1Task4();
__interrupt void Cla1Task5();
__interrupt void Cla1Task6();
__interrupt void Cla1Task7();
__interrupt void Cla1Task8();
#endif // _C_CLA_SHARED_H
/* end of file */
@@ -0,0 +1,187 @@
/* Example_F28069_PI.c
*
* Copyright (C) 2020 Texas Instruments Incorporated - http://www.ti.com/
* ALL RIGHTS RESERVED
*
*/
// header files
#include "F2806x_Device.h"
#include "F2806x_Examples.h"
#include "F2806x_GlobalPrototypes.h"
#include "DCLCLA.h"
#include "CLA_shared.h"
// function prototypes
interrupt void control_Isr(void);
// global variables
long IdleLoopCount = 0;
long IsrCount = 0;
float Duty;
// shared variables
#pragma DATA_SECTION(rk, "CpuToCla1MsgRAM")
#pragma DATA_SECTION(yk, "CpuToCla1MsgRAM")
#pragma DATA_SECTION(uk, "Cla1ToCpuMsgRAM")
float rk = 0.25f;
float yk;
float uk;
#pragma DATA_SECTION(pi1, "Cla1DataRam1")
DCL_PI_CLA pi1 = PI_CLA_DEFAULTS;
main()
{
/* initialise system */
InitSysCtrl(); // [F2806x_SysCtrl.c]
DINT; // disable interrupts
IER = 0x0000;
IFR = 0x0000;
InitPieCtrl(); // initialise PIE control registers [F2806x_PieCtrl.c]
InitPieVectTable(); // initialise PIE vector table [F2806x_PieVect.c]
EALLOW;
PieVectTable.ADCINT1 = &control_Isr;
EDIS;
/* initialise PI controller */
pi1.Kp = 5.5f;
pi1.Ki = 0.015f;
pi1.i10 = 0.0f;
pi1.i6 = 1.0f;
pi1.Umax = 10.2f;
pi1.Umin = -10.2f;
/* compute CLA task vectors */
EALLOW;
Cla1Regs.MVECT1 = (Uint16)((Uint32)&Cla1Task1 -(Uint32)&Cla1Prog_Start);
Cla1Regs.MVECT2 = (Uint16)((Uint32)&Cla1Task2 -(Uint32)&Cla1Prog_Start);
Cla1Regs.MVECT3 = (Uint16)((Uint32)&Cla1Task3 -(Uint32)&Cla1Prog_Start);
Cla1Regs.MVECT4 = (Uint16)((Uint32)&Cla1Task4 -(Uint32)&Cla1Prog_Start);
Cla1Regs.MVECT5 = (Uint16)((Uint32)&Cla1Task5 -(Uint32)&Cla1Prog_Start);
Cla1Regs.MVECT6 = (Uint16)((Uint32)&Cla1Task6 -(Uint32)&Cla1Prog_Start);
Cla1Regs.MVECT7 = (Uint16)((Uint32)&Cla1Task7 -(Uint32)&Cla1Prog_Start);
Cla1Regs.MVECT8 = (Uint16)((Uint32)&Cla1Task8 -(Uint32)&Cla1Prog_Start);
/* CLA task triggers */
Cla1Regs.MPISRCSEL1.bit.PERINT1SEL = CLA_INT1_NONE;
Cla1Regs.MPISRCSEL1.bit.PERINT2SEL = CLA_INT2_NONE;
Cla1Regs.MPISRCSEL1.bit.PERINT3SEL = CLA_INT3_NONE;
Cla1Regs.MPISRCSEL1.bit.PERINT4SEL = CLA_INT4_NONE;
Cla1Regs.MPISRCSEL1.bit.PERINT5SEL = CLA_INT5_NONE;
Cla1Regs.MPISRCSEL1.bit.PERINT6SEL = CLA_INT6_NONE;
Cla1Regs.MPISRCSEL1.bit.PERINT7SEL = CLA_INT7_NONE;
Cla1Regs.MPISRCSEL1.bit.PERINT8SEL = CLA_INT8_NONE;
Cla1Regs.MIER.all = 0x00FF;
/* Switch the CLA program space to the CLA and enable software forcing
* Also switch over CLA data ram 0,1 and 2
* CAUTION: The RAMxCPUE bits can only be enabled by writing to the register
* and not the individual bit field. Furthermore, the status of these bitfields
* is not reflected in either the watch or register views - they always read as
* zeros. This is a known bug and the user is advised to test CPU accessibilty
* first before proceeding
*/
Cla1Regs.MMEMCFG.all = CLA_PROG_ENABLE|CLARAM0_ENABLE|CLARAM1_ENABLE|CLARAM2_ENABLE|CLA_RAM1CPUE;
Cla1Regs.MCTL.bit.IACKE = 1;
EDIS;
/* configure ePWM1 */
EALLOW;
SysCtrlRegs.PCLKCR0.bit.TBCLKSYNC = 0;
EDIS;
InitEPwm(); // [F2806x_EPwm.c]
EPwm1Regs.TBCTL.bit.CTRMODE = 3; // freeze TB counter
EPwm1Regs.TBCTL.bit.PRDLD = 1; // immediate load
EPwm1Regs.TBCTL.bit.PHSEN = 0; // disable phase loading
EPwm1Regs.TBCTL.bit.SYNCOSEL = 3; // disable SYNCOUT signal
EPwm1Regs.TBCTL.bit.HSPCLKDIV = 0; // TBCLK = SYSCLKOUT
EPwm1Regs.TBCTL.bit.CLKDIV = 0; // clock divider = /1
EPwm1Regs.TBCTL.bit.FREE_SOFT = 2; // free run on emulation suspend
EPwm1Regs.TBPRD = 0x2328; // set period for ePWM1 (0x2328 = 10kHz)
EPwm1Regs.TBPHS.all = 0; // time-base Phase Register
EPwm1Regs.TBCTR = 0; // time-base Counter Register
EPwm1Regs.ETSEL.bit.SOCAEN = 1; // enable SOC on A group
EPwm1Regs.ETSEL.bit.SOCASEL = 1; // select SOC from zero match
EPwm1Regs.ETPS.bit.SOCAPRD = 1; // generate pulse on 1st event
EPwm1Regs.CMPCTL.bit.SHDWAMODE = 0; // enable shadow mode
EPwm1Regs.CMPCTL.bit.LOADAMODE = 2; // reload on CTR=zero
EPwm1Regs.CMPA.half.CMPA = 0x0080; // set compare A value
EPwm1Regs.AQCTLA.bit.CAU = AQ_SET; // HIGH on CMPA up match
EPwm1Regs.AQCTLA.bit.ZRO = AQ_CLEAR; // LOW on zero match
EALLOW;
SysCtrlRegs.PCLKCR0.bit.TBCLKSYNC = 1;
EDIS;
/* configure ADC */
InitAdc(); // [F2806x_Adc.c]
EALLOW;
AdcRegs.ADCCTL1.bit.INTPULSEPOS = 0; // early interrupt generation
AdcRegs.INTSEL1N2.bit.INT1E = 1; // enabled ADCINT1
AdcRegs.INTSEL1N2.bit.INT1CONT = 0; // disable ADCINT1 continuous mode
AdcRegs.INTSEL1N2.bit.INT1SEL = 1; // setup EOC1 to trigger ADCINT1
AdcRegs.INTSEL1N2.bit.INT2E = 0; // enable ADCINT2
AdcRegs.INTSEL1N2.bit.INT2CONT = 0; // disable ADCINT1 continuous mode
AdcRegs.INTSEL1N2.bit.INT2SEL = 0; // setup EOC1 to trigger ADCINT2
AdcRegs.ADCSOC0CTL.bit.CHSEL = 0; // set SOC0 channel select to ADCINA0
AdcRegs.ADCSOC1CTL.bit.CHSEL = 8; // set SOC1 channel select to ADCINB0
AdcRegs.ADCSOC0CTL.bit.TRIGSEL = 5; // set SOC0 start trigger on EPWM1A, due to round-robin SOC0 converts first then SOC1
AdcRegs.ADCSOC1CTL.bit.TRIGSEL = 5; // set SOC1 start trigger on EPWM1A, due to round-robin SOC0 converts first then SOC1
AdcRegs.ADCSOC0CTL.bit.ACQPS = 6; // set SOC0 S/H Window to 7 ADC Clock Cycles, (6 ACQPS plus 1)
AdcRegs.ADCSOC1CTL.bit.ACQPS = 6; // set SOC1 S/H Window to 7 ADC Clock Cycles, (6 ACQPS plus 1)
EDIS;
/* configure GPIO */
InitGpio(); // [F2806x_Gpio.c]
EALLOW;
GpioCtrlRegs.GPBMUX1.bit.GPIO34 = 0; // GPIO34 = I/O pin
GpioCtrlRegs.GPBDIR.bit.GPIO34 = 1; // GPIO34 = output
GpioDataRegs.GPBSET.bit.GPIO34 = 1; // GPIO34 = 1
GpioCtrlRegs.GPBMUX1.bit.GPIO39 = 0; // GPIO39 = I/O pin
GpioCtrlRegs.GPBDIR.bit.GPIO39 = 1; // GPIO39 = output
GpioDataRegs.GPBCLEAR.bit.GPIO39 = 1; // GPIO39 = 0
/* CLA setup */
Cla1Regs.MIER.bit.INT3 = 1;
Cla1Regs.MIER.bit.INT8 = 1;
Cla1ForceTask8andWait();
/* enable interrupts */
PieCtrlRegs.PIEIER1.bit.INTx1 = 1; // enable PIE INT 1.1 (ADCINT1) - [adcisr]
IER |= M_INT1; // enable CPU Interrupt 1 (TINT0)
EINT; // enable global interrupt mask
EPwm1Regs.TBCTL.bit.CTRMODE = 0; // PWM1 timer: count up and start
EDIS;
/* idle loop */
while(1)
{
IdleLoopCount++;
}
}
/* control ISR: triggered by ADC EOC */
interrupt void control_Isr(void)
{
PieCtrlRegs.PIEACK.all = PIEACK_GROUP1;
AdcRegs.ADCINTFLGCLR.bit.ADCINT1 = 1;
// read ADC channel
yk = ((float) AdcResult.ADCRESULT0 - 2048.0f) / 2047.0f;
// trigger PI controller on CLA
EALLOW;
Cla1ForceTask3andWait();
// write u(k) to PWM
Duty = (uk / 2.0f + 0.5f) * (float) EPwm1Regs.TBPRD;
EPwm1Regs.CMPA.half.CMPA = (Uint16) Duty;
IsrCount++;
}
/* end of file */
@@ -0,0 +1,62 @@
/* control_F28069_CLA.cla
*
* Copyright (C) 2020 Texas Instruments Incorporated - http://www.ti.com/
* ALL RIGHTS RESERVED
*
*/
#include "CLA_shared.h"
#include "F2806x_Cla_typedefs.h"
#include "F2806x_Device.h"
__interrupt void Cla1Task1 ( void )
{
}
__interrupt void Cla1Task2 ( void )
{
}
// task 3 contains the PI controller
__interrupt void Cla1Task3 ( void )
{
// __mdebugstop();
// run the PI controller
uk = DCL_runPI_L1(&pi1, rk, yk);
__mnop();
__mnop();
__mnop();
}
__interrupt void Cla1Task4 ( void )
{
}
__interrupt void Cla1Task5 ( void )
{
}
__interrupt void Cla1Task6 ( void )
{
}
__interrupt void Cla1Task7 ( void )
{
}
__interrupt void Cla1Task8 ( void )
{
}
// end of file
@@ -0,0 +1,31 @@
<projectSpec>
<project
name="F28069_SMITH"
device="TMS320F28069"
configurations="DEBUG"
launchWizard="False"
linkerCommandFile=""
compilerBuildOptions="--opt_level=off -I${C2000WARE_F2806X_ROOT1} -I${C2000WARE_F2806X_ROOT2} -I${C2000WARE_DCL_INCLUDE_ROOT} -v28 -ml -mt --float_support=fpu32 --define=DEBUG --diag_warning=225 --diag_suppress=10063 --display_error_number"
linkerBuildOptions="--stack_size=0x400 --heap_size=0x200 --define RAM"
>
<pathVariable name="C2000WARE_F2806X_ROOT1" path="../../../../../../../device_support/f2806x/headers/include" scope="project" />
<pathVariable name="C2000WARE_F2806X_ROOT2" path="../../../../../../../device_support/f2806x/common/include" scope="project" />
<pathVariable name="C2000WARE_DCL_INCLUDE_ROOT" path="../../../include" scope="project" />
<file action="copy" path="../../../../../../../device_support/f2806x/common/source/F2806x_Adc.c" targetDirectory="" />
<file action="copy" path="../../../../../../../device_support/f2806x/common/source/F2806x_CpuTimers.c" targetDirectory="" />
<file action="copy" path="../../../../../../../device_support/f2806x/common/source/F2806x_DefaultIsr.c" targetDirectory="" />
<file action="copy" path="../../../../../../../device_support/f2806x/common/source/F2806x_EPwm.c" targetDirectory="" />
<file action="copy" path="../../../../../../../device_support/f2806x/headers/source/F2806x_GlobalVariableDefs.c" targetDirectory="" />
<file action="copy" path="../../../../../../../device_support/f2806x/common/source/F2806x_Gpio.c" targetDirectory="" />
<file action="copy" path="../../../../../../../device_support/f2806x/common/source/F2806x_PieCtrl.c" targetDirectory="" />
<file action="copy" path="../../../../../../../device_support/f2806x/common/source/F2806x_PieVect.c" targetDirectory="" />
<file action="copy" path="../../../../../../../device_support/f2806x/common/source/F2806x_SysCtrl.c" targetDirectory="" />
<file action="copy" path="../../../../../../../device_support/f2806x/common/source/F2806x_DBGIER.asm" targetDirectory="" />
<file action="copy" path="../../../../../../../device_support/f2806x/common/source/F2806x_DisInt.asm" targetDirectory="" />
<file action="copy" path="../../../../../../../device_support/f2806x/common/source/F2806x_usDelay.asm" targetDirectory="" />
<file action="copy" path="../../../../../../../device_support/f2806x/headers/cmd/F2806x_Headers_nonBIOS.cmd" targetDirectory="" />
<file action="copy" path="../../../cmd/F28069_stdmem.cmd" targetDirectory="" />
<file action="copy" path="../../../cmd/F28069_DCL.cmd" targetDirectory="" />
<file action="copy" path="../Example_F28069_Smith.c" targetDirectory="" />
</project>
</projectSpec>
@@ -0,0 +1,171 @@
/* Example_F28069_Smith.c
*
* Copyright (C) 2020 Texas Instruments Incorporated - http://www.ti.com/
* ALL RIGHTS RESERVED
*
*/
// header files
#include "F2806x_Device.h"
#include "F2806x_Examples.h"
#include "F2806x_GlobalPrototypes.h"
#include "DCLF32.h"
#include "DCL_fdlog.h"
// function prototypes
extern interrupt void control_Isr(void);
// global variables
uint32_t IdleLoopCount = 0;
uint32_t IsrCount = 0;
float32_t rk = 0.25f, yk, uk;
float32_t Duty;
// controller
DCL_DF23 F = DF23_DEFAULTS;
DCL_CSS Fcss = DCL_CSS_DEFAULTS;
DCL_DF23_SPS Fsps = DF23_SPS_DEFAULTS;
float32_t v3, v5 = 0.0f, v6 = 0.0f;
// plant model
DCL_DF13 GH = DF13_DEFAULTS;
// modelled delay
#define GH_DELAY_LINE_LENGTH 13
#pragma DATA_SECTION(p_array, "PDataLogSection")
float32_t p_array[GH_DELAY_LINE_LENGTH];
FDLOG pBuf = FDLOG_DEFAULTS;
/* main */
main()
{
/* initialise system */
InitSysCtrl(); // [F2806x_SysCtrl.c]
DINT; // disable interrupts
IER = 0x0000;
IFR = 0x0000;
InitPieCtrl(); // initialise PIE control registers [F2806x_PieCtrl.c]
InitPieVectTable(); // initialise PIE vector table [F2806x_PieVect.c]
EALLOW;
PieVectTable.ADCINT1 = &control_Isr; // load interrupt vector
EDIS;
/* configure ePWM1 */
EALLOW;
SysCtrlRegs.PCLKCR0.bit.TBCLKSYNC = 0;
EDIS;
InitEPwm(); // [F2806x_EPwm.c]
EPwm1Regs.TBCTL.bit.CTRMODE = 3; // freeze TB counter
EPwm1Regs.TBCTL.bit.PRDLD = 1; // immediate load
EPwm1Regs.TBCTL.bit.PHSEN = 0; // disable phase loading
EPwm1Regs.TBCTL.bit.SYNCOSEL = 3; // disable SYNCOUT signal
EPwm1Regs.TBCTL.bit.HSPCLKDIV = 0; // TBCLK = SYSCLKOUT
EPwm1Regs.TBCTL.bit.CLKDIV = 0; // clock divider = /1
EPwm1Regs.TBCTL.bit.FREE_SOFT = 2; // free run on emulation suspend
EPwm1Regs.TBPRD = 0x2328; // set period for ePWM1 (0x2328 = 10kHz)
EPwm1Regs.TBPHS.all = 0; // time-base Phase Register
EPwm1Regs.TBCTR = 0; // time-base Counter Register
EPwm1Regs.ETSEL.bit.SOCAEN = 1; // enable SOC on A group
EPwm1Regs.ETSEL.bit.SOCASEL = 1; // select SOC from zero match
EPwm1Regs.ETPS.bit.SOCAPRD = 1; // generate pulse on 1st event
EPwm1Regs.CMPCTL.bit.SHDWAMODE = 0; // enable shadow mode
EPwm1Regs.CMPCTL.bit.LOADAMODE = 2; // reload on CTR=zero
EPwm1Regs.CMPA.half.CMPA = 0x0080; // set compare A value
EPwm1Regs.AQCTLA.bit.CAU = AQ_SET; // HIGH on CMPA up match
EPwm1Regs.AQCTLA.bit.ZRO = AQ_CLEAR; // LOW on zero match
EALLOW;
SysCtrlRegs.PCLKCR0.bit.TBCLKSYNC = 1;
EDIS;
/* configure ADC */
InitAdc(); // [F2806x_Adc.c]
EALLOW;
AdcRegs.ADCCTL1.bit.INTPULSEPOS = 0; // early interrupt generation
AdcRegs.INTSEL1N2.bit.INT1E = 1; // enable ADCINT1
AdcRegs.INTSEL1N2.bit.INT1CONT = 0; // disable ADCINT1 continuous mode
AdcRegs.INTSEL1N2.bit.INT1SEL = 1; // setup EOC1 to trigger ADCINT1
AdcRegs.INTSEL1N2.bit.INT2E = 0; // disable ADCINT2
AdcRegs.INTSEL1N2.bit.INT2CONT = 0; // disable ADCINT1 continuous mode
AdcRegs.INTSEL1N2.bit.INT2SEL = 0; // no trigger to ADCINT2
AdcRegs.ADCSOC0CTL.bit.CHSEL = 0; // set SOC0 channel select to ADCINA0
AdcRegs.ADCSOC1CTL.bit.CHSEL = 8; // set SOC1 channel select to ADCINB0
AdcRegs.ADCSOC0CTL.bit.TRIGSEL = 5; // set SOC0 start trigger on EPWM1A, due to round-robin SOC0 converts first then SOC1
AdcRegs.ADCSOC1CTL.bit.TRIGSEL = 5; // set SOC1 start trigger on EPWM1A, due to round-robin SOC0 converts first then SOC1
AdcRegs.ADCSOC0CTL.bit.ACQPS = 6; // set SOC0 S/H Window to 7 ADC Clock Cycles, (6 ACQPS plus 1)
AdcRegs.ADCSOC1CTL.bit.ACQPS = 6; // set SOC1 S/H Window to 7 ADC Clock Cycles, (6 ACQPS plus 1)
AdcRegs.ADCINTFLGCLR.bit.ADCINT1 = 1;
EDIS;
/* delay line initialization */
DCL_initLog(&pBuf, p_array, GH_DELAY_LINE_LENGTH);
DCL_clearLog(&pBuf);
/* initialize plant model */
// 4.95e-05 z^2 + 4.926e-07 z - 4.901e-05
// GH(z) = --------------------------------------
// z^3 - 2.97 z^2 + 2.94 z - 0.9704
GH.b0 = 0.0f;
GH.b1 = 4.95e-05f;
GH.b2 = 4.926e-07f;
GH.b3 = -4.901e-05f;
GH.a0 = 1.0f;
GH.a1 = -2.97f;
GH.a2 = 2.94f;
GH.a3 = -0.9704f;
/* initalize controller */
F.b0 = 9.6580f;
F.b1 = -9.1580f;
F.b2 = -9.6521f;
F.b3 = 9.1639f;
F.a1 = -2.1280f;
F.a2 = 1.3968f;
F.a3 = -0.2689f;
/* enable interrupts */
PieCtrlRegs.PIEIER1.bit.INTx1 = 1; // enable PIE INT 1.1 (ADCINT1) - [adcisr]
IER |= M_INT1; // enable core interrupt 1 (ADC) - [control_isr]
SetDBGIER(0x0001); // enable real-time debug interrupts
EINT; // enable global interrupt mask
EALLOW;
EPwm1Regs.TBCTL.bit.CTRMODE = 0; // PWM1 timer: count up and start
EDIS;
/* idle loop */
while(1)
{
IdleLoopCount++; // increment loop counter
asm(" NOP");
} // while
} // main
/* control ISR: triggered by ADC EOC */
interrupt void control_Isr(void)
{
PieCtrlRegs.PIEACK.all = PIEACK_GROUP1;
AdcRegs.ADCINTFLGCLR.bit.ADCINT1 = 1;
// read feedback
yk = ((float) AdcResult.ADCRESULT0 - 2048.0f) / 2047.0f;
// run controller
v3 = rk - yk + v6 - v5;
uk = DCL_runDF23_C4(&F, v3); // control effort
v5 = DCL_runDF13_C4(&GH, uk); // plant model
v6 = DCL_writeLog(&pBuf, v5); // delay line
// write u(k) to PWM
Duty = (uk / 2.0f + 0.5f) * (float) EPwm1Regs.TBPRD;
EPwm1Regs.CMPA.half.CMPA = (Uint16) Duty;
IsrCount++;
}
/* end of file */
@@ -0,0 +1,31 @@
<projectSpec>
<project
name="F28069_TCM"
device="TMS320F28069"
configurations="DEBUG"
launchWizard="False"
linkerCommandFile=""
compilerBuildOptions="--opt_level=off -I${C2000WARE_F2806X_ROOT1} -I${C2000WARE_F2806X_ROOT2} -I${C2000WARE_DCL_INCLUDE_ROOT} -v28 -ml -mt --float_support=fpu32 --define=DEBUG --diag_warning=225 --diag_suppress=10063 --display_error_number"
linkerBuildOptions="--stack_size=0x400 --heap_size=0x200 --define RAM"
>
<pathVariable name="C2000WARE_F2806X_ROOT1" path="../../../../../../../device_support/f2806x/headers/include" scope="project" />
<pathVariable name="C2000WARE_F2806X_ROOT2" path="../../../../../../../device_support/f2806x/common/include" scope="project" />
<pathVariable name="C2000WARE_DCL_INCLUDE_ROOT" path="../../../include" scope="project" />
<file action="copy" path="../../../../../../../device_support/f2806x/common/source/F2806x_CpuTimers.c" targetDirectory="" />
<file action="copy" path="../../../../../../../device_support/f2806x/common/source/F2806x_DefaultIsr.c" targetDirectory="" />
<file action="copy" path="../../../../../../../device_support/f2806x/headers/source/F2806x_GlobalVariableDefs.c" targetDirectory="" />
<file action="copy" path="../../../../../../../device_support/f2806x/common/source/F2806x_PieCtrl.c" targetDirectory="" />
<file action="copy" path="../../../../../../../device_support/f2806x/common/source/F2806x_PieVect.c" targetDirectory="" />
<file action="copy" path="../../../../../../../device_support/f2806x/common/source/F2806x_SysCtrl.c" targetDirectory="" />
<file action="copy" path="../../../../../../../device_support/f2806x/common/source/F2806x_DisInt.asm" targetDirectory="" />
<file action="copy" path="../../../../../../../device_support/f2806x/common/source/F2806x_usDelay.asm" targetDirectory="" />
<file action="copy" path="../../../../../../../device_support/f2806x/headers/cmd/F2806x_Headers_nonBIOS.cmd" targetDirectory="" />
<file action="copy" path="../../../cmd/F28069_stdmem.cmd" targetDirectory="" />
<file action="copy" path="../../../cmd/F28069_DCL.cmd" targetDirectory="" />
<file action="copy" path="../../../source/DCL_index.asm" targetDirectory="" />
<file action="copy" path="../../../source/DCL_frwlog.asm" targetDirectory="" />
<file action="copy" path="../Example_F28069_TCM.c" targetDirectory="" />
<file action="copy" path="../TCM_input.dat" targetDirectory="" />
<file action="copy" path="../TCM_response.dat" targetDirectory="" />
</project>
</projectSpec>
@@ -0,0 +1,133 @@
/* Example_F28069_TCM.c
*
* Copyright (C) 2020 Texas Instruments Incorporated - http://www.ti.com/
* ALL RIGHTS RESERVED
*
*/
#include "F2806x_Device.h"
#include "F2806x_Examples.h"
#include "F2806x_GlobalPrototypes.h"
#include "DCLF32.h"
#include "DCL_fdlog.h"
#include "DCL_TCM.h"
#define DATA_LENGTH 1601
#define TCM_DATA_LENGTH 350
#define ISR_FREQ 10000.0f
// input reference data
#pragma DATA_SECTION(r_array, "PDataLogSection")
float r_array[DATA_LENGTH];
FDLOG rBuf = FDLOG_DEFAULTS;
// feedback data
#pragma DATA_SECTION(y_array, "QDataLogSection")
float y_array[DATA_LENGTH];
FDLOG yBuf = FDLOG_DEFAULTS;
// servo loop error
#pragma DATA_SECTION(e_array, "RDataLogSection")
float e_array[DATA_LENGTH];
FDLOG eBuf = FDLOG_DEFAULTS;
// transient data
#pragma DATA_SECTION(d_array, "SDataLogSection")
float d_array[DATA_LENGTH];
FDLOG dBuf = FDLOG_DEFAULTS;
interrupt void control_Isr(void);
// global variables
long IdleLoopCount = 0;
long IsrCount = 0;
float rk;
float yk;
float ek;
TCM tcm1 = TCM_DEFAULTS;
float P1;
float P2;
float P3;
/* main */
main()
{
// initialise system
InitSysCtrl();
DINT;
IER = 0x0000;
IFR = 0x0000;
InitPieCtrl();
InitPieVectTable();
EALLOW;
PieVectTable.TINT0 = &control_Isr;
EDIS;
// configure CPU timer 0
InitCpuTimers();
ConfigCpuTimer(&CpuTimer0, 90.0, ISR_FREQ);
// initialise data arrays
DCL_initLog(&rBuf, r_array, DATA_LENGTH);
DCL_initLog(&yBuf, y_array, DATA_LENGTH);
DCL_initLog(&eBuf, e_array, DATA_LENGTH);
DCL_initLog(&dBuf, d_array, TCM_DATA_LENGTH);
DCL_clearLog(&eBuf);
// initialise TCM
DCL_initTCM(&tcm1, dBuf.fptr, TCM_DATA_LENGTH, 25, -0.001f, 0.001f);
DCL_armTCM(&tcm1);
// enable interrupts
PieCtrlRegs.PIEIER1.bit.INTx7 = 1;
IER |= M_INT1;
EINT;
StartCpuTimer0();
// idle loop
while(1)
{
IdleLoopCount++;
}
}
/* control ISR: triggered by CPU timer 0 */
interrupt void control_Isr(void)
{
// clear timer flag & acknowledge interrupt
CpuTimer0Regs.TCR.bit.TIF = 1;
PieCtrlRegs.PIEACK.all = PIEACK_GROUP1;
IsrCount++;
// read feedback data from log
rk = DCL_freadLog(&rBuf);
yk = DCL_freadLog(&yBuf);
// run the TCM
DCL_runTCM(&tcm1, yk);
// log the servo error
ek = rk - yk;
DCL_fwriteLog(&eBuf, ek);
// if data read-out complete
if FDLOG_START(&rBuf)
{
// stop interrupt
PieCtrlRegs.PIEIER1.bit.INTx7 = 0;
// compute performance indices
P1 = DCL_runITAE_C1(&eBuf, 1/ISR_FREQ);
P2 = DCL_runIAE_C1(&eBuf);
P3 = DCL_runIES_C1(&eBuf);
// place preak-point here
asm(" NOP");
}
}
/* end of file */
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,27 @@
<projectSpec>
<project
name="F28388D_PIDF64"
device="TMS320F28388D"
configurations="DEBUG"
cgtVersion="22.6.0.LTS"
outputFormat="ELF"
launchWizard="False"
linkerCommandFile=""
compilerBuildOptions="--opt_level=off -I${C2000WARE_DLIB_ROOT} -I${C2000WARE_F2838X_ROOT1} -I${C2000WARE_F2838X_ROOT2} -I${C2000WARE_DCL_INCLUDE_ROOT} -v28 -ml -mt --float_support=fpu64 --define=DEBUG --diag_warning=225 --diag_suppress=10063 --display_error_number --abi=eabi --define=CPU1"
linkerBuildOptions="--stack_size=0x400 --heap_size=0x200 --define RAM"
>
<pathVariable name="C2000WARE_DLIB_ROOT" path="../../../../../../../driverlib/f2838x/driverlib" scope="project" />
<pathVariable name="C2000WARE_F2838X_ROOT1" path="../../../../../../../device_support/f2838x/headers/include" scope="project" />
<pathVariable name="C2000WARE_F2838X_ROOT2" path="../../../../../../../device_support/f2838x/common/include" scope="project" />
<pathVariable name="C2000WARE_DCL_INCLUDE_ROOT" path="../../../include" scope="project" />
<file action="copy" path="../../../../../../../device_support/f2838x/common/include/driverlib.h" targetDirectory="" />
<file action="copy" path="../../../../../../../device_support/f2838x/common/include/device.h" targetDirectory="" />
<file action="copy" path="../../../../../../../device_support/f2838x/common/source/device.c" targetDirectory="" />
<file action="copy" path="../../../../../../../device_support/f2838x/common/source/f2838x_codestartbranch.asm" targetDirectory="" />
<file action="copy" path="../../../../../../../driverlib/f2838x/driverlib/ccs/Debug/driverlib.lib" targetDirectory="" />
<file action="copy" path="../Example_F28388D_PIDF64.c" targetDirectory="" />
<file action="copy" path="../../../cmd/F28388D_stdmem_cpu1.cmd" targetDirectory="" />
<file action="copy" path="../../../cmd/F28388D_DCL.cmd" targetDirectory="" />
<file action="copy" path="../../../source/DCL_error.c" targetDirectory="" />
</project>
</projectSpec>
@@ -0,0 +1,139 @@
/* Example_F28388D_PIDF64.c
*
* Copyright (C) 2020 Texas Instruments Incorporated - http://www.ti.com/
* ALL RIGHTS RESERVED
*
*/
#include "device.h"
#include "DCLF64.h"
#include "DCL_fdlog64.h"
#define ISR_PRD 10000
// data logs
#pragma DATA_SECTION(p_array, "PDataLogSection")
#pragma DATA_SECTION(q_array, "QDataLogSection")
#pragma DATA_SECTION(r_array, "RDataLogSection")
#pragma DATA_SECTION(s_array, "SDataLogSection")
// section addresses from linker file
extern unsigned int pData_start;
extern unsigned int qData_start;
extern unsigned int rData_start;
extern unsigned int sData_start;
// data arrays
float64_t p_array[FDLOG64_DEFAULT_SIZE];
float64_t q_array[FDLOG64_DEFAULT_SIZE];
float64_t r_array[FDLOG64_DEFAULT_SIZE];
float64_t s_array[FDLOG64_DEFAULT_SIZE];
// data log structs
FDLOG64 pBuf = FDLOG64_DEFAULTS;
FDLOG64 qBuf = FDLOG64_DEFAULTS;
FDLOG64 rBuf = FDLOG64_DEFAULTS;
FDLOG64 sBuf = FDLOG64_DEFAULTS;
// global variables
uint32_t IdleLoopCount = 0L;
uint32_t IsrCount = 0L;
float64_t rk = 0.25f;
float64_t yk;
float64_t lk;
float64_t uk;
DCL_PIDF64 pid = PIDF64_DEFAULTS;
// function prototypes
__interrupt void control_isr(void);
void configCPUTimer(uint32_t, uint32_t);
void main(void)
{
// device initialization
Device_init();
SysCtl_disableWatchdog();
Device_initGPIO();
Interrupt_initModule();
DINT;
Interrupt_initVectorTable();
// configure CPU timer 0 interrupt
Interrupt_register(INT_TIMER0, &control_isr);
configCPUTimer(CPUTIMER0_BASE, ISR_PRD);
CPUTimer_enableInterrupt(CPUTIMER0_BASE);
Interrupt_enable(INT_TIMER0);
// initialize data logs
DCL_initLog64(&pBuf, (float64_t *) &pData_start, FDLOG64_DEFAULT_SIZE);
DCL_initLog64(&qBuf, (float64_t *) &qData_start, FDLOG64_DEFAULT_SIZE);
DCL_initLog64(&rBuf, (float64_t *) &rData_start, FDLOG64_DEFAULT_SIZE);
DCL_initLog64(&sBuf, (float64_t *) &sData_start, FDLOG64_DEFAULT_SIZE);
DCL_fillLog64(&rBuf, 1.0);
DCL_clearLog64(&sBuf);
// controller initialization
pid.Kp = 5.4;
pid.Ki = 0.0014;
pid.Kd = 0.25;
pid.Kr = 1.0;
pid.c1 = 628.2199;
pid.c2 = -0.9997;
pid.c1 = 151.7094;
pid.c2 = 0.5171;
DCL_BREAK_POINT;
// enable interrupt
CPUTimer_startTimer(CPUTIMER0_BASE);
EINT;
ERTM;
// idle loop
do {
if (FDLOG64_END(&sBuf))
{
DCL_BREAK_POINT;
}
IdleLoopCount++;
} while(1);
}
// control interrupt service routine
__interrupt void control_isr(void)
{
// read inputs
rk = DCL_readLog64(&pBuf);
yk = DCL_readLog64(&qBuf);
lk = DCL_readLog64(&rBuf);
// run PIDF64 controller
uk = DCL_runPIDF64_S1(&pid, rk, yk, lk);
// store the control
DCL_writeLog64(&sBuf, uk);
// stop timer at end of buffer
if (FDLOG64_END(&sBuf))
{
CPUTimer_stopTimer(CPUTIMER0_BASE);
}
IsrCount++;
Interrupt_clearACKGroup(INTERRUPT_ACK_GROUP1);
}
// CPU timer configuration
void configCPUTimer(uint32_t cpuTimer, uint32_t period)
{
CPUTimer_setPeriod(cpuTimer, period);
CPUTimer_setPreScaler(cpuTimer, 0);
CPUTimer_stopTimer(cpuTimer);
CPUTimer_reloadTimerCounter(cpuTimer);
}
/* end of file */
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,29 @@
<projectSpec>
<project
name="F28P55x_DF22"
device="TMS320F28P550SJ9"
cgtVersion="22.6.0.LTS"
outputFormat="ELF"
launchWizard="False"
linkerCommandFile=""
>
<configuration name="CPU1_RAM" compilerBuildOptions="--opt_level=off -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} -I${DCL_INCLUDE} -v28 -ml -mt --float_support=fpu32 --tmu_support=tmu0 --define=CPU1 --define=DEBUG --define RAM --diag_warning=225 --diag_suppress=10063" linkerBuildOptions="--entry_point code_start --stack_size=0x200 --heap_size=0x100 "/>
<pathVariable name="C2000WARE_DLIB_ROOT" path="../../../../../../../driverlib/f28p55x/driverlib/" scope="project"/>
<pathVariable name="DCL_INCLUDE" path="../../../include" scope="project"/>
<pathVariable name="C2000WARE_DEVICE_SUPPORT" path="../../../../../../../device_support" scope="project"/>
<file action="copy" path="C2000WARE_DEVICE_SUPPORT/f28p55x/common/include/driverlib.h" targetDirectory="device"/>
<file action="copy" path="C2000WARE_DEVICE_SUPPORT/f28p55x/common/include/device.h" targetDirectory="device"/>
<file action="copy" path="C2000WARE_DEVICE_SUPPORT/f28p55x/common/source/device.c" targetDirectory="device"/>
<file action="copy" path="C2000WARE_DEVICE_SUPPORT/f28p55x/common/source/f28p55x_codestartbranch.asm" targetDirectory="device"/>
<file action="copy" path="C2000WARE_DEVICE_SUPPORT/f28p55x/common/targetConfigs/TMS320F28P550SJ9.ccxml" targetDirectory="targetConfigs"/>
<file action="link" path="C2000WARE_DLIB_ROOT/ccs/Debug/driverlib.lib" targetDirectory=""/>
<file action="copy" path="../Example_DF22.c" targetDirectory=""/>
<file action="copy" path="../../../source/DCL_error.c" targetDirectory=""/>
<file action="copy" path="../../../source/DCL_clamp_C1.asm" targetDirectory="" />
<file action="copy" path="../../../source/DCL_DF22_C1.asm" targetDirectory="" />
<file action="copy" path="../../../source/DCL_DF22_C2C3.asm" targetDirectory="" />
<file action="copy" path="../DF22_edata.dat" targetDirectory="" />
<file action="copy" path="C2000WARE_DEVICE_SUPPORT/f28p55x/common/cmd/28p55x_generic_ram_lnk.cmd" targetDirectory=""/>
<file action="copy" path="../../../cmd/F28P55x_DCL.cmd" targetDirectory=""/>
</project>
</projectSpec>
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,168 @@
/* Example_DF22.c
*
* Copyright (C) 2020 Texas Instruments Incorporated - http://www.ti.com/
* ALL RIGHTS RESERVED
*
*/
#include "driverlib.h"
#include "device.h"
#include "DCLF32.h"
#include "DCL_fdlog.h"
#define DATA_LENGTH 1601
// input data
#pragma DATA_SECTION(e_array, "PDataLogSection")
float e_array[DATA_LENGTH];
FDLOG eBuf = FDLOG_DEFAULTS;
// full controller results
#pragma DATA_SECTION(u1_array, "QDataLogSection")
float u1_array[DATA_LENGTH];
FDLOG u1Buf = FDLOG_DEFAULTS;
// pre-computed controller results
#pragma DATA_SECTION(u2_array, "RDataLogSection")
float u2_array[DATA_LENGTH];
FDLOG u2Buf = FDLOG_DEFAULTS;
// controller difference data
#pragma DATA_SECTION(d_array, "SDataLogSection")
float d_array[DATA_LENGTH];
FDLOG dBuf = FDLOG_DEFAULTS;
// function prototypes
void initCPUTimer0(float freq, float period);
extern interrupt void control_Isr(void);
// global variables
long IdleLoopCount = 0;
long IsrCount = 0;
int complete = 0;
float ek;
float u1k;
float u2k;
float dk;
float upperLim;
float lowerLim;
uint16_t v;
DCL_DF22 controller1 = DF22_DEFAULTS;
DCL_DF22 controller2 = DF22_DEFAULTS;
/* main */
main()
{
// device initialization
Device_init();
Interrupt_initModule();
Interrupt_initVectorTable();
// initialize CPU timer0 & interrupt
Interrupt_register(INT_TIMER0, &control_Isr);
initCPUTimer0( DEVICE_SYSCLK_FREQ, 1000);
CPUTimer_enableInterrupt(CPUTIMER0_BASE);
Interrupt_enable(INT_TIMER0);
// initialise data arrays
DCL_initLog(&eBuf, e_array, DATA_LENGTH);
DCL_initLog(&u1Buf, u1_array, DATA_LENGTH);
DCL_initLog(&u2Buf, u2_array, DATA_LENGTH);
DCL_initLog(&dBuf, d_array, DATA_LENGTH);
DCL_clearLog(&u1Buf);
DCL_clearLog(&u2Buf);
DCL_fillLog(&dBuf, 1.234567f);
// initialise full controller
controller1.a1 = -1.9417f;
controller1.a2 = 0.9417f;
controller1.b0 = 9.8549f;
controller1.b1 = -19.4165f;
controller1.b2 = 9.5636f;
// initialise pre-computed controller
controller2.a1 = controller1.a1;
controller2.a2 = controller1.a2;
controller2.b0 = controller1.b0;
controller2.b1 = controller1.b1;
controller2.b2 = controller1.b2;
// clamp limits
upperLim = 1000.0f;
lowerLim = -1000.0f;
// enable global interrupts
EINT;
ERTM;
CPUTimer_startTimer(CPUTIMER0_BASE);
while(1)
{
IdleLoopCount++;
if (complete == 1)
{
DCL_BREAK_POINT;
}
}
}
// initialize CPU timer0
void initCPUTimer0(float freq, float period)
{
uint32_t temp;
temp = (uint32_t)(freq / 1000000 * period);
CPUTimer_setPeriod(CPUTIMER0_BASE, temp);
CPUTimer_setPreScaler(CPUTIMER0_BASE, 0);
CPUTimer_stopTimer(CPUTIMER0_BASE);
CPUTimer_reloadTimerCounter(CPUTIMER0_BASE);
CPUTimer_setEmulationMode(CPUTIMER0_BASE,
CPUTIMER_EMULATIONMODE_STOPAFTERNEXTDECREMENT);
CPUTimer_enableInterrupt(CPUTIMER0_BASE);
}
/* control ISR: triggered by CPU timer 0 */
interrupt void control_Isr(void)
{
// read data & run controllers
if (complete == 0)
{
// read input data
ek = DCL_readLog(&eBuf);
// run full controller
u1k = DCL_runDF22_C1(&controller1, ek);
// run pre-computed controller
u2k = DCL_runDF22_C2(&controller2, ek);
v = DCL_runClamp_C1(&u2k, upperLim, lowerLim);
if (0U == v)
{
DCL_runDF22_C3(&controller2, ek, u2k);
}
// compute difference
dk = u1k - u2k;
// store results
DCL_writeLog(&u1Buf, u1k);
DCL_writeLog(&u2Buf, u2k);
DCL_writeLog(&dBuf, dk);
// check if data log is full
if FDLOG_START(&dBuf)
{
complete = 1;
}
}
IsrCount++;
Interrupt_clearACKGroup(INTERRUPT_ACK_GROUP1);
}
/* end of file */
@@ -0,0 +1,30 @@
<projectSpec>
<project
name="F28P55x_PI"
device="TMS320F28P550SJ9"
cgtVersion="22.6.0.LTS"
outputFormat="ELF"
launchWizard="False"
linkerCommandFile=""
enableSysConfigTool="true"
sysConfigBuildOptions="--product ${C2000WARE_ROOT}/.metadata/sdk.json --device F28P55x --package 128PDT --part F28P55x_128PDT"
>
<configuration name="CPU1_RAM" compilerBuildOptions="--opt_level=off -I${C2000WARE_ROOT} -v28 -ml -mt --cla_support=cla2 --float_support=fpu32 --tmu_support=tmu1 --gen_func_subsections=on --define=DEBUG --define=RAM --define=generic_ram_lnk --diag_warning=225 --diag_suppress=10063" linkerBuildOptions="--entry_point code_start --stack_size=0x200 --heap_size=0x100 --define=RAM -i${C2000WARE_ROOT} -i${PROJECT_BUILD_DIR}/syscfg -lc2000ware_libraries.cmd.genlibs -lboard.cmd.genlibs --define=generic_ram_lnk"/>
<configuration name="CPU1_FLASH" compilerBuildOptions="--opt_level=off -I${C2000WARE_ROOT} -v28 -ml -mt --cla_support=cla2 --float_support=fpu32 --tmu_support=tmu1 --gen_func_subsections=on --define=DEBUG --define=_FLASH --define=generic_flash_lnk --diag_warning=225 --diag_suppress=10063" linkerBuildOptions="--entry_point code_start --stack_size=0x200 --heap_size=0x100 --define=_FLASH -i${C2000WARE_ROOT} -i${PROJECT_BUILD_DIR}/syscfg -lc2000ware_libraries.cmd.genlibs -lboard.cmd.genlibs -ldevice_cmd.cmd.genlibs --define=generic_flash_lnk"/>
<pathVariable name="C2000WARE_ROOT" path="../../../../../../../" scope="project" />
<pathVariable name="C2000WARE_DLIB_ROOT" path="../../../../../../../driverlib/f28p55x/driverlib/" scope="project"/>
<pathVariable name="CLB_SYSCFG_ROOT" path="../../../../../../../utilities/clb_tool/clb_syscfg/" scope="project" />
<pathVariable name="SYSTEMC_INSTALL" path="../../../../../../../utilities/clb_tool/clb_syscfg/systemc-2.3.3" scope="project" />
<pathVariable name="CLB_SIM_COMPILER" path="C:/TDM-GCC-64/bin" scope="project" />
<buildVariable name="CLB_DEBUG" value="0" scope="project" />
<buildVariable name="GENERATE_DIAGRAM" value="0" scope="project" />
<file action="copy" path="../../../../../../../device_support/f28p55x/common/targetConfigs" targetDirectory="targetConfigs"/>
<file action="copy" path="../pi_test.h" targetDirectory=""/>
<file action="copy" path="../pi_test.c" targetDirectory=""/>
<file action="copy" path="../f28p55x_pi.syscfg" targetDirectory=""/>
<file action="copy" path="../data/PI_ctl-1.dat" targetDirectory="data"/>
<file action="copy" path="../data/PI_rk-1.dat" targetDirectory="data"/>
<file action="copy" path="../data/PI_yk-1.dat" targetDirectory="data"/>
</project>
</projectSpec>
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,81 @@
/**
* These arguments were used when this file was generated. They will be automatically applied on subsequent loads
* via the GUI or CLI. Run CLI with '--help' for additional information on how to override these arguments.
* @cliArgs --device "F28P55x" --package "100PZ" --part "F28P55x_100PZ" --context "system" --product "C2000WARE@5.02.00.00"
* @versions {"tool":"1.20.0+3514"}
*/
/**
* Import the modules used in this configuration.
*/
const cputimer = scripting.addModule("/driverlib/cputimer.js", {}, false);
const cputimer1 = cputimer.addInstance();
const device_support = scripting.addModule("/driverlib/device_support.js");
const sysctl = scripting.addModule("/driverlib/sysctl.js");
const controller = scripting.addModule("/libraries/control/dcl/controller.js", {}, false);
const controller1 = controller.addInstance();
const logger = scripting.addModule("/libraries/control/dcl/logger.js", {}, false);
const logger1 = logger.addInstance();
const logger2 = logger.addInstance();
const logger3 = logger.addInstance();
const logger4 = logger.addInstance();
const CMD = scripting.addModule("/utilities/cmd_tool/cmd_syscfg/source/CMD");
const CMD1 = CMD.addInstance();
/**
* Write custom configuration values to the imported modules.
*/
cputimer1.$name = "myCPUTIMER0";
cputimer1.enableInterrupt = true;
cputimer1.startTimer = true;
cputimer1.timerPeriod = 10;
cputimer1.registerInterrupts = true;
cputimer1.emulationMode = "CPUTIMER_EMULATIONMODE_STOPATZERO";
cputimer1.timerInt.$name = "control_Isr";
cputimer1.timerInt.interruptHandler = "control_Isr";
cputimer1.timerInt.enableInterrupt = true;
controller1.controllerChoice = "PI";
controller1.$name = "myController0";
controller1.Kp = "2.5f";
controller1.Ki = "0.01f";
controller1.Umax = "2.0f";
controller1.Umin = "-2.0f";
logger1.$name = "rkLog";
logger1.arrEn = false;
logger1.linkerVal = "LoggerDataSection";
logger1.logSize = 800;
logger2.arrEn = false;
logger2.$name = "ykLog";
logger2.linkerVal = "LoggerDataSection";
logger2.logSize = 800;
logger3.arrEn = false;
logger3.$name = "ctlLog";
logger3.linkerVal = "LoggerDataSection";
logger3.logSize = 800;
logger4.$name = "outLog";
logger4.fillEn = true;
logger4.linkerEn = true;
logger4.linkerVal = "LoggerDataSection";
logger4.logSize = 800;
CMD1.$name = "generic_ram_lnk";
CMD1.sectionMemory_const = ["RAMLS5","RAMLS6"];
CMD1.sectionMemory_ramfunc = ["RAMM0"];
CMD1.sectionMemory_init_array = ["RAMM0"];
CMD1.sectionMemory_switch = ["RAMM0"];
CMD1.sectionMemory_sysmem = ["RAMLS4"];
CMD1.sectionMemory_stack = ["RAMLS0"];
CMD1.sectionMemory_bss = ["RAMGS1","RAMLS3","RAMLS4","RAMLS5"];
CMD1.sectionMemory_data = ["RAMGS2","RAMLS5","RAMLS6","RAMLS7","RAMLS8"];
CMD1.sectionMemory_cinit = ["RAMGS1"];
CMD1.sectionMemory_text = ["RAMLS0","RAMLS1","RAMLS2","RAMLS3","RAMLS4","RAMLS5","RAMLS6","RAMLS7","RAMLS8","RAMLS9"];
CMD1.userSection.create(2);
CMD1.userSection[0].$name = "LoggerDataSection";
CMD1.userSection[0].sectionMemory = ["RAMGS3"];
CMD1.userSection[1].sectionMemory = ["RAMM0"];
CMD1.userSection[1].$name = "dclfuncs";
@@ -0,0 +1,192 @@
//#############################################################################
//! \file pi_test.c
//!
//!
//! This example demonstrates how to use DCL's PI controller along with SysConfig
//! setup
//
// Group: C2000
// Target Family: F28P55X
//
//#############################################################################
//
//
// $Copyright: Copyright (C) 2024 Texas Instruments Incorporated -
// http://www.ti.com/ ALL RIGHTS RESERVED $
//#############################################################################
//*****************************************************************************
// includes
//*****************************************************************************
#include "driverlib.h"
#include "device.h"
#include "board.h"
#include "c2000ware_libraries.h"
#include "stdio.h"
#include "pi_test.h"
//!
//! \addtogroup DCL_EXAMPLES PI controller example
// @{
uint16_t currIdx = 0;
uint16_t completed = 0;
int16_t errors = -1;
void Init_DCL_Logger(void)
{
//
// Initialize Log pointers to the data buffer
//
DCL_initLog(&rkLog, (float32_t*)rkLogArr, DATA_LENGTH);
DCL_initLog(&ykLog, (float32_t*)ykLogArr, DATA_LENGTH);
DCL_initLog(&ctlLog, (float32_t*)ctlLogArr, DATA_LENGTH);
DCL_initLog(&outLog, (float32_t*)outLogArr, DATA_LENGTH);
// Reset PI controller as well
DCL_resetPI(&myController0);
}
int Run_PI_Logger()
{
//
// rk = Target referenced value
// yk = Current feedback value
// uk = Output control effort
//
float32_t rk,yk,uk;
//
// Read the input data buffers
//
rk = DCL_freadLog(&rkLog);
yk = DCL_freadLog(&ykLog);
//
// Run the controller
// Equivalent to uk = DCL_runPI_series(ctrl_handle, rk, yk);
//
uk = DCL_runPI_C1(&myController0, rk, yk);
//
// Write the results to the output buffer
//
DCL_fwriteLog(&outLog, uk);
return 1;
}
int Compare_Results()
{
int i;
//
// Reset the log pointer so it starts from the beginning
//
DCL_resetLog(&outLog);
//
// Check output against expected output with tolerance (1e-06)
//
int errors = 0;
for (i = 0; i < NUM_ELEMENTS; i++)
{
float32_t output = DCL_freadLog(&outLog); // outLogArr[i]
float32_t expected = DCL_freadLog(&ctlLog); // ctlLogArr[i]
float32_t error = fabsf(output - expected);
if (error > EPSILON)
{
errors++;
printf("FAIL at sample %d, outputs %f, should be %f\n", i, output, expected);
}
}
return errors;
}
//
// Main
//
void main(void)
{
//
// Initialize device clock and peripherals
//
Device_init();
//
// Disable pin locks and enable internal pull-ups.
//
Device_initGPIO();
//
// Initialize PIE and clear PIE registers. Disables CPU interrupts.
//
Interrupt_initModule();
//
// Initialize the PIE vector table with pointers to the shell Interrupt
// Service Routines (ISR).
//
Interrupt_initVectorTable();
//
// PinMux and Peripheral Initialization
//
Board_init();
//
// C2000Ware Library initialization
//
C2000Ware_libraries_init();
//
// DCL Logger Initialization
//
Init_DCL_Logger();
//
// Enable Global Interrupt (INTM) and real time interrupt (DBGM)
//
EINT;
ERTM;
while(1)
{
if (completed)
{
errors = Compare_Results();
printf("PI test produced %d error\n",errors);
DCL_BREAK_POINT;
}
}
}
// initialize CPU timer0 in sysconfig
interrupt void control_Isr(void)
{
if (currIdx < NUM_ELEMENTS)
{
Run_PI_Logger();
currIdx++;
}
else
{
completed = 1;
Interrupt_disable(INT_myCPUTIMER0);
}
Interrupt_clearACKGroup(INT_myCPUTIMER0_INTERRUPT_ACK_GROUP);
}
// End of main
// @} //addtogroup
// End of file
@@ -0,0 +1,88 @@
/*
* Copyright (C) 2023 Texas Instruments Incorporated - http://www.ti.com/
*
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the
* distribution.
*
* * Neither the name of Texas Instruments Incorporated nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef PI_TEST_H
#define PI_TEST_H
#ifdef __cplusplus
extern "C" {
#endif
#include "c2000ware_libraries.h"
#include "stdint.h"
#include "math.h"
#include "stdio.h"
int PI_test(void);
//
// User configurable values
//
#define DATA_LENGTH 800 //!< Size of total data inputs
#define NUM_ELEMENTS 400 //!< The number of samples ran, cannot exceed DATA_LENGTH
#define EPSILON 0.00001f
//
// declared & initialized by sysconfig
//
extern DCL_PI myController0;
extern float32_t outLogArr[DATA_LENGTH];
//
// Allocate data sections and initialize data
//
#pragma DATA_SECTION(rkLogArr, "LoggerDataSection")
float32_t rkLogArr[DATA_LENGTH] =
{
#include "data/PI_rk-1.dat"
};
#pragma DATA_SECTION(ykLogArr, "LoggerDataSection")
float32_t ykLogArr[DATA_LENGTH] =
{
#include "data/PI_yk-1.dat"
};
#pragma DATA_SECTION(ctlLogArr, "LoggerDataSection")
float32_t ctlLogArr[DATA_LENGTH] =
{
#include "data/PI_ctl-1.dat"
};
#ifdef __cplusplus
}
#endif // extern "C"
#endif
@@ -0,0 +1,26 @@
<projectSpec>
<project
name="F28P55x_PI"
device="TMS320F28P550SJ9"
cgtVersion="22.6.0.LTS"
outputFormat="ELF"
launchWizard="False"
linkerCommandFile=""
enableSysConfigTool="true"
sysConfigBuildOptions="--product ${C2000WARE_ROOT}/.metadata/sdk.json --device F28P55x --package 128PDT --part F28P55x_128PDT"
>
<configuration name="CPU1_RAM" compilerBuildOptions="--opt_level=off -I${C2000WARE_ROOT} -v28 -ml -mt --cla_support=cla2 --float_support=fpu32 --tmu_support=tmu1 --gen_func_subsections=on --define=DEBUG --define=RAM --define=generic_ram_lnk --diag_warning=225 --diag_suppress=10063" linkerBuildOptions="--entry_point code_start --stack_size=0x200 --heap_size=0x100 --define=RAM -i${C2000WARE_ROOT} -i${PROJECT_BUILD_DIR}/syscfg -lc2000ware_libraries.cmd.genlibs -lboard.cmd.genlibs --define=generic_ram_lnk"/>
<configuration name="CPU1_FLASH" compilerBuildOptions="--opt_level=off -I${C2000WARE_ROOT} -v28 -ml -mt --cla_support=cla2 --float_support=fpu32 --tmu_support=tmu1 --gen_func_subsections=on --define=DEBUG --define=_FLASH --define=generic_flash_lnk --diag_warning=225 --diag_suppress=10063" linkerBuildOptions="--entry_point code_start --stack_size=0x200 --heap_size=0x100 --define=_FLASH -i${C2000WARE_ROOT} -i${PROJECT_BUILD_DIR}/syscfg -lc2000ware_libraries.cmd.genlibs -lboard.cmd.genlibs -ldevice_cmd.cmd.genlibs --define=generic_flash_lnk"/>
<pathVariable name="C2000WARE_ROOT" path="../../../../../../../" scope="project" />
<pathVariable name="C2000WARE_DLIB_ROOT" path="../../../../../../../driverlib/f28p55x/driverlib/" scope="project"/>
<pathVariable name="CLB_SYSCFG_ROOT" path="../../../../../../../utilities/clb_tool/clb_syscfg/" scope="project" />
<pathVariable name="SYSTEMC_INSTALL" path="../../../../../../../utilities/clb_tool/clb_syscfg/systemc-2.3.3" scope="project" />
<pathVariable name="CLB_SIM_COMPILER" path="C:/TDM-GCC-64/bin" scope="project" />
<buildVariable name="CLB_DEBUG" value="0" scope="project" />
<buildVariable name="GENERATE_DIAGRAM" value="0" scope="project" />
<file action="copy" path="../../../../../../../device_support/f28p55x/common/targetConfigs" targetDirectory="targetConfigs"/>
<file action="copy" path="../main.c" targetDirectory=""/>
<file action="copy" path="../f28p55x_refgen.syscfg" targetDirectory=""/>
</project>
</projectSpec>
@@ -0,0 +1,79 @@
/**
* These arguments were used when this file was generated. They will be automatically applied on subsequent loads
* via the GUI or CLI. Run CLI with '--help' for additional information on how to override these arguments.
* @cliArgs --device "F28P55x" --package "100PZ" --part "F28P55x_100PZ" --context "system" --product "C2000WARE@5.02.00.00"
* @versions {"tool":"1.20.0+3514"}
*/
/**
* Import the modules used in this configuration.
*/
const cputimer = scripting.addModule("/driverlib/cputimer.js", {}, false);
const cputimer1 = cputimer.addInstance();
const device_support = scripting.addModule("/driverlib/device_support.js");
const sysctl = scripting.addModule("/driverlib/sysctl.js");
const logger = scripting.addModule("/libraries/control/dcl/logger.js", {}, false);
const logger1 = logger.addInstance();
const logger2 = logger.addInstance();
const logger3 = logger.addInstance();
const refgen = scripting.addModule("/libraries/control/dcl/refgen.js", {}, false);
const refgen1 = refgen.addInstance();
const FPUfastRTS = scripting.addModule("/libraries/math/FPUfastRTS/FPUfastRTS.js", {}, false);
const FPUfastRTS1 = FPUfastRTS.addInstance();
const CMD = scripting.addModule("/utilities/cmd_tool/cmd_syscfg/source/CMD");
const CMD1 = CMD.addInstance();
/**
* Write custom configuration values to the imported modules.
*/
cputimer1.$name = "myCPUTIMER0";
cputimer1.timerPeriod = 100;
cputimer1.enableInterrupt = true;
cputimer1.registerInterrupts = true;
cputimer1.startTimer = true;
cputimer1.timerInt.enableInterrupt = true;
cputimer1.timerInt.$name = "timer_Isr";
cputimer1.timerInt.interruptHandler = "timer_Isr";
logger1.$name = "LoggerSineA";
logger1.logSize = 400;
logger1.fillEn = true;
logger1.linkerEn = true;
logger1.linkerVal = "LoggerDataSection";
logger2.logSize = 400;
logger2.fillEn = true;
logger2.linkerEn = true;
logger2.linkerVal = "LoggerDataSection";
logger2.$name = "LoggerSineB";
logger3.linkerEn = true;
logger3.fillEn = true;
logger3.linkerVal = "LoggerDataSection";
logger3.$name = "LoggerSineC";
logger3.logSize = 400;
refgen1.$name = "myREFGEN0";
refgen1.umax = 1;
refgen1.umin = -1;
refgen1.mode = "SINE3";
refgen1.ampl = 2;
FPUfastRTS1.$name = "myFFR0";
CMD1.$name = "generic_ram_lnk";
CMD1.sectionMemory_const = ["RAMLS5","RAMLS6"];
CMD1.sectionMemory_ramfunc = ["RAMM0"];
CMD1.sectionMemory_init_array = ["RAMM0"];
CMD1.sectionMemory_switch = ["RAMM0"];
CMD1.sectionMemory_sysmem = ["RAMLS4"];
CMD1.sectionMemory_stack = ["RAMLS0"];
CMD1.sectionMemory_bss = ["RAMGS1","RAMLS3","RAMLS4","RAMLS5"];
CMD1.sectionMemory_data = ["RAMGS2","RAMLS5","RAMLS6","RAMLS7","RAMLS8"];
CMD1.sectionMemory_cinit = ["RAMGS1"];
CMD1.sectionMemory_text = ["RAMLS0","RAMLS1","RAMLS2","RAMLS3","RAMLS4","RAMLS5","RAMLS6","RAMLS7","RAMLS8","RAMLS9"];
CMD1.userSection.create(2);
CMD1.userSection[0].$name = "LoggerDataSection";
CMD1.userSection[0].sectionMemory = ["RAMGS3"];
CMD1.userSection[1].$name = "dclfuncs";
CMD1.userSection[1].sectionMemory = ["RAMGS3"];
@@ -0,0 +1,148 @@
//#############################################################################
//! \file /main.c
//!
//!
//! This example shows how to use SysConfig to setup and run DCL's reference
//! generator
//
// Group: C2000
// Target Family: F28P55X
//
//#############################################################################
//
//
// $Copyright: Copyright (C) 2024 Texas Instruments Incorporated -
// http://www.ti.com/ ALL RIGHTS RESERVED $
//#############################################################################
//*****************************************************************************
// includes
//*****************************************************************************
#include "driverlib.h"
#include "device.h"
#include "board.h"
#include "c2000ware_libraries.h"
#include "stdio.h"
//!
//! \addtogroup DCL_EXAMPLES Ref Gen example
// @{
//
// declared & initialized by sysconfig
//
extern DCL_REFGEN myREFGEN0;
extern FDLOG LoggerSineA;
extern FDLOG LoggerSineB;
extern FDLOG LoggerSineC;
uint16_t isrCnt = 0;
uint16_t isrStopCnt = 400;
uint16_t currIdxA = 0;
uint16_t currIdxB = 0;
uint16_t currIdxC = 0;
int Run_RefGen_Logger()
{
float32_t sineA, sineB, sineC;
//
// Runs reference generator based on pre-configured settings denoted in sysconfig
//
DCL_runRefgen(&myREFGEN0);
//
// Save generated phase output to the data logger
//
sineA = DCL_getRefgenPhaseA(&myREFGEN0);
sineB = DCL_getRefgenPhaseB(&myREFGEN0);
sineC = DCL_getRefgenPhaseC(&myREFGEN0);
DCL_writeLog(&LoggerSineA, sineA);
DCL_writeLog(&LoggerSineB, sineB);
DCL_writeLog(&LoggerSineC, sineC);
//
// Record the latest index for each data logger for debugging purposes
//
currIdxA = FDLOG_ELEMENT(&LoggerSineA);
currIdxB = FDLOG_ELEMENT(&LoggerSineB);
currIdxC = FDLOG_ELEMENT(&LoggerSineC);
return 1;
}
//
// Main
//
void main(void)
{
//
// Initialize device clock and peripherals
//
Device_init();
//
// Disable pin locks and enable internal pull-ups.
//
Device_initGPIO();
//
// Initialize PIE and clear PIE registers. Disables CPU interrupts.
//
Interrupt_initModule();
//
// Initialize the PIE vector table with pointers to the shell Interrupt
// Service Routines (ISR).
//
Interrupt_initVectorTable();
//
// PinMux and Peripheral Initialization
//
Board_init();
//
// C2000Ware Library initialization
//
C2000Ware_libraries_init();
//
// Enable Global Interrupt (INTM) and real time interrupt (DBGM)
//
EINT;
ERTM;
while(1)
{
}
}
// initialize CPU timer0 in sysconfig
interrupt void timer_Isr(void)
{
if (isrCnt < isrStopCnt)
{
Run_RefGen_Logger();
isrCnt++;
}
else
{
Interrupt_disable(INT_myCPUTIMER0);
DCL_BREAK_POINT;
}
Interrupt_clearACKGroup(INT_myCPUTIMER0_INTERRUPT_ACK_GROUP);
}
// End of main
// @} //addtogroup
// End of file
@@ -0,0 +1,29 @@
<projectSpec>
<project
name="F28P65x_DF22"
device="TMS320F28P650DK9"
cgtVersion="22.6.0.LTS"
outputFormat="ELF"
launchWizard="False"
linkerCommandFile=""
>
<configuration name="CPU1_RAM" compilerBuildOptions="--opt_level=off -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} -I${DCL_INCLUDE} -v28 -ml -mt --float_support=fpu32 --tmu_support=tmu0 --define=CPU1 --define=DEBUG --define RAM --diag_warning=225 --diag_suppress=10063" linkerBuildOptions="--entry_point code_start --stack_size=0x200 --heap_size=0x100 "/>
<pathVariable name="C2000WARE_DLIB_ROOT" path="../../../../../../../driverlib/f28p65x/driverlib/" scope="project"/>
<pathVariable name="DCL_INCLUDE" path="../../../include" scope="project"/>
<pathVariable name="C2000WARE_DEVICE_SUPPORT" path="../../../../../../../device_support" scope="project"/>
<file action="copy" path="C2000WARE_DEVICE_SUPPORT/f28p65x/common/include/driverlib.h" targetDirectory="device"/>
<file action="copy" path="C2000WARE_DEVICE_SUPPORT/f28p65x/common/include/device.h" targetDirectory="device"/>
<file action="copy" path="C2000WARE_DEVICE_SUPPORT/f28p65x/common/source/device.c" targetDirectory="device"/>
<file action="copy" path="C2000WARE_DEVICE_SUPPORT/f28p65x/common/source/f28p65x_codestartbranch.asm" targetDirectory="device"/>
<file action="copy" path="C2000WARE_DEVICE_SUPPORT/f28p65x/common/targetConfigs/TMS320F28P650DK9.ccxml" targetDirectory="targetConfigs"/>
<file action="link" path="C2000WARE_DLIB_ROOT/ccs/Debug/driverlib.lib" targetDirectory=""/>
<file action="copy" path="../Example_DF22.c" targetDirectory=""/>
<file action="copy" path="../../../source/DCL_error.c" targetDirectory=""/>
<file action="copy" path="../../../source/DCL_clamp_C1.asm" targetDirectory="" />
<file action="copy" path="../../../source/DCL_DF22_C1.asm" targetDirectory="" />
<file action="copy" path="../../../source/DCL_DF22_C2C3.asm" targetDirectory="" />
<file action="copy" path="../DF22_edata.dat" targetDirectory="" />
<file action="copy" path="C2000WARE_DEVICE_SUPPORT/f28p65x/common/cmd/28p65x_generic_ram_lnk_cpu1.cmd" targetDirectory=""/>
<file action="copy" path="../../../cmd/F28P65x_DCL.cmd" targetDirectory=""/>
</project>
</projectSpec>
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,168 @@
/* Example_DF22.c
*
* Copyright (C) 2020 Texas Instruments Incorporated - http://www.ti.com/
* ALL RIGHTS RESERVED
*
*/
#include "driverlib.h"
#include "device.h"
#include "DCLF32.h"
#include "DCL_fdlog.h"
#define DATA_LENGTH 1601
// input data
#pragma DATA_SECTION(e_array, "PDataLogSection")
float e_array[DATA_LENGTH];
FDLOG eBuf = FDLOG_DEFAULTS;
// full controller results
#pragma DATA_SECTION(u1_array, "QDataLogSection")
float u1_array[DATA_LENGTH];
FDLOG u1Buf = FDLOG_DEFAULTS;
// pre-computed controller results
#pragma DATA_SECTION(u2_array, "RDataLogSection")
float u2_array[DATA_LENGTH];
FDLOG u2Buf = FDLOG_DEFAULTS;
// controller difference data
#pragma DATA_SECTION(d_array, "SDataLogSection")
float d_array[DATA_LENGTH];
FDLOG dBuf = FDLOG_DEFAULTS;
// function prototypes
void initCPUTimer0(float freq, float period);
extern interrupt void control_Isr(void);
// global variables
long IdleLoopCount = 0;
long IsrCount = 0;
int complete = 0;
float ek;
float u1k;
float u2k;
float dk;
float upperLim;
float lowerLim;
uint16_t v;
DCL_DF22 controller1 = DF22_DEFAULTS;
DCL_DF22 controller2 = DF22_DEFAULTS;
/* main */
main()
{
// device initialization
Device_init();
Interrupt_initModule();
Interrupt_initVectorTable();
// initialize CPU timer0 & interrupt
Interrupt_register(INT_TIMER0, &control_Isr);
initCPUTimer0( DEVICE_SYSCLK_FREQ, 1000);
CPUTimer_enableInterrupt(CPUTIMER0_BASE);
Interrupt_enable(INT_TIMER0);
// initialise data arrays
DCL_initLog(&eBuf, e_array, DATA_LENGTH);
DCL_initLog(&u1Buf, u1_array, DATA_LENGTH);
DCL_initLog(&u2Buf, u2_array, DATA_LENGTH);
DCL_initLog(&dBuf, d_array, DATA_LENGTH);
DCL_clearLog(&u1Buf);
DCL_clearLog(&u2Buf);
DCL_fillLog(&dBuf, 1.234567f);
// initialise full controller
controller1.a1 = -1.9417f;
controller1.a2 = 0.9417f;
controller1.b0 = 9.8549f;
controller1.b1 = -19.4165f;
controller1.b2 = 9.5636f;
// initialise pre-computed controller
controller2.a1 = controller1.a1;
controller2.a2 = controller1.a2;
controller2.b0 = controller1.b0;
controller2.b1 = controller1.b1;
controller2.b2 = controller1.b2;
// clamp limits
upperLim = 1000.0f;
lowerLim = -1000.0f;
// enable global interrupts
EINT;
ERTM;
CPUTimer_startTimer(CPUTIMER0_BASE);
while(1)
{
IdleLoopCount++;
if (complete == 1)
{
DCL_BREAK_POINT;
}
}
}
// initialize CPU timer0
void initCPUTimer0(float freq, float period)
{
uint32_t temp;
temp = (uint32_t)(freq / 1000000 * period);
CPUTimer_setPeriod(CPUTIMER0_BASE, temp);
CPUTimer_setPreScaler(CPUTIMER0_BASE, 0);
CPUTimer_stopTimer(CPUTIMER0_BASE);
CPUTimer_reloadTimerCounter(CPUTIMER0_BASE);
CPUTimer_setEmulationMode(CPUTIMER0_BASE,
CPUTIMER_EMULATIONMODE_STOPAFTERNEXTDECREMENT);
CPUTimer_enableInterrupt(CPUTIMER0_BASE);
}
/* control ISR: triggered by CPU timer 0 */
interrupt void control_Isr(void)
{
// read data & run controllers
if (complete == 0)
{
// read input data
ek = DCL_readLog(&eBuf);
// run full controller
u1k = DCL_runDF22_C1(&controller1, ek);
// run pre-computed controller
u2k = DCL_runDF22_C2(&controller2, ek);
v = DCL_runClamp_C1(&u2k, upperLim, lowerLim);
if (0U == v)
{
DCL_runDF22_C3(&controller2, ek, u2k);
}
// compute difference
dk = u1k - u2k;
// store results
DCL_writeLog(&u1Buf, u1k);
DCL_writeLog(&u2Buf, u2k);
DCL_writeLog(&dBuf, dk);
// check if data log is full
if FDLOG_START(&dBuf)
{
complete = 1;
}
}
IsrCount++;
Interrupt_clearACKGroup(INTERRUPT_ACK_GROUP1);
}
/* end of file */
@@ -0,0 +1,26 @@
<projectSpec>
<project
name="F280025_NLPID"
device="TMS320F280025C"
cgtVersion="22.6.0.LTS"
outputFormat="ELF"
launchWizard="False"
linkerCommandFile=""
>
<configuration name="CPU1_RAM" compilerBuildOptions="--opt_level=off -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} -I${DCL_INCLUDE} -v28 -ml -mt --float_support=fpu32 --tmu_support=tmu1 --define=DEBUG --define RAM --diag_warning=225 --diag_suppress=10063" linkerBuildOptions="--entry_point code_start --stack_size=0x200 --heap_size=0x100 "/>
<pathVariable name="C2000WARE_DLIB_ROOT" path="../../../../../../../driverlib/f28002x/driverlib/" scope="project"/>
<pathVariable name="DCL_INCLUDE" path="../../../include" scope="project"/>
<file action="copy" path="../../../../../../../device_support/f28002x/common/include/driverlib.h" targetDirectory="device"/>
<file action="copy" path="../../../../../../../device_support/f28002x/common/include/device.h" targetDirectory="device"/>
<file action="copy" path="../../../../../../../device_support/f28002x/common/source/device.c" targetDirectory="device"/>
<file action="copy" path="../../../../../../../device_support/f28002x/common/source/f28002x_codestartbranch.asm" targetDirectory="device"/>
<file action="copy" path="../../../../../../../device_support/f28002x/common/targetConfigs/TMS320F280025C.ccxml" targetDirectory="targetConfigs"/>
<file action="link" path="../../../../../../../driverlib/f28002x/driverlib/ccs/Debug/driverlib.lib" targetDirectory=""/>
<file action="copy" path="../../../../../../../driverlib/f28002x/driverlib/" targetDirectory="device" excludeFromBuild="True"/>
<file action="copy" path="../Example_NLPID.c" targetDirectory=""/>
<file action="copy" path="../../../source/DCL_NLPID_C3.asm" targetDirectory=""/>
<file action="copy" path="../../../source/DCL_error.c" targetDirectory=""/>
<file action="copy" path="../../../cmd/F280025_stdmem.cmd" targetDirectory=""/>
<file action="copy" path="../../../cmd/F280025_DCL.cmd" targetDirectory=""/>
</project>
</projectSpec>
@@ -0,0 +1,26 @@
<projectSpec>
<project
name="F280039_NLPID"
device="TMS320F280039C"
cgtVersion="22.6.0.LTS"
outputFormat="ELF"
launchWizard="False"
linkerCommandFile=""
>
<configuration name="CPU1_RAM" compilerBuildOptions="--opt_level=off -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} -I${DCL_INCLUDE} -v28 -ml -mt --float_support=fpu32 --tmu_support=tmu1 --define=DEBUG --define RAM --diag_warning=225 --diag_suppress=10063" linkerBuildOptions="--entry_point code_start --stack_size=0x200 --heap_size=0x100 "/>
<pathVariable name="C2000WARE_DLIB_ROOT" path="../../../../../../../driverlib/f28003x/driverlib/" scope="project"/>
<pathVariable name="DCL_INCLUDE" path="../../../include" scope="project"/>
<file action="copy" path="../../../../../../../device_support/f28003x/common/include/driverlib.h" targetDirectory="device"/>
<file action="copy" path="../../../../../../../device_support/f28003x/common/include/device.h" targetDirectory="device"/>
<file action="copy" path="../../../../../../../device_support/f28003x/common/source/device.c" targetDirectory="device"/>
<file action="copy" path="../../../../../../../device_support/f28003x/common/source/f28003x_codestartbranch.asm" targetDirectory="device"/>
<file action="copy" path="../../../../../../../device_support/f28003x/common/targetConfigs/TMS320F280039C.ccxml" targetDirectory="targetConfigs"/>
<file action="link" path="../../../../../../../driverlib/f28003x/driverlib/ccs/Debug/driverlib.lib" targetDirectory=""/>
<file action="copy" path="../../../../../../../driverlib/f28003x/driverlib/" targetDirectory="device" excludeFromBuild="True"/>
<file action="copy" path="../Example_NLPID.c" targetDirectory=""/>
<file action="copy" path="../../../source/DCL_NLPID_C3.asm" targetDirectory=""/>
<file action="copy" path="../../../source/DCL_error.c" targetDirectory=""/>
<file action="copy" path="../../../../../../../device_support/f28003x/common/cmd/28003x_generic_ram_lnk.cmd" targetDirectory=""/>
<file action="copy" path="../../../cmd/F280039_DCL.cmd" targetDirectory=""/>
</project>
</projectSpec>
@@ -0,0 +1,153 @@
/* Example_NLPID.c
*
* Copyright (C) 2020 Texas Instruments Incorporated - http://www.ti.com/
* ALL RIGHTS RESERVED
*
*/
// includes
#include "driverlib.h"
#include "device.h"
#include "DCL_NLPID.h"
#include "DCL_fdlog.h"
#define DATA_LENGTH 501
// data logs
#pragma DATA_SECTION(p_array, "pDataLogSection")
#pragma DATA_SECTION(q_array, "qDataLogSection")
#pragma DATA_SECTION(s_array, "sDataLogSection")
// section addresses from linker file
extern unsigned int pData_start;
extern unsigned int qData_start;
extern unsigned int sData_start;
// data arrays
float32_t p_array[DATA_LENGTH];
float32_t q_array[DATA_LENGTH];
float32_t s_array[DATA_LENGTH];
// data log structs
FDLOG pBuf = FDLOG_DEFAULTS;
FDLOG qBuf = FDLOG_DEFAULTS;
FDLOG sBuf = FDLOG_DEFAULTS;
// global variables
long IdleLoopCount = 0;
long IsrCount = 0;
int complete = 0;
float32_t rk = 0.25f, yk, uk;
DCL_NLPID controller1 = NLPID_DEFAULTS;
DCL_NLPID_SPS sps1 = NLPID_SPS_DEFAULTS;
DCL_CSS css1 = DCL_CSS_DEFAULTS;
// function prototypes
void initCPUTimer0(float freq, float period);
__interrupt void control_isr(void);
void main(void)
{
// device initialization
Device_init();
Interrupt_initModule();
Interrupt_initVectorTable();
// initialize CPU timer0 & interrupt
Interrupt_register(INT_TIMER0, &control_isr);
initCPUTimer0( DEVICE_SYSCLK_FREQ, 1000);
CPUTimer_enableInterrupt(CPUTIMER0_BASE);
Interrupt_enable(INT_TIMER0);
// initialize data logs
DCL_initLog(&pBuf, (float32_t *) p_array, DATA_LENGTH);
DCL_initLog(&qBuf, (float32_t *) q_array, DATA_LENGTH);
DCL_initLog(&sBuf, (float32_t *) s_array, DATA_LENGTH);
DCL_clearLog(&sBuf);
// initialize controller
DCL_resetNLPID(&controller1);
controller1.sps = &sps1;
controller1.css = &css1;
DCL_SET_CONTROLLER_PERIOD(&controller1, 0.01f);
controller1.sps->Kp = 25.0f;
controller1.sps->Ki = 0.002f;
controller1.sps->Kd = 0.03f;
controller1.sps->alpha_p = 1.2f;
controller1.sps->alpha_i = 1.05f;
controller1.sps->alpha_d = 0.8f;
controller1.sps->delta_p = 0.3f;
controller1.sps->delta_i = 0.1f;
controller1.sps->delta_d = 0.16f;
controller1.sps->Umax = 100.0f;
controller1.sps->Umin = -100.0f;
DCL_setNLPIDfilterBW(&controller1, 4.9f);
// load gamma from the SPS
DCL_setNLPIDgamma(&controller1);
DCL_REQUEST_UPDATE(&controller1);
DCL_updateNLPID(&controller1);
// enable global interrupts
EINT;
ERTM;
CPUTimer_startTimer(CPUTIMER0_BASE);
while(1)
{
IdleLoopCount++;
if (complete == 1)
{
DCL_BREAK_POINT;
}
}
}
// initialize CPU timer0
void initCPUTimer0(float freq, float period)
{
uint32_t temp;
temp = (uint32_t)(freq / 1000000 * period);
CPUTimer_setPeriod(CPUTIMER0_BASE, temp);
CPUTimer_setPreScaler(CPUTIMER0_BASE, 0);
CPUTimer_stopTimer(CPUTIMER0_BASE);
CPUTimer_reloadTimerCounter(CPUTIMER0_BASE);
CPUTimer_setEmulationMode(CPUTIMER0_BASE,
CPUTIMER_EMULATIONMODE_STOPAFTERNEXTDECREMENT);
CPUTimer_enableInterrupt(CPUTIMER0_BASE);
}
// control ISR, triggered by timer0
__interrupt void control_isr(void)
{
if (complete == 0)
{
// read test data
rk = DCL_readLog(&pBuf);
yk = DCL_readLog(&qBuf);
// run controller
uk = DCL_runNLPID_C3(&controller1, rk, yk, 1.0f);
// store controller output
DCL_writeLog(&sBuf, uk);
// check if data log is full
if FDLOG_START(&sBuf)
{
complete = 1;
}
}
// exit sequence
IsrCount++;
Interrupt_clearACKGroup(INTERRUPT_ACK_GROUP1);
}
/* end of file */
@@ -0,0 +1,501 @@
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
9.84731999e-01
9.85187837e-01
9.82450663e-01
9.77129538e-01
9.69670477e-01
9.60399955e-01
9.49556796e-01
9.37906316e-01
9.25458787e-01
9.11630488e-01
8.97134111e-01
8.82532078e-01
8.67095198e-01
8.50838804e-01
8.34955181e-01
8.18626679e-01
8.01803829e-01
7.84449992e-01
7.67719546e-01
7.50176186e-01
7.32458141e-01
7.14482677e-01
6.96779572e-01
6.79186723e-01
6.61585011e-01
6.43296240e-01
6.25554675e-01
6.07573916e-01
5.89917979e-01
5.72450203e-01
5.54479204e-01
5.37230240e-01
5.19909718e-01
5.02486239e-01
4.85527465e-01
4.68899053e-01
4.51912126e-01
4.35792922e-01
4.19749246e-01
4.03160104e-01
3.87892670e-01
3.72483095e-01
3.56959142e-01
3.41932133e-01
3.27299742e-01
3.12986580e-01
2.99529266e-01
2.85588878e-01
2.71874803e-01
2.58948725e-01
2.46671464e-01
2.33759776e-01
2.22146006e-01
2.10414166e-01
1.99218362e-01
1.87896381e-01
1.77695360e-01
1.67247519e-01
1.57241201e-01
1.48222178e-01
1.38858514e-01
1.29865932e-01
1.21809158e-01
1.13370539e-01
1.05867050e-01
9.85721722e-02
9.15042118e-02
8.52681147e-02
7.85745748e-02
7.27613598e-02
6.71183191e-02
6.16748175e-02
5.70435429e-02
5.25325752e-02
4.81854122e-02
4.40345151e-02
4.06938756e-02
3.68830877e-02
3.39438131e-02
3.11708023e-02
2.91866909e-02
2.67168413e-02
2.45189807e-02
2.31880786e-02
2.20201720e-02
2.04587704e-02
1.98277530e-02
1.88161897e-02
1.87446709e-02
1.83000605e-02
1.82105513e-02
1.90511357e-02
1.89205349e-02
1.98489271e-02
2.04916886e-02
2.15548729e-02
2.30058943e-02
2.42302758e-02
2.53278213e-02
2.69627591e-02
2.90725876e-02
3.10190281e-02
3.28864847e-02
3.53267761e-02
3.70861975e-02
3.95279553e-02
4.19602708e-02
4.44255291e-02
4.75475342e-02
5.00498059e-02
5.26895688e-02
5.54709270e-02
5.83969810e-02
6.14704661e-02
6.46934794e-02
6.74763162e-02
7.05283760e-02
7.38196289e-02
7.67360699e-02
7.99703989e-02
8.34794106e-02
8.60494118e-02
8.96649305e-02
9.23564544e-02
9.55127070e-02
9.90520457e-02
1.01732595e-01
1.04925396e-01
1.07946190e-01
1.11432067e-01
1.14119740e-01
1.17364735e-01
1.19878969e-01
1.23000531e-01
1.26018025e-01
1.28370265e-01
1.31377494e-01
1.34315963e-01
1.36615256e-01
1.38997884e-01
1.42033367e-01
1.44408876e-01
1.46851354e-01
1.48754451e-01
1.51404548e-01
1.53462861e-01
1.55638608e-01
1.57311880e-01
1.59167790e-01
1.61159716e-01
1.63252170e-01
1.64828915e-01
1.66579996e-01
1.68459239e-01
1.69843319e-01
1.71415960e-01
1.72537446e-01
1.73879298e-01
1.75384182e-01
1.76418541e-01
1.77659721e-01
1.78462391e-01
1.79494892e-01
1.80106593e-01
1.80960460e-01
1.81402296e-01
1.82093008e-01
1.82966921e-01
1.83384733e-01
1.84019950e-01
1.84223871e-01
1.84663104e-01
1.84683894e-01
1.84949702e-01
1.84803532e-01
1.84907217e-01
1.85194085e-01
1.85024479e-01
1.85071825e-01
1.84686995e-01
1.84536283e-01
1.84556661e-01
1.84113008e-01
1.83288136e-01
1.83324964e-01
1.82852842e-01
1.81967220e-01
1.81328209e-01
1.80870478e-01
1.80545758e-01
1.79726765e-01
1.79096371e-01
1.78603889e-01
1.77621570e-01
1.76830452e-01
1.75588290e-01
1.75155899e-01
1.74176305e-01
1.73345391e-01
-8.12108688e-01
-8.13798285e-01
-8.12120019e-01
-8.07729682e-01
-8.01108114e-01
-7.93198094e-01
-7.83549384e-01
-7.72380278e-01
-7.61033504e-01
-7.48210573e-01
-7.34649614e-01
-7.20933009e-01
-7.06934912e-01
-6.91974703e-01
-6.77282281e-01
-6.61478390e-01
-6.45832989e-01
-6.30176226e-01
-6.13792744e-01
-5.97889262e-01
-5.81067963e-01
-5.64586580e-01
-5.47674878e-01
-5.30909270e-01
-5.14161952e-01
-4.97338634e-01
-4.80370032e-01
-4.63796309e-01
-4.46872194e-01
-4.30191915e-01
-4.13640833e-01
-3.97134978e-01
-3.80611959e-01
-3.64617809e-01
-3.48410950e-01
-3.32588953e-01
-3.16448749e-01
-3.01206831e-01
-2.85472606e-01
-2.70508658e-01
-2.55549976e-01
-2.41176041e-01
-2.26670690e-01
-2.12650508e-01
-1.98426095e-01
-1.85224051e-01
-1.71661483e-01
-1.58416010e-01
-1.46025077e-01
-1.33741698e-01
-1.21568437e-01
-1.10098235e-01
-9.86249910e-02
-8.77719020e-02
-7.68552649e-02
-6.65147038e-02
-5.60784828e-02
-4.67858472e-02
-3.72636720e-02
-2.81965059e-02
-1.95362856e-02
-1.12478586e-02
-3.30558332e-03
4.30906880e-03
1.16095622e-02
1.86056013e-02
2.53039798e-02
3.17097572e-02
3.72354378e-02
4.31820855e-02
4.82211878e-02
5.36606655e-02
5.81771750e-02
6.24916175e-02
6.65821082e-02
7.04323092e-02
7.34393464e-02
7.68928577e-02
7.94559427e-02
8.24304920e-02
8.44885808e-02
8.63479092e-02
8.85748689e-02
8.98526819e-02
9.09072206e-02
9.23108779e-02
9.27512647e-02
9.35482693e-02
9.39778899e-02
9.40595632e-02
9.38073414e-02
9.38221391e-02
9.34032231e-02
9.25870965e-02
9.19910884e-02
9.09265638e-02
8.94388081e-02
8.81516652e-02
8.69719991e-02
8.52406905e-02
8.30246502e-02
8.15543474e-02
7.94495762e-02
7.73897679e-02
7.53225871e-02
7.26188323e-02
7.05489073e-02
6.77618837e-02
6.55495494e-02
6.25765040e-02
5.95552273e-02
5.70482515e-02
5.43268936e-02
5.14071613e-02
4.83007709e-02
4.56069492e-02
4.20330767e-02
3.95043829e-02
3.60089968e-02
3.34951632e-02
2.99678738e-02
2.67970022e-02
2.38860998e-02
2.05736836e-02
1.75158529e-02
1.46432329e-02
1.13141851e-02
8.79013582e-03
5.71367724e-03
2.19029959e-03
-5.21187154e-04
-3.18937877e-03
-6.41812245e-03
-8.91831113e-03
-1.20270528e-02
-1.50331940e-02
-1.73749774e-02
-2.03723834e-02
-2.27109381e-02
-2.51183900e-02
-2.81686647e-02
-3.05507079e-02
-3.24039945e-02
-3.50122385e-02
-3.70343796e-02
-3.91786610e-02
-4.14139446e-02
-4.37174157e-02
-4.54815632e-02
-4.74020397e-02
-4.94385307e-02
-5.09706813e-02
-5.26847205e-02
-5.45334041e-02
-5.58913262e-02
-5.74410036e-02
-5.91324666e-02
-6.03383025e-02
-6.17396035e-02
-6.26945202e-02
-6.38735728e-02
-6.52179802e-02
-6.60938500e-02
-6.65867697e-02
-6.73501175e-02
-6.83125801e-02
-6.94218625e-02
-7.00488232e-02
-7.02825569e-02
-7.07790261e-02
-7.14687657e-02
-7.17100725e-02
-7.21735687e-02
-7.22097677e-02
-7.24835154e-02
-7.23411832e-02
-7.24445106e-02
-7.27283408e-02
-7.25541275e-02
-7.25947621e-02
-7.22024202e-02
-7.20432386e-02
-7.20551905e-02
-7.16020244e-02
-7.13583847e-02
-7.12684133e-02
-7.07004740e-02
-7.03325025e-02
-6.95203961e-02
-6.89329495e-02
-6.85101784e-02
-6.82080094e-02
-6.74034472e-02
-6.67807629e-02
-6.62912260e-02
-6.53084501e-02
-6.45140565e-02
-6.38576285e-02
-6.27112636e-02
-6.23465022e-02
-6.14133743e-02
-6.06135716e-02
-5.93203861e-02
-5.88062092e-02
-5.77216493e-02
-5.67687986e-02
-5.59121569e-02
-5.51255315e-02
-5.37990608e-02
-5.32173962e-02
-5.20402042e-02
-5.09762183e-02
-4.99947363e-02
-4.90731793e-02
-4.81950142e-02
-4.73481076e-02
-4.59328142e-02
-4.52413667e-02
-4.45296495e-02
-4.32117752e-02
-4.19992001e-02
-4.14540379e-02
-4.02564553e-02
-3.91302979e-02
-3.86466594e-02
-3.74923604e-02
-3.63961359e-02
-3.59326297e-02
-3.47912889e-02
-3.37027395e-02
-3.26522849e-02
-3.22198526e-02
-3.10988696e-02
-3.06135589e-02
-2.94526145e-02
-2.89368368e-02
-2.77523514e-02
-2.72181462e-02
-2.60189586e-02
-2.54728066e-02
-2.48544658e-02
-2.41826411e-02
-2.34710812e-02
-2.27298313e-02
-2.19662576e-02
-2.11857835e-02
-2.03923731e-02
-2.01797141e-02
-1.92511847e-02
-1.89384471e-02
-1.85263232e-02
-1.74501194e-02
@@ -0,0 +1,502 @@
1651 9 e000 1 1F5 10
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
4.57763672e-05
1.83105469e-04
4.11987305e-04
7.32421875e-04
1.14440918e-03
1.64794922e-03
2.22778320e-03
2.88391113e-03
3.63159180e-03
4.45556641e-03
5.34057617e-03
6.30187988e-03
7.33947754e-03
8.42285156e-03
9.56726074e-03
1.07727051e-02
1.20391846e-02
1.33361816e-02
1.46942139e-02
1.60980225e-02
1.75476074e-02
1.90277100e-02
2.05383301e-02
2.20794678e-02
2.36663818e-02
2.52685547e-02
2.69012451e-02
2.85491943e-02
3.02124023e-02
3.19061279e-02
3.35998535e-02
3.53088379e-02
3.70330811e-02
3.87573242e-02
4.04815674e-02
4.22210693e-02
4.39453125e-02
4.56695557e-02
4.74090576e-02
4.91180420e-02
5.08270264e-02
5.25360107e-02
5.42297363e-02
5.59082031e-02
5.75714111e-02
5.92041016e-02
6.08367920e-02
6.24542236e-02
6.40411377e-02
6.55975342e-02
6.71539307e-02
6.86645508e-02
7.01599121e-02
7.16247559e-02
7.30743408e-02
7.44781494e-02
7.58666992e-02
7.72247314e-02
7.85369873e-02
7.98339844e-02
8.11004639e-02
8.23211670e-02
8.35266113e-02
8.46862793e-02
8.58154297e-02
8.69140625e-02
8.79669189e-02
8.90045166e-02
8.99963379e-02
9.09576416e-02
9.18884277e-02
9.27734375e-02
9.36279297e-02
9.44519043e-02
9.52453613e-02
9.59930420e-02
9.67254639e-02
9.74121094e-02
9.80682373e-02
9.86785889e-02
9.92736816e-02
9.98382568e-02
1.00357056e-01
1.00845337e-01
1.01318359e-01
1.01745605e-01
1.02157593e-01
1.02523804e-01
1.02874756e-01
1.03195190e-01
1.03469849e-01
1.03744507e-01
1.03973389e-01
1.04187012e-01
1.04370117e-01
1.04522705e-01
1.04660034e-01
1.04782104e-01
1.04873657e-01
1.04934692e-01
1.04980469e-01
1.05010986e-01
1.05010986e-01
1.05010986e-01
1.04980469e-01
1.04934692e-01
1.04873657e-01
1.04782104e-01
1.04690552e-01
1.04583740e-01
1.04461670e-01
1.04324341e-01
1.04171753e-01
1.04003906e-01
1.03836060e-01
1.03652954e-01
1.03454590e-01
1.03256226e-01
1.03042603e-01
1.02813721e-01
1.02600098e-01
1.02355957e-01
1.02127075e-01
1.01882935e-01
1.01623535e-01
1.01379395e-01
1.01119995e-01
1.00860596e-01
1.00585938e-01
1.00326538e-01
1.00051880e-01
9.97924805e-02
9.95178223e-02
9.92431641e-02
9.89837646e-02
9.87091064e-02
9.84344482e-02
9.81750488e-02
9.79156494e-02
9.76409912e-02
9.73815918e-02
9.71221924e-02
9.68780518e-02
9.66186523e-02
9.63745117e-02
9.61303711e-02
9.59014893e-02
9.56726074e-02
9.54437256e-02
9.52148438e-02
9.50012207e-02
9.47875977e-02
9.45739746e-02
9.43756104e-02
9.41772461e-02
9.39941406e-02
9.38110352e-02
9.36279297e-02
9.34600830e-02
9.32922363e-02
9.31396484e-02
9.29870605e-02
9.28497314e-02
9.27124023e-02
9.25903320e-02
9.24682617e-02
9.23461914e-02
9.22393799e-02
9.21325684e-02
9.20410156e-02
9.19494629e-02
9.18731689e-02
9.17968750e-02
9.17358398e-02
9.16748047e-02
9.16137695e-02
9.15679932e-02
9.15222168e-02
9.14916992e-02
9.14611816e-02
9.14306641e-02
9.14154053e-02
9.14154053e-02
9.14001465e-02
9.14001465e-02
9.14154053e-02
9.14306641e-02
9.14459229e-02
9.14611816e-02
9.14916992e-02
9.15222168e-02
9.15527344e-02
9.15985107e-02
9.16442871e-02
9.17053223e-02
9.17510986e-02
9.18121338e-02
9.18731689e-02
9.19342041e-02
9.19647217e-02
9.19036865e-02
9.17510986e-02
9.15069580e-02
9.11865234e-02
9.07745361e-02
9.02709961e-02
8.97064209e-02
8.90502930e-02
8.83178711e-02
8.75244141e-02
8.66699219e-02
8.57391357e-02
8.47625732e-02
8.37097168e-02
8.26110840e-02
8.14666748e-02
8.02612305e-02
7.90252686e-02
7.77282715e-02
7.64007568e-02
7.50274658e-02
7.36236572e-02
7.21893311e-02
7.07244873e-02
6.92291260e-02
6.77185059e-02
6.61773682e-02
6.46209717e-02
6.30493164e-02
6.14624023e-02
5.98602295e-02
5.82580566e-02
5.66406250e-02
5.50231934e-02
5.33905029e-02
5.17730713e-02
5.01403809e-02
4.85229492e-02
4.69055176e-02
4.53033447e-02
4.37011719e-02
4.21142578e-02
4.05273438e-02
3.89709473e-02
3.74145508e-02
3.58734131e-02
3.43627930e-02
3.28674316e-02
3.13873291e-02
2.99377441e-02
2.85034180e-02
2.70996094e-02
2.57110596e-02
2.43530273e-02
2.30102539e-02
2.17132568e-02
2.04315186e-02
1.91802979e-02
1.79595947e-02
1.67694092e-02
1.56097412e-02
1.44805908e-02
1.33819580e-02
1.23138428e-02
1.12762451e-02
1.02691650e-02
9.30786133e-03
8.36181641e-03
7.46154785e-03
6.57653809e-03
5.73730469e-03
4.92858887e-03
4.15039063e-03
3.40270996e-03
2.70080566e-03
2.01416016e-03
1.37329102e-03
7.47680664e-04
1.67846680e-04
-3.81469727e-04
-9.15527344e-04
-1.40380859e-03
-1.86157227e-03
-2.30407715e-03
-2.70080566e-03
-3.08227539e-03
-3.43322754e-03
-3.75366211e-03
-4.04357910e-03
-4.31823730e-03
-4.56237793e-03
-4.77600098e-03
-4.97436523e-03
-5.14221191e-03
-5.27954102e-03
-5.40161133e-03
-5.50842285e-03
-5.58471680e-03
-5.63049316e-03
-5.67626953e-03
-5.69152832e-03
-5.69152832e-03
-5.67626953e-03
-5.63049316e-03
-5.58471680e-03
-5.50842285e-03
-5.43212891e-03
-5.32531738e-03
-5.20324707e-03
-5.08117676e-03
-4.94384766e-03
-4.79125977e-03
-4.62341309e-03
-4.45556641e-03
-4.25720215e-03
-4.07409668e-03
-3.86047363e-03
-3.66210938e-03
-3.43322754e-03
-3.20434570e-03
-2.97546387e-03
-2.73132324e-03
-2.48718262e-03
-2.24304199e-03
-1.98364258e-03
-1.73950195e-03
-1.48010254e-03
-1.20544434e-03
-9.46044922e-04
-6.86645508e-04
-4.11987305e-04
-1.52587891e-04
1.22070313e-04
3.96728516e-04
6.56127930e-04
9.30786133e-04
1.19018555e-03
1.44958496e-03
1.72424316e-03
1.98364258e-03
2.22778320e-03
2.48718262e-03
2.73132324e-03
2.97546387e-03
3.21960449e-03
3.46374512e-03
3.69262695e-03
3.92150879e-03
4.15039063e-03
4.36401367e-03
4.57763672e-03
4.79125977e-03
4.98962402e-03
5.18798828e-03
5.38635254e-03
5.56945801e-03
5.75256348e-03
5.92041016e-03
6.08825684e-03
6.25610352e-03
6.40869141e-03
6.54602051e-03
6.68334961e-03
6.82067871e-03
6.95800781e-03
7.08007813e-03
7.18688965e-03
7.29370117e-03
7.40051270e-03
7.49206543e-03
7.58361816e-03
7.65991211e-03
7.73620605e-03
7.79724121e-03
7.85827637e-03
7.91931152e-03
7.96508789e-03
8.01086426e-03
8.04138184e-03
8.07189941e-03
8.10241699e-03
8.11767578e-03
8.13293457e-03
8.14819336e-03
8.14819336e-03
8.14819336e-03
8.13293457e-03
8.11767578e-03
8.10241699e-03
8.08715820e-03
8.05664063e-03
8.02612305e-03
7.99560547e-03
7.94982910e-03
7.90405273e-03
7.85827637e-03
7.79724121e-03
7.75146484e-03
7.69042969e-03
7.62939453e-03
7.55310059e-03
7.49206543e-03
7.41577148e-03
7.33947754e-03
7.26318359e-03
7.18688965e-03
7.09533691e-03
7.01904297e-03
6.92749023e-03
6.83593750e-03
6.74438477e-03
6.65283203e-03
6.56127930e-03
6.46972656e-03
6.36291504e-03
6.27136230e-03
6.17980957e-03
6.07299805e-03
5.96618652e-03
5.87463379e-03
5.76782227e-03
5.66101074e-03
5.56945801e-03
5.46264648e-03
5.35583496e-03
5.26428223e-03
5.15747070e-03
5.05065918e-03
4.94384766e-03
4.85229492e-03
4.74548340e-03
4.65393066e-03
4.54711914e-03
4.45556641e-03
4.34875488e-03
4.25720215e-03
4.15039063e-03
4.05883789e-03
3.96728516e-03
3.87573242e-03
3.78417969e-03
3.69262695e-03
3.60107422e-03
3.50952148e-03
3.41796875e-03
3.34167480e-03
3.25012207e-03
3.17382813e-03
3.09753418e-03
3.00598145e-03
@@ -0,0 +1,502 @@
1651 9 c000 1 1F5 10
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
1.00000001e-01
1.00000001e-01
1.00000001e-01
1.00000001e-01
1.00000001e-01
1.00000001e-01
1.00000001e-01
1.00000001e-01
1.00000001e-01
1.00000001e-01
1.00000001e-01
1.00000001e-01
1.00000001e-01
1.00000001e-01
1.00000001e-01
1.00000001e-01
1.00000001e-01
1.00000001e-01
1.00000001e-01
1.00000001e-01
1.00000001e-01
1.00000001e-01
1.00000001e-01
1.00000001e-01
1.00000001e-01
1.00000001e-01
1.00000001e-01
1.00000001e-01
1.00000001e-01
1.00000001e-01
1.00000001e-01
1.00000001e-01
1.00000001e-01
1.00000001e-01
1.00000001e-01
1.00000001e-01
1.00000001e-01
1.00000001e-01
1.00000001e-01
1.00000001e-01
1.00000001e-01
1.00000001e-01
1.00000001e-01
1.00000001e-01
1.00000001e-01
1.00000001e-01
1.00000001e-01
1.00000001e-01
1.00000001e-01
1.00000001e-01
1.00000001e-01
1.00000001e-01
1.00000001e-01
1.00000001e-01
1.00000001e-01
1.00000001e-01
1.00000001e-01
1.00000001e-01
1.00000001e-01
1.00000001e-01
1.00000001e-01
1.00000001e-01
1.00000001e-01
1.00000001e-01
1.00000001e-01
1.00000001e-01
1.00000001e-01
1.00000001e-01
1.00000001e-01
1.00000001e-01
1.00000001e-01
1.00000001e-01
1.00000001e-01
1.00000001e-01
1.00000001e-01
1.00000001e-01
1.00000001e-01
1.00000001e-01
1.00000001e-01
1.00000001e-01
1.00000001e-01
1.00000001e-01
1.00000001e-01
1.00000001e-01
1.00000001e-01
1.00000001e-01
1.00000001e-01
1.00000001e-01
1.00000001e-01
1.00000001e-01
1.00000001e-01
1.00000001e-01
1.00000001e-01
1.00000001e-01
1.00000001e-01
1.00000001e-01
1.00000001e-01
1.00000001e-01
1.00000001e-01
1.00000001e-01
1.00000001e-01
1.00000001e-01
1.00000001e-01
1.00000001e-01
1.00000001e-01
1.00000001e-01
1.00000001e-01
1.00000001e-01
1.00000001e-01
1.00000001e-01
1.00000001e-01
1.00000001e-01
1.00000001e-01
1.00000001e-01
1.00000001e-01
1.00000001e-01
1.00000001e-01
1.00000001e-01
1.00000001e-01
1.00000001e-01
1.00000001e-01
1.00000001e-01
1.00000001e-01
1.00000001e-01
1.00000001e-01
1.00000001e-01
1.00000001e-01
1.00000001e-01
1.00000001e-01
1.00000001e-01
1.00000001e-01
1.00000001e-01
1.00000001e-01
1.00000001e-01
1.00000001e-01
1.00000001e-01
1.00000001e-01
1.00000001e-01
1.00000001e-01
1.00000001e-01
1.00000001e-01
1.00000001e-01
1.00000001e-01
1.00000001e-01
1.00000001e-01
1.00000001e-01
1.00000001e-01
1.00000001e-01
1.00000001e-01
1.00000001e-01
1.00000001e-01
1.00000001e-01
1.00000001e-01
1.00000001e-01
1.00000001e-01
1.00000001e-01
1.00000001e-01
1.00000001e-01
1.00000001e-01
1.00000001e-01
1.00000001e-01
1.00000001e-01
1.00000001e-01
1.00000001e-01
1.00000001e-01
1.00000001e-01
1.00000001e-01
1.00000001e-01
1.00000001e-01
1.00000001e-01
1.00000001e-01
1.00000001e-01
1.00000001e-01
1.00000001e-01
1.00000001e-01
1.00000001e-01
1.00000001e-01
1.00000001e-01
1.00000001e-01
1.00000001e-01
1.00000001e-01
1.00000001e-01
1.00000001e-01
1.00000001e-01
1.00000001e-01
1.00000001e-01
1.00000001e-01
1.00000001e-01
1.00000001e-01
1.00000001e-01
1.00000001e-01
1.00000001e-01
1.00000001e-01
1.00000001e-01
1.00000001e-01
1.00000001e-01
1.00000001e-01
1.00000001e-01
1.00000001e-01
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
0.00000000e+00
@@ -0,0 +1,502 @@
1651 9 c000 1 1f5 10
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.984732032
0.985187709
0.982450664
0.977129519
0.969670475
0.960399866
0.949556708
0.937906206
0.925458729
0.911630392
0.897134006
0.88253212
0.867095113
0.850838721
0.834955096
0.818626642
0.801803768
0.784449935
0.767719507
0.750176072
0.732458055
0.714482546
0.69677949
0.679186642
0.661584914
0.643296063
0.625554621
0.607573867
0.589917958
0.572450101
0.554479182
0.537230074
0.519909739
0.50248611
0.485527396
0.468898982
0.451912045
0.435792863
0.419749171
0.403160006
0.387892604
0.372483075
0.356959075
0.341931999
0.327299654
0.312986642
0.299529314
0.285588682
0.271874666
0.258948803
0.246671498
0.233759791
0.222145841
0.210414022
0.199218243
0.187896281
0.177695274
0.167247444
0.157241136
0.148222104
0.138858452
0.12986587
0.121809088
0.113370478
0.105866991
0.0985721201
0.091504164
0.0852680579
0.0785744935
0.0727612823
0.0671182498
0.0616747439
0.0570434704
0.0525325015
0.048185356
0.0440344587
0.040693827
0.0368830413
0.0339437723
0.0311707556
0.0291866511
0.026716806
0.0245189443
0.0231880397
0.0220201313
0.0204587355
0.0198277235
0.0188161656
0.0187446401
0.0183000267
0.0182103366
0.0190511569
0.0189203545
0.0198489726
0.0204917192
0.0215548798
0.0230059028
0.0242300928
0.0253278688
0.0269627869
0.0290726051
0.0310190395
0.0328864902
0.0353267714
0.0370861851
0.0395279415
0.041960258
0.0444255173
0.0475475192
0.050049793
0.052689556
0.0554709136
0.0583969653
0.0614704527
0.0646934658
0.0674761161
0.0705284104
0.0738192797
0.076736182
0.0799702927
0.0834793299
0.0860495269
0.0896650106
0.0923565105
0.0955127403
0.0990520641
0.101732418
0.104925446
0.107946225
0.111431904
0.114119798
0.117364772
0.119878992
0.123000547
0.126018032
0.12837027
0.131377488
0.134315953
0.136615247
0.138997868
0.142033353
0.144408852
0.146851152
0.148754478
0.15140456
0.153462857
0.155638605
0.157311857
0.159167767
0.161159694
0.163251966
0.164828926
0.166580006
0.168459237
0.169843316
0.171415955
0.172537416
0.173879266
0.175384164
0.176418513
0.17765969
0.178462356
0.179494858
0.18010655
0.180960417
0.181402266
0.18209298
0.182966709
0.183384746
0.184019953
0.184223861
0.184663087
0.184683859
0.184949666
0.184803501
0.184907183
0.185194045
0.18502444
0.185071781
0.184686944
0.184536234
0.184556618
0.184112966
0.183288097
0.183324918
0.182852805
0.181967169
0.181328177
0.180870444
0.180545717
0.17972672
0.179096311
0.178603843
0.177621514
0.176830411
0.17558825
0.175155848
0.174176261
0.173345357
-0.812108696
-0.813798308
-0.812119961
-0.807729721
-0.801108062
-0.793198109
-0.783549368
-0.772380233
-0.761033535
-0.748210549
-0.734649658
-0.72093302
-0.706934988
-0.691974759
-0.677282274
-0.661478341
-0.645832956
-0.630176246
-0.613792717
-0.597889245
-0.581067979
-0.56458658
-0.547674894
-0.53090924
-0.514161944
-0.497338653
-0.480369985
-0.463796288
-0.446872354
-0.430191815
-0.413640589
-0.397134781
-0.380612016
-0.364617825
-0.348410964
-0.332588941
-0.316448629
-0.301206768
-0.285472572
-0.270508617
-0.255549908
-0.241176009
-0.226670668
-0.212650478
-0.198426038
-0.185224026
-0.171661466
-0.158415988
-0.146025047
-0.133741677
-0.121568412
-0.110098213
-0.0986248776
-0.0877719074
-0.0768552274
-0.0665146485
-0.0560784526
-0.0467858091
-0.0372636616
-0.0281965043
-0.0195362847
-0.0112478621
-0.00330558047
0.00430907588
0.0116095822
0.0186055936
0.0253039896
0.0317097716
0.0372354388
0.0431820974
0.0482211411
0.0536606535
0.0581771657
0.0624916032
0.0665820912
0.0704322904
0.0734393448
0.0768928453
0.0794559419
0.0824304819
0.0844885632
0.0863478929
0.0885748491
0.0898526534
0.0909071863
0.0923108533
0.0927512348
0.0935482383
0.0939778537
0.0940595344
0.0938073173
0.0938221142
0.0934031978
0.0925870687
0.0919910595
0.0909265354
0.0894387811
0.0881516337
0.0869719908
0.0852406472
0.0830246061
0.0815543085
0.0794495344
0.077389732
0.0753225461
0.07261879
0.0705488622
0.0677618682
0.0655495003
0.0625764579
0.0595551804
0.057048209
0.0543268509
0.0514071174
0.0483007282
0.0456068926
0.0420330316
0.0395043381
0.036008954
0.0334951207
0.0299678184
0.0267969538
0.0238860603
0.0205736365
0.0175158046
0.0146431848
0.0113141406
0.00879008509
0.00571362954
0.00219025183
-0.000521233305
-0.00318942592
-0.00641816854
-0.00891835429
-0.012027096
-0.0150332395
-0.0173750222
-0.020372428
-0.0227109883
-0.0251184348
-0.0281687137
-0.0305507556
-0.0324040353
-0.0350122824
-0.0370344259
-0.0391787142
-0.0414139852
-0.0437174551
-0.0454816036
-0.0474020839
-0.0494385809
-0.0509707257
-0.0526847616
-0.0545334518
-0.055891376
-0.057441052
-0.0591325052
-0.0603383407
-0.0617396496
-0.0626945645
-0.0638736114
-0.065218024
-0.0660938919
-0.0665868148
-0.0673501641
-0.0683126301
-0.0694218874
-0.0700488761
-0.0702826083
-0.0707790777
-0.0714687929
-0.0717100948
-0.0721736327
-0.0722098276
-0.0724835619
-0.0723412037
-0.0724445581
-0.072728388
-0.0725541487
-0.072594814
-0.0722024664
-0.0720432624
-0.072055243
-0.0716020763
-0.0713584349
-0.0712684467
-0.0707005113
-0.0703325421
-0.0695204362
-0.0689329952
-0.0685102195
-0.0682080463
-0.0674034879
-0.0667807981
-0.0662912726
-0.0653084666
-0.0645141006
-0.0638576746
-0.0627112836
-0.0623465478
-0.0614133961
-0.060613621
-0.0593204275
-0.0588062294
-0.0577216744
-0.0567688569
-0.0559122004
-0.055125583
-0.0537991077
-0.0532174408
-0.052040223
-0.0509762615
-0.0499947704
-0.0490732118
-0.0481950492
-0.0473481566
-0.0459328517
-0.0452413931
-0.0445296802
-0.043211814
-0.0419992357
-0.041454073
-0.0402564928
-0.0391303375
-0.038646698
-0.0374924019
-0.0363961793
-0.0359326676
-0.0347913131
-0.0337027833
-0.0326523259
-0.0322198942
-0.0310988948
-0.0306136012
-0.0294526573
-0.0289368648
-0.027752392
-0.0272181872
-0.0260189995
-0.0254728477
-0.0248545073
-0.0241826791
-0.0234711226
-0.0227298588
-0.0219662879
-0.0211858302
-0.020392416
-0.0201797523
-0.0192512218
-0.0189384837
-0.0185263604
-0.0174501576