Update repo
This commit is contained in:
1 parent
749dab5721
commit
ce65a0f59a
14950 files changed
+4408250
-1
No files matched your search
@@ -0,0 +1,40 @@
|
||||
<projectSpec>
|
||||
<project
|
||||
name="cmpss_ex1_asynch"
|
||||
device="TMS320F28388D"
|
||||
cgtVersion="22.6.1.LTS"
|
||||
products="sysconfig;C2000WARE"
|
||||
outputFormat="ELF"
|
||||
launchWizard="False"
|
||||
linkerCommandFile=""
|
||||
enableSysConfigTool="true"
|
||||
sysConfigBuildOptions="--product ${C2000WARE_ROOT}/.metadata/sdk.json --device F2838x --package 337bga --part F2838x_337bga"
|
||||
postBuildStep="
|
||||
echo "========= Build of the CLB simulation has moved to the CLB Tool. Click the '?' icon by the _Generate CLB Simulation File_ enable for more details (located in the Global Parameters of the Tile Design SysConfig module) ============="
|
||||
;if ${GENERATE_DIAGRAM} == 1 ${NODE_TOOL} "${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/dot_file_libraries/clbDotUtility.js" "${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/" "${BuildDirectory}/syscfg" "${BuildDirectory}/syscfg/clb.dot"
|
||||
;if ${GENERATE_DIAGRAM} == 1 mkdir "${BuildDirectory}/diagrams"
|
||||
;if ${GENERATE_DIAGRAM} == 1 ${NODE_TOOL} "${C2000WARE_ROOT}/driverlib/.meta/generate_diagrams.js" "${C2000WARE_ROOT}" "${BuildDirectory}/diagrams" "${BuildDirectory}/syscfg"
|
||||
"
|
||||
>
|
||||
<configuration name="CPU1_RAM" compilerBuildOptions= "--opt_level=off -I${C2000WARE_ROOT} -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} -v28 -ml -mt --cla_support=cla2 --define=RAM --float_support=fpu64 --tmu_support=tmu0 --define=DEBUG --define=CPU1 --gen_func_subsections=on --diag_warning=225 --diag_suppress=10063" linkerBuildOptions="--entry_point code_start --stack_size=0x3F8 --heap_size=0x200 --define=RAM -i${C2000WARE_ROOT} -i${PROJECT_BUILD_DIR}/syscfg -lc2000ware_libraries.cmd.genlibs " />
|
||||
<configuration name="CPU1_FLASH" compilerBuildOptions="--opt_level=off -I${C2000WARE_ROOT} -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} --define=_FLASH -v28 -ml -mt --cla_support=cla2 --float_support=fpu64 --tmu_support=tmu0 --define=DEBUG --define=CPU1 --gen_func_subsections=on --diag_warning=225 --diag_suppress=10063" linkerBuildOptions="--entry_point code_start --stack_size=0x3F8 --heap_size=0x200 --define=_FLASH -i${C2000WARE_ROOT} -i${PROJECT_BUILD_DIR}/syscfg -lc2000ware_libraries.cmd.genlibs " />
|
||||
|
||||
<pathVariable name="C2000WARE_DLIB_ROOT" path="../../../../../../driverlib/f2838x/driverlib/" scope="project" />
|
||||
<pathVariable name="C2000WARE_ROOT" path="../../../../../../" 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="GENERATE_DIAGRAM" value="0" scope="project" />
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/include/driverlib.h" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/include/device.h" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/source/device.c" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/targetConfigs/TMS320F28388D.ccxml" targetDirectory="targetConfigs" />
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/cmd/2838x_RAM_lnk_cpu1.cmd" targetDirectory="" applicableConfigurations="CPU1_RAM" />
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/cmd/2838x_FLASH_lnk_cpu1.cmd" targetDirectory="" applicableConfigurations="CPU1_FLASH" />
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/source/f2838x_codestartbranch.asm" targetDirectory="device" />
|
||||
<file action="link" path="../../../../../../driverlib/f2838x/driverlib/ccs/Debug/driverlib.lib" targetDirectory="" />
|
||||
<file action="copy" path="../../../../../../driverlib/f2838x/driverlib/" targetDirectory="device" excludeFromBuild="True" />
|
||||
<file action="copy" path="../cmpss_ex1_asynch.c" targetDirectory=""/>
|
||||
<file action="copy" path="../cmpss_ex1_asynch.syscfg" targetDirectory=""/>
|
||||
</project>
|
||||
</projectSpec>
|
||||
+40
@@ -0,0 +1,40 @@
|
||||
<projectSpec>
|
||||
<project
|
||||
name="cmpss_ex2_digital_filter"
|
||||
device="TMS320F28388D"
|
||||
cgtVersion="22.6.1.LTS"
|
||||
products="sysconfig;C2000WARE"
|
||||
outputFormat="ELF"
|
||||
launchWizard="False"
|
||||
linkerCommandFile=""
|
||||
enableSysConfigTool="true"
|
||||
sysConfigBuildOptions="--product ${C2000WARE_ROOT}/.metadata/sdk.json --device F2838x --package 337bga --part F2838x_337bga"
|
||||
postBuildStep="
|
||||
echo "========= Build of the CLB simulation has moved to the CLB Tool. Click the '?' icon by the _Generate CLB Simulation File_ enable for more details (located in the Global Parameters of the Tile Design SysConfig module) ============="
|
||||
;if ${GENERATE_DIAGRAM} == 1 ${NODE_TOOL} "${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/dot_file_libraries/clbDotUtility.js" "${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/" "${BuildDirectory}/syscfg" "${BuildDirectory}/syscfg/clb.dot"
|
||||
;if ${GENERATE_DIAGRAM} == 1 mkdir "${BuildDirectory}/diagrams"
|
||||
;if ${GENERATE_DIAGRAM} == 1 ${NODE_TOOL} "${C2000WARE_ROOT}/driverlib/.meta/generate_diagrams.js" "${C2000WARE_ROOT}" "${BuildDirectory}/diagrams" "${BuildDirectory}/syscfg"
|
||||
"
|
||||
>
|
||||
<configuration name="CPU1_RAM" compilerBuildOptions= "--opt_level=off -I${C2000WARE_ROOT} -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} -v28 -ml -mt --cla_support=cla2 --define=RAM --float_support=fpu64 --tmu_support=tmu0 --define=DEBUG --define=CPU1 --gen_func_subsections=on --diag_warning=225 --diag_suppress=10063" linkerBuildOptions="--entry_point code_start --stack_size=0x3F8 --heap_size=0x200 --define=RAM -i${C2000WARE_ROOT} -i${PROJECT_BUILD_DIR}/syscfg -lc2000ware_libraries.cmd.genlibs " />
|
||||
<configuration name="CPU1_FLASH" compilerBuildOptions="--opt_level=off -I${C2000WARE_ROOT} -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} --define=_FLASH -v28 -ml -mt --cla_support=cla2 --float_support=fpu64 --tmu_support=tmu0 --define=DEBUG --define=CPU1 --gen_func_subsections=on --diag_warning=225 --diag_suppress=10063" linkerBuildOptions="--entry_point code_start --stack_size=0x3F8 --heap_size=0x200 --define=_FLASH -i${C2000WARE_ROOT} -i${PROJECT_BUILD_DIR}/syscfg -lc2000ware_libraries.cmd.genlibs " />
|
||||
|
||||
<pathVariable name="C2000WARE_DLIB_ROOT" path="../../../../../../driverlib/f2838x/driverlib/" scope="project" />
|
||||
<pathVariable name="C2000WARE_ROOT" path="../../../../../../" 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="GENERATE_DIAGRAM" value="0" scope="project" />
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/include/driverlib.h" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/include/device.h" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/source/device.c" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/targetConfigs/TMS320F28388D.ccxml" targetDirectory="targetConfigs" />
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/cmd/2838x_RAM_lnk_cpu1.cmd" targetDirectory="" applicableConfigurations="CPU1_RAM" />
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/cmd/2838x_FLASH_lnk_cpu1.cmd" targetDirectory="" applicableConfigurations="CPU1_FLASH" />
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/source/f2838x_codestartbranch.asm" targetDirectory="device" />
|
||||
<file action="link" path="../../../../../../driverlib/f2838x/driverlib/ccs/Debug/driverlib.lib" targetDirectory="" />
|
||||
<file action="copy" path="../../../../../../driverlib/f2838x/driverlib/" targetDirectory="device" excludeFromBuild="True" />
|
||||
<file action="copy" path="../cmpss_ex2_digital_filter.c" targetDirectory=""/>
|
||||
<file action="copy" path="../cmpss_ex2_digital_filter.syscfg" targetDirectory=""/>
|
||||
</project>
|
||||
</projectSpec>
|
||||
@@ -0,0 +1,269 @@
|
||||
//#############################################################################
|
||||
//
|
||||
// FILE: cmpss_ex1_asynch.c
|
||||
//
|
||||
// TITLE: CMPSS Asynchronous Trip
|
||||
//
|
||||
//! \addtogroup driver_example_list
|
||||
//! <h1> CMPSS Asynchronous Trip </h1>
|
||||
//!
|
||||
//! This example enables the CMPSS1 COMPH comparator and feeds the asynchronous
|
||||
//! CTRIPOUTH signal to the GPIO14/OUTPUTXBAR3 pin and CTRIPH to GPIO15/EPWM8B.
|
||||
//!
|
||||
//! CMPSS is configured to generate trip signals to trip the EPWM signals.
|
||||
//! CMPIN1P is used to give positive input and internal DAC is configured
|
||||
//! to provide the negative input. Internal DAC is configured to provide a
|
||||
//! signal at VDD/2. An EPWM signal is generated at GPIO15 and is configured
|
||||
//! to be tripped by CTRIPOUTH.
|
||||
//!
|
||||
//! When a low input(VSS) is provided to CMPIN1P,
|
||||
//! - Trip signal(GPIO14) output is low
|
||||
//! - PWM8B(GPIO15) gives a PWM signal
|
||||
//!
|
||||
//! When a high input(higher than VDD/2) is provided to CMPIN1P,
|
||||
//! - Trip signal(GPIO14) output turns high
|
||||
//! - PWM8B(GPIO15) gets tripped and outputs as high
|
||||
//!
|
||||
//! \b External \b Connections \n
|
||||
//! - Give input on CMPIN1P (HSEC Pin 15)
|
||||
//! - Outputs can be observed on GPIO14 and GPIO15 using an oscilloscope
|
||||
//!
|
||||
//! \b Watch \b Variables \n
|
||||
//! - None
|
||||
//!
|
||||
//
|
||||
//#############################################################################
|
||||
//
|
||||
//
|
||||
//
|
||||
// C2000Ware v5.04.00.00
|
||||
//
|
||||
// Copyright (C) 2024 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 "driverlib.h"
|
||||
#include "device.h"
|
||||
#include "board.h"
|
||||
|
||||
//
|
||||
// Function Prototypes
|
||||
//
|
||||
void initEPWM(void);
|
||||
|
||||
//
|
||||
// Main
|
||||
//
|
||||
void main(void)
|
||||
{
|
||||
//
|
||||
// Initialize device clock and peripherals
|
||||
//
|
||||
Device_init();
|
||||
|
||||
//
|
||||
// Disable pin locks and enable internal pullups.
|
||||
//
|
||||
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();
|
||||
|
||||
//
|
||||
// Set up ePWM8 to take CTRIPH as TRIP4 for its DC trip input
|
||||
//
|
||||
initEPWM();
|
||||
|
||||
//
|
||||
// Board Initialization
|
||||
// - Configure GPIO14 to output CTRIPOUT1H (routed through XBAROUTPUT3)
|
||||
// - Setup the Output X-BAR to output CTRIPOUTH on OUTPUTXBAR3
|
||||
// - Configure the high comparator of CMPSS1
|
||||
// - Enable CMPSS and configure the negative input signal to come from
|
||||
// the DAC
|
||||
// - Use VDDA as the reference for the DAC and set DAC value to midpoint for
|
||||
// arbitrary reference.
|
||||
// - Configure the output signals. Both CTRIPH and CTRIPOUTH will be fed by
|
||||
// the asynchronous comparator output.
|
||||
//
|
||||
Board_init();
|
||||
|
||||
|
||||
//
|
||||
// Configure GPIO15 to output CTRIPH (routed through ePWM TRIP4 and ePWM8)
|
||||
//
|
||||
GPIO_setPinConfig(GPIO_15_EPWM8B);
|
||||
|
||||
//
|
||||
// Enable Global Interrupt (INTM) and realtime interrupt (DBGM)
|
||||
//
|
||||
EINT;
|
||||
ERTM;
|
||||
|
||||
//
|
||||
// Loop indefinitely
|
||||
//
|
||||
while(1)
|
||||
{
|
||||
//
|
||||
// Trip flag is set when CTRIP signal is asserted
|
||||
//
|
||||
if((EPWM_getTripZoneFlagStatus(EPWM8_BASE) &
|
||||
EPWM_TZ_FLAG_OST) != 0U)
|
||||
{
|
||||
//
|
||||
// Wait for comparator CTRIP to de-assert
|
||||
//
|
||||
while((CMPSS_getStatus(CMPSS1_BASE) & CMPSS_STS_HI_FILTOUT) != 0U)
|
||||
{
|
||||
;
|
||||
}
|
||||
|
||||
//
|
||||
// Clear trip flags
|
||||
//
|
||||
EPWM_clearTripZoneFlag(EPWM8_BASE, EPWM_TZ_INTERRUPT |
|
||||
EPWM_TZ_FLAG_OST);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// initEPWM - Function to configure ePWM8 and the ePWM X-BAR to take CTRIPH as
|
||||
// the DC trip input
|
||||
//
|
||||
void initEPWM(void)
|
||||
{
|
||||
//
|
||||
// Disable the ePWM time base clock before configuring the module
|
||||
//
|
||||
SysCtl_disablePeripheral(SYSCTL_PERIPH_CLK_TBCLKSYNC);
|
||||
|
||||
//
|
||||
// Set the time base clock prescalers to /1
|
||||
//
|
||||
EPWM_setClockPrescaler(EPWM8_BASE, EPWM_CLOCK_DIVIDER_1,
|
||||
EPWM_HSCLOCK_DIVIDER_1);
|
||||
|
||||
//
|
||||
// Initializing dummy values for ePWM counter and period
|
||||
//
|
||||
EPWM_setTimeBaseCounter(EPWM8_BASE, 0);
|
||||
EPWM_setTimeBasePeriod(EPWM8_BASE, 0xFFFF);
|
||||
|
||||
//
|
||||
// Set-up compare
|
||||
//
|
||||
EPWM_setCounterCompareValue(EPWM8_BASE, EPWM_COUNTER_COMPARE_B, 0x8000);
|
||||
|
||||
//
|
||||
// Set actions
|
||||
//
|
||||
EPWM_setActionQualifierAction(EPWM8_BASE,
|
||||
EPWM_AQ_OUTPUT_B,
|
||||
EPWM_AQ_OUTPUT_HIGH,
|
||||
EPWM_AQ_OUTPUT_ON_TIMEBASE_UP_CMPB);
|
||||
|
||||
EPWM_setActionQualifierAction(EPWM8_BASE,
|
||||
EPWM_AQ_OUTPUT_B,
|
||||
EPWM_AQ_OUTPUT_LOW,
|
||||
EPWM_AQ_OUTPUT_ON_TIMEBASE_ZERO);
|
||||
|
||||
//
|
||||
// Configure ePWM8B to output high on TZB TRIP
|
||||
|
||||
//
|
||||
EPWM_setTripZoneAction(EPWM8_BASE, EPWM_TZ_ACTION_EVENT_TZB,
|
||||
EPWM_TZ_ACTION_HIGH);
|
||||
|
||||
//
|
||||
// Trigger event when DCBH is high
|
||||
//
|
||||
EPWM_setTripZoneDigitalCompareEventCondition(EPWM8_BASE,
|
||||
EPWM_TZ_DC_OUTPUT_B1,
|
||||
EPWM_TZ_EVENT_DCXH_HIGH);
|
||||
|
||||
//
|
||||
// Configure DCBH to use TRIP4 as an input
|
||||
//
|
||||
EPWM_enableDigitalCompareTripCombinationInput(EPWM8_BASE,
|
||||
EPWM_DC_COMBINATIONAL_TRIPIN4,
|
||||
EPWM_DC_TYPE_DCBH);
|
||||
|
||||
//
|
||||
// Enable DCB as OST
|
||||
//
|
||||
EPWM_enableTripZoneSignals(EPWM8_BASE, EPWM_TZ_SIGNAL_DCBEVT1);
|
||||
|
||||
//
|
||||
// Configure the DCB path to be unfiltered and asynchronous
|
||||
//
|
||||
EPWM_setDigitalCompareEventSource(EPWM8_BASE,
|
||||
EPWM_DC_MODULE_B,
|
||||
EPWM_DC_EVENT_1,
|
||||
EPWM_DC_EVENT_SOURCE_ORIG_SIGNAL);
|
||||
|
||||
//
|
||||
// Sync the ePWM time base clock
|
||||
//
|
||||
SysCtl_enablePeripheral(SYSCTL_PERIPH_CLK_TBCLKSYNC);
|
||||
|
||||
//
|
||||
// Configure TRIP4 to be CTRIP1H using the ePWM X-BAR
|
||||
//
|
||||
XBAR_setEPWMMuxConfig(XBAR_TRIP4, XBAR_EPWM_MUX00_CMPSS1_CTRIPH);
|
||||
XBAR_enableEPWMMux(XBAR_TRIP4, XBAR_MUX00);
|
||||
|
||||
|
||||
//
|
||||
// Clear trip flags
|
||||
//
|
||||
EPWM_clearTripZoneFlag(EPWM8_BASE, EPWM_TZ_INTERRUPT |
|
||||
EPWM_TZ_FLAG_OST);
|
||||
|
||||
//
|
||||
// Put the time base counter into up-count mode
|
||||
//
|
||||
EPWM_setTimeBaseCounterMode(EPWM8_BASE, EPWM_COUNTER_MODE_UP);
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
|
||||
/**
|
||||
* Import the modules used in this configuration.
|
||||
*/
|
||||
const cmpss = scripting.addModule("/driverlib/cmpss.js", {}, false);
|
||||
const cmpss1 = cmpss.addInstance();
|
||||
const outputxbar = scripting.addModule("/driverlib/outputxbar.js", {}, false);
|
||||
const outputxbar1 = outputxbar.addInstance();
|
||||
|
||||
/**
|
||||
* Write custom configuration values to the imported modules.
|
||||
*/
|
||||
cmpss1.$name = "myCMPSS0";
|
||||
cmpss1.enableModule = true;
|
||||
cmpss1.dacValHigh = 2048;
|
||||
|
||||
outputxbar1.$name = "myOUTPUTXBAR0";
|
||||
outputxbar1.muxesUsed = ["XBAR_MUX00"];
|
||||
outputxbar1.outputxbar.$assign = "OUTPUTXBAR3";
|
||||
outputxbar1.outputxbar.outputxbarPin.$assign = "GPIO14";
|
||||
@@ -0,0 +1,133 @@
|
||||
//#############################################################################
|
||||
//
|
||||
// FILE: cmpss_ex2_digital_filter.c
|
||||
//
|
||||
// TITLE: CMPSS Digital Filter Configuration
|
||||
//
|
||||
//! \addtogroup driver_example_list
|
||||
//! <h1> CMPSS Digital Filter Configuration </h1>
|
||||
//!
|
||||
//! This example enables the CMPSS1 COMPH comparator and feeds the output
|
||||
//! through the digital filter to the GPIO14/OUTPUTXBAR3 pin.
|
||||
//!
|
||||
//! CMPIN1P is used to give positive input and internal DAC is configured
|
||||
//! to provide the negative input. Internal DAC is configured to provide a
|
||||
//! signal at VDD/2.
|
||||
//!
|
||||
//! When a low input(VSS) is provided to CMPIN1P,
|
||||
//! - GPIO14 output is low
|
||||
//!
|
||||
//! When a high input(higher than VDD/2) is provided to CMPIN1P,
|
||||
//! - GPIO14 output turns high
|
||||
|
||||
//!
|
||||
//! \b External \b Connections \n
|
||||
//! - Give input on CMPIN1P (HSEC Pin 15)
|
||||
//! - Output can be observed on GPIO14 using an oscilloscope
|
||||
//!
|
||||
//! \b Watch \b Variables \n
|
||||
//! - None
|
||||
//!
|
||||
//
|
||||
//#############################################################################
|
||||
//
|
||||
//
|
||||
//
|
||||
// C2000Ware v5.04.00.00
|
||||
//
|
||||
// Copyright (C) 2024 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 "driverlib.h"
|
||||
#include "device.h"
|
||||
#include "board.h"
|
||||
|
||||
//
|
||||
// Main
|
||||
//
|
||||
void main(void)
|
||||
{
|
||||
//
|
||||
// Initialize device clock and peripherals
|
||||
//
|
||||
Device_init();
|
||||
|
||||
//
|
||||
// Disable pin locks and enable internal pullups.
|
||||
//
|
||||
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();
|
||||
|
||||
//
|
||||
// Board initialization
|
||||
// - Configure GPIO14 to output CTRIPOUT1H (routed through XBAROUTPUT3)
|
||||
// - Setup the Output X-BAR to output CTRIPOUTH on OUTPUTXBAR3
|
||||
// - Configure the high comparator of CMPSS1
|
||||
// - Enable CMPSS and configure the negative input signal to come from
|
||||
// the DAC
|
||||
// - Use VDDA as the reference for the DAC and set DAC value to midpoint for
|
||||
// arbitrary reference.
|
||||
// - Configure digital filter. For this example, the maxiumum values will be
|
||||
// used for the clock prescale, sample window size, and threshold.
|
||||
// - Initialize the filter logic and start filtering
|
||||
// - Configure the output signals. Both CTRIPH and CTRIPOUTH will be fed by
|
||||
// the filter output.
|
||||
//
|
||||
Board_init();
|
||||
|
||||
//
|
||||
// Enable Global Interrupt (INTM) and realtime interrupt (DBGM)
|
||||
//
|
||||
EINT;
|
||||
ERTM;
|
||||
|
||||
//
|
||||
// Loop indefinitely
|
||||
//
|
||||
while(1)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
|
||||
/**
|
||||
* Import the modules used in this configuration.
|
||||
*/
|
||||
const cmpss = scripting.addModule("/driverlib/cmpss.js", {}, false);
|
||||
const cmpss1 = cmpss.addInstance();
|
||||
const outputxbar = scripting.addModule("/driverlib/outputxbar.js", {}, false);
|
||||
const outputxbar1 = outputxbar.addInstance();
|
||||
|
||||
/**
|
||||
* Write custom configuration values to the imported modules.
|
||||
*/
|
||||
cmpss1.$name = "myCMPSS0";
|
||||
cmpss1.enableModule = true;
|
||||
cmpss1.dacValHigh = 2048;
|
||||
cmpss1.samplePrescaleHigh = 1023;
|
||||
cmpss1.sampleWindowHigh = 32;
|
||||
cmpss1.thresholdHigh = 31;
|
||||
cmpss1.initFilterHigh = true;
|
||||
cmpss1.highCTRIPOUT = "CMPSS_TRIPOUT_FILTER";
|
||||
cmpss1.highCTRIP = "CMPSS_TRIP_FILTER";
|
||||
|
||||
outputxbar1.$name = "myOUTPUTXBAR0";
|
||||
outputxbar1.muxesUsed = ["XBAR_MUX00"];
|
||||
outputxbar1.outputxbar.$assign = "OUTPUTXBAR3";
|
||||
outputxbar1.outputxbar.outputxbarPin.$assign = "GPIO14";
|
||||
Reference in new issue
Block a user