Update repo
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
<projectSpec>
|
||||
<project
|
||||
name="adc_ex10_ppb_pwm_trip"
|
||||
device="TMS320F28377D"
|
||||
cgtVersion="22.6.0.LTS"
|
||||
products="C2000WARE"
|
||||
outputFormat="ELF"
|
||||
launchWizard="False"
|
||||
linkerCommandFile=""
|
||||
enableSysConfigTool="true"
|
||||
sysConfigBuildOptions="--product ${C2000WARE_ROOT}/.metadata/sdk.json --device F2837xD"
|
||||
>
|
||||
<configuration name="CPU1_RAM" compilerBuildOptions="--opt_level=off -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} -I${C2000WARE_SFO_INCLUDE} --define=DEBUG -v28 -ml -mt --define=CPU1 --diag_warning=225 --diag_suppress=10063 --display_error_number" linkerBuildOptions="--entry_point code_start --stack_size=0x3F8 --heap_size=0x200 --define RAM" />
|
||||
<configuration name="CPU1_FLASH" compilerBuildOptions="--opt_level=off -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} -I${C2000WARE_SFO_INCLUDE} --define=DEBUG -v28 -ml -mt --define=CPU1 --define=_FLASH --diag_warning=225 --diag_suppress=10063 --display_error_number" linkerBuildOptions="--entry_point code_start --stack_size=0x3F8 --heap_size=0x200 " />
|
||||
|
||||
<configuration name="CPU1_CLB" postBuildStep="mkdir "${BuildDirectory}/simulation"
|
||||
;${CLB_SIM_COMPILER}/g++ -c -DCLB_SIM -I${SYSTEMC_INSTALL}/src -I${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/include -I${PROJECT_ROOT} -I${CLB_SIM_COMPILER}/include -Og -g -gdwarf-3 -gstrict-dwarf -Wall -MMD -MP -MF${BuildDirectory}/simulation/clb_sim.d -MT${BuildDirectory}/simulation/clb_sim.o -I${BuildDirectory}/syscfg -fno-threadsafe-statics -o${BuildDirectory}/simulation/clb_sim.o ${BuildDirectory}/syscfg/clb_sim.cpp
|
||||
;${CLB_SIM_COMPILER}/g++ -DCLB_SIM -Og -g -gdwarf-3 -gstrict-dwarf -Wall -Wl,-Map,${BuildDirectory}/simulation/simulation_output.map -L${SYSTEMC_INSTALL}/build/src -o${BuildDirectory}/simulation/simulation_output.exe ${BuildDirectory}/simulation/clb_sim.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/CLB_FSM_SC_model.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/CLB_HLC_SC_model.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/CLB_LUT4_SC_model.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/CLB_OutputLUT_SC_model.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/CLB_counter_SC_model.o -Wl,--start-group -lsystemc -Wl,--end-group;./simulation/simulation_output.exe
|
||||
;${NODE_TOOL} "${CLB_SYSCFG_ROOT}/dot_file_libraries/clbDotUtility.js" "${CLB_SYSCFG_ROOT}" "${BuildDirectory}/syscfg" "${BuildDirectory}/syscfg/clb.dot"" compilerBuildOptions="--opt_level=off -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} -I${C2000WARE_SFO_INCLUDE} --define=DEBUG -v28 -ml -mt --define=CPU1 --diag_warning=225 --diag_suppress=10063 --display_error_number" linkerBuildOptions="--entry_point code_start --stack_size=0x3F8 --heap_size=0x200 --define RAM" />
|
||||
|
||||
<pathVariable name="C2000WARE_DLIB_ROOT" path="../../../../driverlib/" scope="project" />
|
||||
<pathVariable name="C2000WARE_ROOT" path="../../../../../../" scope="project" />
|
||||
<pathVariable name="C2000WARE_SFO_INCLUDE" path="../../../../../../libraries/calibration/hrpwm/F2837xD/include/" 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" />
|
||||
|
||||
<file action="link" path="../../../../../../libraries/calibration/hrpwm/F2837xD/lib/SFO_v8_fpu_lib_build_c28_driverlib.lib" targetDirectory="" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/include/driverlib.h" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/include/device.h" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/source/device.c" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/targetConfigs/TMS320F28377D.ccxml" targetDirectory="targetConfigs" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/cmd/2837xD_RAM_lnk_cpu1.cmd" targetDirectory="" applicableConfigurations="CPU1_RAM,CPU1_CLB" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/cmd/2837xD_FLASH_lnk_cpu1.cmd" targetDirectory="" applicableConfigurations="CPU1_FLASH" />
|
||||
<file action="copy" path="../../../../driverlib/" targetDirectory="device" excludeFromBuild="True" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/source/F2837xD_CodeStartBranch.asm" targetDirectory="device" />
|
||||
<file action="link" path="../../../../driverlib/ccs/Debug/driverlib.lib" targetDirectory="" />
|
||||
|
||||
<file action="copy" path="../adc_ex10_ppb_pwm_trip.c" targetDirectory="" />
|
||||
</project>
|
||||
</projectSpec>
|
||||
+42
@@ -0,0 +1,42 @@
|
||||
<projectSpec>
|
||||
<project
|
||||
name="adc_ex11_multiple_soc_epwm"
|
||||
device="TMS320F28377D"
|
||||
cgtVersion="22.6.0.LTS"
|
||||
products="C2000WARE"
|
||||
outputFormat="ELF"
|
||||
launchWizard="False"
|
||||
linkerCommandFile=""
|
||||
enableSysConfigTool="true"
|
||||
sysConfigBuildOptions="--product ${C2000WARE_ROOT}/.metadata/sdk.json --device F2837xD"
|
||||
>
|
||||
<configuration name="CPU1_RAM" compilerBuildOptions="--opt_level=off -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} -I${C2000WARE_SFO_INCLUDE} --define=DEBUG -v28 -ml -mt --define=CPU1 --diag_warning=225 --diag_suppress=10063 --display_error_number" linkerBuildOptions="--entry_point code_start --stack_size=0x3F8 --heap_size=0x200 --define RAM" />
|
||||
<configuration name="CPU1_FLASH" compilerBuildOptions="--opt_level=off -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} -I${C2000WARE_SFO_INCLUDE} --define=DEBUG -v28 -ml -mt --define=CPU1 --define=_FLASH --diag_warning=225 --diag_suppress=10063 --display_error_number" linkerBuildOptions="--entry_point code_start --stack_size=0x3F8 --heap_size=0x200 " />
|
||||
|
||||
<configuration name="CPU1_CLB" postBuildStep="mkdir "${BuildDirectory}/simulation"
|
||||
;${CLB_SIM_COMPILER}/g++ -c -DCLB_SIM -I${SYSTEMC_INSTALL}/src -I${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/include -I${PROJECT_ROOT} -I${CLB_SIM_COMPILER}/include -Og -g -gdwarf-3 -gstrict-dwarf -Wall -MMD -MP -MF${BuildDirectory}/simulation/clb_sim.d -MT${BuildDirectory}/simulation/clb_sim.o -I${BuildDirectory}/syscfg -fno-threadsafe-statics -o${BuildDirectory}/simulation/clb_sim.o ${BuildDirectory}/syscfg/clb_sim.cpp
|
||||
;${CLB_SIM_COMPILER}/g++ -DCLB_SIM -Og -g -gdwarf-3 -gstrict-dwarf -Wall -Wl,-Map,${BuildDirectory}/simulation/simulation_output.map -L${SYSTEMC_INSTALL}/build/src -o${BuildDirectory}/simulation/simulation_output.exe ${BuildDirectory}/simulation/clb_sim.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/CLB_FSM_SC_model.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/CLB_HLC_SC_model.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/CLB_LUT4_SC_model.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/CLB_OutputLUT_SC_model.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/CLB_counter_SC_model.o -Wl,--start-group -lsystemc -Wl,--end-group;./simulation/simulation_output.exe
|
||||
;${NODE_TOOL} "${CLB_SYSCFG_ROOT}/dot_file_libraries/clbDotUtility.js" "${CLB_SYSCFG_ROOT}" "${BuildDirectory}/syscfg" "${BuildDirectory}/syscfg/clb.dot"" compilerBuildOptions="--opt_level=off -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} -I${C2000WARE_SFO_INCLUDE} --define=DEBUG -v28 -ml -mt --define=CPU1 --diag_warning=225 --diag_suppress=10063 --display_error_number" linkerBuildOptions="--entry_point code_start --stack_size=0x3F8 --heap_size=0x200 --define RAM" />
|
||||
|
||||
<pathVariable name="C2000WARE_DLIB_ROOT" path="../../../../driverlib/" scope="project" />
|
||||
<pathVariable name="C2000WARE_ROOT" path="../../../../../../" scope="project" />
|
||||
<pathVariable name="C2000WARE_SFO_INCLUDE" path="../../../../../../libraries/calibration/hrpwm/F2837xD/include/" 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" />
|
||||
|
||||
<file action="link" path="../../../../../../libraries/calibration/hrpwm/F2837xD/lib/SFO_v8_fpu_lib_build_c28_driverlib.lib" targetDirectory="" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/include/driverlib.h" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/include/device.h" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/source/device.c" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/targetConfigs/TMS320F28377D.ccxml" targetDirectory="targetConfigs" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/cmd/2837xD_RAM_lnk_cpu1.cmd" targetDirectory="" applicableConfigurations="CPU1_RAM,CPU1_CLB" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/cmd/2837xD_FLASH_lnk_cpu1.cmd" targetDirectory="" applicableConfigurations="CPU1_FLASH" />
|
||||
<file action="copy" path="../../../../driverlib/" targetDirectory="device" excludeFromBuild="True" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/source/F2837xD_CodeStartBranch.asm" targetDirectory="device" />
|
||||
<file action="link" path="../../../../driverlib/ccs/Debug/driverlib.lib" targetDirectory="" />
|
||||
|
||||
<file action="copy" path="../adc_ex11_multiple_soc_epwm.c" targetDirectory="" />
|
||||
</project>
|
||||
</projectSpec>
|
||||
+42
@@ -0,0 +1,42 @@
|
||||
<projectSpec>
|
||||
<project
|
||||
name="adc_ex12_burst_mode_epwm"
|
||||
device="TMS320F28377D"
|
||||
cgtVersion="22.6.0.LTS"
|
||||
products="C2000WARE"
|
||||
outputFormat="ELF"
|
||||
launchWizard="False"
|
||||
linkerCommandFile=""
|
||||
enableSysConfigTool="true"
|
||||
sysConfigBuildOptions="--product ${C2000WARE_ROOT}/.metadata/sdk.json --device F2837xD"
|
||||
>
|
||||
<configuration name="CPU1_RAM" compilerBuildOptions="--opt_level=off -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} -I${C2000WARE_SFO_INCLUDE} --define=DEBUG -v28 -ml -mt --define=CPU1 --diag_warning=225 --diag_suppress=10063 --display_error_number" linkerBuildOptions="--entry_point code_start --stack_size=0x3F8 --heap_size=0x200 --define RAM" />
|
||||
<configuration name="CPU1_FLASH" compilerBuildOptions="--opt_level=off -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} -I${C2000WARE_SFO_INCLUDE} --define=DEBUG -v28 -ml -mt --define=CPU1 --define=_FLASH --diag_warning=225 --diag_suppress=10063 --display_error_number" linkerBuildOptions="--entry_point code_start --stack_size=0x3F8 --heap_size=0x200 " />
|
||||
|
||||
<configuration name="CPU1_CLB" postBuildStep="mkdir "${BuildDirectory}/simulation"
|
||||
;${CLB_SIM_COMPILER}/g++ -c -DCLB_SIM -I${SYSTEMC_INSTALL}/src -I${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/include -I${PROJECT_ROOT} -I${CLB_SIM_COMPILER}/include -Og -g -gdwarf-3 -gstrict-dwarf -Wall -MMD -MP -MF${BuildDirectory}/simulation/clb_sim.d -MT${BuildDirectory}/simulation/clb_sim.o -I${BuildDirectory}/syscfg -fno-threadsafe-statics -o${BuildDirectory}/simulation/clb_sim.o ${BuildDirectory}/syscfg/clb_sim.cpp
|
||||
;${CLB_SIM_COMPILER}/g++ -DCLB_SIM -Og -g -gdwarf-3 -gstrict-dwarf -Wall -Wl,-Map,${BuildDirectory}/simulation/simulation_output.map -L${SYSTEMC_INSTALL}/build/src -o${BuildDirectory}/simulation/simulation_output.exe ${BuildDirectory}/simulation/clb_sim.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/CLB_FSM_SC_model.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/CLB_HLC_SC_model.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/CLB_LUT4_SC_model.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/CLB_OutputLUT_SC_model.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/CLB_counter_SC_model.o -Wl,--start-group -lsystemc -Wl,--end-group;./simulation/simulation_output.exe
|
||||
;${NODE_TOOL} "${CLB_SYSCFG_ROOT}/dot_file_libraries/clbDotUtility.js" "${CLB_SYSCFG_ROOT}" "${BuildDirectory}/syscfg" "${BuildDirectory}/syscfg/clb.dot"" compilerBuildOptions="--opt_level=off -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} -I${C2000WARE_SFO_INCLUDE} --define=DEBUG -v28 -ml -mt --define=CPU1 --diag_warning=225 --diag_suppress=10063 --display_error_number" linkerBuildOptions="--entry_point code_start --stack_size=0x3F8 --heap_size=0x200 --define RAM" />
|
||||
|
||||
<pathVariable name="C2000WARE_DLIB_ROOT" path="../../../../driverlib/" scope="project" />
|
||||
<pathVariable name="C2000WARE_ROOT" path="../../../../../../" scope="project" />
|
||||
<pathVariable name="C2000WARE_SFO_INCLUDE" path="../../../../../../libraries/calibration/hrpwm/F2837xD/include/" 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" />
|
||||
|
||||
<file action="link" path="../../../../../../libraries/calibration/hrpwm/F2837xD/lib/SFO_v8_fpu_lib_build_c28_driverlib.lib" targetDirectory="" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/include/driverlib.h" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/include/device.h" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/source/device.c" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/targetConfigs/TMS320F28377D.ccxml" targetDirectory="targetConfigs" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/cmd/2837xD_RAM_lnk_cpu1.cmd" targetDirectory="" applicableConfigurations="CPU1_RAM,CPU1_CLB" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/cmd/2837xD_FLASH_lnk_cpu1.cmd" targetDirectory="" applicableConfigurations="CPU1_FLASH" />
|
||||
<file action="copy" path="../../../../driverlib/" targetDirectory="device" excludeFromBuild="True" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/source/F2837xD_CodeStartBranch.asm" targetDirectory="device" />
|
||||
<file action="link" path="../../../../driverlib/ccs/Debug/driverlib.lib" targetDirectory="" />
|
||||
|
||||
<file action="copy" path="../adc_ex12_burst_mode_epwm.c" targetDirectory="" />
|
||||
</project>
|
||||
</projectSpec>
|
||||
+42
@@ -0,0 +1,42 @@
|
||||
<projectSpec>
|
||||
<project
|
||||
name="adc_ex13_burst_mode_oversampling"
|
||||
device="TMS320F28377D"
|
||||
cgtVersion="22.6.0.LTS"
|
||||
products="C2000WARE"
|
||||
outputFormat="ELF"
|
||||
launchWizard="False"
|
||||
linkerCommandFile=""
|
||||
enableSysConfigTool="true"
|
||||
sysConfigBuildOptions="--product ${C2000WARE_ROOT}/.metadata/sdk.json --device F2837xD"
|
||||
>
|
||||
<configuration name="CPU1_RAM" compilerBuildOptions="--opt_level=off -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} -I${C2000WARE_SFO_INCLUDE} --define=DEBUG -v28 -ml -mt --define=CPU1 --diag_warning=225 --diag_suppress=10063 --display_error_number" linkerBuildOptions="--entry_point code_start --stack_size=0x3F8 --heap_size=0x200 --define RAM" />
|
||||
<configuration name="CPU1_FLASH" compilerBuildOptions="--opt_level=off -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} -I${C2000WARE_SFO_INCLUDE} --define=DEBUG -v28 -ml -mt --define=CPU1 --define=_FLASH --diag_warning=225 --diag_suppress=10063 --display_error_number" linkerBuildOptions="--entry_point code_start --stack_size=0x3F8 --heap_size=0x200 " />
|
||||
|
||||
<configuration name="CPU1_CLB" postBuildStep="mkdir "${BuildDirectory}/simulation"
|
||||
;${CLB_SIM_COMPILER}/g++ -c -DCLB_SIM -I${SYSTEMC_INSTALL}/src -I${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/include -I${PROJECT_ROOT} -I${CLB_SIM_COMPILER}/include -Og -g -gdwarf-3 -gstrict-dwarf -Wall -MMD -MP -MF${BuildDirectory}/simulation/clb_sim.d -MT${BuildDirectory}/simulation/clb_sim.o -I${BuildDirectory}/syscfg -fno-threadsafe-statics -o${BuildDirectory}/simulation/clb_sim.o ${BuildDirectory}/syscfg/clb_sim.cpp
|
||||
;${CLB_SIM_COMPILER}/g++ -DCLB_SIM -Og -g -gdwarf-3 -gstrict-dwarf -Wall -Wl,-Map,${BuildDirectory}/simulation/simulation_output.map -L${SYSTEMC_INSTALL}/build/src -o${BuildDirectory}/simulation/simulation_output.exe ${BuildDirectory}/simulation/clb_sim.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/CLB_FSM_SC_model.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/CLB_HLC_SC_model.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/CLB_LUT4_SC_model.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/CLB_OutputLUT_SC_model.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/CLB_counter_SC_model.o -Wl,--start-group -lsystemc -Wl,--end-group;./simulation/simulation_output.exe
|
||||
;${NODE_TOOL} "${CLB_SYSCFG_ROOT}/dot_file_libraries/clbDotUtility.js" "${CLB_SYSCFG_ROOT}" "${BuildDirectory}/syscfg" "${BuildDirectory}/syscfg/clb.dot"" compilerBuildOptions="--opt_level=off -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} -I${C2000WARE_SFO_INCLUDE} --define=DEBUG -v28 -ml -mt --define=CPU1 --diag_warning=225 --diag_suppress=10063 --display_error_number" linkerBuildOptions="--entry_point code_start --stack_size=0x3F8 --heap_size=0x200 --define RAM" />
|
||||
|
||||
<pathVariable name="C2000WARE_DLIB_ROOT" path="../../../../driverlib/" scope="project" />
|
||||
<pathVariable name="C2000WARE_ROOT" path="../../../../../../" scope="project" />
|
||||
<pathVariable name="C2000WARE_SFO_INCLUDE" path="../../../../../../libraries/calibration/hrpwm/F2837xD/include/" 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" />
|
||||
|
||||
<file action="link" path="../../../../../../libraries/calibration/hrpwm/F2837xD/lib/SFO_v8_fpu_lib_build_c28_driverlib.lib" targetDirectory="" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/include/driverlib.h" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/include/device.h" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/source/device.c" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/targetConfigs/TMS320F28377D.ccxml" targetDirectory="targetConfigs" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/cmd/2837xD_RAM_lnk_cpu1.cmd" targetDirectory="" applicableConfigurations="CPU1_RAM,CPU1_CLB" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/cmd/2837xD_FLASH_lnk_cpu1.cmd" targetDirectory="" applicableConfigurations="CPU1_FLASH" />
|
||||
<file action="copy" path="../../../../driverlib/" targetDirectory="device" excludeFromBuild="True" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/source/F2837xD_CodeStartBranch.asm" targetDirectory="device" />
|
||||
<file action="link" path="../../../../driverlib/ccs/Debug/driverlib.lib" targetDirectory="" />
|
||||
|
||||
<file action="copy" path="../adc_ex13_burst_mode_oversampling.c" targetDirectory="" />
|
||||
</project>
|
||||
</projectSpec>
|
||||
+42
@@ -0,0 +1,42 @@
|
||||
<projectSpec>
|
||||
<project
|
||||
name="adc_ex14_soc_oversampling"
|
||||
device="TMS320F28377D"
|
||||
cgtVersion="22.6.0.LTS"
|
||||
products="C2000WARE"
|
||||
outputFormat="ELF"
|
||||
launchWizard="False"
|
||||
linkerCommandFile=""
|
||||
enableSysConfigTool="true"
|
||||
sysConfigBuildOptions="--product ${C2000WARE_ROOT}/.metadata/sdk.json --device F2837xD"
|
||||
>
|
||||
<configuration name="CPU1_RAM" compilerBuildOptions="--opt_level=off -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} -I${C2000WARE_SFO_INCLUDE} --define=DEBUG -v28 -ml -mt --define=CPU1 --diag_warning=225 --diag_suppress=10063 --display_error_number" linkerBuildOptions="--entry_point code_start --stack_size=0x3F8 --heap_size=0x200 --define RAM" />
|
||||
<configuration name="CPU1_FLASH" compilerBuildOptions="--opt_level=off -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} -I${C2000WARE_SFO_INCLUDE} --define=DEBUG -v28 -ml -mt --define=CPU1 --define=_FLASH --diag_warning=225 --diag_suppress=10063 --display_error_number" linkerBuildOptions="--entry_point code_start --stack_size=0x3F8 --heap_size=0x200 " />
|
||||
|
||||
<configuration name="CPU1_CLB" postBuildStep="mkdir "${BuildDirectory}/simulation"
|
||||
;${CLB_SIM_COMPILER}/g++ -c -DCLB_SIM -I${SYSTEMC_INSTALL}/src -I${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/include -I${PROJECT_ROOT} -I${CLB_SIM_COMPILER}/include -Og -g -gdwarf-3 -gstrict-dwarf -Wall -MMD -MP -MF${BuildDirectory}/simulation/clb_sim.d -MT${BuildDirectory}/simulation/clb_sim.o -I${BuildDirectory}/syscfg -fno-threadsafe-statics -o${BuildDirectory}/simulation/clb_sim.o ${BuildDirectory}/syscfg/clb_sim.cpp
|
||||
;${CLB_SIM_COMPILER}/g++ -DCLB_SIM -Og -g -gdwarf-3 -gstrict-dwarf -Wall -Wl,-Map,${BuildDirectory}/simulation/simulation_output.map -L${SYSTEMC_INSTALL}/build/src -o${BuildDirectory}/simulation/simulation_output.exe ${BuildDirectory}/simulation/clb_sim.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/CLB_FSM_SC_model.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/CLB_HLC_SC_model.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/CLB_LUT4_SC_model.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/CLB_OutputLUT_SC_model.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/CLB_counter_SC_model.o -Wl,--start-group -lsystemc -Wl,--end-group;./simulation/simulation_output.exe
|
||||
;${NODE_TOOL} "${CLB_SYSCFG_ROOT}/dot_file_libraries/clbDotUtility.js" "${CLB_SYSCFG_ROOT}" "${BuildDirectory}/syscfg" "${BuildDirectory}/syscfg/clb.dot"" compilerBuildOptions="--opt_level=off -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} -I${C2000WARE_SFO_INCLUDE} --define=DEBUG -v28 -ml -mt --define=CPU1 --diag_warning=225 --diag_suppress=10063 --display_error_number" linkerBuildOptions="--entry_point code_start --stack_size=0x3F8 --heap_size=0x200 --define RAM" />
|
||||
|
||||
<pathVariable name="C2000WARE_DLIB_ROOT" path="../../../../driverlib/" scope="project" />
|
||||
<pathVariable name="C2000WARE_ROOT" path="../../../../../../" scope="project" />
|
||||
<pathVariable name="C2000WARE_SFO_INCLUDE" path="../../../../../../libraries/calibration/hrpwm/F2837xD/include/" 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" />
|
||||
|
||||
<file action="link" path="../../../../../../libraries/calibration/hrpwm/F2837xD/lib/SFO_v8_fpu_lib_build_c28_driverlib.lib" targetDirectory="" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/include/driverlib.h" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/include/device.h" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/source/device.c" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/targetConfigs/TMS320F28377D.ccxml" targetDirectory="targetConfigs" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/cmd/2837xD_RAM_lnk_cpu1.cmd" targetDirectory="" applicableConfigurations="CPU1_RAM,CPU1_CLB" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/cmd/2837xD_FLASH_lnk_cpu1.cmd" targetDirectory="" applicableConfigurations="CPU1_FLASH" />
|
||||
<file action="copy" path="../../../../driverlib/" targetDirectory="device" excludeFromBuild="True" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/source/F2837xD_CodeStartBranch.asm" targetDirectory="device" />
|
||||
<file action="link" path="../../../../driverlib/ccs/Debug/driverlib.lib" targetDirectory="" />
|
||||
|
||||
<file action="copy" path="../adc_ex14_soc_oversampling.c" targetDirectory="" />
|
||||
</project>
|
||||
</projectSpec>
|
||||
@@ -0,0 +1,42 @@
|
||||
<projectSpec>
|
||||
<project
|
||||
name="adc_ex1_soc_software"
|
||||
device="TMS320F28377D"
|
||||
cgtVersion="22.6.0.LTS"
|
||||
products="C2000WARE"
|
||||
outputFormat="ELF"
|
||||
launchWizard="False"
|
||||
linkerCommandFile=""
|
||||
enableSysConfigTool="true"
|
||||
sysConfigBuildOptions="--product ${C2000WARE_ROOT}/.metadata/sdk.json --device F2837xD"
|
||||
>
|
||||
<configuration name="CPU1_RAM" compilerBuildOptions="--opt_level=off -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} -I${C2000WARE_SFO_INCLUDE} --define=DEBUG -v28 -ml -mt --define=CPU1 --diag_warning=225 --diag_suppress=10063 --display_error_number" linkerBuildOptions="--entry_point code_start --stack_size=0x3F8 --heap_size=0x200 --define RAM" />
|
||||
<configuration name="CPU1_FLASH" compilerBuildOptions="--opt_level=off -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} -I${C2000WARE_SFO_INCLUDE} --define=DEBUG -v28 -ml -mt --define=CPU1 --define=_FLASH --diag_warning=225 --diag_suppress=10063 --display_error_number" linkerBuildOptions="--entry_point code_start --stack_size=0x3F8 --heap_size=0x200 " />
|
||||
|
||||
<configuration name="CPU1_CLB" postBuildStep="mkdir "${BuildDirectory}/simulation"
|
||||
;${CLB_SIM_COMPILER}/g++ -c -DCLB_SIM -I${SYSTEMC_INSTALL}/src -I${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/include -I${PROJECT_ROOT} -I${CLB_SIM_COMPILER}/include -Og -g -gdwarf-3 -gstrict-dwarf -Wall -MMD -MP -MF${BuildDirectory}/simulation/clb_sim.d -MT${BuildDirectory}/simulation/clb_sim.o -I${BuildDirectory}/syscfg -fno-threadsafe-statics -o${BuildDirectory}/simulation/clb_sim.o ${BuildDirectory}/syscfg/clb_sim.cpp
|
||||
;${CLB_SIM_COMPILER}/g++ -DCLB_SIM -Og -g -gdwarf-3 -gstrict-dwarf -Wall -Wl,-Map,${BuildDirectory}/simulation/simulation_output.map -L${SYSTEMC_INSTALL}/build/src -o${BuildDirectory}/simulation/simulation_output.exe ${BuildDirectory}/simulation/clb_sim.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/CLB_FSM_SC_model.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/CLB_HLC_SC_model.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/CLB_LUT4_SC_model.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/CLB_OutputLUT_SC_model.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/CLB_counter_SC_model.o -Wl,--start-group -lsystemc -Wl,--end-group;./simulation/simulation_output.exe
|
||||
;${NODE_TOOL} "${CLB_SYSCFG_ROOT}/dot_file_libraries/clbDotUtility.js" "${CLB_SYSCFG_ROOT}" "${BuildDirectory}/syscfg" "${BuildDirectory}/syscfg/clb.dot"" compilerBuildOptions="--opt_level=off -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} -I${C2000WARE_SFO_INCLUDE} --define=DEBUG -v28 -ml -mt --define=CPU1 --diag_warning=225 --diag_suppress=10063 --display_error_number" linkerBuildOptions="--entry_point code_start --stack_size=0x3F8 --heap_size=0x200 --define RAM" />
|
||||
|
||||
<pathVariable name="C2000WARE_DLIB_ROOT" path="../../../../driverlib/" scope="project" />
|
||||
<pathVariable name="C2000WARE_ROOT" path="../../../../../../" scope="project" />
|
||||
<pathVariable name="C2000WARE_SFO_INCLUDE" path="../../../../../../libraries/calibration/hrpwm/F2837xD/include/" 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" />
|
||||
|
||||
<file action="link" path="../../../../../../libraries/calibration/hrpwm/F2837xD/lib/SFO_v8_fpu_lib_build_c28_driverlib.lib" targetDirectory="" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/include/driverlib.h" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/include/device.h" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/source/device.c" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/targetConfigs/TMS320F28377D.ccxml" targetDirectory="targetConfigs" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/cmd/2837xD_RAM_lnk_cpu1.cmd" targetDirectory="" applicableConfigurations="CPU1_RAM,CPU1_CLB" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/cmd/2837xD_FLASH_lnk_cpu1.cmd" targetDirectory="" applicableConfigurations="CPU1_FLASH" />
|
||||
<file action="copy" path="../../../../driverlib/" targetDirectory="device" excludeFromBuild="True" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/source/F2837xD_CodeStartBranch.asm" targetDirectory="device" />
|
||||
<file action="link" path="../../../../driverlib/ccs/Debug/driverlib.lib" targetDirectory="" />
|
||||
|
||||
<file action="copy" path="../adc_ex1_soc_software.c" targetDirectory="" />
|
||||
</project>
|
||||
</projectSpec>
|
||||
@@ -0,0 +1,42 @@
|
||||
<projectSpec>
|
||||
<project
|
||||
name="adc_ex2_soc_epwm"
|
||||
device="TMS320F28377D"
|
||||
cgtVersion="22.6.0.LTS"
|
||||
products="C2000WARE"
|
||||
outputFormat="ELF"
|
||||
launchWizard="False"
|
||||
linkerCommandFile=""
|
||||
enableSysConfigTool="true"
|
||||
sysConfigBuildOptions="--product ${C2000WARE_ROOT}/.metadata/sdk.json --device F2837xD"
|
||||
>
|
||||
<configuration name="CPU1_RAM" compilerBuildOptions="--opt_level=off -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} -I${C2000WARE_SFO_INCLUDE} --define=DEBUG -v28 -ml -mt --define=CPU1 --diag_warning=225 --diag_suppress=10063 --display_error_number" linkerBuildOptions="--entry_point code_start --stack_size=0x3F8 --heap_size=0x200 --define RAM" />
|
||||
<configuration name="CPU1_FLASH" compilerBuildOptions="--opt_level=off -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} -I${C2000WARE_SFO_INCLUDE} --define=DEBUG -v28 -ml -mt --define=CPU1 --define=_FLASH --diag_warning=225 --diag_suppress=10063 --display_error_number" linkerBuildOptions="--entry_point code_start --stack_size=0x3F8 --heap_size=0x200 " />
|
||||
|
||||
<configuration name="CPU1_CLB" postBuildStep="mkdir "${BuildDirectory}/simulation"
|
||||
;${CLB_SIM_COMPILER}/g++ -c -DCLB_SIM -I${SYSTEMC_INSTALL}/src -I${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/include -I${PROJECT_ROOT} -I${CLB_SIM_COMPILER}/include -Og -g -gdwarf-3 -gstrict-dwarf -Wall -MMD -MP -MF${BuildDirectory}/simulation/clb_sim.d -MT${BuildDirectory}/simulation/clb_sim.o -I${BuildDirectory}/syscfg -fno-threadsafe-statics -o${BuildDirectory}/simulation/clb_sim.o ${BuildDirectory}/syscfg/clb_sim.cpp
|
||||
;${CLB_SIM_COMPILER}/g++ -DCLB_SIM -Og -g -gdwarf-3 -gstrict-dwarf -Wall -Wl,-Map,${BuildDirectory}/simulation/simulation_output.map -L${SYSTEMC_INSTALL}/build/src -o${BuildDirectory}/simulation/simulation_output.exe ${BuildDirectory}/simulation/clb_sim.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/CLB_FSM_SC_model.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/CLB_HLC_SC_model.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/CLB_LUT4_SC_model.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/CLB_OutputLUT_SC_model.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/CLB_counter_SC_model.o -Wl,--start-group -lsystemc -Wl,--end-group;./simulation/simulation_output.exe
|
||||
;${NODE_TOOL} "${CLB_SYSCFG_ROOT}/dot_file_libraries/clbDotUtility.js" "${CLB_SYSCFG_ROOT}" "${BuildDirectory}/syscfg" "${BuildDirectory}/syscfg/clb.dot"" compilerBuildOptions="--opt_level=off -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} -I${C2000WARE_SFO_INCLUDE} --define=DEBUG -v28 -ml -mt --define=CPU1 --diag_warning=225 --diag_suppress=10063 --display_error_number" linkerBuildOptions="--entry_point code_start --stack_size=0x3F8 --heap_size=0x200 --define RAM" />
|
||||
|
||||
<pathVariable name="C2000WARE_DLIB_ROOT" path="../../../../driverlib/" scope="project" />
|
||||
<pathVariable name="C2000WARE_ROOT" path="../../../../../../" scope="project" />
|
||||
<pathVariable name="C2000WARE_SFO_INCLUDE" path="../../../../../../libraries/calibration/hrpwm/F2837xD/include/" 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" />
|
||||
|
||||
<file action="link" path="../../../../../../libraries/calibration/hrpwm/F2837xD/lib/SFO_v8_fpu_lib_build_c28_driverlib.lib" targetDirectory="" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/include/driverlib.h" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/include/device.h" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/source/device.c" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/targetConfigs/TMS320F28377D.ccxml" targetDirectory="targetConfigs" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/cmd/2837xD_RAM_lnk_cpu1.cmd" targetDirectory="" applicableConfigurations="CPU1_RAM,CPU1_CLB" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/cmd/2837xD_FLASH_lnk_cpu1.cmd" targetDirectory="" applicableConfigurations="CPU1_FLASH" />
|
||||
<file action="copy" path="../../../../driverlib/" targetDirectory="device" excludeFromBuild="True" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/source/F2837xD_CodeStartBranch.asm" targetDirectory="device" />
|
||||
<file action="link" path="../../../../driverlib/ccs/Debug/driverlib.lib" targetDirectory="" />
|
||||
|
||||
<file action="copy" path="../adc_ex2_soc_epwm.c" targetDirectory="" />
|
||||
</project>
|
||||
</projectSpec>
|
||||
@@ -0,0 +1,42 @@
|
||||
<projectSpec>
|
||||
<project
|
||||
name="adc_ex3_temp_sensor"
|
||||
device="TMS320F28377D"
|
||||
cgtVersion="22.6.0.LTS"
|
||||
products="C2000WARE"
|
||||
outputFormat="ELF"
|
||||
launchWizard="False"
|
||||
linkerCommandFile=""
|
||||
enableSysConfigTool="true"
|
||||
sysConfigBuildOptions="--product ${C2000WARE_ROOT}/.metadata/sdk.json --device F2837xD"
|
||||
>
|
||||
<configuration name="CPU1_RAM" compilerBuildOptions="--opt_level=off -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} -I${C2000WARE_SFO_INCLUDE} --define=DEBUG -v28 -ml -mt --define=CPU1 --diag_warning=225 --diag_suppress=10063 --display_error_number" linkerBuildOptions="--entry_point code_start --stack_size=0x3F8 --heap_size=0x200 --define RAM" />
|
||||
<configuration name="CPU1_FLASH" compilerBuildOptions="--opt_level=off -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} -I${C2000WARE_SFO_INCLUDE} --define=DEBUG -v28 -ml -mt --define=CPU1 --define=_FLASH --diag_warning=225 --diag_suppress=10063 --display_error_number" linkerBuildOptions="--entry_point code_start --stack_size=0x3F8 --heap_size=0x200 " />
|
||||
|
||||
<configuration name="CPU1_CLB" postBuildStep="mkdir "${BuildDirectory}/simulation"
|
||||
;${CLB_SIM_COMPILER}/g++ -c -DCLB_SIM -I${SYSTEMC_INSTALL}/src -I${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/include -I${PROJECT_ROOT} -I${CLB_SIM_COMPILER}/include -Og -g -gdwarf-3 -gstrict-dwarf -Wall -MMD -MP -MF${BuildDirectory}/simulation/clb_sim.d -MT${BuildDirectory}/simulation/clb_sim.o -I${BuildDirectory}/syscfg -fno-threadsafe-statics -o${BuildDirectory}/simulation/clb_sim.o ${BuildDirectory}/syscfg/clb_sim.cpp
|
||||
;${CLB_SIM_COMPILER}/g++ -DCLB_SIM -Og -g -gdwarf-3 -gstrict-dwarf -Wall -Wl,-Map,${BuildDirectory}/simulation/simulation_output.map -L${SYSTEMC_INSTALL}/build/src -o${BuildDirectory}/simulation/simulation_output.exe ${BuildDirectory}/simulation/clb_sim.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/CLB_FSM_SC_model.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/CLB_HLC_SC_model.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/CLB_LUT4_SC_model.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/CLB_OutputLUT_SC_model.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/CLB_counter_SC_model.o -Wl,--start-group -lsystemc -Wl,--end-group;./simulation/simulation_output.exe
|
||||
;${NODE_TOOL} "${CLB_SYSCFG_ROOT}/dot_file_libraries/clbDotUtility.js" "${CLB_SYSCFG_ROOT}" "${BuildDirectory}/syscfg" "${BuildDirectory}/syscfg/clb.dot"" compilerBuildOptions="--opt_level=off -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} -I${C2000WARE_SFO_INCLUDE} --define=DEBUG -v28 -ml -mt --define=CPU1 --diag_warning=225 --diag_suppress=10063 --display_error_number" linkerBuildOptions="--entry_point code_start --stack_size=0x3F8 --heap_size=0x200 --define RAM" />
|
||||
|
||||
<pathVariable name="C2000WARE_DLIB_ROOT" path="../../../../driverlib/" scope="project" />
|
||||
<pathVariable name="C2000WARE_ROOT" path="../../../../../../" scope="project" />
|
||||
<pathVariable name="C2000WARE_SFO_INCLUDE" path="../../../../../../libraries/calibration/hrpwm/F2837xD/include/" 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" />
|
||||
|
||||
<file action="link" path="../../../../../../libraries/calibration/hrpwm/F2837xD/lib/SFO_v8_fpu_lib_build_c28_driverlib.lib" targetDirectory="" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/include/driverlib.h" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/include/device.h" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/source/device.c" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/targetConfigs/TMS320F28377D.ccxml" targetDirectory="targetConfigs" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/cmd/2837xD_RAM_lnk_cpu1.cmd" targetDirectory="" applicableConfigurations="CPU1_RAM,CPU1_CLB" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/cmd/2837xD_FLASH_lnk_cpu1.cmd" targetDirectory="" applicableConfigurations="CPU1_FLASH" />
|
||||
<file action="copy" path="../../../../driverlib/" targetDirectory="device" excludeFromBuild="True" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/source/F2837xD_CodeStartBranch.asm" targetDirectory="device" />
|
||||
<file action="link" path="../../../../driverlib/ccs/Debug/driverlib.lib" targetDirectory="" />
|
||||
|
||||
<file action="copy" path="../adc_ex3_temp_sensor.c" targetDirectory="" />
|
||||
</project>
|
||||
</projectSpec>
|
||||
+42
@@ -0,0 +1,42 @@
|
||||
<projectSpec>
|
||||
<project
|
||||
name="adc_ex4_soc_software_sync"
|
||||
device="TMS320F28377D"
|
||||
cgtVersion="22.6.0.LTS"
|
||||
products="C2000WARE"
|
||||
outputFormat="ELF"
|
||||
launchWizard="False"
|
||||
linkerCommandFile=""
|
||||
enableSysConfigTool="true"
|
||||
sysConfigBuildOptions="--product ${C2000WARE_ROOT}/.metadata/sdk.json --device F2837xD"
|
||||
>
|
||||
<configuration name="CPU1_RAM" compilerBuildOptions="--opt_level=off -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} -I${C2000WARE_SFO_INCLUDE} --define=DEBUG -v28 -ml -mt --define=CPU1 --diag_warning=225 --diag_suppress=10063 --display_error_number" linkerBuildOptions="--entry_point code_start --stack_size=0x3F8 --heap_size=0x200 --define RAM" />
|
||||
<configuration name="CPU1_FLASH" compilerBuildOptions="--opt_level=off -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} -I${C2000WARE_SFO_INCLUDE} --define=DEBUG -v28 -ml -mt --define=CPU1 --define=_FLASH --diag_warning=225 --diag_suppress=10063 --display_error_number" linkerBuildOptions="--entry_point code_start --stack_size=0x3F8 --heap_size=0x200 " />
|
||||
|
||||
<configuration name="CPU1_CLB" postBuildStep="mkdir "${BuildDirectory}/simulation"
|
||||
;${CLB_SIM_COMPILER}/g++ -c -DCLB_SIM -I${SYSTEMC_INSTALL}/src -I${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/include -I${PROJECT_ROOT} -I${CLB_SIM_COMPILER}/include -Og -g -gdwarf-3 -gstrict-dwarf -Wall -MMD -MP -MF${BuildDirectory}/simulation/clb_sim.d -MT${BuildDirectory}/simulation/clb_sim.o -I${BuildDirectory}/syscfg -fno-threadsafe-statics -o${BuildDirectory}/simulation/clb_sim.o ${BuildDirectory}/syscfg/clb_sim.cpp
|
||||
;${CLB_SIM_COMPILER}/g++ -DCLB_SIM -Og -g -gdwarf-3 -gstrict-dwarf -Wall -Wl,-Map,${BuildDirectory}/simulation/simulation_output.map -L${SYSTEMC_INSTALL}/build/src -o${BuildDirectory}/simulation/simulation_output.exe ${BuildDirectory}/simulation/clb_sim.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/CLB_FSM_SC_model.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/CLB_HLC_SC_model.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/CLB_LUT4_SC_model.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/CLB_OutputLUT_SC_model.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/CLB_counter_SC_model.o -Wl,--start-group -lsystemc -Wl,--end-group;./simulation/simulation_output.exe
|
||||
;${NODE_TOOL} "${CLB_SYSCFG_ROOT}/dot_file_libraries/clbDotUtility.js" "${CLB_SYSCFG_ROOT}" "${BuildDirectory}/syscfg" "${BuildDirectory}/syscfg/clb.dot"" compilerBuildOptions="--opt_level=off -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} -I${C2000WARE_SFO_INCLUDE} --define=DEBUG -v28 -ml -mt --define=CPU1 --diag_warning=225 --diag_suppress=10063 --display_error_number" linkerBuildOptions="--entry_point code_start --stack_size=0x3F8 --heap_size=0x200 --define RAM" />
|
||||
|
||||
<pathVariable name="C2000WARE_DLIB_ROOT" path="../../../../driverlib/" scope="project" />
|
||||
<pathVariable name="C2000WARE_ROOT" path="../../../../../../" scope="project" />
|
||||
<pathVariable name="C2000WARE_SFO_INCLUDE" path="../../../../../../libraries/calibration/hrpwm/F2837xD/include/" 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" />
|
||||
|
||||
<file action="link" path="../../../../../../libraries/calibration/hrpwm/F2837xD/lib/SFO_v8_fpu_lib_build_c28_driverlib.lib" targetDirectory="" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/include/driverlib.h" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/include/device.h" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/source/device.c" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/targetConfigs/TMS320F28377D.ccxml" targetDirectory="targetConfigs" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/cmd/2837xD_RAM_lnk_cpu1.cmd" targetDirectory="" applicableConfigurations="CPU1_RAM,CPU1_CLB" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/cmd/2837xD_FLASH_lnk_cpu1.cmd" targetDirectory="" applicableConfigurations="CPU1_FLASH" />
|
||||
<file action="copy" path="../../../../driverlib/" targetDirectory="device" excludeFromBuild="True" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/source/F2837xD_CodeStartBranch.asm" targetDirectory="device" />
|
||||
<file action="link" path="../../../../driverlib/ccs/Debug/driverlib.lib" targetDirectory="" />
|
||||
|
||||
<file action="copy" path="../adc_ex4_soc_software_sync.c" targetDirectory="" />
|
||||
</project>
|
||||
</projectSpec>
|
||||
@@ -0,0 +1,42 @@
|
||||
<projectSpec>
|
||||
<project
|
||||
name="adc_ex5_soc_continuous"
|
||||
device="TMS320F28377D"
|
||||
cgtVersion="22.6.0.LTS"
|
||||
products="C2000WARE"
|
||||
outputFormat="ELF"
|
||||
launchWizard="False"
|
||||
linkerCommandFile=""
|
||||
enableSysConfigTool="true"
|
||||
sysConfigBuildOptions="--product ${C2000WARE_ROOT}/.metadata/sdk.json --device F2837xD"
|
||||
>
|
||||
<configuration name="CPU1_RAM" compilerBuildOptions="--opt_level=off -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} -I${C2000WARE_SFO_INCLUDE} --define=DEBUG -v28 -ml -mt --define=CPU1 --diag_warning=225 --diag_suppress=10063 --display_error_number" linkerBuildOptions="--entry_point code_start --stack_size=0x3F8 --heap_size=0x200 --define RAM" />
|
||||
<configuration name="CPU1_FLASH" compilerBuildOptions="--opt_level=off -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} -I${C2000WARE_SFO_INCLUDE} --define=DEBUG -v28 -ml -mt --define=CPU1 --define=_FLASH --diag_warning=225 --diag_suppress=10063 --display_error_number" linkerBuildOptions="--entry_point code_start --stack_size=0x3F8 --heap_size=0x200 " />
|
||||
|
||||
<configuration name="CPU1_CLB" postBuildStep="mkdir "${BuildDirectory}/simulation"
|
||||
;${CLB_SIM_COMPILER}/g++ -c -DCLB_SIM -I${SYSTEMC_INSTALL}/src -I${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/include -I${PROJECT_ROOT} -I${CLB_SIM_COMPILER}/include -Og -g -gdwarf-3 -gstrict-dwarf -Wall -MMD -MP -MF${BuildDirectory}/simulation/clb_sim.d -MT${BuildDirectory}/simulation/clb_sim.o -I${BuildDirectory}/syscfg -fno-threadsafe-statics -o${BuildDirectory}/simulation/clb_sim.o ${BuildDirectory}/syscfg/clb_sim.cpp
|
||||
;${CLB_SIM_COMPILER}/g++ -DCLB_SIM -Og -g -gdwarf-3 -gstrict-dwarf -Wall -Wl,-Map,${BuildDirectory}/simulation/simulation_output.map -L${SYSTEMC_INSTALL}/build/src -o${BuildDirectory}/simulation/simulation_output.exe ${BuildDirectory}/simulation/clb_sim.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/CLB_FSM_SC_model.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/CLB_HLC_SC_model.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/CLB_LUT4_SC_model.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/CLB_OutputLUT_SC_model.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/CLB_counter_SC_model.o -Wl,--start-group -lsystemc -Wl,--end-group;./simulation/simulation_output.exe
|
||||
;${NODE_TOOL} "${CLB_SYSCFG_ROOT}/dot_file_libraries/clbDotUtility.js" "${CLB_SYSCFG_ROOT}" "${BuildDirectory}/syscfg" "${BuildDirectory}/syscfg/clb.dot"" compilerBuildOptions="--opt_level=off -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} -I${C2000WARE_SFO_INCLUDE} --define=DEBUG -v28 -ml -mt --define=CPU1 --diag_warning=225 --diag_suppress=10063 --display_error_number" linkerBuildOptions="--entry_point code_start --stack_size=0x3F8 --heap_size=0x200 --define RAM" />
|
||||
|
||||
<pathVariable name="C2000WARE_DLIB_ROOT" path="../../../../driverlib/" scope="project" />
|
||||
<pathVariable name="C2000WARE_ROOT" path="../../../../../../" scope="project" />
|
||||
<pathVariable name="C2000WARE_SFO_INCLUDE" path="../../../../../../libraries/calibration/hrpwm/F2837xD/include/" 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" />
|
||||
|
||||
<file action="link" path="../../../../../../libraries/calibration/hrpwm/F2837xD/lib/SFO_v8_fpu_lib_build_c28_driverlib.lib" targetDirectory="" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/include/driverlib.h" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/include/device.h" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/source/device.c" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/targetConfigs/TMS320F28377D.ccxml" targetDirectory="targetConfigs" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/cmd/2837xD_RAM_lnk_cpu1.cmd" targetDirectory="" applicableConfigurations="CPU1_RAM,CPU1_CLB" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/cmd/2837xD_FLASH_lnk_cpu1.cmd" targetDirectory="" applicableConfigurations="CPU1_FLASH" />
|
||||
<file action="copy" path="../../../../driverlib/" targetDirectory="device" excludeFromBuild="True" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/source/F2837xD_CodeStartBranch.asm" targetDirectory="device" />
|
||||
<file action="link" path="../../../../driverlib/ccs/Debug/driverlib.lib" targetDirectory="" />
|
||||
|
||||
<file action="copy" path="../adc_ex5_soc_continuous.c" targetDirectory="" />
|
||||
</project>
|
||||
</projectSpec>
|
||||
+42
@@ -0,0 +1,42 @@
|
||||
<projectSpec>
|
||||
<project
|
||||
name="adc_ex6_soc_continuous_dma"
|
||||
device="TMS320F28377D"
|
||||
cgtVersion="22.6.0.LTS"
|
||||
products="C2000WARE"
|
||||
outputFormat="ELF"
|
||||
launchWizard="False"
|
||||
linkerCommandFile=""
|
||||
enableSysConfigTool="true"
|
||||
sysConfigBuildOptions="--product ${C2000WARE_ROOT}/.metadata/sdk.json --device F2837xD"
|
||||
>
|
||||
<configuration name="CPU1_RAM" compilerBuildOptions="--opt_level=off -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} -I${C2000WARE_SFO_INCLUDE} --define=DEBUG -v28 -ml -mt --define=CPU1 --diag_warning=225 --diag_suppress=10063 --display_error_number" linkerBuildOptions="--entry_point code_start --stack_size=0x3F8 --heap_size=0x200 --define RAM" />
|
||||
<configuration name="CPU1_FLASH" compilerBuildOptions="--opt_level=off -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} -I${C2000WARE_SFO_INCLUDE} --define=DEBUG -v28 -ml -mt --define=CPU1 --define=_FLASH --diag_warning=225 --diag_suppress=10063 --display_error_number" linkerBuildOptions="--entry_point code_start --stack_size=0x3F8 --heap_size=0x200 " />
|
||||
|
||||
<configuration name="CPU1_CLB" postBuildStep="mkdir "${BuildDirectory}/simulation"
|
||||
;${CLB_SIM_COMPILER}/g++ -c -DCLB_SIM -I${SYSTEMC_INSTALL}/src -I${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/include -I${PROJECT_ROOT} -I${CLB_SIM_COMPILER}/include -Og -g -gdwarf-3 -gstrict-dwarf -Wall -MMD -MP -MF${BuildDirectory}/simulation/clb_sim.d -MT${BuildDirectory}/simulation/clb_sim.o -I${BuildDirectory}/syscfg -fno-threadsafe-statics -o${BuildDirectory}/simulation/clb_sim.o ${BuildDirectory}/syscfg/clb_sim.cpp
|
||||
;${CLB_SIM_COMPILER}/g++ -DCLB_SIM -Og -g -gdwarf-3 -gstrict-dwarf -Wall -Wl,-Map,${BuildDirectory}/simulation/simulation_output.map -L${SYSTEMC_INSTALL}/build/src -o${BuildDirectory}/simulation/simulation_output.exe ${BuildDirectory}/simulation/clb_sim.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/CLB_FSM_SC_model.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/CLB_HLC_SC_model.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/CLB_LUT4_SC_model.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/CLB_OutputLUT_SC_model.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/CLB_counter_SC_model.o -Wl,--start-group -lsystemc -Wl,--end-group;./simulation/simulation_output.exe
|
||||
;${NODE_TOOL} "${CLB_SYSCFG_ROOT}/dot_file_libraries/clbDotUtility.js" "${CLB_SYSCFG_ROOT}" "${BuildDirectory}/syscfg" "${BuildDirectory}/syscfg/clb.dot"" compilerBuildOptions="--opt_level=off -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} -I${C2000WARE_SFO_INCLUDE} --define=DEBUG -v28 -ml -mt --define=CPU1 --diag_warning=225 --diag_suppress=10063 --display_error_number" linkerBuildOptions="--entry_point code_start --stack_size=0x3F8 --heap_size=0x200 --define RAM" />
|
||||
|
||||
<pathVariable name="C2000WARE_DLIB_ROOT" path="../../../../driverlib/" scope="project" />
|
||||
<pathVariable name="C2000WARE_ROOT" path="../../../../../../" scope="project" />
|
||||
<pathVariable name="C2000WARE_SFO_INCLUDE" path="../../../../../../libraries/calibration/hrpwm/F2837xD/include/" 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" />
|
||||
|
||||
<file action="link" path="../../../../../../libraries/calibration/hrpwm/F2837xD/lib/SFO_v8_fpu_lib_build_c28_driverlib.lib" targetDirectory="" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/include/driverlib.h" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/include/device.h" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/source/device.c" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/targetConfigs/TMS320F28377D.ccxml" targetDirectory="targetConfigs" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/cmd/2837xD_RAM_lnk_cpu1.cmd" targetDirectory="" applicableConfigurations="CPU1_RAM,CPU1_CLB" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/cmd/2837xD_FLASH_lnk_cpu1.cmd" targetDirectory="" applicableConfigurations="CPU1_FLASH" />
|
||||
<file action="copy" path="../../../../driverlib/" targetDirectory="device" excludeFromBuild="True" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/source/F2837xD_CodeStartBranch.asm" targetDirectory="device" />
|
||||
<file action="link" path="../../../../driverlib/ccs/Debug/driverlib.lib" targetDirectory="" />
|
||||
|
||||
<file action="copy" path="../adc_ex6_soc_continuous_dma.c" targetDirectory="" />
|
||||
</project>
|
||||
</projectSpec>
|
||||
@@ -0,0 +1,42 @@
|
||||
<projectSpec>
|
||||
<project
|
||||
name="adc_ex7_ppb_offset"
|
||||
device="TMS320F28377D"
|
||||
cgtVersion="22.6.0.LTS"
|
||||
products="C2000WARE"
|
||||
outputFormat="ELF"
|
||||
launchWizard="False"
|
||||
linkerCommandFile=""
|
||||
enableSysConfigTool="true"
|
||||
sysConfigBuildOptions="--product ${C2000WARE_ROOT}/.metadata/sdk.json --device F2837xD"
|
||||
>
|
||||
<configuration name="CPU1_RAM" compilerBuildOptions="--opt_level=off -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} -I${C2000WARE_SFO_INCLUDE} --define=DEBUG -v28 -ml -mt --define=CPU1 --diag_warning=225 --diag_suppress=10063 --display_error_number" linkerBuildOptions="--entry_point code_start --stack_size=0x3F8 --heap_size=0x200 --define RAM" />
|
||||
<configuration name="CPU1_FLASH" compilerBuildOptions="--opt_level=off -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} -I${C2000WARE_SFO_INCLUDE} --define=DEBUG -v28 -ml -mt --define=CPU1 --define=_FLASH --diag_warning=225 --diag_suppress=10063 --display_error_number" linkerBuildOptions="--entry_point code_start --stack_size=0x3F8 --heap_size=0x200 " />
|
||||
|
||||
<configuration name="CPU1_CLB" postBuildStep="mkdir "${BuildDirectory}/simulation"
|
||||
;${CLB_SIM_COMPILER}/g++ -c -DCLB_SIM -I${SYSTEMC_INSTALL}/src -I${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/include -I${PROJECT_ROOT} -I${CLB_SIM_COMPILER}/include -Og -g -gdwarf-3 -gstrict-dwarf -Wall -MMD -MP -MF${BuildDirectory}/simulation/clb_sim.d -MT${BuildDirectory}/simulation/clb_sim.o -I${BuildDirectory}/syscfg -fno-threadsafe-statics -o${BuildDirectory}/simulation/clb_sim.o ${BuildDirectory}/syscfg/clb_sim.cpp
|
||||
;${CLB_SIM_COMPILER}/g++ -DCLB_SIM -Og -g -gdwarf-3 -gstrict-dwarf -Wall -Wl,-Map,${BuildDirectory}/simulation/simulation_output.map -L${SYSTEMC_INSTALL}/build/src -o${BuildDirectory}/simulation/simulation_output.exe ${BuildDirectory}/simulation/clb_sim.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/CLB_FSM_SC_model.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/CLB_HLC_SC_model.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/CLB_LUT4_SC_model.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/CLB_OutputLUT_SC_model.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/CLB_counter_SC_model.o -Wl,--start-group -lsystemc -Wl,--end-group;./simulation/simulation_output.exe
|
||||
;${NODE_TOOL} "${CLB_SYSCFG_ROOT}/dot_file_libraries/clbDotUtility.js" "${CLB_SYSCFG_ROOT}" "${BuildDirectory}/syscfg" "${BuildDirectory}/syscfg/clb.dot"" compilerBuildOptions="--opt_level=off -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} -I${C2000WARE_SFO_INCLUDE} --define=DEBUG -v28 -ml -mt --define=CPU1 --diag_warning=225 --diag_suppress=10063 --display_error_number" linkerBuildOptions="--entry_point code_start --stack_size=0x3F8 --heap_size=0x200 --define RAM" />
|
||||
|
||||
<pathVariable name="C2000WARE_DLIB_ROOT" path="../../../../driverlib/" scope="project" />
|
||||
<pathVariable name="C2000WARE_ROOT" path="../../../../../../" scope="project" />
|
||||
<pathVariable name="C2000WARE_SFO_INCLUDE" path="../../../../../../libraries/calibration/hrpwm/F2837xD/include/" 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" />
|
||||
|
||||
<file action="link" path="../../../../../../libraries/calibration/hrpwm/F2837xD/lib/SFO_v8_fpu_lib_build_c28_driverlib.lib" targetDirectory="" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/include/driverlib.h" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/include/device.h" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/source/device.c" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/targetConfigs/TMS320F28377D.ccxml" targetDirectory="targetConfigs" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/cmd/2837xD_RAM_lnk_cpu1.cmd" targetDirectory="" applicableConfigurations="CPU1_RAM,CPU1_CLB" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/cmd/2837xD_FLASH_lnk_cpu1.cmd" targetDirectory="" applicableConfigurations="CPU1_FLASH" />
|
||||
<file action="copy" path="../../../../driverlib/" targetDirectory="device" excludeFromBuild="True" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/source/F2837xD_CodeStartBranch.asm" targetDirectory="device" />
|
||||
<file action="link" path="../../../../driverlib/ccs/Debug/driverlib.lib" targetDirectory="" />
|
||||
|
||||
<file action="copy" path="../adc_ex7_ppb_offset.c" targetDirectory="" />
|
||||
</project>
|
||||
</projectSpec>
|
||||
@@ -0,0 +1,42 @@
|
||||
<projectSpec>
|
||||
<project
|
||||
name="adc_ex8_ppb_limits"
|
||||
device="TMS320F28377D"
|
||||
cgtVersion="22.6.0.LTS"
|
||||
products="C2000WARE"
|
||||
outputFormat="ELF"
|
||||
launchWizard="False"
|
||||
linkerCommandFile=""
|
||||
enableSysConfigTool="true"
|
||||
sysConfigBuildOptions="--product ${C2000WARE_ROOT}/.metadata/sdk.json --device F2837xD"
|
||||
>
|
||||
<configuration name="CPU1_RAM" compilerBuildOptions="--opt_level=off -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} -I${C2000WARE_SFO_INCLUDE} --define=DEBUG -v28 -ml -mt --define=CPU1 --diag_warning=225 --diag_suppress=10063 --display_error_number" linkerBuildOptions="--entry_point code_start --stack_size=0x3F8 --heap_size=0x200 --define RAM" />
|
||||
<configuration name="CPU1_FLASH" compilerBuildOptions="--opt_level=off -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} -I${C2000WARE_SFO_INCLUDE} --define=DEBUG -v28 -ml -mt --define=CPU1 --define=_FLASH --diag_warning=225 --diag_suppress=10063 --display_error_number" linkerBuildOptions="--entry_point code_start --stack_size=0x3F8 --heap_size=0x200 " />
|
||||
|
||||
<configuration name="CPU1_CLB" postBuildStep="mkdir "${BuildDirectory}/simulation"
|
||||
;${CLB_SIM_COMPILER}/g++ -c -DCLB_SIM -I${SYSTEMC_INSTALL}/src -I${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/include -I${PROJECT_ROOT} -I${CLB_SIM_COMPILER}/include -Og -g -gdwarf-3 -gstrict-dwarf -Wall -MMD -MP -MF${BuildDirectory}/simulation/clb_sim.d -MT${BuildDirectory}/simulation/clb_sim.o -I${BuildDirectory}/syscfg -fno-threadsafe-statics -o${BuildDirectory}/simulation/clb_sim.o ${BuildDirectory}/syscfg/clb_sim.cpp
|
||||
;${CLB_SIM_COMPILER}/g++ -DCLB_SIM -Og -g -gdwarf-3 -gstrict-dwarf -Wall -Wl,-Map,${BuildDirectory}/simulation/simulation_output.map -L${SYSTEMC_INSTALL}/build/src -o${BuildDirectory}/simulation/simulation_output.exe ${BuildDirectory}/simulation/clb_sim.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/CLB_FSM_SC_model.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/CLB_HLC_SC_model.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/CLB_LUT4_SC_model.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/CLB_OutputLUT_SC_model.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/CLB_counter_SC_model.o -Wl,--start-group -lsystemc -Wl,--end-group;./simulation/simulation_output.exe
|
||||
;${NODE_TOOL} "${CLB_SYSCFG_ROOT}/dot_file_libraries/clbDotUtility.js" "${CLB_SYSCFG_ROOT}" "${BuildDirectory}/syscfg" "${BuildDirectory}/syscfg/clb.dot"" compilerBuildOptions="--opt_level=off -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} -I${C2000WARE_SFO_INCLUDE} --define=DEBUG -v28 -ml -mt --define=CPU1 --diag_warning=225 --diag_suppress=10063 --display_error_number" linkerBuildOptions="--entry_point code_start --stack_size=0x3F8 --heap_size=0x200 --define RAM" />
|
||||
|
||||
<pathVariable name="C2000WARE_DLIB_ROOT" path="../../../../driverlib/" scope="project" />
|
||||
<pathVariable name="C2000WARE_ROOT" path="../../../../../../" scope="project" />
|
||||
<pathVariable name="C2000WARE_SFO_INCLUDE" path="../../../../../../libraries/calibration/hrpwm/F2837xD/include/" 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" />
|
||||
|
||||
<file action="link" path="../../../../../../libraries/calibration/hrpwm/F2837xD/lib/SFO_v8_fpu_lib_build_c28_driverlib.lib" targetDirectory="" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/include/driverlib.h" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/include/device.h" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/source/device.c" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/targetConfigs/TMS320F28377D.ccxml" targetDirectory="targetConfigs" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/cmd/2837xD_RAM_lnk_cpu1.cmd" targetDirectory="" applicableConfigurations="CPU1_RAM,CPU1_CLB" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/cmd/2837xD_FLASH_lnk_cpu1.cmd" targetDirectory="" applicableConfigurations="CPU1_FLASH" />
|
||||
<file action="copy" path="../../../../driverlib/" targetDirectory="device" excludeFromBuild="True" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/source/F2837xD_CodeStartBranch.asm" targetDirectory="device" />
|
||||
<file action="link" path="../../../../driverlib/ccs/Debug/driverlib.lib" targetDirectory="" />
|
||||
|
||||
<file action="copy" path="../adc_ex8_ppb_limits.c" targetDirectory="" />
|
||||
</project>
|
||||
</projectSpec>
|
||||
@@ -0,0 +1,42 @@
|
||||
<projectSpec>
|
||||
<project
|
||||
name="adc_ex9_ppb_delay"
|
||||
device="TMS320F28377D"
|
||||
cgtVersion="22.6.0.LTS"
|
||||
products="C2000WARE"
|
||||
outputFormat="ELF"
|
||||
launchWizard="False"
|
||||
linkerCommandFile=""
|
||||
enableSysConfigTool="true"
|
||||
sysConfigBuildOptions="--product ${C2000WARE_ROOT}/.metadata/sdk.json --device F2837xD"
|
||||
>
|
||||
<configuration name="CPU1_RAM" compilerBuildOptions="--opt_level=off -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} -I${C2000WARE_SFO_INCLUDE} --define=DEBUG -v28 -ml -mt --define=CPU1 --diag_warning=225 --diag_suppress=10063 --display_error_number" linkerBuildOptions="--entry_point code_start --stack_size=0x3F8 --heap_size=0x200 --define RAM" />
|
||||
<configuration name="CPU1_FLASH" compilerBuildOptions="--opt_level=off -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} -I${C2000WARE_SFO_INCLUDE} --define=DEBUG -v28 -ml -mt --define=CPU1 --define=_FLASH --diag_warning=225 --diag_suppress=10063 --display_error_number" linkerBuildOptions="--entry_point code_start --stack_size=0x3F8 --heap_size=0x200 " />
|
||||
|
||||
<configuration name="CPU1_CLB" postBuildStep="mkdir "${BuildDirectory}/simulation"
|
||||
;${CLB_SIM_COMPILER}/g++ -c -DCLB_SIM -I${SYSTEMC_INSTALL}/src -I${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/include -I${PROJECT_ROOT} -I${CLB_SIM_COMPILER}/include -Og -g -gdwarf-3 -gstrict-dwarf -Wall -MMD -MP -MF${BuildDirectory}/simulation/clb_sim.d -MT${BuildDirectory}/simulation/clb_sim.o -I${BuildDirectory}/syscfg -fno-threadsafe-statics -o${BuildDirectory}/simulation/clb_sim.o ${BuildDirectory}/syscfg/clb_sim.cpp
|
||||
;${CLB_SIM_COMPILER}/g++ -DCLB_SIM -Og -g -gdwarf-3 -gstrict-dwarf -Wall -Wl,-Map,${BuildDirectory}/simulation/simulation_output.map -L${SYSTEMC_INSTALL}/build/src -o${BuildDirectory}/simulation/simulation_output.exe ${BuildDirectory}/simulation/clb_sim.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/CLB_FSM_SC_model.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/CLB_HLC_SC_model.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/CLB_LUT4_SC_model.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/CLB_OutputLUT_SC_model.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/CLB_counter_SC_model.o -Wl,--start-group -lsystemc -Wl,--end-group;./simulation/simulation_output.exe
|
||||
;${NODE_TOOL} "${CLB_SYSCFG_ROOT}/dot_file_libraries/clbDotUtility.js" "${CLB_SYSCFG_ROOT}" "${BuildDirectory}/syscfg" "${BuildDirectory}/syscfg/clb.dot"" compilerBuildOptions="--opt_level=off -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} -I${C2000WARE_SFO_INCLUDE} --define=DEBUG -v28 -ml -mt --define=CPU1 --diag_warning=225 --diag_suppress=10063 --display_error_number" linkerBuildOptions="--entry_point code_start --stack_size=0x3F8 --heap_size=0x200 --define RAM" />
|
||||
|
||||
<pathVariable name="C2000WARE_DLIB_ROOT" path="../../../../driverlib/" scope="project" />
|
||||
<pathVariable name="C2000WARE_ROOT" path="../../../../../../" scope="project" />
|
||||
<pathVariable name="C2000WARE_SFO_INCLUDE" path="../../../../../../libraries/calibration/hrpwm/F2837xD/include/" 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" />
|
||||
|
||||
<file action="link" path="../../../../../../libraries/calibration/hrpwm/F2837xD/lib/SFO_v8_fpu_lib_build_c28_driverlib.lib" targetDirectory="" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/include/driverlib.h" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/include/device.h" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/source/device.c" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/targetConfigs/TMS320F28377D.ccxml" targetDirectory="targetConfigs" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/cmd/2837xD_RAM_lnk_cpu1.cmd" targetDirectory="" applicableConfigurations="CPU1_RAM,CPU1_CLB" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/cmd/2837xD_FLASH_lnk_cpu1.cmd" targetDirectory="" applicableConfigurations="CPU1_FLASH" />
|
||||
<file action="copy" path="../../../../driverlib/" targetDirectory="device" excludeFromBuild="True" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/source/F2837xD_CodeStartBranch.asm" targetDirectory="device" />
|
||||
<file action="link" path="../../../../driverlib/ccs/Debug/driverlib.lib" targetDirectory="" />
|
||||
|
||||
<file action="copy" path="../adc_ex9_ppb_delay.c" targetDirectory="" />
|
||||
</project>
|
||||
</projectSpec>
|
||||
@@ -0,0 +1,586 @@
|
||||
//###########################################################################
|
||||
//
|
||||
// FILE: adc_ex10_ppb_pwm_trip.c
|
||||
//
|
||||
// TITLE: ADC limits check and PWM trip in case of out of bound input.
|
||||
//
|
||||
//! \addtogroup driver_example_list
|
||||
//! <h1> ADC PPB PWM trip (adc_ppb_pwm_trip)</h1>
|
||||
//!
|
||||
//! This example demonstrates EPWM tripping through ADC limit detection PPB
|
||||
//! block. ADCAINT1 is configured to periodically trigger the ADCA channel 2
|
||||
//! post initial software forced trigger. The limit detection post-processing
|
||||
//! block(PPB) is configured and if the ADC results are outside of the
|
||||
//! defined range, the post-processing block will generate an ADCxEVTy event.
|
||||
//! This event is configured as EPWM trip source through configuring EPWM
|
||||
//! XBAR and corresponding EPWM's trip zone and digital compare sub-modules.
|
||||
//! The example showcases
|
||||
//! - one-shot
|
||||
//! - and direct tripping of PWMs
|
||||
//! through ADCAEVT1 source via Digital compare submodule.
|
||||
//!
|
||||
//! The default limits are 0LSBs and 3600LSBs. With VREFHI set to 3.3V, the
|
||||
//! PPB will generate a trip event if the input voltage goes above about
|
||||
//! 2.9V.
|
||||
//!
|
||||
//! \b External \b Connections \n
|
||||
//! - A2 should be connected to a signal to convert
|
||||
//! - Observe the following signals on an oscilloscope
|
||||
//! - ePWM1(GPIO0 - GPIO1)
|
||||
//! - ePWM3(GPIO4 - GPIO5)
|
||||
//! -
|
||||
//!
|
||||
//! \b Watch \b Variables \n
|
||||
//! - adcA2Results - digital representation of the voltage on pin A2
|
||||
//!
|
||||
//
|
||||
//#############################################################################
|
||||
//
|
||||
//
|
||||
// $Copyright:
|
||||
// Copyright (C) 2013-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"
|
||||
|
||||
//
|
||||
// Defines
|
||||
//
|
||||
|
||||
// Uncomment to enable profiling
|
||||
//#define ENABLE_PROFILING
|
||||
#define RESULTS_BUFFER_SIZE 512U
|
||||
#define EX_ADC_RESOLUTION 12
|
||||
// 12 for 12-bit conversion resolution, which supports (ADC_MODE_SINGLE_ENDED)
|
||||
// Sample on single pin (VREFLO is the low reference)
|
||||
// Or 16 for 16-bit conversion resolution, which supports (ADC_MODE_DIFFERENTIAL)
|
||||
// Sample on pair of pins (difference between pins is converted, subject to
|
||||
// common mode voltage requirements; see the device data manual)
|
||||
|
||||
|
||||
//
|
||||
// Globals
|
||||
//
|
||||
volatile uint16_t indexA = 0; // Index into result buffer
|
||||
volatile uint16_t bufferFull; // Flag to indicate buffer is full
|
||||
uint16_t adcA2Results[RESULTS_BUFFER_SIZE]; // ADC result buffer
|
||||
|
||||
//
|
||||
// Characteristics of PWMs to be tripped
|
||||
// EPWM1 - frequency -> 10kHz, dutyA -> 50%, dutyB -> 50%, ePWM1B - inverted
|
||||
// EPWM3 - frequency -> 5kHz, dutyA -> 70%, dutyB -> 50%, ePWM3B - inverted
|
||||
//
|
||||
EPWM_SignalParams pwmSignal1 =
|
||||
{10000, 0.5f, 0.5f, true, DEVICE_SYSCLK_FREQ, SYSCTL_EPWMCLK_DIV_2,
|
||||
EPWM_COUNTER_MODE_UP_DOWN, EPWM_CLOCK_DIVIDER_1,
|
||||
EPWM_HSCLOCK_DIVIDER_1};
|
||||
|
||||
|
||||
EPWM_SignalParams pwmSignal3 =
|
||||
{5000, 0.7f, 0.5f, true, DEVICE_SYSCLK_FREQ, SYSCTL_EPWMCLK_DIV_2,
|
||||
EPWM_COUNTER_MODE_UP_DOWN, EPWM_CLOCK_DIVIDER_1,
|
||||
EPWM_HSCLOCK_DIVIDER_1};
|
||||
|
||||
//
|
||||
// Functional Prototypes
|
||||
//
|
||||
|
||||
//
|
||||
// ADC configuration related APIs
|
||||
//
|
||||
void configureADC(uint32_t adcBase);
|
||||
void configureADCSOC(uint32_t adcBase, uint16_t channel);
|
||||
void configureLimitDetectionPPB(uint16_t soc, uint16_t limitHigh,
|
||||
uint16_t limitLow);
|
||||
|
||||
//
|
||||
// EPWM configuration related APIs
|
||||
//
|
||||
void initEPWMGPIO(void);
|
||||
void configureOSHTripSignal(uint32_t epwmBase);
|
||||
void configureDirectTripSignal(uint32_t epwmBase);
|
||||
|
||||
#ifdef ENABLE_PROFILING
|
||||
void setupProfileGpio(void);
|
||||
#endif
|
||||
|
||||
//
|
||||
// ISRs
|
||||
//
|
||||
__interrupt void adcA1ISR(void);
|
||||
|
||||
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();
|
||||
|
||||
//
|
||||
// Interrupts that are used in this example are re-mapped to ISR functions
|
||||
// found within this file.
|
||||
//
|
||||
Interrupt_register(INT_ADCA1, &adcA1ISR);
|
||||
|
||||
#ifdef ENABLE_PROFILING
|
||||
//
|
||||
// Setup profiling GPIO
|
||||
//
|
||||
setupProfileGpio();
|
||||
#endif
|
||||
|
||||
//
|
||||
// For this case just init GPIO pins for ePWM1, ePWM2, ePWM3
|
||||
//
|
||||
initEPWMGPIO();
|
||||
|
||||
|
||||
//
|
||||
// Configure the ADC and power it up
|
||||
//
|
||||
configureADC(ADCA_BASE);
|
||||
|
||||
//
|
||||
// Disable sync(Freeze clock to PWM as well)
|
||||
//
|
||||
SysCtl_disablePeripheral(SYSCTL_PERIPH_CLK_TBCLKSYNC);
|
||||
|
||||
//
|
||||
// Configuring ePWM modules for desired frequency and duty
|
||||
//
|
||||
EPWM_configureSignal(EPWM1_BASE, &pwmSignal1);
|
||||
EPWM_configureSignal(EPWM3_BASE, &pwmSignal3);
|
||||
|
||||
//
|
||||
// Configure ADCEVTx as one-shot trip signal for ePWM1
|
||||
//
|
||||
configureOSHTripSignal(EPWM1_BASE);
|
||||
|
||||
|
||||
//
|
||||
// Configure ADCEVTx as direct trip signal for ePWM3
|
||||
//
|
||||
configureDirectTripSignal(EPWM3_BASE);
|
||||
|
||||
//
|
||||
// Setup the ADC for ADCAINT1 triggered conversions on channel 2
|
||||
//
|
||||
configureADCSOC(ADCA_BASE, 2U);
|
||||
|
||||
//
|
||||
// Configure ADC post-processing limits
|
||||
// SOC0 will generate an interrupt if conversion is above or below limits
|
||||
//
|
||||
configureLimitDetectionPPB(0U, 3600U, 0U);
|
||||
|
||||
//
|
||||
// Enable ADC interrupt
|
||||
//
|
||||
Interrupt_enable(INT_ADCA1);
|
||||
|
||||
//
|
||||
// Enable global Interrupts and higher priority real-time debug events:
|
||||
//
|
||||
EINT; // Enable Global interrupt INTM
|
||||
ERTM; // Enable Global realtime interrupt DBGM
|
||||
|
||||
//
|
||||
// Start ePWM:
|
||||
// Enable sync and clock to PWM
|
||||
//
|
||||
SysCtl_enablePeripheral(SYSCTL_PERIPH_CLK_TBCLKSYNC);
|
||||
|
||||
//
|
||||
// Trigger ADC once through software
|
||||
//
|
||||
ADC_forceSOC(ADCA_BASE, ADC_SOC_NUMBER0);
|
||||
|
||||
//
|
||||
// IDLE loop. Just sit and loop forever (optional):
|
||||
//
|
||||
do
|
||||
{
|
||||
}
|
||||
while(1);
|
||||
}
|
||||
|
||||
//
|
||||
// configureOSHTripSignal - Configure ADCAEVT1 as one-shot trip signal for
|
||||
// desired PWM instance
|
||||
//
|
||||
void configureOSHTripSignal(uint32_t epwmBase)
|
||||
{
|
||||
//
|
||||
// Configure trip 7 input to be triggered by ADCAEVT1
|
||||
//
|
||||
XBAR_setEPWMMuxConfig(XBAR_TRIP7, XBAR_EPWM_MUX00_ADCAEVT1);
|
||||
|
||||
//
|
||||
// Enable mux 0
|
||||
//
|
||||
XBAR_enableEPWMMux(XBAR_TRIP7, XBAR_MUX00);
|
||||
|
||||
//
|
||||
// Select Trip 7 input as input to DC module
|
||||
//
|
||||
EPWM_selectDigitalCompareTripInput(epwmBase, EPWM_DC_TRIP_TRIPIN7,
|
||||
EPWM_DC_TYPE_DCAH);
|
||||
|
||||
//
|
||||
// DCAEVT1 is generated when DCAH is high.
|
||||
//
|
||||
EPWM_setTripZoneDigitalCompareEventCondition(epwmBase,EPWM_TZ_DC_OUTPUT_A1,
|
||||
EPWM_TZ_EVENT_DCXH_HIGH);
|
||||
|
||||
//
|
||||
// DCAEVT1 uses the unfiltered version of DCAEVT1
|
||||
//
|
||||
EPWM_setDigitalCompareEventSource(epwmBase, EPWM_DC_MODULE_A,
|
||||
EPWM_DC_EVENT_1, EPWM_DC_EVENT_SOURCE_ORIG_SIGNAL);
|
||||
|
||||
//
|
||||
// DCAEVT1 is asynchronous
|
||||
//
|
||||
EPWM_setDigitalCompareEventSyncMode( epwmBase, EPWM_DC_MODULE_A,
|
||||
EPWM_DC_EVENT_1,EPWM_DC_EVENT_INPUT_NOT_SYNCED);
|
||||
|
||||
//
|
||||
// Enable Trip zone signals
|
||||
//
|
||||
EPWM_enableTripZoneSignals(epwmBase, EPWM_TZ_SIGNAL_DCAEVT1);
|
||||
|
||||
//
|
||||
// Action on DCAEVT1
|
||||
// Force the EPWMxA LOW and EPWMxB HIGH
|
||||
//
|
||||
EPWM_setTripZoneAction(epwmBase,
|
||||
EPWM_TZ_ACTION_EVENT_TZA,
|
||||
EPWM_TZ_ACTION_LOW);
|
||||
|
||||
EPWM_setTripZoneAction(epwmBase,
|
||||
EPWM_TZ_ACTION_EVENT_TZB,
|
||||
EPWM_TZ_ACTION_HIGH);
|
||||
|
||||
//
|
||||
// Clear any spurious trip zone flags before enabling the interrupt
|
||||
//
|
||||
EPWM_clearTripZoneFlag(epwmBase, EPWM_TZ_FLAG_DCAEVT1);
|
||||
|
||||
EPWM_clearOneShotTripZoneFlag(epwmBase, EPWM_TZ_OST_FLAG_DCAEVT1);
|
||||
|
||||
//
|
||||
// Enable TZ interrupt
|
||||
//
|
||||
EPWM_enableTripZoneInterrupt(epwmBase, EPWM_TZ_INTERRUPT_OST);
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// configureDirectTripSignal - Configure ADCAEVT1 as direct trip signal for
|
||||
// desired PWM instance
|
||||
//
|
||||
void configureDirectTripSignal(uint32_t epwmBase)
|
||||
{
|
||||
//
|
||||
// Configure trip 9 input to be triggered by ADCAEVT1
|
||||
//
|
||||
XBAR_setEPWMMuxConfig(XBAR_TRIP9, XBAR_EPWM_MUX00_ADCAEVT1);
|
||||
|
||||
//
|
||||
// Enable mux 0
|
||||
//
|
||||
XBAR_enableEPWMMux(XBAR_TRIP9, XBAR_MUX00);
|
||||
|
||||
//
|
||||
// Select Trip 9 input as input to DC module
|
||||
//
|
||||
EPWM_selectDigitalCompareTripInput(epwmBase, EPWM_DC_TRIP_TRIPIN9,
|
||||
EPWM_DC_TYPE_DCAH);
|
||||
EPWM_selectDigitalCompareTripInput(epwmBase, EPWM_DC_TRIP_TRIPIN9,
|
||||
EPWM_DC_TYPE_DCBH);
|
||||
|
||||
//
|
||||
// DCAEVT1 is generated when DCAH is high. DCBEVT2 is generated when DCBH
|
||||
// is high
|
||||
//
|
||||
EPWM_setTripZoneDigitalCompareEventCondition(epwmBase, EPWM_TZ_DC_OUTPUT_A1,
|
||||
EPWM_TZ_EVENT_DCXH_HIGH);
|
||||
EPWM_setTripZoneDigitalCompareEventCondition(epwmBase, EPWM_TZ_DC_OUTPUT_B2,
|
||||
EPWM_TZ_EVENT_DCXH_HIGH);
|
||||
|
||||
//
|
||||
// DCAEVT1/DCBEVT2 uses the unfiltered version of DCAEVT1/DCBEVT2
|
||||
//
|
||||
EPWM_setDigitalCompareEventSource(epwmBase, EPWM_DC_MODULE_A,
|
||||
EPWM_DC_EVENT_1, EPWM_DC_EVENT_SOURCE_ORIG_SIGNAL);
|
||||
EPWM_setDigitalCompareEventSource(epwmBase, EPWM_DC_MODULE_B,
|
||||
EPWM_DC_EVENT_2, EPWM_DC_EVENT_SOURCE_ORIG_SIGNAL);
|
||||
|
||||
//
|
||||
// DCAEVT1/ DCBEVT2 is asynchronous
|
||||
//
|
||||
EPWM_setDigitalCompareEventSyncMode(epwmBase, EPWM_DC_MODULE_A,
|
||||
EPWM_DC_EVENT_1, EPWM_DC_EVENT_INPUT_NOT_SYNCED);
|
||||
EPWM_setDigitalCompareEventSyncMode(epwmBase, EPWM_DC_MODULE_B,
|
||||
EPWM_DC_EVENT_2, EPWM_DC_EVENT_INPUT_NOT_SYNCED);
|
||||
|
||||
//
|
||||
// Action on TZA/TZB
|
||||
// Force the EPWMxA LOW and EPWMxB HIGH
|
||||
//
|
||||
EPWM_setTripZoneAction(epwmBase,
|
||||
EPWM_TZ_ACTION_EVENT_DCAEVT1,
|
||||
EPWM_TZ_ACTION_LOW);
|
||||
|
||||
EPWM_setTripZoneAction(epwmBase,
|
||||
EPWM_TZ_ACTION_EVENT_DCBEVT2,
|
||||
EPWM_TZ_ACTION_HIGH);
|
||||
|
||||
//
|
||||
// Clear any spurious trip zone flags before enabling the interrupt
|
||||
//
|
||||
EPWM_clearTripZoneFlag(epwmBase, (EPWM_TZ_INTERRUPT_DCAEVT1 |
|
||||
EPWM_TZ_INTERRUPT_DCBEVT2));
|
||||
|
||||
//
|
||||
// Enable TZ interrupt
|
||||
//
|
||||
EPWM_enableTripZoneInterrupt(epwmBase, (EPWM_TZ_INTERRUPT_DCAEVT1 |
|
||||
EPWM_TZ_INTERRUPT_DCBEVT2));
|
||||
}
|
||||
|
||||
//
|
||||
// configureADC - Write ADC configurations and power up the ADC for both
|
||||
// ADC A and ADC B
|
||||
//
|
||||
void configureADC(uint32_t adcBase)
|
||||
{
|
||||
//
|
||||
// Set ADCDLK divider to /4
|
||||
//
|
||||
ADC_setPrescaler(adcBase, ADC_CLK_DIV_4_0);
|
||||
|
||||
//
|
||||
// Set resolution and signal mode (see #defines above) and load
|
||||
// corresponding trims.
|
||||
//
|
||||
#if(EX_ADC_RESOLUTION == 12)
|
||||
ADC_setMode(adcBase, ADC_RESOLUTION_12BIT, ADC_MODE_SINGLE_ENDED);
|
||||
#elif(EX_ADC_RESOLUTION == 16)
|
||||
ADC_setMode(adcBase, ADC_RESOLUTION_16BIT, ADC_MODE_DIFFERENTIAL);
|
||||
#endif
|
||||
|
||||
//
|
||||
// Set pulse positions to late
|
||||
//
|
||||
ADC_setInterruptPulseMode(adcBase, ADC_PULSE_END_OF_CONV);
|
||||
|
||||
//
|
||||
// Power up the ADCs and then delay for 1 ms
|
||||
//
|
||||
ADC_enableConverter(adcBase);
|
||||
|
||||
//
|
||||
// Delay for 1ms to allow ADC time to power up
|
||||
//
|
||||
DEVICE_DELAY_US(1000);
|
||||
}
|
||||
|
||||
//
|
||||
// configureLimitDetectionPPB - Configure high and low limits for ADCPPB
|
||||
//
|
||||
void configureLimitDetectionPPB(uint16_t soc, uint16_t limitHigh,
|
||||
uint16_t limitLow)
|
||||
{
|
||||
//
|
||||
// Associate PPB1 with soc
|
||||
//
|
||||
ADC_setupPPB(ADCA_BASE, ADC_PPB_NUMBER1, (ADC_SOCNumber)soc);
|
||||
|
||||
//
|
||||
// Set high and low limits
|
||||
//
|
||||
ADC_setPPBTripLimits(ADCA_BASE, ADC_PPB_NUMBER1, limitHigh, limitLow);
|
||||
|
||||
//
|
||||
// Enable high and low limit PPB events
|
||||
//
|
||||
ADC_enablePPBEvent(ADCA_BASE, ADC_PPB_NUMBER1, (ADC_EVT_TRIPHI |
|
||||
ADC_EVT_TRIPLO));
|
||||
|
||||
}
|
||||
|
||||
//
|
||||
// configureADCSOC - Setup ADC EPWM channel and trigger settings
|
||||
//
|
||||
void configureADCSOC(uint32_t adcBase, uint16_t channel)
|
||||
{
|
||||
uint16_t acqps;
|
||||
|
||||
//
|
||||
// Determine minimum acquisition window (in SYSCLKS) based on resolution
|
||||
//
|
||||
if(EX_ADC_RESOLUTION == 12)
|
||||
{
|
||||
acqps = 14; // 75ns
|
||||
}
|
||||
else //resolution is 16-bit
|
||||
{
|
||||
acqps = 63; // 320ns
|
||||
}
|
||||
//
|
||||
// - NOTE: A longer sampling window will be required if the ADC driving
|
||||
// source is less than ideal (an ideal source would be a high bandwidth
|
||||
// op-amp with a small series resistance). See TI application report
|
||||
// SPRACT6 for guidance on ADC driver design.
|
||||
//
|
||||
|
||||
//
|
||||
// Select the channels to convert and end of conversion flag
|
||||
// ADCA
|
||||
//
|
||||
ADC_setupSOC(adcBase, ADC_SOC_NUMBER0, ADC_TRIGGER_SW_ONLY,
|
||||
(ADC_Channel)channel, acqps);
|
||||
|
||||
//
|
||||
// Configure ADCINT1 as SOC0 trigger
|
||||
//
|
||||
ADC_setInterruptSOCTrigger(adcBase, ADC_SOC_NUMBER0,
|
||||
ADC_INT_SOC_TRIGGER_ADCINT1);
|
||||
|
||||
//
|
||||
// Enable continuous mode
|
||||
//
|
||||
ADC_enableContinuousMode(ADCA_BASE, ADC_INT_NUMBER1);
|
||||
|
||||
//
|
||||
// Configure source as EOC1, clear & enable the interrupt
|
||||
//
|
||||
ADC_setInterruptSource(adcBase, ADC_INT_NUMBER1, ADC_SOC_NUMBER0);
|
||||
ADC_clearInterruptStatus(adcBase, ADC_INT_NUMBER1);
|
||||
ADC_enableInterrupt(adcBase, ADC_INT_NUMBER1);
|
||||
}
|
||||
|
||||
//
|
||||
// ADC A Interrupt 1 ISR
|
||||
//
|
||||
__interrupt void adcA1ISR(void)
|
||||
{
|
||||
#ifdef ENABLE_PROFILING
|
||||
//
|
||||
// Setting Profiling GPIO12 : Takes 3 cycles
|
||||
//
|
||||
HWREG(GPIODATA_BASE + GPIO_O_GPASET) = 0x1000;
|
||||
#endif
|
||||
|
||||
//
|
||||
// Add the latest result to the buffer
|
||||
//
|
||||
adcA2Results[indexA++] = ADC_readResult(ADCARESULT_BASE, ADC_SOC_NUMBER0);
|
||||
|
||||
//
|
||||
// Set the bufferFull flag if the buffer is full
|
||||
//
|
||||
if(RESULTS_BUFFER_SIZE <= indexA)
|
||||
{
|
||||
indexA = 0;
|
||||
}
|
||||
|
||||
//
|
||||
// Acknowledge the interrupt
|
||||
//
|
||||
Interrupt_clearACKGroup(INTERRUPT_ACK_GROUP1);
|
||||
|
||||
#ifdef ENABLE_PROFILING
|
||||
//
|
||||
// Resetting Profiling GPIO12
|
||||
//
|
||||
HWREG(GPIODATA_BASE + GPIO_O_GPACLEAR) = 0x1000;
|
||||
#endif
|
||||
}
|
||||
|
||||
//
|
||||
// initEPWMGPIO - Configure ePWM1-ePWM3 GPIO
|
||||
//
|
||||
void initEPWMGPIO(void)
|
||||
{
|
||||
//
|
||||
// Disable pull up on GPIO0-5 and configure them as PWMs
|
||||
//
|
||||
GPIO_setPadConfig(0, GPIO_PIN_TYPE_STD);
|
||||
GPIO_setPinConfig(GPIO_0_EPWM1A);
|
||||
|
||||
GPIO_setPadConfig(1, GPIO_PIN_TYPE_STD);
|
||||
GPIO_setPinConfig(GPIO_1_EPWM1B);
|
||||
|
||||
|
||||
GPIO_setPadConfig(4, GPIO_PIN_TYPE_STD);
|
||||
GPIO_setPinConfig(GPIO_4_EPWM3A);
|
||||
|
||||
GPIO_setPadConfig(5, GPIO_PIN_TYPE_STD);
|
||||
GPIO_setPinConfig(GPIO_5_EPWM3B);
|
||||
}
|
||||
|
||||
#ifdef ENABLE_PROFILING
|
||||
void setupProfileGpio(void)
|
||||
{
|
||||
GPIO_setDirectionMode(12,GPIO_DIR_MODE_OUT);
|
||||
GPIO_setQualificationMode(12,GPIO_QUAL_SYNC);
|
||||
GPIO_setPinConfig(GPIO_12_GPIO12);
|
||||
GPIO_writePin(12,0);
|
||||
}
|
||||
|
||||
#endif
|
||||
//
|
||||
// End of file
|
||||
//
|
||||
@@ -0,0 +1,338 @@
|
||||
//#############################################################################
|
||||
//
|
||||
// FILE: adc_ex11_multiple_soc_epwm.c
|
||||
//
|
||||
// TITLE: ADC ePWM Triggering Multiple SOC
|
||||
//
|
||||
//! \addtogroup driver_example_list
|
||||
//! <h1>ADC ePWM Triggering Multiple SOC</h1>
|
||||
//!
|
||||
//! This example sets up ePWM1 to periodically trigger a set of conversions on
|
||||
//! ADCA and ADCD. This example demonstrates multiple ADCs working together
|
||||
//! to process of a batch of conversions using the available parallelism
|
||||
//! accross multiple ADCs.
|
||||
//!
|
||||
//! ADCA Interrupt ISRs are used to read results of both ADCA and ADCD.
|
||||
//!
|
||||
//! \b External \b Connections \n
|
||||
//! - A0, A1, A2 and D2, D3, D4 pins should be connected to signals to be
|
||||
//! converted.
|
||||
//!
|
||||
//! \b Watch \b Variables \n
|
||||
//! - \b adcAResult0 - Digital representation of the voltage on pin A0
|
||||
//! - \b adcAResult1 - Digital representation of the voltage on pin A1
|
||||
//! - \b adcAResult2 - Digital representation of the voltage on pin A2
|
||||
//! - \b adcDResult0 - Digital representation of the voltage on pin D2
|
||||
//! - \b adcDResult1 - Digital representation of the voltage on pin D3
|
||||
//! - \b adcDResult2 - Digital representation of the voltage on pin D4
|
||||
//!
|
||||
//
|
||||
//#############################################################################
|
||||
//
|
||||
//
|
||||
// $Copyright:
|
||||
// Copyright (C) 2013-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"
|
||||
|
||||
//
|
||||
// Defines
|
||||
//
|
||||
#define EX_ADC_RESOLUTION 12
|
||||
// 12 for 12-bit conversion resolution, which supports (ADC_MODE_SINGLE_ENDED)
|
||||
// Sample on single pin (VREFLO is the low reference)
|
||||
// Or 16 for 16-bit conversion resolution, which supports (ADC_MODE_DIFFERENTIAL)
|
||||
// Sample on pair of pins (difference between pins is converted, subject to
|
||||
// common mode voltage requirements; see the device data manual)
|
||||
|
||||
//
|
||||
// Globals
|
||||
//
|
||||
uint16_t adcAResult0;
|
||||
uint16_t adcAResult1;
|
||||
uint16_t adcAResult2;
|
||||
uint16_t adcDResult0;
|
||||
uint16_t adcDResult1;
|
||||
uint16_t adcDResult2;
|
||||
|
||||
//
|
||||
// Function Prototypes
|
||||
//
|
||||
void configureADC(uint32_t adcBase);
|
||||
void initEPWM();
|
||||
void initADCSOC(void);
|
||||
__interrupt void adcA1ISR(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();
|
||||
|
||||
//
|
||||
// Interrupts that are used in this example are re-mapped to ISR functions
|
||||
// found within this file.
|
||||
//
|
||||
Interrupt_register(INT_ADCA1, &adcA1ISR);
|
||||
|
||||
//
|
||||
// Set up the ADC and the ePWM and initialize the SOC
|
||||
//
|
||||
configureADC(ADCA_BASE);
|
||||
configureADC(ADCD_BASE);
|
||||
initEPWM();
|
||||
initADCSOC();
|
||||
|
||||
//
|
||||
// Enable ADC interrupt
|
||||
//
|
||||
Interrupt_enable(INT_ADCA1);
|
||||
|
||||
//
|
||||
// Enable Global Interrupt (INTM) and realtime interrupt (DBGM)
|
||||
//
|
||||
EINT;
|
||||
ERTM;
|
||||
|
||||
//
|
||||
// Start ePWM1, enabling SOCA and putting the counter in up-count mode
|
||||
//
|
||||
EPWM_enableADCTrigger(EPWM1_BASE, EPWM_SOC_A);
|
||||
EPWM_setTimeBaseCounterMode(EPWM1_BASE, EPWM_COUNTER_MODE_UP);
|
||||
|
||||
//
|
||||
// Take conversions indefinitely in loop
|
||||
//
|
||||
do
|
||||
{
|
||||
//
|
||||
// Wait while ePWM causes ADC conversions.
|
||||
// ADCA1 ISR processes each new set of conversions.
|
||||
//
|
||||
}
|
||||
while(1);
|
||||
}
|
||||
|
||||
//
|
||||
// configureADC - Write ADC configurations and power up the ADC for the
|
||||
// selected ADC
|
||||
//
|
||||
void configureADC(uint32_t adcBase)
|
||||
{
|
||||
//
|
||||
// Set ADCDLK divider to /4
|
||||
//
|
||||
ADC_setPrescaler(adcBase, ADC_CLK_DIV_4_0);
|
||||
|
||||
//
|
||||
// Set resolution and signal mode (see #defines above) and load
|
||||
// corresponding trims.
|
||||
//
|
||||
#if(EX_ADC_RESOLUTION == 12)
|
||||
ADC_setMode(adcBase, ADC_RESOLUTION_12BIT, ADC_MODE_SINGLE_ENDED);
|
||||
#elif(EX_ADC_RESOLUTION == 16)
|
||||
ADC_setMode(adcBase, ADC_RESOLUTION_16BIT, ADC_MODE_DIFFERENTIAL);
|
||||
#endif
|
||||
|
||||
//
|
||||
// Set pulse positions to late
|
||||
//
|
||||
ADC_setInterruptPulseMode(adcBase, ADC_PULSE_END_OF_CONV);
|
||||
|
||||
//
|
||||
// Power up the ADCs and then delay for 1 ms
|
||||
//
|
||||
ADC_enableConverter(adcBase);
|
||||
|
||||
//
|
||||
// Delay for 1ms to allow ADC time to power up
|
||||
//
|
||||
DEVICE_DELAY_US(1000);
|
||||
}
|
||||
|
||||
//
|
||||
// Function to configure ePWM1 to generate the SOC.
|
||||
//
|
||||
void initEPWM(void)
|
||||
{
|
||||
//
|
||||
// Disable SOCA
|
||||
//
|
||||
EPWM_disableADCTrigger(EPWM1_BASE, EPWM_SOC_A);
|
||||
|
||||
//
|
||||
// Configure the SOC to occur on the first up-count event
|
||||
//
|
||||
EPWM_setADCTriggerSource(EPWM1_BASE, EPWM_SOC_A, EPWM_SOC_TBCTR_U_CMPA);
|
||||
EPWM_setADCTriggerEventPrescale(EPWM1_BASE, EPWM_SOC_A, 1);
|
||||
|
||||
//
|
||||
// Set the compare A value to 1000 and the period to 1999
|
||||
// Assuming ePWM clock is 100MHz, this would give 50kHz sampling
|
||||
// 50MHz ePWM clock would give 25kHz sampling, etc.
|
||||
// The sample rate can also be modulated by changing the ePWM period
|
||||
// directly (ensure that the compare A value is less than the period).
|
||||
//
|
||||
EPWM_setCounterCompareValue(EPWM1_BASE, EPWM_COUNTER_COMPARE_A, 1000);
|
||||
EPWM_setTimeBasePeriod(EPWM1_BASE, 1999);
|
||||
|
||||
//
|
||||
// Set the local ePWM module clock divider to /1
|
||||
//
|
||||
EPWM_setClockPrescaler(EPWM1_BASE,
|
||||
EPWM_CLOCK_DIVIDER_1,
|
||||
EPWM_HSCLOCK_DIVIDER_1);
|
||||
|
||||
//
|
||||
// Freeze the counter
|
||||
//
|
||||
EPWM_setTimeBaseCounterMode(EPWM1_BASE, EPWM_COUNTER_MODE_STOP_FREEZE);
|
||||
}
|
||||
|
||||
//
|
||||
// Function to configure SOCs on ADCA and ADCD to be triggered by ePWM1.
|
||||
//
|
||||
void initADCSOC(void)
|
||||
{
|
||||
uint16_t acqps;
|
||||
|
||||
//
|
||||
// Determine minimum acquisition window (in SYSCLKS) based on resolution
|
||||
//
|
||||
if(EX_ADC_RESOLUTION == 12)
|
||||
{
|
||||
acqps = 14; // 75ns
|
||||
}
|
||||
else //resolution is 16-bit
|
||||
{
|
||||
acqps = 63; // 320ns
|
||||
}
|
||||
//
|
||||
// - NOTE: A longer sampling window will be required if the ADC driving
|
||||
// source is less than ideal (an ideal source would be a high bandwidth
|
||||
// op-amp with a small series resistance). See TI application report
|
||||
// SPRACT6 for guidance on ADC driver design.
|
||||
// - NOTE: SOCs need not use the same S+H window duration, but SOCs
|
||||
// occurring in parallel (in this example, SOC0 on both ADCs occur in
|
||||
// parallel, as do the SOC1s on both ADCs, etc.) should usually
|
||||
// use the same value to ensure simultaneous samples and synchronous
|
||||
// operation.
|
||||
|
||||
//
|
||||
// Select the channels to convert and the configure the ePWM trigger
|
||||
//
|
||||
ADC_setupSOC(ADCA_BASE, ADC_SOC_NUMBER0, ADC_TRIGGER_EPWM1_SOCA,
|
||||
ADC_CH_ADCIN0, acqps);
|
||||
ADC_setupSOC(ADCA_BASE, ADC_SOC_NUMBER1, ADC_TRIGGER_EPWM1_SOCA,
|
||||
ADC_CH_ADCIN1, acqps);
|
||||
ADC_setupSOC(ADCA_BASE, ADC_SOC_NUMBER2, ADC_TRIGGER_EPWM1_SOCA,
|
||||
ADC_CH_ADCIN2, acqps);
|
||||
ADC_setupSOC(ADCD_BASE, ADC_SOC_NUMBER0, ADC_TRIGGER_EPWM1_SOCA,
|
||||
ADC_CH_ADCIN2, acqps);
|
||||
ADC_setupSOC(ADCD_BASE, ADC_SOC_NUMBER1, ADC_TRIGGER_EPWM1_SOCA,
|
||||
ADC_CH_ADCIN3, acqps);
|
||||
ADC_setupSOC(ADCD_BASE, ADC_SOC_NUMBER2, ADC_TRIGGER_EPWM1_SOCA,
|
||||
ADC_CH_ADCIN4, acqps);
|
||||
|
||||
//
|
||||
// Selec SOC2 on ADCA as the interrupt source. SOC2 on ADCD will end at
|
||||
// the same time, so either SOC2 would be an acceptable interrupt triggger.
|
||||
//
|
||||
ADC_setInterruptSource(ADCA_BASE, ADC_INT_NUMBER1, ADC_SOC_NUMBER2);
|
||||
ADC_enableInterrupt(ADCA_BASE, ADC_INT_NUMBER1);
|
||||
ADC_clearInterruptStatus(ADCA_BASE, ADC_INT_NUMBER1);
|
||||
}
|
||||
|
||||
//
|
||||
// ADC A Interrupt 1 ISR
|
||||
//
|
||||
__interrupt void adcA1ISR(void)
|
||||
{
|
||||
//
|
||||
// Store results
|
||||
//
|
||||
adcAResult0 = ADC_readResult(ADCARESULT_BASE, ADC_SOC_NUMBER0);
|
||||
adcAResult1 = ADC_readResult(ADCARESULT_BASE, ADC_SOC_NUMBER1);
|
||||
adcAResult2 = ADC_readResult(ADCARESULT_BASE, ADC_SOC_NUMBER2);
|
||||
adcDResult0 = ADC_readResult(ADCDRESULT_BASE, ADC_SOC_NUMBER0);
|
||||
adcDResult1 = ADC_readResult(ADCDRESULT_BASE, ADC_SOC_NUMBER1);
|
||||
adcDResult2 = ADC_readResult(ADCDRESULT_BASE, ADC_SOC_NUMBER2);
|
||||
|
||||
//
|
||||
// Clear the interrupt flag
|
||||
//
|
||||
ADC_clearInterruptStatus(ADCA_BASE, ADC_INT_NUMBER1);
|
||||
|
||||
//
|
||||
// Check if overflow has occurred
|
||||
//
|
||||
if(true == ADC_getInterruptOverflowStatus(ADCA_BASE, ADC_INT_NUMBER1))
|
||||
{
|
||||
ADC_clearInterruptOverflowStatus(ADCA_BASE, ADC_INT_NUMBER1);
|
||||
ADC_clearInterruptStatus(ADCA_BASE, ADC_INT_NUMBER1);
|
||||
}
|
||||
|
||||
//
|
||||
// Acknowledge the interrupt
|
||||
//
|
||||
Interrupt_clearACKGroup(INTERRUPT_ACK_GROUP1);
|
||||
}
|
||||
|
||||
//
|
||||
// End of file
|
||||
//
|
||||
@@ -0,0 +1,404 @@
|
||||
//#############################################################################
|
||||
//
|
||||
// FILE: adc_ex12_burst_mode_epwm.c
|
||||
//
|
||||
// TITLE: ADC burst mode example
|
||||
//
|
||||
//! \addtogroup driver_example_list
|
||||
//! <h1>ADC Burst Mode</h1>
|
||||
//!
|
||||
//! This example sets up ePWM1 to periodically trigger ADCA using burst mode.
|
||||
//! This allows for different channels to be sampled with each burst.
|
||||
//!
|
||||
//! Each burst triggers 3 conversions. A0 and A1 are part of every burst while
|
||||
//! the third conversion rotates between A2, A3, and A4. This allows high
|
||||
//! importance signals to be sampled at high speed while lower priority signals
|
||||
//! can be sampled at a lower rate.
|
||||
//!
|
||||
//! ADCA Interrupt ISRs are used to read results for ADCA.
|
||||
//!
|
||||
//! \b External \b Connections \n
|
||||
//! - A0, A1, A2, A3, A4
|
||||
//!
|
||||
//! \b Watch \b Variables \n
|
||||
//! - \b adcAResult0 - Digital representation of the voltage on pin A0
|
||||
//! - \b adcAResult1 - Digital representation of the voltage on pin A1
|
||||
//! - \b adcAResult2 - Digital representation of the voltage on pin A2
|
||||
//! - \b adcAResult3 - Digital representation of the voltage on pin A3
|
||||
//! - \b adcAResult4 - Digital representation of the voltage on pin A4
|
||||
//!
|
||||
//
|
||||
//#############################################################################
|
||||
//
|
||||
//
|
||||
// $Copyright:
|
||||
// Copyright (C) 2013-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"
|
||||
|
||||
//
|
||||
// Defines
|
||||
//
|
||||
#define EX_ADC_RESOLUTION 12
|
||||
// 12 for 12-bit conversion resolution, which supports (ADC_MODE_SINGLE_ENDED)
|
||||
// Sample on single pin (VREFLO is the low reference)
|
||||
// Or 16 for 16-bit conversion resolution, which supports (ADC_MODE_DIFFERENTIAL)
|
||||
// Sample on pair of pins (difference between pins is converted, subject to
|
||||
// common mode voltage requirements; see the device data manual)
|
||||
|
||||
//
|
||||
// Globals
|
||||
//
|
||||
uint16_t adcAResult0;
|
||||
uint16_t adcAResult1;
|
||||
uint16_t adcAResult2;
|
||||
uint16_t adcAResult3;
|
||||
uint16_t adcAResult4;
|
||||
|
||||
|
||||
//
|
||||
// Function Prototypes
|
||||
//
|
||||
void configureADC(uint32_t adcBase);
|
||||
void initEPWM();
|
||||
void initADCSOC(void);
|
||||
__interrupt void adcABurstISR(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();
|
||||
|
||||
//
|
||||
// Interrupts that are used in this example are re-mapped to ISR functions
|
||||
// found within this file.
|
||||
//
|
||||
// Each of the 3 interrupts will occur at the end of the 3 different
|
||||
// bursts, but all 3 will map to the same ADC result handling ISR
|
||||
//
|
||||
Interrupt_register(INT_ADCA1, &adcABurstISR);
|
||||
Interrupt_register(INT_ADCA2, &adcABurstISR);
|
||||
Interrupt_register(INT_ADCA3, &adcABurstISR);
|
||||
|
||||
//
|
||||
// Set up the ADC and the ePWM and initialize the SOC
|
||||
//
|
||||
configureADC(ADCA_BASE);
|
||||
initEPWM();
|
||||
initADCSOC();
|
||||
|
||||
//
|
||||
// Enable ADC interrupts.
|
||||
// Each of the 3 interrupts will occur at the end of the 3 different
|
||||
// bursts, but all 3 will map to the same ADC result handling ISR
|
||||
//
|
||||
Interrupt_enable(INT_ADCA1);
|
||||
Interrupt_enable(INT_ADCA2);
|
||||
Interrupt_enable(INT_ADCA3);
|
||||
|
||||
//
|
||||
// Enable Global Interrupt (INTM) and realtime interrupt (DBGM)
|
||||
//
|
||||
EINT;
|
||||
ERTM;
|
||||
|
||||
//
|
||||
// Start ePWM1, enabling SOCA and putting the counter in up-count mode
|
||||
//
|
||||
EPWM_enableADCTrigger(EPWM1_BASE, EPWM_SOC_A);
|
||||
EPWM_setTimeBaseCounterMode(EPWM1_BASE, EPWM_COUNTER_MODE_UP);
|
||||
|
||||
//
|
||||
// Take conversions indefinitely in loop
|
||||
//
|
||||
do
|
||||
{
|
||||
//
|
||||
// Wait while ePWM causes ADC conversions.
|
||||
// ADCA Burst ISR processes each new set of conversions.
|
||||
//
|
||||
}
|
||||
while(1);
|
||||
}
|
||||
|
||||
//
|
||||
// configureADC - Write ADC configurations and power up the ADC for the
|
||||
// selected ADC
|
||||
//
|
||||
void configureADC(uint32_t adcBase)
|
||||
{
|
||||
//
|
||||
// Set ADCDLK divider to /4
|
||||
//
|
||||
ADC_setPrescaler(adcBase, ADC_CLK_DIV_4_0);
|
||||
|
||||
//
|
||||
// Set resolution and signal mode (see #defines above) and load
|
||||
// corresponding trims.
|
||||
//
|
||||
#if(EX_ADC_RESOLUTION == 12)
|
||||
ADC_setMode(adcBase, ADC_RESOLUTION_12BIT, ADC_MODE_SINGLE_ENDED);
|
||||
#elif(EX_ADC_RESOLUTION == 16)
|
||||
ADC_setMode(adcBase, ADC_RESOLUTION_16BIT, ADC_MODE_DIFFERENTIAL);
|
||||
#endif
|
||||
|
||||
//
|
||||
// Set pulse positions to late
|
||||
//
|
||||
ADC_setInterruptPulseMode(adcBase, ADC_PULSE_END_OF_CONV);
|
||||
|
||||
//
|
||||
// Power up the ADCs and then delay for 1 ms
|
||||
//
|
||||
ADC_enableConverter(adcBase);
|
||||
|
||||
//
|
||||
// Delay for 1ms to allow ADC time to power up
|
||||
//
|
||||
DEVICE_DELAY_US(1000);
|
||||
}
|
||||
|
||||
//
|
||||
// Function to configure ePWM1 to generate the SOC.
|
||||
//
|
||||
void initEPWM(void)
|
||||
{
|
||||
//
|
||||
// Disable SOCA
|
||||
//
|
||||
EPWM_disableADCTrigger(EPWM1_BASE, EPWM_SOC_A);
|
||||
|
||||
//
|
||||
// Configure the SOC to occur on the first up-count event
|
||||
//
|
||||
EPWM_setADCTriggerSource(EPWM1_BASE, EPWM_SOC_A, EPWM_SOC_TBCTR_U_CMPA);
|
||||
EPWM_setADCTriggerEventPrescale(EPWM1_BASE, EPWM_SOC_A, 1);
|
||||
|
||||
//
|
||||
// Set the compare A value to 1000 and the period to 1999
|
||||
// Assuming ePWM clock is 100MHz, this would give 50kHz sampling
|
||||
// 50MHz ePWM clock would give 25kHz sampling, etc.
|
||||
// The sample rate can also be modulated by changing the ePWM period
|
||||
// directly (ensure that the compare A value is less than the period).
|
||||
//
|
||||
EPWM_setCounterCompareValue(EPWM1_BASE, EPWM_COUNTER_COMPARE_A, 1000);
|
||||
EPWM_setTimeBasePeriod(EPWM1_BASE, 1999);
|
||||
|
||||
//
|
||||
// Set the local ePWM module clock divider to /1
|
||||
//
|
||||
EPWM_setClockPrescaler(EPWM1_BASE,
|
||||
EPWM_CLOCK_DIVIDER_1,
|
||||
EPWM_HSCLOCK_DIVIDER_1);
|
||||
|
||||
//
|
||||
// Freeze the counter
|
||||
//
|
||||
EPWM_setTimeBaseCounterMode(EPWM1_BASE, EPWM_COUNTER_MODE_STOP_FREEZE);
|
||||
}
|
||||
|
||||
//
|
||||
// Function to configure SOCs on ADCA and ADCD to be triggered by ePWM1.
|
||||
//
|
||||
void initADCSOC(void)
|
||||
{
|
||||
//
|
||||
// Configure burst mode for SOCs
|
||||
// - EPWM1A will trigger each burst
|
||||
// - Each burst will be 3 conversions long
|
||||
// - 3 bursts of 3 conversions each will need 9 SOCs, so SOC0 to SOC6
|
||||
// are set to high priority, leaving 9 Round-Robin SOCs for the
|
||||
// bursts (SOC7 through SOC15).
|
||||
// - SOC0 to SOC6 are unused in this example, but could be allocated
|
||||
// to non burst mode triggering
|
||||
//
|
||||
ADC_enableBurstMode(ADCA_BASE);
|
||||
ADC_setBurstModeConfig(ADCA_BASE, ADC_TRIGGER_EPWM1_SOCA, 3);
|
||||
ADC_setSOCPriority(ADCA_BASE, ADC_PRI_THRU_SOC6_HIPRI);
|
||||
|
||||
uint16_t acqps;
|
||||
|
||||
//
|
||||
// Determine minimum acquisition window (in SYSCLKS) based on resolution
|
||||
//
|
||||
if(EX_ADC_RESOLUTION == 12)
|
||||
{
|
||||
acqps = 14; // 75ns
|
||||
}
|
||||
else //resolution is 16-bit
|
||||
{
|
||||
acqps = 63; // 320ns
|
||||
}
|
||||
//
|
||||
// - NOTE: A longer sampling window will be required if the ADC driving
|
||||
// source is less than ideal (an ideal source would be a high bandwidth
|
||||
// op-amp with a small series resistance). See TI application report
|
||||
// SPRACT6 for guidance on ADC driver design.
|
||||
//
|
||||
|
||||
//
|
||||
// Select the channels to convert and the configure the S+H duration
|
||||
// Burst1: SOC7 (A0) + SOC8 (A1) + SOC9 (A2)
|
||||
// Burst2: SOC10 (A0) + SOC11 (A1) + SOC12 (A3)
|
||||
// Burst3: SOC13 (A0) + SOC14 (A1) + SOC15 (A4)
|
||||
//
|
||||
ADC_setupSOC(ADCA_BASE, ADC_SOC_NUMBER7, ADC_TRIGGER_SW_ONLY,
|
||||
ADC_CH_ADCIN0, acqps);
|
||||
ADC_setupSOC(ADCA_BASE, ADC_SOC_NUMBER8, ADC_TRIGGER_SW_ONLY,
|
||||
ADC_CH_ADCIN1, acqps);
|
||||
ADC_setupSOC(ADCA_BASE, ADC_SOC_NUMBER9, ADC_TRIGGER_SW_ONLY,
|
||||
ADC_CH_ADCIN2, acqps);
|
||||
ADC_setupSOC(ADCA_BASE, ADC_SOC_NUMBER10, ADC_TRIGGER_SW_ONLY,
|
||||
ADC_CH_ADCIN0, acqps);
|
||||
ADC_setupSOC(ADCA_BASE, ADC_SOC_NUMBER11, ADC_TRIGGER_SW_ONLY,
|
||||
ADC_CH_ADCIN1, acqps);
|
||||
ADC_setupSOC(ADCA_BASE, ADC_SOC_NUMBER12, ADC_TRIGGER_SW_ONLY,
|
||||
ADC_CH_ADCIN3, acqps);
|
||||
ADC_setupSOC(ADCA_BASE, ADC_SOC_NUMBER13, ADC_TRIGGER_SW_ONLY,
|
||||
ADC_CH_ADCIN0, acqps);
|
||||
ADC_setupSOC(ADCA_BASE, ADC_SOC_NUMBER14, ADC_TRIGGER_SW_ONLY,
|
||||
ADC_CH_ADCIN1, acqps);
|
||||
ADC_setupSOC(ADCA_BASE, ADC_SOC_NUMBER15, ADC_TRIGGER_SW_ONLY,
|
||||
ADC_CH_ADCIN4, acqps);
|
||||
|
||||
//
|
||||
// Allocate SOCs to interrupt sources.
|
||||
// Each burst triggers an ISR at the end.
|
||||
//
|
||||
ADC_setInterruptSource(ADCA_BASE, ADC_INT_NUMBER1, ADC_SOC_NUMBER9);
|
||||
ADC_enableInterrupt(ADCA_BASE, ADC_INT_NUMBER1);
|
||||
ADC_clearInterruptStatus(ADCA_BASE, ADC_INT_NUMBER1);
|
||||
ADC_setInterruptSource(ADCA_BASE, ADC_INT_NUMBER2, ADC_SOC_NUMBER12);
|
||||
ADC_enableInterrupt(ADCA_BASE, ADC_INT_NUMBER2);
|
||||
ADC_clearInterruptStatus(ADCA_BASE, ADC_INT_NUMBER2);
|
||||
ADC_setInterruptSource(ADCA_BASE, ADC_INT_NUMBER3, ADC_SOC_NUMBER15);
|
||||
ADC_enableInterrupt(ADCA_BASE, ADC_INT_NUMBER3);
|
||||
ADC_clearInterruptStatus(ADCA_BASE, ADC_INT_NUMBER3);
|
||||
}
|
||||
|
||||
//
|
||||
// ADC A Interrupt Burst Mode ISR
|
||||
//
|
||||
__interrupt void adcABurstISR(void)
|
||||
{
|
||||
uint16_t rrPointer;
|
||||
ADC_IntNumber burstIntSource;
|
||||
|
||||
//
|
||||
//Read the round-robin pointer to determine which burst just completed
|
||||
//
|
||||
rrPointer = (HWREGH(ADCA_BASE + ADC_O_SOCPRICTL) & 0x03E0) >> 5;
|
||||
switch(rrPointer){
|
||||
//
|
||||
// Burst 1
|
||||
//
|
||||
case 9:
|
||||
adcAResult0 = ADC_readResult(ADCARESULT_BASE, ADC_SOC_NUMBER7);
|
||||
adcAResult1 = ADC_readResult(ADCARESULT_BASE, ADC_SOC_NUMBER8);
|
||||
adcAResult2 = ADC_readResult(ADCARESULT_BASE, ADC_SOC_NUMBER9);
|
||||
burstIntSource = ADC_INT_NUMBER1;
|
||||
break;
|
||||
|
||||
//
|
||||
// Burst 2
|
||||
//
|
||||
case 12:
|
||||
adcAResult0 = ADC_readResult(ADCARESULT_BASE, ADC_SOC_NUMBER10);
|
||||
adcAResult1 = ADC_readResult(ADCARESULT_BASE, ADC_SOC_NUMBER11);
|
||||
adcAResult3 = ADC_readResult(ADCARESULT_BASE, ADC_SOC_NUMBER12);
|
||||
burstIntSource = ADC_INT_NUMBER2;
|
||||
break;
|
||||
|
||||
//
|
||||
// Burst 3
|
||||
//
|
||||
case 15:
|
||||
adcAResult0 = ADC_readResult(ADCARESULT_BASE, ADC_SOC_NUMBER13);
|
||||
adcAResult1 = ADC_readResult(ADCARESULT_BASE, ADC_SOC_NUMBER14);
|
||||
adcAResult4 = ADC_readResult(ADCARESULT_BASE, ADC_SOC_NUMBER15);
|
||||
burstIntSource = ADC_INT_NUMBER3;
|
||||
break;
|
||||
|
||||
default:
|
||||
ESTOP0; //handle error for unexpected RR pointer value
|
||||
}
|
||||
|
||||
//
|
||||
// Clear the interrupt flag
|
||||
//
|
||||
ADC_clearInterruptStatus(ADCA_BASE, burstIntSource);
|
||||
|
||||
//
|
||||
// Check if overflow has occurred
|
||||
//
|
||||
if(true == ADC_getInterruptOverflowStatus(ADCA_BASE, burstIntSource))
|
||||
{
|
||||
ADC_clearInterruptOverflowStatus(ADCA_BASE, burstIntSource);
|
||||
ADC_clearInterruptStatus(ADCA_BASE, burstIntSource);
|
||||
}
|
||||
|
||||
//
|
||||
// Acknowledge the interrupt
|
||||
//
|
||||
Interrupt_clearACKGroup(INTERRUPT_ACK_GROUP1);
|
||||
}
|
||||
|
||||
//
|
||||
// End of file
|
||||
//
|
||||
@@ -0,0 +1,365 @@
|
||||
//#############################################################################
|
||||
//
|
||||
// FILE: adc_ex13_burst_mode_oversampling.c
|
||||
//
|
||||
// TITLE: ADC burst mode oversampling example
|
||||
//
|
||||
//! \addtogroup driver_example_list
|
||||
//! <h1>ADC Burst Mode Oversampling</h1>
|
||||
//!
|
||||
//! This example sets up ePWM1 to periodically trigger SOC0 and SOC1 on
|
||||
//! ADCA (to sample A0 and A1). Additionally, the ADC burst mode is also
|
||||
//! triggered using ePWM1. The burst SOCs are used to accumulate multiple
|
||||
//! conversions to oversample A2 over multiple ePWM periods.
|
||||
//!
|
||||
//! \b External \b Connections \n
|
||||
//! - A0, A1, A2
|
||||
//!
|
||||
//! \b Watch \b Variables \n
|
||||
//! - \b adcAResult0 - Digital representation of the voltage on pin A0
|
||||
//! - \b adcAResult1 - Digital representation of the voltage on pin A1
|
||||
//! - \b adcAResult2 - Digital representation of the voltage on pin A2
|
||||
//!
|
||||
//
|
||||
//#############################################################################
|
||||
//
|
||||
//
|
||||
// $Copyright:
|
||||
// Copyright (C) 2013-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"
|
||||
|
||||
//
|
||||
// Defines
|
||||
//
|
||||
#define EX_ADC_RESOLUTION 12
|
||||
// 12 for 12-bit conversion resolution, which supports (ADC_MODE_SINGLE_ENDED)
|
||||
// Sample on single pin (VREFLO is the low reference)
|
||||
// Or 16 for 16-bit conversion resolution, which supports (ADC_MODE_DIFFERENTIAL)
|
||||
// Sample on pair of pins (difference between pins is converted, subject to
|
||||
// common mode voltage requirements; see the device data manual)
|
||||
|
||||
//
|
||||
// Globals
|
||||
//
|
||||
uint16_t adcAResult0;
|
||||
uint16_t adcAResult1;
|
||||
uint16_t adcAResult2;
|
||||
uint16_t isrCount;
|
||||
|
||||
//
|
||||
// Function Prototypes
|
||||
//
|
||||
void configureADC(uint32_t adcBase);
|
||||
void initEPWM();
|
||||
void initADCSOC(void);
|
||||
__interrupt void adcA1ISR(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();
|
||||
|
||||
//
|
||||
// Interrupts that are used in this example are re-mapped to ISR functions
|
||||
// found within this file.
|
||||
//
|
||||
Interrupt_register(INT_ADCA1, &adcA1ISR);
|
||||
|
||||
//
|
||||
// Set up the ADC and the ePWM and initialize the SOC
|
||||
//
|
||||
configureADC(ADCA_BASE);
|
||||
initEPWM();
|
||||
initADCSOC();
|
||||
|
||||
//
|
||||
// Enable ADC interrupts.
|
||||
//
|
||||
Interrupt_enable(INT_ADCA1);
|
||||
|
||||
//
|
||||
// Enable Global Interrupt (INTM) and realtime interrupt (DBGM)
|
||||
//
|
||||
EINT;
|
||||
ERTM;
|
||||
|
||||
//
|
||||
// Initialize ISR counter
|
||||
//
|
||||
isrCount = 0;
|
||||
|
||||
//
|
||||
// Start ePWM1, enabling SOCA and putting the counter in up-count mode
|
||||
//
|
||||
EPWM_enableADCTrigger(EPWM1_BASE, EPWM_SOC_A);
|
||||
EPWM_setTimeBaseCounterMode(EPWM1_BASE, EPWM_COUNTER_MODE_UP);
|
||||
|
||||
//
|
||||
// Take conversions indefinitely in loop
|
||||
//
|
||||
do
|
||||
{
|
||||
//
|
||||
// Wait while ePWM causes ADC conversions.
|
||||
// ADCA1 ISR processes each new set of conversions.
|
||||
//
|
||||
}
|
||||
while(1);
|
||||
}
|
||||
|
||||
//
|
||||
// configureADC - Write ADC configurations and power up the ADC for the
|
||||
// selected ADC
|
||||
//
|
||||
void configureADC(uint32_t adcBase)
|
||||
{
|
||||
//
|
||||
// Set ADCDLK divider to /4
|
||||
//
|
||||
ADC_setPrescaler(adcBase, ADC_CLK_DIV_4_0);
|
||||
|
||||
//
|
||||
// Set resolution and signal mode (see #defines above) and load
|
||||
// corresponding trims.
|
||||
//
|
||||
#if(EX_ADC_RESOLUTION == 12)
|
||||
ADC_setMode(adcBase, ADC_RESOLUTION_12BIT, ADC_MODE_SINGLE_ENDED);
|
||||
#elif(EX_ADC_RESOLUTION == 16)
|
||||
ADC_setMode(adcBase, ADC_RESOLUTION_16BIT, ADC_MODE_DIFFERENTIAL);
|
||||
#endif
|
||||
|
||||
//
|
||||
// Set pulse positions to late
|
||||
//
|
||||
ADC_setInterruptPulseMode(adcBase, ADC_PULSE_END_OF_CONV);
|
||||
|
||||
//
|
||||
// Power up the ADCs and then delay for 1 ms
|
||||
//
|
||||
ADC_enableConverter(adcBase);
|
||||
|
||||
//
|
||||
// Delay for 1ms to allow ADC time to power up
|
||||
//
|
||||
DEVICE_DELAY_US(1000);
|
||||
}
|
||||
|
||||
//
|
||||
// Function to configure ePWM1 to generate the SOC.
|
||||
//
|
||||
void initEPWM(void)
|
||||
{
|
||||
//
|
||||
// Disable SOCA
|
||||
//
|
||||
EPWM_disableADCTrigger(EPWM1_BASE, EPWM_SOC_A);
|
||||
|
||||
//
|
||||
// Configure the SOC to occur on the first up-count event
|
||||
//
|
||||
EPWM_setADCTriggerSource(EPWM1_BASE, EPWM_SOC_A, EPWM_SOC_TBCTR_U_CMPA);
|
||||
EPWM_setADCTriggerEventPrescale(EPWM1_BASE, EPWM_SOC_A, 1);
|
||||
|
||||
//
|
||||
// Set the compare A value to 1000 and the period to 1999
|
||||
// Assuming ePWM clock is 100MHz, this would give 50kHz sampling
|
||||
// 50MHz ePWM clock would give 25kHz sampling, etc.
|
||||
// The sample rate can also be modulated by changing the ePWM period
|
||||
// directly (ensure that the compare A value is less than the period).
|
||||
//
|
||||
EPWM_setCounterCompareValue(EPWM1_BASE, EPWM_COUNTER_COMPARE_A, 1000);
|
||||
EPWM_setTimeBasePeriod(EPWM1_BASE, 1999);
|
||||
|
||||
//
|
||||
// Set the local ePWM module clock divider to /1
|
||||
//
|
||||
EPWM_setClockPrescaler(EPWM1_BASE,
|
||||
EPWM_CLOCK_DIVIDER_1,
|
||||
EPWM_HSCLOCK_DIVIDER_1);
|
||||
|
||||
//
|
||||
// Freeze the counter
|
||||
//
|
||||
EPWM_setTimeBaseCounterMode(EPWM1_BASE, EPWM_COUNTER_MODE_STOP_FREEZE);
|
||||
}
|
||||
|
||||
//
|
||||
// Function to configure SOCs on ADCA and ADCD to be triggered by ePWM1.
|
||||
//
|
||||
void initADCSOC(void)
|
||||
{
|
||||
//
|
||||
// Configure burst mode for SOCs
|
||||
// - EPWM1A will trigger each burst
|
||||
// - The burst will be 4 conversions long
|
||||
// - 1 burst of 4 conversions as each will need 4 SOCs, so SOC0 to SOC11
|
||||
// are set to high priority, leaving 4 Round-Robin SOCs for the
|
||||
// bursts (SOC12 through SOC15).
|
||||
//
|
||||
ADC_enableBurstMode(ADCA_BASE);
|
||||
ADC_setBurstModeConfig(ADCA_BASE, ADC_TRIGGER_EPWM1_SOCA, 3);
|
||||
ADC_setSOCPriority(ADCA_BASE, ADC_PRI_THRU_SOC11_HIPRI);
|
||||
|
||||
uint16_t acqps;
|
||||
|
||||
//
|
||||
// Determine minimum acquisition window (in SYSCLKS) based on resolution
|
||||
//
|
||||
if(EX_ADC_RESOLUTION == 12)
|
||||
{
|
||||
acqps = 14; // 75ns
|
||||
}
|
||||
else //resolution is 16-bit
|
||||
{
|
||||
acqps = 63; // 320ns
|
||||
}
|
||||
//
|
||||
// - NOTE: A longer sampling window will be required if the ADC driving
|
||||
// source is less than ideal (an ideal source would be a high bandwidth
|
||||
// op-amp with a small series resistance). See TI application report
|
||||
// SPRACT6 for guidance on ADC driver design.
|
||||
//
|
||||
|
||||
//
|
||||
// Setup the burst SOCs for oversampling (all convert A2)
|
||||
// All 4 results will be averaged together after 4 ePWM cycles
|
||||
//
|
||||
ADC_setupSOC(ADCA_BASE, ADC_SOC_NUMBER12, ADC_TRIGGER_SW_ONLY,
|
||||
ADC_CH_ADCIN2, acqps);
|
||||
ADC_setupSOC(ADCA_BASE, ADC_SOC_NUMBER13, ADC_TRIGGER_SW_ONLY,
|
||||
ADC_CH_ADCIN2, acqps);
|
||||
ADC_setupSOC(ADCA_BASE, ADC_SOC_NUMBER14, ADC_TRIGGER_SW_ONLY,
|
||||
ADC_CH_ADCIN2, acqps);
|
||||
ADC_setupSOC(ADCA_BASE, ADC_SOC_NUMBER15, ADC_TRIGGER_SW_ONLY,
|
||||
ADC_CH_ADCIN2, acqps);
|
||||
|
||||
//
|
||||
// Setup the regular (high priority SOCs) to sample A0 and A1
|
||||
//
|
||||
ADC_setupSOC(ADCA_BASE, ADC_SOC_NUMBER0, ADC_TRIGGER_EPWM1_SOCA,
|
||||
ADC_CH_ADCIN0, acqps);
|
||||
ADC_setupSOC(ADCA_BASE, ADC_SOC_NUMBER1, ADC_TRIGGER_EPWM1_SOCA,
|
||||
ADC_CH_ADCIN1, acqps);
|
||||
|
||||
//
|
||||
// Allocate SOCs to interrupt sources.
|
||||
// SOC1 triggers the ISR
|
||||
//
|
||||
ADC_setInterruptSource(ADCA_BASE, ADC_INT_NUMBER1, ADC_SOC_NUMBER1);
|
||||
ADC_enableInterrupt(ADCA_BASE, ADC_INT_NUMBER1);
|
||||
}
|
||||
|
||||
//
|
||||
// ADC A Interrupt Burst Mode ISR
|
||||
//
|
||||
// Every ISR new results for A0 and A1 will be collected
|
||||
//
|
||||
// A2 is oversampled over 4 ePWM periods
|
||||
//
|
||||
__interrupt void adcA1ISR(void)
|
||||
{
|
||||
|
||||
|
||||
//
|
||||
// Record the results for A0 and A1
|
||||
//
|
||||
adcAResult0 = ADC_readResult(ADCARESULT_BASE, ADC_SOC_NUMBER0);
|
||||
adcAResult1 = ADC_readResult(ADCARESULT_BASE, ADC_SOC_NUMBER1);
|
||||
|
||||
//
|
||||
// Every 4th ISR, the burst mode buffer will be full of new results to
|
||||
// be averaged
|
||||
//
|
||||
if(++isrCount == 4)
|
||||
{
|
||||
//
|
||||
// Average the 4 results and reset the counter
|
||||
//
|
||||
adcAResult2 =
|
||||
(ADC_readResult(ADCARESULT_BASE, ADC_SOC_NUMBER12) +
|
||||
ADC_readResult(ADCARESULT_BASE, ADC_SOC_NUMBER13) +
|
||||
ADC_readResult(ADCARESULT_BASE, ADC_SOC_NUMBER14) +
|
||||
ADC_readResult(ADCARESULT_BASE, ADC_SOC_NUMBER15)) >> 2;
|
||||
isrCount = 0;
|
||||
}
|
||||
|
||||
//
|
||||
// Clear the interrupt flag
|
||||
//
|
||||
ADC_clearInterruptStatus(ADCA_BASE, ADC_INT_NUMBER1);
|
||||
|
||||
//
|
||||
// Check if overflow has occurred
|
||||
//
|
||||
if(true == ADC_getInterruptOverflowStatus(ADCA_BASE, ADC_INT_NUMBER1))
|
||||
{
|
||||
ADC_clearInterruptOverflowStatus(ADCA_BASE, ADC_INT_NUMBER1);
|
||||
ADC_clearInterruptStatus(ADCA_BASE, ADC_INT_NUMBER1);
|
||||
}
|
||||
|
||||
//
|
||||
// Acknowledge the interrupt
|
||||
//
|
||||
Interrupt_clearACKGroup(INTERRUPT_ACK_GROUP1);
|
||||
}
|
||||
|
||||
//
|
||||
// End of file
|
||||
//
|
||||
@@ -0,0 +1,332 @@
|
||||
//#############################################################################
|
||||
//
|
||||
// FILE: adc_ex14_soc_oversampling.c
|
||||
//
|
||||
// TITLE: ADC Oversampling Using Multiple SOCs
|
||||
//
|
||||
//! \addtogroup driver_example_list
|
||||
//! <h1>ADC SOC Oversampling </h1>
|
||||
//!
|
||||
//! This example sets up ePWM1 to periodically trigger a set of conversions on
|
||||
//! ADCA including multiple SOCs that all convert A2 to achieve oversampling on
|
||||
//! A2.
|
||||
//!
|
||||
//! ADCA Interrupt ISRs are used to read results of ADCA.
|
||||
//!
|
||||
//! \b External \b Connections \n
|
||||
//! - A0, A1, A2 should be connected to signals to be converted.
|
||||
//!
|
||||
//! \b Watch \b Variables \n
|
||||
//! - \b adcAResult0 - Digital representation of the voltage on pin A0
|
||||
//! - \b adcAResult1 - Digital representation of the voltage on pin A1
|
||||
//! - \b adcAResult2 - Digital representation of the voltage on pin A2
|
||||
//!
|
||||
//
|
||||
//#############################################################################
|
||||
//
|
||||
//
|
||||
// $Copyright:
|
||||
// Copyright (C) 2013-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"
|
||||
|
||||
//
|
||||
// Defines
|
||||
//
|
||||
#define EX_ADC_RESOLUTION 12
|
||||
// 12 for 12-bit conversion resolution, which supports (ADC_MODE_SINGLE_ENDED)
|
||||
// Sample on single pin (VREFLO is the low reference)
|
||||
// Or 16 for 16-bit conversion resolution, which supports (ADC_MODE_DIFFERENTIAL)
|
||||
// Sample on pair of pins (difference between pins is converted, subject to
|
||||
// common mode voltage requirements; see the device data manual)
|
||||
|
||||
//
|
||||
// Globals
|
||||
//
|
||||
uint16_t adcAResult0;
|
||||
uint16_t adcAResult1;
|
||||
uint16_t adcAResult2;
|
||||
|
||||
//
|
||||
// Function Prototypes
|
||||
//
|
||||
void configureADC(uint32_t adcBase);
|
||||
void initEPWM();
|
||||
void initADCSOC(void);
|
||||
__interrupt void adcA1ISR(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();
|
||||
|
||||
//
|
||||
// Interrupts that are used in this example are re-mapped to ISR functions
|
||||
// found within this file.
|
||||
//
|
||||
Interrupt_register(INT_ADCA1, &adcA1ISR);
|
||||
|
||||
//
|
||||
// Set up the ADC and the ePWM and initialize the SOC
|
||||
//
|
||||
configureADC(ADCA_BASE);
|
||||
initEPWM();
|
||||
initADCSOC();
|
||||
|
||||
//
|
||||
// Enable ADC interrupt
|
||||
//
|
||||
Interrupt_enable(INT_ADCA1);
|
||||
|
||||
//
|
||||
// Enable Global Interrupt (INTM) and realtime interrupt (DBGM)
|
||||
//
|
||||
EINT;
|
||||
ERTM;
|
||||
|
||||
//
|
||||
// Start ePWM1, enabling SOCA and putting the counter in up-count mode
|
||||
//
|
||||
EPWM_enableADCTrigger(EPWM1_BASE, EPWM_SOC_A);
|
||||
EPWM_setTimeBaseCounterMode(EPWM1_BASE, EPWM_COUNTER_MODE_UP);
|
||||
|
||||
//
|
||||
// Take conversions indefinitely in loop
|
||||
//
|
||||
do
|
||||
{
|
||||
//
|
||||
// Wait while ePWM causes ADC conversions.
|
||||
// ADCA1 ISR processes each new set of conversions.
|
||||
//
|
||||
}
|
||||
while(1);
|
||||
}
|
||||
|
||||
//
|
||||
// configureADC - Write ADC configurations and power up the ADC for the
|
||||
// selected ADC
|
||||
//
|
||||
void configureADC(uint32_t adcBase)
|
||||
{
|
||||
//
|
||||
// Set ADCDLK divider to /4
|
||||
//
|
||||
ADC_setPrescaler(adcBase, ADC_CLK_DIV_4_0);
|
||||
|
||||
//
|
||||
// Set resolution and signal mode (see #defines above) and load
|
||||
// corresponding trims.
|
||||
//
|
||||
#if(EX_ADC_RESOLUTION == 12)
|
||||
ADC_setMode(adcBase, ADC_RESOLUTION_12BIT, ADC_MODE_SINGLE_ENDED);
|
||||
#elif(EX_ADC_RESOLUTION == 16)
|
||||
ADC_setMode(adcBase, ADC_RESOLUTION_16BIT, ADC_MODE_DIFFERENTIAL);
|
||||
#endif
|
||||
|
||||
//
|
||||
// Set pulse positions to late
|
||||
//
|
||||
ADC_setInterruptPulseMode(adcBase, ADC_PULSE_END_OF_CONV);
|
||||
|
||||
//
|
||||
// Power up the ADCs and then delay for 1 ms
|
||||
//
|
||||
ADC_enableConverter(adcBase);
|
||||
|
||||
//
|
||||
// Delay for 1ms to allow ADC time to power up
|
||||
//
|
||||
DEVICE_DELAY_US(1000);
|
||||
}
|
||||
|
||||
//
|
||||
// Function to configure ePWM1 to generate the SOC.
|
||||
//
|
||||
void initEPWM(void)
|
||||
{
|
||||
//
|
||||
// Disable SOCA
|
||||
//
|
||||
EPWM_disableADCTrigger(EPWM1_BASE, EPWM_SOC_A);
|
||||
|
||||
//
|
||||
// Configure the SOC to occur on the first up-count event
|
||||
//
|
||||
EPWM_setADCTriggerSource(EPWM1_BASE, EPWM_SOC_A, EPWM_SOC_TBCTR_U_CMPA);
|
||||
EPWM_setADCTriggerEventPrescale(EPWM1_BASE, EPWM_SOC_A, 1);
|
||||
|
||||
//
|
||||
// Set the compare A value to 1000 and the period to 1999
|
||||
// Assuming ePWM clock is 100MHz, this would give 50kHz sampling
|
||||
// 50MHz ePWM clock would give 25kHz sampling, etc.
|
||||
// The sample rate can also be modulated by changing the ePWM period
|
||||
// directly (ensure that the compare A value is less than the period).
|
||||
//
|
||||
EPWM_setCounterCompareValue(EPWM1_BASE, EPWM_COUNTER_COMPARE_A, 1000);
|
||||
EPWM_setTimeBasePeriod(EPWM1_BASE, 1999);
|
||||
|
||||
//
|
||||
// Set the local ePWM module clock divider to /1
|
||||
//
|
||||
EPWM_setClockPrescaler(EPWM1_BASE,
|
||||
EPWM_CLOCK_DIVIDER_1,
|
||||
EPWM_HSCLOCK_DIVIDER_1);
|
||||
|
||||
//
|
||||
// Freeze the counter
|
||||
//
|
||||
EPWM_setTimeBaseCounterMode(EPWM1_BASE, EPWM_COUNTER_MODE_STOP_FREEZE);
|
||||
}
|
||||
|
||||
//
|
||||
// Function to configure SOCs on ADCA and ADCD to be triggered by ePWM1.
|
||||
//
|
||||
void initADCSOC(void)
|
||||
{
|
||||
uint16_t acqps;
|
||||
|
||||
//
|
||||
// Determine minimum acquisition window (in SYSCLKS) based on resolution
|
||||
//
|
||||
if(EX_ADC_RESOLUTION == 12)
|
||||
{
|
||||
acqps = 14; // 75ns
|
||||
}
|
||||
else //resolution is 16-bit
|
||||
{
|
||||
acqps = 63; // 320ns
|
||||
}
|
||||
//
|
||||
// - NOTE: A longer sampling window will be required if the ADC driving
|
||||
// source is less than ideal (an ideal source would be a high bandwidth
|
||||
// op-amp with a small series resistance). See TI application report
|
||||
// SPRACT6 for guidance on ADC driver design.
|
||||
|
||||
//
|
||||
// Select the channels to convert and the configure the ePWM trigger
|
||||
//
|
||||
ADC_setupSOC(ADCA_BASE, ADC_SOC_NUMBER0, ADC_TRIGGER_EPWM1_SOCA,
|
||||
ADC_CH_ADCIN0, acqps);
|
||||
ADC_setupSOC(ADCA_BASE, ADC_SOC_NUMBER1, ADC_TRIGGER_EPWM1_SOCA,
|
||||
ADC_CH_ADCIN1, acqps);
|
||||
|
||||
//
|
||||
// Setup multiple SOCs to oversample A2
|
||||
//
|
||||
ADC_setupSOC(ADCA_BASE, ADC_SOC_NUMBER2, ADC_TRIGGER_EPWM1_SOCA,
|
||||
ADC_CH_ADCIN2, acqps);
|
||||
ADC_setupSOC(ADCA_BASE, ADC_SOC_NUMBER3, ADC_TRIGGER_EPWM1_SOCA,
|
||||
ADC_CH_ADCIN2, acqps);
|
||||
ADC_setupSOC(ADCA_BASE, ADC_SOC_NUMBER4, ADC_TRIGGER_EPWM1_SOCA,
|
||||
ADC_CH_ADCIN2, acqps);
|
||||
ADC_setupSOC(ADCA_BASE, ADC_SOC_NUMBER5, ADC_TRIGGER_EPWM1_SOCA,
|
||||
ADC_CH_ADCIN2, acqps);
|
||||
|
||||
//
|
||||
// Selec SOC5 on ADCA as the interrupt source.
|
||||
//
|
||||
ADC_setInterruptSource(ADCA_BASE, ADC_INT_NUMBER1, ADC_SOC_NUMBER5);
|
||||
ADC_enableInterrupt(ADCA_BASE, ADC_INT_NUMBER1);
|
||||
ADC_clearInterruptStatus(ADCA_BASE, ADC_INT_NUMBER1);
|
||||
}
|
||||
|
||||
//
|
||||
// ADC A Interrupt 1 ISR
|
||||
//
|
||||
__interrupt void adcA1ISR(void)
|
||||
{
|
||||
//
|
||||
// Store results for A0 and A1
|
||||
//
|
||||
adcAResult0 = ADC_readResult(ADCARESULT_BASE, ADC_SOC_NUMBER0);
|
||||
adcAResult1 = ADC_readResult(ADCARESULT_BASE, ADC_SOC_NUMBER1);
|
||||
|
||||
//
|
||||
// Average the 4 oversampled A2 results together
|
||||
//
|
||||
adcAResult2 =
|
||||
(ADC_readResult(ADCARESULT_BASE, ADC_SOC_NUMBER2) +
|
||||
ADC_readResult(ADCARESULT_BASE, ADC_SOC_NUMBER3) +
|
||||
ADC_readResult(ADCARESULT_BASE, ADC_SOC_NUMBER4) +
|
||||
ADC_readResult(ADCARESULT_BASE, ADC_SOC_NUMBER5)) >> 2;
|
||||
|
||||
//
|
||||
// Clear the interrupt flag
|
||||
//
|
||||
ADC_clearInterruptStatus(ADCA_BASE, ADC_INT_NUMBER1);
|
||||
|
||||
//
|
||||
// Check if overflow has occurred
|
||||
//
|
||||
if(true == ADC_getInterruptOverflowStatus(ADCA_BASE, ADC_INT_NUMBER1))
|
||||
{
|
||||
ADC_clearInterruptOverflowStatus(ADCA_BASE, ADC_INT_NUMBER1);
|
||||
ADC_clearInterruptStatus(ADCA_BASE, ADC_INT_NUMBER1);
|
||||
}
|
||||
|
||||
//
|
||||
// Acknowledge the interrupt
|
||||
//
|
||||
Interrupt_clearACKGroup(INTERRUPT_ACK_GROUP1);
|
||||
}
|
||||
|
||||
//
|
||||
// End of file
|
||||
//
|
||||
@@ -0,0 +1,291 @@
|
||||
//#############################################################################
|
||||
//
|
||||
// FILE: adc_ex1_soc_software.c
|
||||
//
|
||||
// TITLE: ADC Software Triggering
|
||||
//
|
||||
//! \addtogroup driver_example_list
|
||||
//! <h1>ADC Software Triggering</h1>
|
||||
//!
|
||||
//! This example converts some voltages on ADCA and ADCD based on a software
|
||||
//! trigger.
|
||||
//!
|
||||
//! The ADCD will not convert until ADCA is complete, so the ADCs will not run
|
||||
//! asynchronously. However, this is much less efficient than allowing the ADCs
|
||||
//! to convert synchronously in parallel (for example, by using an ePWM
|
||||
//! trigger).
|
||||
//!
|
||||
//! \b External \b Connections \n
|
||||
//! - A0, A1, D2, and D3 should be connected to signals to convert
|
||||
//!
|
||||
//! \b Watch \b Variables \n
|
||||
//! - \b adcAResult0 - Digital representation of the voltage on pin A0
|
||||
//! - \b adcAResult1 - Digital representation of the voltage on pin A1
|
||||
//! - \b adcDResult0 - Digital representation of the voltage on pin D2
|
||||
//! - \b adcDResult1 - Digital representation of the voltage on pin D3
|
||||
//!
|
||||
//
|
||||
//#############################################################################
|
||||
//
|
||||
//
|
||||
// $Copyright:
|
||||
// Copyright (C) 2013-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"
|
||||
|
||||
//
|
||||
// Defines
|
||||
//
|
||||
#define EX_ADC_RESOLUTION 12
|
||||
// 12 for 12-bit conversion resolution, which supports (ADC_MODE_SINGLE_ENDED)
|
||||
// Sample on single pin (VREFLO is the low reference)
|
||||
// Or 16 for 16-bit conversion resolution, which supports (ADC_MODE_DIFFERENTIAL)
|
||||
// Sample on pair of pins (difference between pins is converted, subject to
|
||||
// common mode voltage requirements; see the device data manual)
|
||||
|
||||
//
|
||||
// Globals
|
||||
//
|
||||
uint16_t adcAResult0;
|
||||
uint16_t adcAResult1;
|
||||
uint16_t adcDResult0;
|
||||
uint16_t adcDResult1;
|
||||
|
||||
//
|
||||
// Function Prototypes
|
||||
//
|
||||
void initADCs(void);
|
||||
void initADCSOCs(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 ADCs, initializing the SOCs to be triggered by software
|
||||
//
|
||||
initADCs();
|
||||
initADCSOCs();
|
||||
|
||||
//
|
||||
// Enable Global Interrupt (INTM) and realtime interrupt (DBGM)
|
||||
//
|
||||
EINT;
|
||||
ERTM;
|
||||
|
||||
//
|
||||
// Loop indefinitely
|
||||
//
|
||||
while(1)
|
||||
{
|
||||
//
|
||||
// Convert, wait for completion, and store results
|
||||
//
|
||||
ADC_forceMultipleSOC(ADCA_BASE, (ADC_FORCE_SOC0 | ADC_FORCE_SOC1));
|
||||
|
||||
//
|
||||
// Wait for ADCA to complete, then acknowledge flag
|
||||
//
|
||||
while(ADC_getInterruptStatus(ADCA_BASE, ADC_INT_NUMBER1) == false)
|
||||
{
|
||||
}
|
||||
ADC_clearInterruptStatus(ADCA_BASE, ADC_INT_NUMBER1);
|
||||
|
||||
ADC_forceMultipleSOC(ADCD_BASE, (ADC_FORCE_SOC0 | ADC_FORCE_SOC1));
|
||||
//
|
||||
// Wait for ADCD to complete, then acknowledge flag
|
||||
//
|
||||
while(ADC_getInterruptStatus(ADCD_BASE, ADC_INT_NUMBER1) == false)
|
||||
{
|
||||
}
|
||||
ADC_clearInterruptStatus(ADCD_BASE, ADC_INT_NUMBER1);
|
||||
|
||||
//
|
||||
// Store results
|
||||
//
|
||||
adcAResult0 = ADC_readResult(ADCARESULT_BASE, ADC_SOC_NUMBER0);
|
||||
adcAResult1 = ADC_readResult(ADCARESULT_BASE, ADC_SOC_NUMBER1);
|
||||
adcDResult0 = ADC_readResult(ADCDRESULT_BASE, ADC_SOC_NUMBER0);
|
||||
adcDResult1 = ADC_readResult(ADCDRESULT_BASE, ADC_SOC_NUMBER1);
|
||||
|
||||
//
|
||||
// Software breakpoint. At this point, conversion results are stored in
|
||||
// adcAResult0, adcAResult1, adcDResult0, and adcDResult1.
|
||||
//
|
||||
// Hit run again to get updated conversions.
|
||||
//
|
||||
ESTOP0;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Function to configure and power up ADCs A and C.
|
||||
//
|
||||
void initADCs(void)
|
||||
{
|
||||
|
||||
|
||||
//
|
||||
// Set ADCDLK divider to /4
|
||||
//
|
||||
ADC_setPrescaler(ADCA_BASE, ADC_CLK_DIV_4_0);
|
||||
ADC_setPrescaler(ADCD_BASE, ADC_CLK_DIV_4_0);
|
||||
|
||||
//
|
||||
// Set resolution and signal mode (see #defines above) and load
|
||||
// corresponding trims.
|
||||
//
|
||||
#if(EX_ADC_RESOLUTION == 12)
|
||||
ADC_setMode(ADCA_BASE, ADC_RESOLUTION_12BIT, ADC_MODE_SINGLE_ENDED);
|
||||
ADC_setMode(ADCD_BASE, ADC_RESOLUTION_12BIT, ADC_MODE_SINGLE_ENDED);
|
||||
#elif(EX_ADC_RESOLUTION == 16)
|
||||
ADC_setMode(ADCA_BASE, ADC_RESOLUTION_16BIT, ADC_MODE_DIFFERENTIAL);
|
||||
ADC_setMode(ADCD_BASE, ADC_RESOLUTION_16BIT, ADC_MODE_DIFFERENTIAL);
|
||||
#endif
|
||||
|
||||
//
|
||||
// Set pulse positions to late
|
||||
//
|
||||
ADC_setInterruptPulseMode(ADCA_BASE, ADC_PULSE_END_OF_CONV);
|
||||
ADC_setInterruptPulseMode(ADCD_BASE, ADC_PULSE_END_OF_CONV);
|
||||
|
||||
//
|
||||
// Power up the ADCs and then delay for 1 ms
|
||||
//
|
||||
ADC_enableConverter(ADCA_BASE);
|
||||
ADC_enableConverter(ADCD_BASE);
|
||||
|
||||
DEVICE_DELAY_US(1000);
|
||||
}
|
||||
|
||||
//
|
||||
// Function to configure SOCs 0 and 1 of ADCs A and C.
|
||||
//
|
||||
void initADCSOCs(void)
|
||||
{
|
||||
//
|
||||
// Configure SOCs of ADCA
|
||||
// - SOC0 will convert pin A0.
|
||||
// - SOC1 will convert pin A1.
|
||||
// - Both will be triggered by software only.
|
||||
// - For 12-bit resolution, a sampling window of 15 (75 ns at a 200MHz
|
||||
// SYSCLK rate) will be used. For 16-bit resolution, a sampling window
|
||||
// of 64 (320 ns at a 200MHz SYSCLK rate) will be used.
|
||||
// - NOTE: A longer sampling window will be required if the ADC driving
|
||||
// source is less than ideal (an ideal source would be a high bandwidth
|
||||
// op-amp with a small series resistance). See TI application report
|
||||
// SPRACT6 for guidance on ADC driver design.
|
||||
//
|
||||
|
||||
#if(EX_ADC_RESOLUTION == 12)
|
||||
ADC_setupSOC(ADCA_BASE, ADC_SOC_NUMBER0, ADC_TRIGGER_SW_ONLY,
|
||||
ADC_CH_ADCIN0, 15);
|
||||
ADC_setupSOC(ADCA_BASE, ADC_SOC_NUMBER1, ADC_TRIGGER_SW_ONLY,
|
||||
ADC_CH_ADCIN1, 15);
|
||||
#elif(EX_ADC_RESOLUTION == 16)
|
||||
ADC_setupSOC(ADCA_BASE, ADC_SOC_NUMBER0, ADC_TRIGGER_SW_ONLY,
|
||||
ADC_CH_ADCIN0, 64);
|
||||
ADC_setupSOC(ADCA_BASE, ADC_SOC_NUMBER1, ADC_TRIGGER_SW_ONLY,
|
||||
ADC_CH_ADCIN1, 64);
|
||||
#endif
|
||||
|
||||
//
|
||||
// Set SOC1 to set the interrupt 1 flag. Enable the interrupt and make
|
||||
// sure its flag is cleared.
|
||||
//
|
||||
ADC_setInterruptSource(ADCA_BASE, ADC_INT_NUMBER1, ADC_SOC_NUMBER1);
|
||||
ADC_enableInterrupt(ADCA_BASE, ADC_INT_NUMBER1);
|
||||
ADC_clearInterruptStatus(ADCA_BASE, ADC_INT_NUMBER1);
|
||||
|
||||
//
|
||||
// Configure SOCs of ADCD
|
||||
// - SOC0 will convert pin D2.
|
||||
// - SOC1 will convert pin D3.
|
||||
// - Both will be triggered by software only.
|
||||
// - For 12-bit resolution, a sampling window of 15 (75 ns at a 200MHz
|
||||
// SYSCLK rate) will be used. For 16-bit resolution, a sampling window
|
||||
// of 64 (320 ns at a 200MHz SYSCLK rate) will be used.
|
||||
// - NOTE: A longer sampling window will be required if the ADC driving
|
||||
// source is less than ideal (an ideal source would be a high bandwidth
|
||||
// op-amp with a small series resistance). See TI application report
|
||||
// SPRACT6 for guidance on ADC driver design.
|
||||
//
|
||||
|
||||
#if(EX_ADC_RESOLUTION == 12)
|
||||
ADC_setupSOC(ADCD_BASE, ADC_SOC_NUMBER0, ADC_TRIGGER_SW_ONLY,
|
||||
ADC_CH_ADCIN2, 15);
|
||||
ADC_setupSOC(ADCD_BASE, ADC_SOC_NUMBER1, ADC_TRIGGER_SW_ONLY,
|
||||
ADC_CH_ADCIN3, 15);
|
||||
#elif(EX_ADC_RESOLUTION == 16)
|
||||
ADC_setupSOC(ADCD_BASE, ADC_SOC_NUMBER0, ADC_TRIGGER_SW_ONLY,
|
||||
ADC_CH_ADCIN2, 64);
|
||||
ADC_setupSOC(ADCD_BASE, ADC_SOC_NUMBER1, ADC_TRIGGER_SW_ONLY,
|
||||
ADC_CH_ADCIN3, 64);
|
||||
#endif
|
||||
|
||||
//
|
||||
// Set SOC1 to set the interrupt 1 flag. Enable the interrupt and make
|
||||
// sure its flag is cleared.
|
||||
//
|
||||
ADC_setInterruptSource(ADCD_BASE, ADC_INT_NUMBER1, ADC_SOC_NUMBER1);
|
||||
ADC_enableInterrupt(ADCD_BASE, ADC_INT_NUMBER1);
|
||||
ADC_clearInterruptStatus(ADCD_BASE, ADC_INT_NUMBER1);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,330 @@
|
||||
//#############################################################################
|
||||
//
|
||||
// FILE: adc_ex2_soc_epwm.c
|
||||
//
|
||||
// TITLE: ADC ePWM Triggering
|
||||
//
|
||||
//! \addtogroup driver_example_list
|
||||
//! <h1>ADC ePWM Triggering</h1>
|
||||
//!
|
||||
//! This example sets up ePWM1 to periodically trigger a conversion on ADCA.
|
||||
//!
|
||||
//! \b External \b Connections \n
|
||||
//! - A0 should be connected to a signal to convert
|
||||
//!
|
||||
//! \b Watch \b Variables \n
|
||||
//! - \b adcAResults - A sequence of analog-to-digital conversion samples from
|
||||
//! pin A0. The time between samples is determined based on the period
|
||||
//! of the ePWM timer.
|
||||
//!
|
||||
//
|
||||
//#############################################################################
|
||||
//
|
||||
//
|
||||
// $Copyright:
|
||||
// Copyright (C) 2013-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"
|
||||
|
||||
//
|
||||
// Defines
|
||||
//
|
||||
#define RESULTS_BUFFER_SIZE 256
|
||||
#define EX_ADC_RESOLUTION 12
|
||||
// 12 for 12-bit conversion resolution, which supports (ADC_MODE_SINGLE_ENDED)
|
||||
// Sample on single pin (VREFLO is the low reference)
|
||||
// Or 16 for 16-bit conversion resolution, which supports (ADC_MODE_DIFFERENTIAL)
|
||||
// Sample on pair of pins (difference between pins is converted, subject to
|
||||
// common mode voltage requirements; see the device data manual)
|
||||
|
||||
//
|
||||
// Globals
|
||||
//
|
||||
uint16_t adcAResults[RESULTS_BUFFER_SIZE]; // Buffer for results
|
||||
uint16_t index; // Index into result buffer
|
||||
volatile uint16_t bufferFull; // Flag to indicate buffer is full
|
||||
|
||||
//
|
||||
// Function Prototypes
|
||||
//
|
||||
void initADC(void);
|
||||
void initEPWM(void);
|
||||
void initADCSOC(void);
|
||||
__interrupt void adcA1ISR(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();
|
||||
|
||||
//
|
||||
// Interrupts that are used in this example are re-mapped to ISR functions
|
||||
// found within this file.
|
||||
//
|
||||
Interrupt_register(INT_ADCA1, &adcA1ISR);
|
||||
|
||||
//
|
||||
// Set up the ADC and the ePWM and initialize the SOC
|
||||
//
|
||||
initADC();
|
||||
initEPWM();
|
||||
initADCSOC();
|
||||
|
||||
//
|
||||
// Initialize results buffer
|
||||
//
|
||||
for(index = 0; index < RESULTS_BUFFER_SIZE; index++)
|
||||
{
|
||||
adcAResults[index] = 0;
|
||||
}
|
||||
|
||||
index = 0;
|
||||
bufferFull = 0;
|
||||
|
||||
//
|
||||
// Enable ADC interrupt
|
||||
//
|
||||
Interrupt_enable(INT_ADCA1);
|
||||
|
||||
//
|
||||
// Enable Global Interrupt (INTM) and realtime interrupt (DBGM)
|
||||
//
|
||||
EINT;
|
||||
ERTM;
|
||||
|
||||
//
|
||||
// Loop indefinitely
|
||||
//
|
||||
while(1)
|
||||
{
|
||||
//
|
||||
// Start ePWM1, enabling SOCA and putting the counter in up-count mode
|
||||
//
|
||||
EPWM_enableADCTrigger(EPWM1_BASE, EPWM_SOC_A);
|
||||
EPWM_setTimeBaseCounterMode(EPWM1_BASE, EPWM_COUNTER_MODE_UP);
|
||||
|
||||
//
|
||||
// Wait while ePWM1 causes ADC conversions which then cause interrupts.
|
||||
// When the results buffer is filled, the bufferFull flag will be set.
|
||||
//
|
||||
while(bufferFull == 0)
|
||||
{
|
||||
}
|
||||
bufferFull = 0; // Clear the buffer full flag
|
||||
|
||||
//
|
||||
// Stop ePWM1, disabling SOCA and freezing the counter
|
||||
//
|
||||
EPWM_disableADCTrigger(EPWM1_BASE, EPWM_SOC_A);
|
||||
EPWM_setTimeBaseCounterMode(EPWM1_BASE, EPWM_COUNTER_MODE_STOP_FREEZE);
|
||||
|
||||
//
|
||||
// Software breakpoint. At this point, conversion results are stored in
|
||||
// adcAResults.
|
||||
//
|
||||
// Hit run again to get updated conversions.
|
||||
//
|
||||
ESTOP0;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Function to configure and power up ADCA.
|
||||
//
|
||||
void initADC(void)
|
||||
{
|
||||
|
||||
//
|
||||
// Set ADCDLK divider to /4
|
||||
//
|
||||
ADC_setPrescaler(ADCA_BASE, ADC_CLK_DIV_4_0);
|
||||
|
||||
//
|
||||
// Set resolution and signal mode (see #defines above) and load
|
||||
// corresponding trims.
|
||||
//
|
||||
#if(EX_ADC_RESOLUTION == 12)
|
||||
ADC_setMode(ADCA_BASE, ADC_RESOLUTION_12BIT, ADC_MODE_SINGLE_ENDED);
|
||||
#elif(EX_ADC_RESOLUTION == 16)
|
||||
ADC_setMode(ADCA_BASE, ADC_RESOLUTION_16BIT, ADC_MODE_DIFFERENTIAL);
|
||||
#endif
|
||||
|
||||
//
|
||||
// Set pulse positions to late
|
||||
//
|
||||
ADC_setInterruptPulseMode(ADCA_BASE, ADC_PULSE_END_OF_CONV);
|
||||
|
||||
//
|
||||
// Power up the ADC and then delay for 1 ms
|
||||
//
|
||||
ADC_enableConverter(ADCA_BASE);
|
||||
DEVICE_DELAY_US(1000);
|
||||
}
|
||||
|
||||
//
|
||||
// Function to configure ePWM1 to generate the SOC.
|
||||
//
|
||||
void initEPWM(void)
|
||||
{
|
||||
//
|
||||
// Disable SOCA
|
||||
//
|
||||
EPWM_disableADCTrigger(EPWM1_BASE, EPWM_SOC_A);
|
||||
|
||||
//
|
||||
// Configure the SOC to occur on the first up-count event
|
||||
//
|
||||
EPWM_setADCTriggerSource(EPWM1_BASE, EPWM_SOC_A, EPWM_SOC_TBCTR_U_CMPA);
|
||||
EPWM_setADCTriggerEventPrescale(EPWM1_BASE, EPWM_SOC_A, 1);
|
||||
|
||||
//
|
||||
// Set the compare A value to 1000 and the period to 1999
|
||||
// Assuming ePWM clock is 100MHz, this would give 50kHz sampling
|
||||
// 50MHz ePWM clock would give 25kHz sampling, etc.
|
||||
// The sample rate can also be modulated by changing the ePWM period
|
||||
// directly (ensure that the compare A value is less than the period).
|
||||
//
|
||||
EPWM_setCounterCompareValue(EPWM1_BASE, EPWM_COUNTER_COMPARE_A, 1000);
|
||||
EPWM_setTimeBasePeriod(EPWM1_BASE, 1999);
|
||||
|
||||
//
|
||||
// Set the local ePWM module clock divider to /1
|
||||
//
|
||||
EPWM_setClockPrescaler(EPWM1_BASE,
|
||||
EPWM_CLOCK_DIVIDER_1,
|
||||
EPWM_HSCLOCK_DIVIDER_1);
|
||||
|
||||
//
|
||||
// Freeze the counter
|
||||
//
|
||||
EPWM_setTimeBaseCounterMode(EPWM1_BASE, EPWM_COUNTER_MODE_STOP_FREEZE);
|
||||
}
|
||||
|
||||
//
|
||||
// Function to configure ADCA's SOC0 to be triggered by ePWM1.
|
||||
//
|
||||
void initADCSOC(void)
|
||||
{
|
||||
//
|
||||
// Configure SOC0 of ADCA to convert pin A0. The EPWM1SOCA signal will be
|
||||
// the trigger.
|
||||
// - For 12-bit resolution, a sampling window of 15 (75 ns at a 200MHz
|
||||
// SYSCLK rate) will be used. For 16-bit resolution, a sampling window
|
||||
// of 64 (320 ns at a 200MHz SYSCLK rate) will be used.
|
||||
// - NOTE: A longer sampling window will be required if the ADC driving
|
||||
// source is less than ideal (an ideal source would be a high bandwidth
|
||||
// op-amp with a small series resistance). See TI application report
|
||||
// SPRACT6 for guidance on ADC driver design.
|
||||
//
|
||||
|
||||
#if(EX_ADC_RESOLUTION == 12)
|
||||
ADC_setupSOC(ADCA_BASE, ADC_SOC_NUMBER0, ADC_TRIGGER_EPWM1_SOCA,
|
||||
ADC_CH_ADCIN0, 15);
|
||||
#elif(EX_ADC_RESOLUTION == 16)
|
||||
ADC_setupSOC(ADCA_BASE, ADC_SOC_NUMBER0, ADC_TRIGGER_EPWM1_SOCA,
|
||||
ADC_CH_ADCIN0, 64);
|
||||
#endif
|
||||
|
||||
//
|
||||
// Set SOC0 to set the interrupt 1 flag. Enable the interrupt and make
|
||||
// sure its flag is cleared.
|
||||
//
|
||||
ADC_setInterruptSource(ADCA_BASE, ADC_INT_NUMBER1, ADC_SOC_NUMBER0);
|
||||
ADC_enableInterrupt(ADCA_BASE, ADC_INT_NUMBER1);
|
||||
ADC_clearInterruptStatus(ADCA_BASE, ADC_INT_NUMBER1);
|
||||
}
|
||||
|
||||
//
|
||||
// ADC A Interrupt 1 ISR
|
||||
//
|
||||
__interrupt void adcA1ISR(void)
|
||||
{
|
||||
//
|
||||
// Add the latest result to the buffer
|
||||
//
|
||||
adcAResults[index++] = ADC_readResult(ADCARESULT_BASE, ADC_SOC_NUMBER0);
|
||||
|
||||
//
|
||||
// Set the bufferFull flag if the buffer is full
|
||||
//
|
||||
if(RESULTS_BUFFER_SIZE <= index)
|
||||
{
|
||||
index = 0;
|
||||
bufferFull = 1;
|
||||
}
|
||||
|
||||
//
|
||||
// Clear the interrupt flag
|
||||
//
|
||||
ADC_clearInterruptStatus(ADCA_BASE, ADC_INT_NUMBER1);
|
||||
|
||||
//
|
||||
// Check if overflow has occurred
|
||||
//
|
||||
if(true == ADC_getInterruptOverflowStatus(ADCA_BASE, ADC_INT_NUMBER1))
|
||||
{
|
||||
ADC_clearInterruptOverflowStatus(ADCA_BASE, ADC_INT_NUMBER1);
|
||||
ADC_clearInterruptStatus(ADCA_BASE, ADC_INT_NUMBER1);
|
||||
}
|
||||
|
||||
//
|
||||
// Acknowledge the interrupt
|
||||
//
|
||||
Interrupt_clearACKGroup(INTERRUPT_ACK_GROUP1);
|
||||
}
|
||||
@@ -0,0 +1,269 @@
|
||||
//#############################################################################
|
||||
//
|
||||
// FILE: adc_ex3_temp_sensor.c
|
||||
//
|
||||
// TITLE: Sample temperature sensor and convert to temperature
|
||||
//
|
||||
//! \addtogroup driver_example_list
|
||||
//! <h1>ADC Temperature Sensor Conversion</h1>
|
||||
//!
|
||||
//! This example sets up the ePWM to periodically trigger the ADC. The
|
||||
//! ADC converts the internal connection to the temperature sensor,
|
||||
//! which is then interpreted as a temperature by calling the
|
||||
//! ADC_getTemperatureC() function.
|
||||
//!
|
||||
//! \b Watch \b Variables \n
|
||||
//! - \b sensorSample - The raw reading from the temperature sensor
|
||||
//! - \b sensorTemp - The interpretation of the sensor sample as a temperature
|
||||
//! in degrees Celsius.
|
||||
//
|
||||
//#############################################################################
|
||||
//
|
||||
//
|
||||
// $Copyright:
|
||||
// Copyright (C) 2013-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"
|
||||
|
||||
//
|
||||
// Globals
|
||||
//
|
||||
uint16_t sensorSample;
|
||||
int16_t sensorTemp;
|
||||
|
||||
//
|
||||
// Function Prototypes
|
||||
//
|
||||
void initADC(void);
|
||||
void initEPWM(void);
|
||||
void initADCSOC(void);
|
||||
__interrupt void adcA1ISR(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();
|
||||
|
||||
//
|
||||
// Interrupts that are used in this example are re-mapped to ISR functions
|
||||
// found within this file.
|
||||
//
|
||||
Interrupt_register(INT_ADCA1, &adcA1ISR);
|
||||
|
||||
//
|
||||
// Set up the ADC and the ePWM and initialize the SOC
|
||||
//
|
||||
initADC();
|
||||
initEPWM();
|
||||
initADCSOC();
|
||||
|
||||
//
|
||||
// Enable the temperature sensor and give it 500 us to power up
|
||||
//
|
||||
ASysCtl_enableTemperatureSensor();
|
||||
DEVICE_DELAY_US(500);
|
||||
|
||||
//
|
||||
// Enable ADC interrupt
|
||||
//
|
||||
Interrupt_enable(INT_ADCA1);
|
||||
|
||||
//
|
||||
// Enable Global Interrupt (INTM) and realtime interrupt (DBGM)
|
||||
//
|
||||
EINT;
|
||||
ERTM;
|
||||
|
||||
//
|
||||
// Start ePWM1, enabling SOCA and putting the counter in up-count mode
|
||||
//
|
||||
EPWM_enableADCTrigger(EPWM1_BASE, EPWM_SOC_A);
|
||||
EPWM_setTimeBaseCounterMode(EPWM1_BASE, EPWM_COUNTER_MODE_UP);
|
||||
|
||||
//
|
||||
// Loop indefinitely
|
||||
//
|
||||
while(1)
|
||||
{
|
||||
;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// initADC - Function to configure and power up ADCA.
|
||||
//
|
||||
void initADC(void)
|
||||
{
|
||||
|
||||
//
|
||||
// Set ADCDLK divider to /4
|
||||
//
|
||||
ADC_setPrescaler(ADCA_BASE, ADC_CLK_DIV_4_0);
|
||||
|
||||
//
|
||||
// Set resolution and signal mode (see #defines above) and load
|
||||
// corresponding trims.
|
||||
//
|
||||
ADC_setMode(ADCA_BASE, ADC_RESOLUTION_12BIT, ADC_MODE_SINGLE_ENDED);
|
||||
|
||||
//
|
||||
// Set pulse positions to late
|
||||
//
|
||||
ADC_setInterruptPulseMode(ADCA_BASE, ADC_PULSE_END_OF_CONV);
|
||||
|
||||
//
|
||||
// Power up the ADC and then delay for 1 ms
|
||||
//
|
||||
ADC_enableConverter(ADCA_BASE);
|
||||
DEVICE_DELAY_US(1000);
|
||||
}
|
||||
|
||||
//
|
||||
// initEPWM - Function to configure ePWM1 to generate the SOC.
|
||||
//
|
||||
void initEPWM(void)
|
||||
{
|
||||
//
|
||||
// Disable SOCA
|
||||
//
|
||||
EPWM_disableADCTrigger(EPWM1_BASE, EPWM_SOC_A);
|
||||
|
||||
//
|
||||
// Configure the SOC to occur on the first up-count event
|
||||
//
|
||||
EPWM_setADCTriggerSource(EPWM1_BASE, EPWM_SOC_A, EPWM_SOC_TBCTR_U_CMPA);
|
||||
EPWM_setADCTriggerEventPrescale(EPWM1_BASE, EPWM_SOC_A, 1);
|
||||
|
||||
//
|
||||
// Set the compare A value to 1000 and the period to 1999
|
||||
// Assuming ePWM clock is 100MHz, this would give 50kHz sampling
|
||||
// 50MHz ePWM clock would give 25kHz sampling, etc.
|
||||
// The sample rate can also be modulated by changing the ePWM period
|
||||
// directly (ensure that the compare A value is less than the period).
|
||||
//
|
||||
EPWM_setCounterCompareValue(EPWM1_BASE, EPWM_COUNTER_COMPARE_A, 1000);
|
||||
EPWM_setTimeBasePeriod(EPWM1_BASE, 1999);
|
||||
|
||||
//
|
||||
// Set the local ePWM module clock divider to /1
|
||||
//
|
||||
EPWM_setClockPrescaler(EPWM1_BASE,
|
||||
EPWM_CLOCK_DIVIDER_1,
|
||||
EPWM_HSCLOCK_DIVIDER_1);
|
||||
|
||||
//
|
||||
// Freeze the counter
|
||||
//
|
||||
EPWM_setTimeBaseCounterMode(EPWM1_BASE, EPWM_COUNTER_MODE_STOP_FREEZE);
|
||||
}
|
||||
|
||||
//
|
||||
// initADCSOC - Function to configure ADCA's SOC0 to be triggered by ePWM1.
|
||||
//
|
||||
void initADCSOC(void)
|
||||
{
|
||||
//
|
||||
// Configure SOC0. The temperature sensor is internally connected to A13
|
||||
// and requires an acquisition time of at least 700 ns.
|
||||
//
|
||||
ADC_setupSOC(ADCA_BASE, ADC_SOC_NUMBER0, ADC_TRIGGER_EPWM1_SOCA,
|
||||
ADC_CH_ADCIN13, 140);
|
||||
|
||||
//
|
||||
// Set SOC0 to set the interrupt 1 flag. Enable the interrupt and make
|
||||
// sure its flag is cleared.
|
||||
//
|
||||
ADC_setInterruptSource(ADCA_BASE, ADC_INT_NUMBER1, ADC_SOC_NUMBER0);
|
||||
ADC_enableInterrupt(ADCA_BASE, ADC_INT_NUMBER1);
|
||||
ADC_clearInterruptStatus(ADCA_BASE, ADC_INT_NUMBER1);
|
||||
}
|
||||
|
||||
//
|
||||
// adcA1ISR - ADC A Interrupt 1 ISR
|
||||
//
|
||||
__interrupt void adcA1ISR(void)
|
||||
{
|
||||
//
|
||||
// Read the raw result
|
||||
//
|
||||
sensorSample = ADC_readResult(ADCARESULT_BASE, ADC_SOC_NUMBER0);
|
||||
|
||||
//
|
||||
// Convert the result to a temperature in degrees C
|
||||
//
|
||||
sensorTemp = ADC_getTemperatureC(sensorSample, 3.0f);
|
||||
|
||||
//
|
||||
// Clear the interrupt flag
|
||||
//
|
||||
ADC_clearInterruptStatus(ADCA_BASE, ADC_INT_NUMBER1);
|
||||
|
||||
//
|
||||
// Check if overflow has occurred
|
||||
//
|
||||
if(true == ADC_getInterruptOverflowStatus(ADCA_BASE, ADC_INT_NUMBER1))
|
||||
{
|
||||
ADC_clearInterruptOverflowStatus(ADCA_BASE, ADC_INT_NUMBER1);
|
||||
ADC_clearInterruptStatus(ADCA_BASE, ADC_INT_NUMBER1);
|
||||
}
|
||||
|
||||
//
|
||||
// Acknowledge the interrupt
|
||||
//
|
||||
Interrupt_clearACKGroup(INTERRUPT_ACK_GROUP1);
|
||||
}
|
||||
@@ -0,0 +1,288 @@
|
||||
//###########################################################################
|
||||
//
|
||||
// FILE: adc_ex4_soc_software_sync.c
|
||||
//
|
||||
// TITLE: ADC synchronous software triggering
|
||||
//
|
||||
//! \addtogroup driver_example_list
|
||||
//! <h1> ADC Synchronous SOC Software Force (adc_soc_software_sync)</h1>
|
||||
//!
|
||||
//! This example converts some voltages on ADCA and ADCD using input 5 of the
|
||||
//! input X-BAR as a software force. Input 5 is triggered by toggling GPIO0,
|
||||
//! but any spare GPIO could be used. This method will ensure that both ADCs
|
||||
//! start converting at exactly the same time.
|
||||
//!
|
||||
//! \b External \b Connections \n
|
||||
//! - A2, A3, D2, D3 pins should be connected to signals to convert
|
||||
//!
|
||||
//! \b Watch \b Variables \n
|
||||
//! - \b adcAResult0 \b: a digital representation of the voltage on pin A2\n
|
||||
//! - \b adcAResult1 \b: a digital representation of the voltage on pin A3\n
|
||||
//! - \b adcDResult0 \b: a digital representation of the voltage on pin D2\n
|
||||
//! - \b adcDResult1 \b: a digital representation of the voltage on pin D3\n
|
||||
//!
|
||||
//
|
||||
//#############################################################################
|
||||
//
|
||||
//
|
||||
// $Copyright:
|
||||
// Copyright (C) 2013-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"
|
||||
|
||||
//
|
||||
// Function Prototypes
|
||||
//
|
||||
void configureADC(uint32_t adcBase);
|
||||
void setupADCSoftwareSync(uint32_t adcBase);
|
||||
void setupInputXBAR5(void);
|
||||
|
||||
//
|
||||
// Defines
|
||||
//
|
||||
#define EX_ADC_RESOLUTION 12
|
||||
// 12 for 12-bit conversion resolution, which supports (ADC_MODE_SINGLE_ENDED)
|
||||
// Sample on single pin (VREFLO is the low reference)
|
||||
// Or 16 for 16-bit conversion resolution, which supports (ADC_MODE_DIFFERENTIAL)
|
||||
// Sample on pair of pins (difference between pins is converted, subject to
|
||||
// common mode voltage requirements; see the device data manual)
|
||||
|
||||
//
|
||||
// Globals
|
||||
//
|
||||
uint16_t adcAResult0;
|
||||
uint16_t adcAResult1;
|
||||
uint16_t adcDResult0;
|
||||
uint16_t adcDResult1;
|
||||
|
||||
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();
|
||||
|
||||
|
||||
//
|
||||
// Configure the ADCs and power them up
|
||||
//
|
||||
configureADC(ADCA_BASE);
|
||||
configureADC(ADCD_BASE);
|
||||
|
||||
//
|
||||
// Setup the ADCs for software conversions
|
||||
//
|
||||
setupADCSoftwareSync(ADCA_BASE);
|
||||
setupADCSoftwareSync(ADCD_BASE);
|
||||
setupInputXBAR5();
|
||||
|
||||
//
|
||||
// Enable global Interrupts and higher priority real-time debug events:
|
||||
//
|
||||
EINT; // Enable Global interrupt INTM
|
||||
ERTM; // Enable Global realtime interrupt DBGM
|
||||
|
||||
//
|
||||
// Take conversions indefinitely in loop
|
||||
//
|
||||
do
|
||||
{
|
||||
//
|
||||
// Convert, wait for completion, and store results
|
||||
//
|
||||
|
||||
//
|
||||
// Toggle GPIO0 in software. This will cause a trigger to
|
||||
// both ADCs via input XBAR, line 5.
|
||||
//
|
||||
GPIO_writePin(0U, 1U); // Set pin
|
||||
GPIO_writePin(0U, 0U); // Clear pin
|
||||
|
||||
//
|
||||
// Wait for ADCA to complete, then acknowledge the flag.
|
||||
// Since both ADCs are running synchronously, it isn't necessary
|
||||
// to wait for completion notification from both ADCs
|
||||
//
|
||||
while(ADC_getInterruptStatus(ADCA_BASE, ADC_INT_NUMBER1) == 0U);
|
||||
ADC_clearInterruptStatus(ADCA_BASE, ADC_INT_NUMBER1);
|
||||
|
||||
//
|
||||
// Store results
|
||||
//
|
||||
adcAResult0 = ADC_readResult(ADCARESULT_BASE, ADC_SOC_NUMBER0);
|
||||
adcAResult1 = ADC_readResult(ADCARESULT_BASE, ADC_SOC_NUMBER1);
|
||||
adcDResult0 = ADC_readResult(ADCDRESULT_BASE, ADC_SOC_NUMBER0);
|
||||
adcDResult1 = ADC_readResult(ADCDRESULT_BASE, ADC_SOC_NUMBER1);
|
||||
|
||||
//
|
||||
// At this point, conversion results are stored in
|
||||
// adcAResult0, adcAResult1, adcDResult0, and adcDResult1
|
||||
//
|
||||
|
||||
//
|
||||
// Software breakpoint, hit run again to get updated conversions
|
||||
//
|
||||
asm(" ESTOP0");
|
||||
|
||||
}
|
||||
while(1);
|
||||
}
|
||||
|
||||
//
|
||||
// configureADC - Write ADC configurations and power up the ADC for both
|
||||
// ADC A and ADC C
|
||||
//
|
||||
void configureADC(uint32_t adcBase)
|
||||
{
|
||||
//
|
||||
// Set ADCDLK divider to /4
|
||||
//
|
||||
ADC_setPrescaler(adcBase, ADC_CLK_DIV_4_0);
|
||||
|
||||
//
|
||||
// Set resolution and signal mode (see #defines above) and load
|
||||
// corresponding trims.
|
||||
//
|
||||
#if(EX_ADC_RESOLUTION == 12)
|
||||
ADC_setMode(adcBase, ADC_RESOLUTION_12BIT, ADC_MODE_SINGLE_ENDED);
|
||||
#elif(EX_ADC_RESOLUTION == 16)
|
||||
ADC_setMode(adcBase, ADC_RESOLUTION_16BIT, ADC_MODE_DIFFERENTIAL);
|
||||
#endif
|
||||
|
||||
//
|
||||
// Set pulse positions to late
|
||||
//
|
||||
ADC_setInterruptPulseMode(adcBase, ADC_PULSE_END_OF_CONV);
|
||||
|
||||
//
|
||||
// Power up the ADCs and then delay for 1 ms
|
||||
//
|
||||
ADC_enableConverter(adcBase);
|
||||
|
||||
//
|
||||
// Delay for 1ms to allow ADC time to power up
|
||||
//
|
||||
DEVICE_DELAY_US(1000);
|
||||
}
|
||||
|
||||
//
|
||||
// setupInputXBAR5 - Setup GPIO 0 to trigger input XBAR line 5. GPIO0 is used
|
||||
// as an example, but any spare GPIO could be used. The
|
||||
// physical GPIO pin should be allowed to float, since the
|
||||
// code configures it as an output and changes the value.
|
||||
//
|
||||
void setupInputXBAR5(void)
|
||||
{
|
||||
//
|
||||
// GPIO0 will trigger the input XBAR line 5
|
||||
//
|
||||
XBAR_setInputPin(XBAR_INPUT5, 0);
|
||||
|
||||
//
|
||||
// GPIO0 as an output
|
||||
//
|
||||
GPIO_setPadConfig(0, GPIO_PIN_TYPE_STD);
|
||||
GPIO_setDirectionMode(0U, GPIO_DIR_MODE_OUT);
|
||||
GPIO_setPinConfig(GPIO_0_GPIO0);
|
||||
|
||||
//
|
||||
// GPIO0 set as low
|
||||
//
|
||||
GPIO_writePin(0U, 0U);
|
||||
}
|
||||
|
||||
//
|
||||
// setupADCSoftwareSync - Setup ADC acquisition window and compare values
|
||||
//
|
||||
void setupADCSoftwareSync(uint32_t adcBase)
|
||||
{
|
||||
uint16_t acqps;
|
||||
|
||||
//
|
||||
// Determine minimum acquisition window (in SYSCLKS) based on resolution
|
||||
//
|
||||
if(EX_ADC_RESOLUTION == 12)
|
||||
{
|
||||
acqps = 14; // 75ns
|
||||
}
|
||||
else //resolution is 16-bit
|
||||
{
|
||||
acqps = 63; // 320ns
|
||||
}
|
||||
//
|
||||
// - NOTE: A longer sampling window will be required if the ADC driving
|
||||
// source is less than ideal (an ideal source would be a high bandwidth
|
||||
// op-amp with a small series resistance). See TI application report
|
||||
// SPRACT6 for guidance on ADC driver design.
|
||||
//
|
||||
|
||||
//
|
||||
// Select the channels to convert and end of conversion flag
|
||||
//
|
||||
ADC_setupSOC(adcBase, ADC_SOC_NUMBER0, ADC_TRIGGER_GPIO,
|
||||
ADC_CH_ADCIN2, acqps);
|
||||
ADC_setupSOC(adcBase, ADC_SOC_NUMBER1, ADC_TRIGGER_GPIO,
|
||||
ADC_CH_ADCIN3, acqps);
|
||||
|
||||
if(adcBase == ADCA_BASE)
|
||||
{
|
||||
ADC_setInterruptSource(adcBase, ADC_INT_NUMBER1, ADC_SOC_NUMBER1);
|
||||
ADC_enableInterrupt(adcBase, ADC_INT_NUMBER1);
|
||||
ADC_clearInterruptStatus(adcBase, ADC_INT_NUMBER1);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// End of file
|
||||
//
|
||||
@@ -0,0 +1,432 @@
|
||||
//###########################################################################
|
||||
//
|
||||
// FILE: adc_ex5_soc_continuous.c
|
||||
//
|
||||
// TITLE: ADC continuous self-triggering.
|
||||
//
|
||||
//! \addtogroup driver_example_list
|
||||
//! <h1> ADC Continuous Triggering (adc_soc_continuous)</h1>
|
||||
//!
|
||||
//! This example sets up the ADC to convert continuously, achieving maximum
|
||||
//! sampling rate.\n
|
||||
//!
|
||||
//! \b External \b Connections \n
|
||||
//! - A0 pin should be connected to signal to convert
|
||||
//!
|
||||
//! \b Watch \b Variables \n
|
||||
//! - \b adcAResults - A sequence of analog-to-digital conversion samples
|
||||
//! from pin A0. The time between samples is the minimum possible based on the
|
||||
//! ADC speed.
|
||||
//
|
||||
//#############################################################################
|
||||
//
|
||||
//
|
||||
// $Copyright:
|
||||
// Copyright (C) 2013-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"
|
||||
|
||||
//
|
||||
// Function Prototypes
|
||||
//
|
||||
void configureADC(uint32_t adcBase);
|
||||
void setupADCContinuous(uint32_t adcBase, uint32_t channel);
|
||||
|
||||
//
|
||||
// Defines
|
||||
//
|
||||
#define RESULTS_BUFFER_SIZE 256 //buffer for storing conversion results
|
||||
//(size must be multiple of 16)
|
||||
#define EX_ADC_RESOLUTION 12
|
||||
// 12 for 12-bit conversion resolution, which supports (ADC_MODE_SINGLE_ENDED)
|
||||
// Sample on single pin (VREFLO is the low reference)
|
||||
// Or 16 for 16-bit conversion resolution, which supports (ADC_MODE_DIFFERENTIAL)
|
||||
// Sample on pair of pins (difference between pins is converted, subject to
|
||||
// common mode voltage requirements; see the device data manual)
|
||||
|
||||
//
|
||||
// Globals
|
||||
//
|
||||
uint16_t adcAResults[RESULTS_BUFFER_SIZE];
|
||||
uint16_t resultsIndex;
|
||||
|
||||
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();
|
||||
|
||||
|
||||
//
|
||||
// Configure the ADC and power it up
|
||||
//
|
||||
configureADC(ADCA_BASE);
|
||||
|
||||
//
|
||||
// Setup the ADC for continuous conversions on channel 0
|
||||
//
|
||||
setupADCContinuous(ADCA_BASE, 0U);
|
||||
|
||||
//
|
||||
// Initialize results buffer
|
||||
//
|
||||
for(resultsIndex = 0; resultsIndex < RESULTS_BUFFER_SIZE; resultsIndex++)
|
||||
{
|
||||
adcAResults[resultsIndex] = 0;
|
||||
}
|
||||
resultsIndex = 0;
|
||||
|
||||
//
|
||||
// Enable global Interrupts and higher priority real-time debug events:
|
||||
//
|
||||
EINT; // Enable Global interrupt INTM
|
||||
ERTM; // Enable Global realtime interrupt DBGM
|
||||
|
||||
//
|
||||
// Take conversions indefinitely in loop
|
||||
//
|
||||
do
|
||||
{
|
||||
//
|
||||
// Enable ADC interrupts
|
||||
//
|
||||
ADC_enableInterrupt(ADCA_BASE, ADC_INT_NUMBER1);
|
||||
ADC_enableInterrupt(ADCA_BASE, ADC_INT_NUMBER2);
|
||||
ADC_enableInterrupt(ADCA_BASE, ADC_INT_NUMBER3);
|
||||
ADC_enableInterrupt(ADCA_BASE, ADC_INT_NUMBER4);
|
||||
|
||||
//
|
||||
// Clear all interrupts flags(INT1-4)
|
||||
//
|
||||
HWREGH(ADCA_BASE + ADC_O_INTFLGCLR) = 0x000F;
|
||||
|
||||
//
|
||||
// Initialize results index
|
||||
//
|
||||
resultsIndex = 0;
|
||||
|
||||
//
|
||||
// Software force start SOC0 to SOC7
|
||||
//
|
||||
HWREGH(ADCA_BASE + ADC_O_SOCFRC1) = 0x00FF;
|
||||
|
||||
//
|
||||
// Keep taking samples until the results buffer is full
|
||||
//
|
||||
while(resultsIndex < RESULTS_BUFFER_SIZE)
|
||||
{
|
||||
//
|
||||
// Wait for first set of 8 conversions to complete
|
||||
//
|
||||
while(false == ADC_getInterruptStatus(ADCA_BASE, ADC_INT_NUMBER3));
|
||||
|
||||
//
|
||||
// Clear the interrupt flag
|
||||
//
|
||||
ADC_clearInterruptStatus(ADCA_BASE, ADC_INT_NUMBER3);
|
||||
|
||||
//
|
||||
// Save results for first 8 conversions
|
||||
//
|
||||
// Note that during this time, the second 8 conversions have
|
||||
// already been triggered by EOC6->ADCIN1 and will be actively
|
||||
// converting while first 8 results are being saved
|
||||
//
|
||||
adcAResults[resultsIndex++] = ADC_readResult(ADCARESULT_BASE,
|
||||
ADC_SOC_NUMBER0);
|
||||
adcAResults[resultsIndex++] = ADC_readResult(ADCARESULT_BASE,
|
||||
ADC_SOC_NUMBER1);
|
||||
adcAResults[resultsIndex++] = ADC_readResult(ADCARESULT_BASE,
|
||||
ADC_SOC_NUMBER2);
|
||||
adcAResults[resultsIndex++] = ADC_readResult(ADCARESULT_BASE,
|
||||
ADC_SOC_NUMBER3);
|
||||
adcAResults[resultsIndex++] = ADC_readResult(ADCARESULT_BASE,
|
||||
ADC_SOC_NUMBER4);
|
||||
adcAResults[resultsIndex++] = ADC_readResult(ADCARESULT_BASE,
|
||||
ADC_SOC_NUMBER5);
|
||||
adcAResults[resultsIndex++] = ADC_readResult(ADCARESULT_BASE,
|
||||
ADC_SOC_NUMBER6);
|
||||
adcAResults[resultsIndex++] = ADC_readResult(ADCARESULT_BASE,
|
||||
ADC_SOC_NUMBER7);
|
||||
|
||||
//
|
||||
// Wait for the second set of 8 conversions to complete
|
||||
//
|
||||
while(false == ADC_getInterruptStatus(ADCA_BASE, ADC_INT_NUMBER4));
|
||||
|
||||
//
|
||||
// Clear the interrupt flag
|
||||
//
|
||||
ADC_clearInterruptStatus(ADCA_BASE, ADC_INT_NUMBER4);
|
||||
|
||||
//
|
||||
// Save results for second 8 conversions
|
||||
//
|
||||
// Note that during this time, the first 8 conversions have
|
||||
// already been triggered by EOC14->ADCIN2 and will be actively
|
||||
// converting while second 8 results are being saved
|
||||
//
|
||||
adcAResults[resultsIndex++] = ADC_readResult(ADCARESULT_BASE,
|
||||
ADC_SOC_NUMBER8);
|
||||
adcAResults[resultsIndex++] = ADC_readResult(ADCARESULT_BASE,
|
||||
ADC_SOC_NUMBER9);
|
||||
adcAResults[resultsIndex++] = ADC_readResult(ADCARESULT_BASE,
|
||||
ADC_SOC_NUMBER10);
|
||||
adcAResults[resultsIndex++] = ADC_readResult(ADCARESULT_BASE,
|
||||
ADC_SOC_NUMBER11);
|
||||
adcAResults[resultsIndex++] = ADC_readResult(ADCARESULT_BASE,
|
||||
ADC_SOC_NUMBER12);
|
||||
adcAResults[resultsIndex++] = ADC_readResult(ADCARESULT_BASE,
|
||||
ADC_SOC_NUMBER13);
|
||||
adcAResults[resultsIndex++] = ADC_readResult(ADCARESULT_BASE,
|
||||
ADC_SOC_NUMBER14);
|
||||
adcAResults[resultsIndex++] = ADC_readResult(ADCARESULT_BASE,
|
||||
ADC_SOC_NUMBER15);
|
||||
}
|
||||
|
||||
//
|
||||
// Disable all ADCINT flags to stop sampling
|
||||
//
|
||||
ADC_disableInterrupt(ADCA_BASE, ADC_INT_NUMBER1);
|
||||
ADC_disableInterrupt(ADCA_BASE, ADC_INT_NUMBER2);
|
||||
ADC_disableInterrupt(ADCA_BASE, ADC_INT_NUMBER3);
|
||||
ADC_disableInterrupt(ADCA_BASE, ADC_INT_NUMBER4);
|
||||
|
||||
//
|
||||
// At this point, adcAResults[] contains a sequence of conversions
|
||||
// from the selected channel
|
||||
//
|
||||
|
||||
//
|
||||
// Software breakpoint, hit run again to get updated conversions
|
||||
//
|
||||
asm(" ESTOP0");
|
||||
}
|
||||
while(1); // Loop forever
|
||||
}
|
||||
|
||||
//
|
||||
// configureADC - Write ADC configurations and power up the ADC for both
|
||||
// ADC A and ADC B
|
||||
//
|
||||
void configureADC(uint32_t adcBase)
|
||||
{
|
||||
//
|
||||
// Set ADCDLK divider to /4
|
||||
//
|
||||
ADC_setPrescaler(adcBase, ADC_CLK_DIV_4_0);
|
||||
|
||||
//
|
||||
// Set resolution and signal mode (see #defines above) and load
|
||||
// corresponding trims.
|
||||
//
|
||||
#if(EX_ADC_RESOLUTION == 12)
|
||||
ADC_setMode(adcBase, ADC_RESOLUTION_12BIT, ADC_MODE_SINGLE_ENDED);
|
||||
#elif(EX_ADC_RESOLUTION == 16)
|
||||
ADC_setMode(adcBase, ADC_RESOLUTION_16BIT, ADC_MODE_DIFFERENTIAL);
|
||||
#endif
|
||||
|
||||
//
|
||||
// Set pulse positions to late
|
||||
//
|
||||
ADC_setInterruptPulseMode(adcBase, ADC_PULSE_END_OF_CONV);
|
||||
|
||||
//
|
||||
// Power up the ADCs and then delay for 1 ms
|
||||
//
|
||||
ADC_enableConverter(adcBase);
|
||||
|
||||
//
|
||||
// Delay for 1ms to allow ADC time to power up
|
||||
//
|
||||
DEVICE_DELAY_US(1000);
|
||||
}
|
||||
|
||||
//
|
||||
// setupADCContinuous - setup the ADC to continuously convert on one channel
|
||||
//
|
||||
void setupADCContinuous(uint32_t adcBase, uint32_t channel)
|
||||
{
|
||||
uint16_t acqps;
|
||||
|
||||
//
|
||||
// Determine acquisition window (in SYSCLKS) based on resolution
|
||||
//
|
||||
if(EX_ADC_RESOLUTION == 12)
|
||||
{
|
||||
acqps = 30; // 150ns
|
||||
}
|
||||
else //resolution is 16-bit
|
||||
{
|
||||
acqps = 64; // 320ns
|
||||
}
|
||||
//
|
||||
// - NOTE: A longer sampling window will be required if the ADC driving
|
||||
// source is less than ideal (an ideal source would be a high bandwidth
|
||||
// op-amp with a small series resistance). See TI application report
|
||||
// SPRACT6 for guidance on ADC driver design.
|
||||
// - NOTE: A slightly longer S+H window is used with 12-bit resolution to
|
||||
// ensure the data collection loop can keep up with the ADC
|
||||
//
|
||||
|
||||
//
|
||||
// Configure SOCs channel no. & acquisition window.
|
||||
//
|
||||
ADC_setupSOC(adcBase, ADC_SOC_NUMBER0, ADC_TRIGGER_SW_ONLY,
|
||||
(ADC_Channel)channel, acqps);
|
||||
ADC_setupSOC(adcBase, ADC_SOC_NUMBER1, ADC_TRIGGER_SW_ONLY,
|
||||
(ADC_Channel)channel, acqps);
|
||||
ADC_setupSOC(adcBase, ADC_SOC_NUMBER2, ADC_TRIGGER_SW_ONLY,
|
||||
(ADC_Channel)channel, acqps);
|
||||
ADC_setupSOC(adcBase, ADC_SOC_NUMBER3, ADC_TRIGGER_SW_ONLY,
|
||||
(ADC_Channel)channel, acqps);
|
||||
ADC_setupSOC(adcBase, ADC_SOC_NUMBER4, ADC_TRIGGER_SW_ONLY,
|
||||
(ADC_Channel)channel, acqps);
|
||||
ADC_setupSOC(adcBase, ADC_SOC_NUMBER5, ADC_TRIGGER_SW_ONLY,
|
||||
(ADC_Channel)channel, acqps);
|
||||
ADC_setupSOC(adcBase, ADC_SOC_NUMBER6, ADC_TRIGGER_SW_ONLY,
|
||||
(ADC_Channel)channel, acqps);
|
||||
ADC_setupSOC(adcBase, ADC_SOC_NUMBER7, ADC_TRIGGER_SW_ONLY,
|
||||
(ADC_Channel)channel, acqps);
|
||||
ADC_setupSOC(adcBase, ADC_SOC_NUMBER8, ADC_TRIGGER_SW_ONLY,
|
||||
(ADC_Channel)channel, acqps);
|
||||
ADC_setupSOC(adcBase, ADC_SOC_NUMBER9, ADC_TRIGGER_SW_ONLY,
|
||||
(ADC_Channel)channel, acqps);
|
||||
ADC_setupSOC(adcBase, ADC_SOC_NUMBER10, ADC_TRIGGER_SW_ONLY,
|
||||
(ADC_Channel)channel, acqps);
|
||||
ADC_setupSOC(adcBase, ADC_SOC_NUMBER11, ADC_TRIGGER_SW_ONLY,
|
||||
(ADC_Channel)channel, acqps);
|
||||
ADC_setupSOC(adcBase, ADC_SOC_NUMBER12, ADC_TRIGGER_SW_ONLY,
|
||||
(ADC_Channel)channel, acqps);
|
||||
ADC_setupSOC(adcBase, ADC_SOC_NUMBER13, ADC_TRIGGER_SW_ONLY,
|
||||
(ADC_Channel)channel, acqps);
|
||||
ADC_setupSOC(adcBase, ADC_SOC_NUMBER14, ADC_TRIGGER_SW_ONLY,
|
||||
(ADC_Channel)channel, acqps);
|
||||
ADC_setupSOC(adcBase, ADC_SOC_NUMBER15, ADC_TRIGGER_SW_ONLY,
|
||||
(ADC_Channel)channel, acqps);
|
||||
|
||||
//
|
||||
// Setup interrupt trigger for SOCs. ADCINT2 will trigger first 8 SOCs.
|
||||
// ADCINT1 will trigger next 8 SOCs
|
||||
//
|
||||
|
||||
//
|
||||
// ADCINT2 trigger for SOC0-SOC7
|
||||
//
|
||||
ADC_setInterruptSOCTrigger(adcBase, ADC_SOC_NUMBER0,
|
||||
ADC_INT_SOC_TRIGGER_ADCINT2);
|
||||
ADC_setInterruptSOCTrigger(adcBase, ADC_SOC_NUMBER1,
|
||||
ADC_INT_SOC_TRIGGER_ADCINT2);
|
||||
ADC_setInterruptSOCTrigger(adcBase, ADC_SOC_NUMBER2,
|
||||
ADC_INT_SOC_TRIGGER_ADCINT2);
|
||||
ADC_setInterruptSOCTrigger(adcBase, ADC_SOC_NUMBER3,
|
||||
ADC_INT_SOC_TRIGGER_ADCINT2);
|
||||
ADC_setInterruptSOCTrigger(adcBase, ADC_SOC_NUMBER4,
|
||||
ADC_INT_SOC_TRIGGER_ADCINT2);
|
||||
ADC_setInterruptSOCTrigger(adcBase, ADC_SOC_NUMBER5,
|
||||
ADC_INT_SOC_TRIGGER_ADCINT2);
|
||||
ADC_setInterruptSOCTrigger(adcBase, ADC_SOC_NUMBER6,
|
||||
ADC_INT_SOC_TRIGGER_ADCINT2);
|
||||
ADC_setInterruptSOCTrigger(adcBase, ADC_SOC_NUMBER7,
|
||||
ADC_INT_SOC_TRIGGER_ADCINT2);
|
||||
|
||||
//
|
||||
// ADCINT1 trigger for SOC8-SOC15
|
||||
//
|
||||
ADC_setInterruptSOCTrigger(adcBase, ADC_SOC_NUMBER8,
|
||||
ADC_INT_SOC_TRIGGER_ADCINT1);
|
||||
ADC_setInterruptSOCTrigger(adcBase, ADC_SOC_NUMBER9,
|
||||
ADC_INT_SOC_TRIGGER_ADCINT1);
|
||||
ADC_setInterruptSOCTrigger(adcBase, ADC_SOC_NUMBER10,
|
||||
ADC_INT_SOC_TRIGGER_ADCINT1);
|
||||
ADC_setInterruptSOCTrigger(adcBase, ADC_SOC_NUMBER11,
|
||||
ADC_INT_SOC_TRIGGER_ADCINT1);
|
||||
ADC_setInterruptSOCTrigger(adcBase, ADC_SOC_NUMBER12,
|
||||
ADC_INT_SOC_TRIGGER_ADCINT1);
|
||||
ADC_setInterruptSOCTrigger(adcBase, ADC_SOC_NUMBER13,
|
||||
ADC_INT_SOC_TRIGGER_ADCINT1);
|
||||
ADC_setInterruptSOCTrigger(adcBase, ADC_SOC_NUMBER14,
|
||||
ADC_INT_SOC_TRIGGER_ADCINT1);
|
||||
ADC_setInterruptSOCTrigger(adcBase, ADC_SOC_NUMBER15,
|
||||
ADC_INT_SOC_TRIGGER_ADCINT1);
|
||||
|
||||
//
|
||||
// Disable Interrupt flags
|
||||
//
|
||||
ADC_disableInterrupt(adcBase, ADC_INT_NUMBER1);
|
||||
ADC_disableInterrupt(adcBase, ADC_INT_NUMBER2);
|
||||
ADC_disableInterrupt(adcBase, ADC_INT_NUMBER3);
|
||||
ADC_disableInterrupt(adcBase, ADC_INT_NUMBER4);
|
||||
|
||||
//
|
||||
// Enable continuous mode
|
||||
//
|
||||
ADC_enableContinuousMode(adcBase, ADC_INT_NUMBER1);
|
||||
ADC_enableContinuousMode(adcBase, ADC_INT_NUMBER2);
|
||||
ADC_enableContinuousMode(adcBase, ADC_INT_NUMBER3);
|
||||
ADC_enableContinuousMode(adcBase, ADC_INT_NUMBER4);
|
||||
|
||||
//
|
||||
// Configure interrupt triggers
|
||||
//
|
||||
ADC_setInterruptSource(adcBase, ADC_INT_NUMBER1, ADC_SOC_NUMBER6);
|
||||
ADC_setInterruptSource(adcBase, ADC_INT_NUMBER2, ADC_SOC_NUMBER14);
|
||||
ADC_setInterruptSource(adcBase, ADC_INT_NUMBER3, ADC_SOC_NUMBER7);
|
||||
ADC_setInterruptSource(adcBase, ADC_INT_NUMBER4, ADC_SOC_NUMBER15);
|
||||
}
|
||||
|
||||
//
|
||||
// End of file
|
||||
//
|
||||
@@ -0,0 +1,533 @@
|
||||
//###########################################################################
|
||||
//
|
||||
// FILE: adc_ex6_soc_continuous_dma.c
|
||||
//
|
||||
// TITLE: ADC continuous conversions read by DMA.
|
||||
//
|
||||
//! \addtogroup driver_example_list
|
||||
//! <h1> ADC Continuous Conversions Read by DMA (adc_soc_continuous_dma)</h1>
|
||||
//!
|
||||
//! This example sets up two ADC channels to convert simultaneously. The
|
||||
//! results will be transferred by the DMA into a buffer in RAM.
|
||||
//!
|
||||
//! \b External \b Connections \n
|
||||
//! - A3 & D3 pins should be connected to signals to convert
|
||||
//!
|
||||
//! \b Watch \b Variables \n
|
||||
//! - \b adcADataBuffer \b: a digital representation of the voltage on pin A3\n
|
||||
//! - \b adcDDataBuffer \b: a digital representation of the voltage on pin D3\n
|
||||
//!
|
||||
//
|
||||
//#############################################################################
|
||||
//
|
||||
//
|
||||
// $Copyright:
|
||||
// Copyright (C) 2013-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"
|
||||
|
||||
//
|
||||
// Function Prototypes
|
||||
//
|
||||
__interrupt void adcA1ISR(void);
|
||||
__interrupt void dmach1ISR(void);
|
||||
|
||||
void configureEPWM(uint32_t epwmBase);
|
||||
void configureADC(uint32_t adcBase);
|
||||
void setupADCContinuous(uint32_t adcBase, uint16_t channel);
|
||||
void initializeDMA(void);
|
||||
void configureDMAChannels(void);
|
||||
|
||||
//
|
||||
// Defines
|
||||
//
|
||||
#define RESULTS_BUFFER_SIZE 1024 //buffer for storing conversion results
|
||||
//(size must be multiple of 16)
|
||||
#define EX_ADC_RESOLUTION 12
|
||||
// 12 for 12-bit conversion resolution, which supports (ADC_MODE_SINGLE_ENDED)
|
||||
// Sample on single pin (VREFLO is the low reference)
|
||||
// Or 16 for 16-bit conversion resolution, which supports (ADC_MODE_DIFFERENTIAL)
|
||||
// Sample on pair of pins (difference between pins is converted, subject to
|
||||
// common mode voltage requirements; see the device data manual)
|
||||
|
||||
//
|
||||
// Globals
|
||||
//
|
||||
#pragma DATA_SECTION(adcADataBuffer, "ramgs0");
|
||||
#pragma DATA_SECTION(adcDDataBuffer, "ramgs0");
|
||||
uint16_t adcADataBuffer[RESULTS_BUFFER_SIZE];
|
||||
uint16_t adcDDataBuffer[RESULTS_BUFFER_SIZE];
|
||||
volatile uint16_t done;
|
||||
|
||||
void main(void)
|
||||
{
|
||||
uint16_t resultsIndex;
|
||||
|
||||
//
|
||||
// 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 ISRs used by this example
|
||||
//
|
||||
// ISR for ADCA INT1 - occurs after first conversion
|
||||
// ISR for DMA ch1 - occurs when DMA transfer is complete
|
||||
//
|
||||
Interrupt_register(INT_ADCA1, &adcA1ISR);
|
||||
Interrupt_register(INT_DMA_CH1, &dmach1ISR);
|
||||
|
||||
//
|
||||
// Enable specific PIE & CPU interrupts:
|
||||
// ADCA INT1 - Group 1, interrupt 1
|
||||
// DMA interrupt - Group 7, interrupt 1
|
||||
//
|
||||
Interrupt_enable(INT_ADCA1);
|
||||
Interrupt_enable(INT_DMA_CH1);
|
||||
|
||||
//
|
||||
// Stop the ePWM clock
|
||||
//
|
||||
SysCtl_disablePeripheral(SYSCTL_PERIPH_CLK_TBCLKSYNC);
|
||||
|
||||
//
|
||||
// Call the set up function for ePWM 2
|
||||
//
|
||||
configureEPWM(EPWM2_BASE);
|
||||
|
||||
//
|
||||
// Start the ePWM clock
|
||||
//
|
||||
SysCtl_enablePeripheral(SYSCTL_PERIPH_CLK_TBCLKSYNC);
|
||||
|
||||
|
||||
//
|
||||
// Configure the ADCA & ADCD and power it up
|
||||
//
|
||||
configureADC(ADCA_BASE);
|
||||
configureADC(ADCD_BASE);
|
||||
|
||||
//
|
||||
// Setup the ADC for continuous conversions on channels A3 and D3
|
||||
//
|
||||
setupADCContinuous(ADCA_BASE, 3);
|
||||
setupADCContinuous(ADCD_BASE, 3);
|
||||
|
||||
//
|
||||
// Initialize the DMA & configure DMA channels 1 & 2
|
||||
//
|
||||
initializeDMA();
|
||||
configureDMAChannels();
|
||||
|
||||
//
|
||||
// Initialize results buffer
|
||||
//
|
||||
for(resultsIndex = 0; resultsIndex < RESULTS_BUFFER_SIZE; resultsIndex++)
|
||||
{
|
||||
adcADataBuffer[resultsIndex] = 0;
|
||||
adcDDataBuffer[resultsIndex] = 0;
|
||||
}
|
||||
|
||||
//
|
||||
// Clearing all pending interrupt flags
|
||||
//
|
||||
DMA_clearTriggerFlag(DMA_CH1_BASE); // DMA channel 1
|
||||
DMA_clearTriggerFlag(DMA_CH2_BASE); // DMA channel 2
|
||||
HWREGH(ADCA_BASE + ADC_O_INTFLGCLR) = 0x3U; // ADCA
|
||||
HWREGH(ADCD_BASE + ADC_O_INTFLGCLR) = 0x3U; // ADCD
|
||||
EPWM_forceADCTriggerEventCountInit(EPWM2_BASE, EPWM_SOC_A); // EPWM2 SOCA
|
||||
EPWM_clearADCTriggerFlag(EPWM2_BASE, EPWM_SOC_A); // EPWM2 SOCA
|
||||
|
||||
//
|
||||
// Enable continuous operation by setting the last SOC to re-trigger
|
||||
// the first
|
||||
//
|
||||
ADC_setInterruptSOCTrigger(ADCA_BASE, ADC_SOC_NUMBER0, // ADCA
|
||||
ADC_INT_SOC_TRIGGER_ADCINT2);
|
||||
ADC_setInterruptSOCTrigger(ADCD_BASE, ADC_SOC_NUMBER0, // ADCD
|
||||
ADC_INT_SOC_TRIGGER_ADCINT2);
|
||||
|
||||
//
|
||||
// Enable global Interrupts and higher priority real-time debug events:
|
||||
//
|
||||
EINT; // Enable Global interrupt INTM
|
||||
ERTM; // Enable Global realtime interrupt DBGM
|
||||
|
||||
//
|
||||
// Start DMA
|
||||
//
|
||||
done = 0;
|
||||
DMA_startChannel(DMA_CH1_BASE);
|
||||
DMA_startChannel(DMA_CH2_BASE);
|
||||
|
||||
//
|
||||
// Finally, enable the SOCA trigger from ePWM. This will kick off
|
||||
// conversions at the next ePWM event.
|
||||
//
|
||||
EPWM_enableADCTrigger(EPWM2_BASE, EPWM_SOC_A);
|
||||
|
||||
//
|
||||
// Loop until the ISR signals the transfer is complete
|
||||
//
|
||||
while(done == 0)
|
||||
{
|
||||
__asm(" NOP");
|
||||
}
|
||||
ESTOP0;
|
||||
}
|
||||
|
||||
//
|
||||
// adcA1ISR - This is called after the very first conversion and will disable
|
||||
// the ePWM SOC to avoid re-triggering problems.
|
||||
//
|
||||
#pragma CODE_SECTION(adcA1ISR, ".TI.ramfunc");
|
||||
__interrupt void adcA1ISR(void)
|
||||
{
|
||||
//
|
||||
// Remove ePWM trigger
|
||||
//
|
||||
EPWM_disableADCTrigger(EPWM2_BASE, EPWM_SOC_A);
|
||||
|
||||
//
|
||||
// Disable this interrupt from happening again
|
||||
//
|
||||
Interrupt_disable(INT_ADCA1);
|
||||
|
||||
//
|
||||
// Acknowledge interrupt
|
||||
//
|
||||
Interrupt_clearACKGroup(INTERRUPT_ACK_GROUP1);
|
||||
}
|
||||
|
||||
//
|
||||
// dmach1ISR - This is called at the end of the DMA transfer, the conversions
|
||||
// are stopped by removing the trigger of the first SOC from
|
||||
// the last.
|
||||
//
|
||||
#pragma CODE_SECTION(dmach1ISR, ".TI.ramfunc");
|
||||
__interrupt void dmach1ISR(void)
|
||||
{
|
||||
//
|
||||
// Stop the ADC by removing the trigger for SOC0
|
||||
//
|
||||
ADC_setInterruptSOCTrigger(ADCA_BASE, ADC_SOC_NUMBER0,
|
||||
ADC_INT_SOC_TRIGGER_NONE);
|
||||
ADC_setInterruptSOCTrigger(ADCD_BASE, ADC_SOC_NUMBER0,
|
||||
ADC_INT_SOC_TRIGGER_NONE);
|
||||
done = 1;
|
||||
|
||||
//
|
||||
// Acknowledge interrupt
|
||||
//
|
||||
Interrupt_clearACKGroup(INTERRUPT_ACK_GROUP7);
|
||||
}
|
||||
|
||||
//
|
||||
// configureEPWM - Set up the ePWM2 module so that the A output has a period
|
||||
// of 40us with a 50% duty. The SOCA signal is coincident with
|
||||
// the rising edge of this.
|
||||
//
|
||||
void configureEPWM(uint32_t epwmBase)
|
||||
{
|
||||
//
|
||||
// Make the timer count up with a period of 40us
|
||||
//
|
||||
HWREGH(epwmBase + EPWM_O_TBCTL) = 0x0000U;
|
||||
EPWM_setTimeBasePeriod(epwmBase, 4000U);
|
||||
|
||||
//
|
||||
// Set the A output on zero and reset on CMPA
|
||||
//
|
||||
EPWM_setActionQualifierAction(epwmBase, EPWM_AQ_OUTPUT_A,
|
||||
EPWM_AQ_OUTPUT_HIGH,
|
||||
EPWM_AQ_OUTPUT_ON_TIMEBASE_ZERO);
|
||||
EPWM_setActionQualifierAction(epwmBase, EPWM_AQ_OUTPUT_A,
|
||||
EPWM_AQ_OUTPUT_LOW,
|
||||
EPWM_AQ_OUTPUT_ON_TIMEBASE_UP_CMPA);
|
||||
|
||||
//
|
||||
// Set CMPA to 20us to get a 50% duty
|
||||
//
|
||||
EPWM_setCounterCompareValue(epwmBase, EPWM_COUNTER_COMPARE_A, 2000U);
|
||||
|
||||
//
|
||||
// Start ADC when timer equals zero (note: don't enable yet)
|
||||
//
|
||||
EPWM_setADCTriggerSource(epwmBase, EPWM_SOC_A, EPWM_SOC_TBCTR_ZERO);
|
||||
EPWM_setADCTriggerEventPrescale(epwmBase, EPWM_SOC_A, 1U);
|
||||
}
|
||||
|
||||
//
|
||||
// configureADC - Write ADC configurations and power up the ADC for both
|
||||
// ADC A and ADC D
|
||||
//
|
||||
void configureADC(uint32_t adcBase)
|
||||
{
|
||||
//
|
||||
// Set ADCDLK divider to /4
|
||||
//
|
||||
ADC_setPrescaler(adcBase, ADC_CLK_DIV_4_0);
|
||||
|
||||
//
|
||||
// Set resolution and signal mode (see #defines above) and load
|
||||
// corresponding trims.
|
||||
//
|
||||
#if(EX_ADC_RESOLUTION == 12)
|
||||
ADC_setMode(adcBase, ADC_RESOLUTION_12BIT, ADC_MODE_SINGLE_ENDED);
|
||||
#elif(EX_ADC_RESOLUTION == 16)
|
||||
ADC_setMode(adcBase, ADC_RESOLUTION_16BIT, ADC_MODE_DIFFERENTIAL);
|
||||
#endif
|
||||
|
||||
//
|
||||
// Set pulse positions to late
|
||||
//
|
||||
ADC_setInterruptPulseMode(adcBase, ADC_PULSE_END_OF_CONV);
|
||||
|
||||
//
|
||||
// Power up the ADCs and then delay for 1 ms
|
||||
//
|
||||
ADC_enableConverter(adcBase);
|
||||
|
||||
//
|
||||
// Delay for 1ms to allow ADC time to power up
|
||||
//
|
||||
DEVICE_DELAY_US(1000);
|
||||
}
|
||||
|
||||
//
|
||||
// setupADCContinuous - setup the ADC to continuously convert on one channel
|
||||
//
|
||||
void setupADCContinuous(uint32_t adcBase, uint16_t channel)
|
||||
{
|
||||
uint16_t acqps;
|
||||
|
||||
//
|
||||
// Determine minimum acquisition window (in SYSCLKS) based on resolution
|
||||
//
|
||||
if(EX_ADC_RESOLUTION == 12)
|
||||
{
|
||||
acqps = 14; // 75ns
|
||||
}
|
||||
else //resolution is 16-bit
|
||||
{
|
||||
acqps = 63; // 320ns
|
||||
}
|
||||
//
|
||||
// - NOTE: A longer sampling window will be required if the ADC driving
|
||||
// source is less than ideal (an ideal source would be a high bandwidth
|
||||
// op-amp with a small series resistance). See TI application report
|
||||
// SPRACT6 for guidance on ADC driver design.
|
||||
//
|
||||
|
||||
//
|
||||
// Configure SOCs channel no. & acquisition window.
|
||||
// Trigger SCO0 from EPWM2SOCA.
|
||||
// Trigger all other SOCs from INT1 (EOC on SOC0).
|
||||
//
|
||||
ADC_setupSOC(adcBase, ADC_SOC_NUMBER0, ADC_TRIGGER_EPWM2_SOCA,
|
||||
(ADC_Channel)channel, acqps);
|
||||
ADC_setupSOC(adcBase, ADC_SOC_NUMBER1, ADC_TRIGGER_SW_ONLY,
|
||||
(ADC_Channel)channel, acqps);
|
||||
ADC_setupSOC(adcBase, ADC_SOC_NUMBER2, ADC_TRIGGER_SW_ONLY,
|
||||
(ADC_Channel)channel, acqps);
|
||||
ADC_setupSOC(adcBase, ADC_SOC_NUMBER3, ADC_TRIGGER_SW_ONLY,
|
||||
(ADC_Channel)channel, acqps);
|
||||
ADC_setupSOC(adcBase, ADC_SOC_NUMBER4, ADC_TRIGGER_SW_ONLY,
|
||||
(ADC_Channel)channel, acqps);
|
||||
ADC_setupSOC(adcBase, ADC_SOC_NUMBER5, ADC_TRIGGER_SW_ONLY,
|
||||
(ADC_Channel)channel, acqps);
|
||||
ADC_setupSOC(adcBase, ADC_SOC_NUMBER6, ADC_TRIGGER_SW_ONLY,
|
||||
(ADC_Channel)channel, acqps);
|
||||
ADC_setupSOC(adcBase, ADC_SOC_NUMBER7, ADC_TRIGGER_SW_ONLY,
|
||||
(ADC_Channel)channel, acqps);
|
||||
ADC_setupSOC(adcBase, ADC_SOC_NUMBER8, ADC_TRIGGER_SW_ONLY,
|
||||
(ADC_Channel)channel, acqps);
|
||||
ADC_setupSOC(adcBase, ADC_SOC_NUMBER9, ADC_TRIGGER_SW_ONLY,
|
||||
(ADC_Channel)channel, acqps);
|
||||
ADC_setupSOC(adcBase, ADC_SOC_NUMBER10, ADC_TRIGGER_SW_ONLY,
|
||||
(ADC_Channel)channel, acqps);
|
||||
ADC_setupSOC(adcBase, ADC_SOC_NUMBER11, ADC_TRIGGER_SW_ONLY,
|
||||
(ADC_Channel)channel, acqps);
|
||||
ADC_setupSOC(adcBase, ADC_SOC_NUMBER12, ADC_TRIGGER_SW_ONLY,
|
||||
(ADC_Channel)channel, acqps);
|
||||
ADC_setupSOC(adcBase, ADC_SOC_NUMBER13, ADC_TRIGGER_SW_ONLY,
|
||||
(ADC_Channel)channel, acqps);
|
||||
ADC_setupSOC(adcBase, ADC_SOC_NUMBER14, ADC_TRIGGER_SW_ONLY,
|
||||
(ADC_Channel)channel, acqps);
|
||||
ADC_setupSOC(adcBase, ADC_SOC_NUMBER15, ADC_TRIGGER_SW_ONLY,
|
||||
(ADC_Channel)channel, acqps);
|
||||
|
||||
//
|
||||
// Configure ADCINT1 trigger for SOC1-SOC15
|
||||
//
|
||||
ADC_setInterruptSOCTrigger(adcBase, ADC_SOC_NUMBER1,
|
||||
ADC_INT_SOC_TRIGGER_ADCINT1);
|
||||
ADC_setInterruptSOCTrigger(adcBase, ADC_SOC_NUMBER2,
|
||||
ADC_INT_SOC_TRIGGER_ADCINT1);
|
||||
ADC_setInterruptSOCTrigger(adcBase, ADC_SOC_NUMBER3,
|
||||
ADC_INT_SOC_TRIGGER_ADCINT1);
|
||||
ADC_setInterruptSOCTrigger(adcBase, ADC_SOC_NUMBER4,
|
||||
ADC_INT_SOC_TRIGGER_ADCINT1);
|
||||
ADC_setInterruptSOCTrigger(adcBase, ADC_SOC_NUMBER5,
|
||||
ADC_INT_SOC_TRIGGER_ADCINT1);
|
||||
ADC_setInterruptSOCTrigger(adcBase, ADC_SOC_NUMBER6,
|
||||
ADC_INT_SOC_TRIGGER_ADCINT1);
|
||||
ADC_setInterruptSOCTrigger(adcBase, ADC_SOC_NUMBER7,
|
||||
ADC_INT_SOC_TRIGGER_ADCINT1);
|
||||
ADC_setInterruptSOCTrigger(adcBase, ADC_SOC_NUMBER8,
|
||||
ADC_INT_SOC_TRIGGER_ADCINT1);
|
||||
ADC_setInterruptSOCTrigger(adcBase, ADC_SOC_NUMBER9,
|
||||
ADC_INT_SOC_TRIGGER_ADCINT1);
|
||||
ADC_setInterruptSOCTrigger(adcBase, ADC_SOC_NUMBER10,
|
||||
ADC_INT_SOC_TRIGGER_ADCINT1);
|
||||
ADC_setInterruptSOCTrigger(adcBase, ADC_SOC_NUMBER11,
|
||||
ADC_INT_SOC_TRIGGER_ADCINT1);
|
||||
ADC_setInterruptSOCTrigger(adcBase, ADC_SOC_NUMBER12,
|
||||
ADC_INT_SOC_TRIGGER_ADCINT1);
|
||||
ADC_setInterruptSOCTrigger(adcBase, ADC_SOC_NUMBER13,
|
||||
ADC_INT_SOC_TRIGGER_ADCINT1);
|
||||
ADC_setInterruptSOCTrigger(adcBase, ADC_SOC_NUMBER14,
|
||||
ADC_INT_SOC_TRIGGER_ADCINT1);
|
||||
ADC_setInterruptSOCTrigger(adcBase, ADC_SOC_NUMBER15,
|
||||
ADC_INT_SOC_TRIGGER_ADCINT1);
|
||||
|
||||
//
|
||||
// Enable ADCINT1 & ADCINT2. Disable ADCINT3 & ADCINT4.
|
||||
//
|
||||
ADC_enableInterrupt(adcBase, ADC_INT_NUMBER1);
|
||||
ADC_enableInterrupt(adcBase, ADC_INT_NUMBER2);
|
||||
ADC_disableInterrupt(adcBase, ADC_INT_NUMBER3);
|
||||
ADC_disableInterrupt(adcBase, ADC_INT_NUMBER4);
|
||||
|
||||
//
|
||||
// Enable continuous mode
|
||||
//
|
||||
ADC_enableContinuousMode(adcBase, ADC_INT_NUMBER1);
|
||||
ADC_enableContinuousMode(adcBase, ADC_INT_NUMBER2);
|
||||
|
||||
//
|
||||
// Configure interrupt triggers
|
||||
//
|
||||
ADC_setInterruptSource(adcBase, ADC_INT_NUMBER1, ADC_SOC_NUMBER0);
|
||||
ADC_setInterruptSource(adcBase, ADC_INT_NUMBER2, ADC_SOC_NUMBER15);
|
||||
}
|
||||
|
||||
//
|
||||
// initializeDMA - Initialize DMA through hard reset
|
||||
//
|
||||
void initializeDMA(void)
|
||||
{
|
||||
//
|
||||
// Perform a hard reset on DMA
|
||||
//
|
||||
DMA_initController();
|
||||
|
||||
//
|
||||
// Allow DMA to run free on emulation suspend
|
||||
//
|
||||
DMA_setEmulationMode(DMA_EMULATION_FREE_RUN);
|
||||
}
|
||||
|
||||
//
|
||||
// configureDMAChannels - Initialize DMA ch 1 to transfer ADCA results
|
||||
// and DMA ch 2 to transfer ADCB results
|
||||
//
|
||||
void configureDMAChannels(void)
|
||||
{
|
||||
//
|
||||
// DMA channel 1 set up for ADCA
|
||||
//
|
||||
DMA_configAddresses(DMA_CH1_BASE, (uint16_t *)&adcADataBuffer,
|
||||
(uint16_t *)ADCARESULT_BASE);
|
||||
|
||||
//
|
||||
// Perform enough 16-word bursts to fill the results buffer. Data will be
|
||||
// transferred 32 bits at a time hence the address steps below.
|
||||
//
|
||||
DMA_configBurst(DMA_CH1_BASE, 16, 2, 2);
|
||||
DMA_configTransfer(DMA_CH1_BASE, (RESULTS_BUFFER_SIZE >> 4), -14, 2);
|
||||
DMA_configMode(DMA_CH1_BASE, DMA_TRIGGER_ADCA2,
|
||||
(DMA_CFG_ONESHOT_DISABLE | DMA_CFG_CONTINUOUS_DISABLE |
|
||||
DMA_CFG_SIZE_32BIT));
|
||||
|
||||
DMA_enableTrigger(DMA_CH1_BASE);
|
||||
DMA_disableOverrunInterrupt(DMA_CH1_BASE);
|
||||
DMA_setInterruptMode(DMA_CH1_BASE, DMA_INT_AT_END);
|
||||
DMA_enableInterrupt(DMA_CH1_BASE);
|
||||
|
||||
//
|
||||
// DMA channel 2 set up for ADCD
|
||||
//
|
||||
DMA_configAddresses(DMA_CH2_BASE, (uint16_t *)&adcDDataBuffer,
|
||||
(uint16_t *)ADCDRESULT_BASE);
|
||||
|
||||
//
|
||||
// Perform enough 16-word bursts to fill the results buffer. Data will be
|
||||
// transferred 32 bits at a time hence the address steps below.
|
||||
//
|
||||
DMA_configBurst(DMA_CH2_BASE, 16, 2, 2);
|
||||
DMA_configTransfer(DMA_CH2_BASE, (RESULTS_BUFFER_SIZE >> 4), -14, 2);
|
||||
DMA_configMode(DMA_CH2_BASE, DMA_TRIGGER_ADCA2,
|
||||
(DMA_CFG_ONESHOT_DISABLE | DMA_CFG_CONTINUOUS_DISABLE |
|
||||
DMA_CFG_SIZE_32BIT));
|
||||
|
||||
DMA_enableTrigger(DMA_CH2_BASE);
|
||||
DMA_disableOverrunInterrupt(DMA_CH2_BASE);
|
||||
DMA_setInterruptMode(DMA_CH2_BASE, DMA_INT_AT_END);
|
||||
DMA_enableInterrupt(DMA_CH2_BASE);
|
||||
}
|
||||
|
||||
//
|
||||
// End of file
|
||||
//
|
||||
@@ -0,0 +1,287 @@
|
||||
//###########################################################################
|
||||
//
|
||||
// FILE: adc_ex7_ppb_offset.c
|
||||
//
|
||||
// TITLE: ADC offset adjust using post-processing block
|
||||
//
|
||||
//! \addtogroup driver_example_list
|
||||
//! <h1> ADC PPB Offset (adc_ppb_offset)</h1>
|
||||
//!
|
||||
//! This example software triggers the ADC. Some SOCs have automatic offset
|
||||
//! adjustment applied by the post-processing block. After the program runs,
|
||||
//! the memory will contain ADC & post-processing block(PPB) results.
|
||||
//!
|
||||
//! \b External \b Connections \n
|
||||
//! - A2, D2 pins should be connected to signals to convert
|
||||
//!
|
||||
//! \b Watch \b Variables \n
|
||||
//! - \b adcAResult \b: a digital representation of the voltage on pin A2
|
||||
//! - \b adcAPPBResult \b : a digital representation of the voltage
|
||||
//! on pin A2, minus 100 LSBs of automatically added offset
|
||||
//! - \b adcDResult \b: a digital representation of the voltage on pin D2
|
||||
//! - \b adcCPPBResult \b : a digital representation of the voltage
|
||||
//! on pin D2 plus 100 LSBs of automatically added offset
|
||||
//
|
||||
//#############################################################################
|
||||
//
|
||||
//
|
||||
// $Copyright:
|
||||
// Copyright (C) 2013-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"
|
||||
|
||||
//
|
||||
// Defines
|
||||
//
|
||||
#define EX_ADC_RESOLUTION 12
|
||||
// 12 for 12-bit conversion resolution, which supports (ADC_MODE_SINGLE_ENDED)
|
||||
// Sample on single pin (VREFLO is the low reference)
|
||||
// Or 16 for 16-bit conversion resolution, which supports (ADC_MODE_DIFFERENTIAL)
|
||||
// Sample on pair of pins (difference between pins is converted, subject to
|
||||
// common mode voltage requirements; see the device data manual)
|
||||
|
||||
//
|
||||
// Function Prototypes
|
||||
//
|
||||
void configureADC(uint32_t adcBas);
|
||||
void setupADCSoftware(uint32_t adcBase);
|
||||
void setupPPBOffset(int16_t aOffset, int16_t bOffset);
|
||||
|
||||
//
|
||||
// Globals
|
||||
//
|
||||
uint16_t adcAResult;
|
||||
uint16_t adcAPPBResult;
|
||||
uint16_t adcDResult;
|
||||
uint16_t adcCPPBResult;
|
||||
|
||||
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();
|
||||
|
||||
|
||||
//
|
||||
// Configure the ADCs and power them up
|
||||
//
|
||||
configureADC(ADCA_BASE);
|
||||
configureADC(ADCD_BASE);
|
||||
|
||||
//
|
||||
// Setup the ADCs for software conversions
|
||||
//
|
||||
setupADCSoftware(ADCA_BASE);
|
||||
setupADCSoftware(ADCD_BASE);
|
||||
|
||||
//
|
||||
// Setup PPB offset correction.
|
||||
// conversion on channel A will subtract 100.
|
||||
// conversion on channel C will add 100.
|
||||
//
|
||||
setupPPBOffset(100, -100);
|
||||
|
||||
//
|
||||
// Enable global Interrupts and higher priority real-time debug events:
|
||||
//
|
||||
EINT; // Enable Global interrupt INTM
|
||||
ERTM; // Enable Global realtime interrupt DBGM
|
||||
|
||||
//
|
||||
// Take conversions indefinitely in loop
|
||||
//
|
||||
do
|
||||
{
|
||||
//
|
||||
// Convert, wait for completion, and store results.
|
||||
// Start conversions immediately via software, ADCA
|
||||
//
|
||||
ADC_forceSOC(ADCA_BASE, ADC_SOC_NUMBER0);
|
||||
ADC_forceSOC(ADCA_BASE, ADC_SOC_NUMBER1);
|
||||
|
||||
//
|
||||
// Wait for ADCA to complete, then acknowledge flag
|
||||
//
|
||||
while(ADC_getInterruptStatus(ADCA_BASE, ADC_INT_NUMBER1) == false);
|
||||
ADC_clearInterruptStatus(ADCA_BASE, ADC_INT_NUMBER1);
|
||||
|
||||
//
|
||||
// Start conversions immediately via software, ADCD
|
||||
//
|
||||
ADC_forceSOC(ADCD_BASE, ADC_SOC_NUMBER0);
|
||||
ADC_forceSOC(ADCD_BASE, ADC_SOC_NUMBER1);
|
||||
|
||||
//
|
||||
// Wait for ADCD to complete, then acknowledge flag
|
||||
//
|
||||
while(ADC_getInterruptStatus(ADCD_BASE, ADC_INT_NUMBER1) == false);
|
||||
ADC_clearInterruptStatus(ADCD_BASE, ADC_INT_NUMBER1);
|
||||
|
||||
//
|
||||
// Store results
|
||||
//
|
||||
adcAResult = ADC_readResult(ADCARESULT_BASE, ADC_SOC_NUMBER0);
|
||||
adcAPPBResult = ADC_readPPBResult(ADCARESULT_BASE, ADC_PPB_NUMBER1);
|
||||
adcDResult = ADC_readResult(ADCDRESULT_BASE, ADC_SOC_NUMBER0);
|
||||
adcCPPBResult = ADC_readPPBResult(ADCDRESULT_BASE, ADC_PPB_NUMBER1);
|
||||
|
||||
//
|
||||
// Software breakpoint, hit run again to get updated conversions
|
||||
//
|
||||
asm(" ESTOP0");
|
||||
}
|
||||
while(1);
|
||||
}
|
||||
|
||||
//
|
||||
// configureADC - Write ADC configurations and power up the ADC for both
|
||||
// ADC A and ADC C
|
||||
//
|
||||
void configureADC(uint32_t adcBase)
|
||||
{
|
||||
//
|
||||
// Set ADCDLK divider to /4
|
||||
//
|
||||
ADC_setPrescaler(adcBase, ADC_CLK_DIV_4_0);
|
||||
|
||||
//
|
||||
// Set resolution and signal mode (see #defines above) and load
|
||||
// corresponding trims.
|
||||
//
|
||||
#if(EX_ADC_RESOLUTION == 12)
|
||||
ADC_setMode(adcBase, ADC_RESOLUTION_12BIT, ADC_MODE_SINGLE_ENDED);
|
||||
#elif(EX_ADC_RESOLUTION == 16)
|
||||
ADC_setMode(adcBase, ADC_RESOLUTION_16BIT, ADC_MODE_DIFFERENTIAL);
|
||||
#endif
|
||||
|
||||
//
|
||||
// Set pulse positions to late
|
||||
//
|
||||
ADC_setInterruptPulseMode(adcBase, ADC_PULSE_END_OF_CONV);
|
||||
|
||||
//
|
||||
// Power up the ADCs and then delay for 1 ms
|
||||
//
|
||||
ADC_enableConverter(adcBase);
|
||||
|
||||
//
|
||||
// Delay for 1ms to allow ADC time to power up
|
||||
//
|
||||
DEVICE_DELAY_US(1000);
|
||||
}
|
||||
|
||||
//
|
||||
// setupADCSoftware - Configure ADC SOC and acquisition window
|
||||
//
|
||||
void setupADCSoftware(uint32_t adcBase)
|
||||
{
|
||||
uint16_t acqps;
|
||||
|
||||
//
|
||||
// Determine minimum acquisition window (in SYSCLKS) based on resolution
|
||||
//
|
||||
if(EX_ADC_RESOLUTION == 12)
|
||||
{
|
||||
acqps = 14; // 75ns
|
||||
}
|
||||
else //resolution is 16-bit
|
||||
{
|
||||
acqps = 63; // 320ns
|
||||
}
|
||||
//
|
||||
// - NOTE: A longer sampling window will be required if the ADC driving
|
||||
// source is less than ideal (an ideal source would be a high bandwidth
|
||||
// op-amp with a small series resistance). See TI application report
|
||||
// SPRACT6 for guidance on ADC driver design.
|
||||
//
|
||||
|
||||
//
|
||||
// Select the channels to convert and end of conversion flag
|
||||
// ADCA
|
||||
//
|
||||
ADC_setupSOC(adcBase, ADC_SOC_NUMBER0, ADC_TRIGGER_SW_ONLY,
|
||||
(ADC_Channel)2U, acqps);
|
||||
ADC_setupSOC(adcBase, ADC_SOC_NUMBER1, ADC_TRIGGER_SW_ONLY,
|
||||
(ADC_Channel)2U, acqps);
|
||||
|
||||
//
|
||||
// Configure source as EOC1, clear & enable the interrupt
|
||||
//
|
||||
ADC_setInterruptSource(adcBase, ADC_INT_NUMBER1, ADC_SOC_NUMBER1);
|
||||
ADC_clearInterruptStatus(adcBase, ADC_INT_NUMBER1);
|
||||
ADC_enableInterrupt(adcBase, ADC_INT_NUMBER1);
|
||||
}
|
||||
|
||||
//
|
||||
// setupPPBOffset - Configure PPB for SOC
|
||||
//
|
||||
void setupPPBOffset(int16_t aOffset, int16_t bOffset)
|
||||
{
|
||||
//
|
||||
// PPB1 is associated with SOC1. PPB1 will subtract OFFCAL value
|
||||
// from associated SOC
|
||||
//
|
||||
// ADCA
|
||||
ADC_setupPPB(ADCA_BASE, ADC_PPB_NUMBER1, ADC_SOC_NUMBER1);
|
||||
ADC_setPPBCalibrationOffset(ADCA_BASE, ADC_PPB_NUMBER1, aOffset);
|
||||
|
||||
// ADCB
|
||||
ADC_setupPPB(ADCD_BASE, ADC_PPB_NUMBER1, ADC_SOC_NUMBER1);
|
||||
ADC_setPPBCalibrationOffset(ADCD_BASE, ADC_PPB_NUMBER1, bOffset);
|
||||
}
|
||||
|
||||
//
|
||||
// End of file
|
||||
//
|
||||
@@ -0,0 +1,356 @@
|
||||
//###########################################################################
|
||||
//
|
||||
// FILE: adc_ex8_ppb_limits.c
|
||||
//
|
||||
// TITLE: ADC limits check using post-processing block for f2838x.
|
||||
//
|
||||
//! \addtogroup driver_example_list
|
||||
//! <h1> ADC PPB Limits (adc_ppb_limits)</h1>
|
||||
//!
|
||||
//! This example sets up the ePWM to periodically trigger the ADC. If the
|
||||
//! results are outside of the defined range, the post-processing block
|
||||
//! will generate an interrupt.
|
||||
//!
|
||||
//! The default limits are 1000LSBs and 3000LSBs. With VREFHI set to 3.3V, the
|
||||
//! PPB will generate an interrupt if the input voltage goes above about
|
||||
//! 2.4V or below about 0.8V.
|
||||
//!
|
||||
//! \b External \b Connections \n
|
||||
//! - A0 should be connected to a signal to convert
|
||||
//!
|
||||
//! \b Watch \b Variables \n
|
||||
//! - None
|
||||
//!
|
||||
//
|
||||
//#############################################################################
|
||||
//
|
||||
//
|
||||
// $Copyright:
|
||||
// Copyright (C) 2013-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"
|
||||
|
||||
//
|
||||
// Defines
|
||||
//
|
||||
#define EX_ADC_RESOLUTION 12
|
||||
// 12 for 12-bit conversion resolution, which supports (ADC_MODE_SINGLE_ENDED)
|
||||
// Sample on single pin (VREFLO is the low reference)
|
||||
// Or 16 for 16-bit conversion resolution, which supports (ADC_MODE_DIFFERENTIAL)
|
||||
// Sample on pair of pins (difference between pins is converted, subject to
|
||||
// common mode voltage requirements; see the device data manual)
|
||||
|
||||
//
|
||||
// Globals
|
||||
//
|
||||
uint32_t intStatus;
|
||||
//
|
||||
// Functional Prototypes
|
||||
//
|
||||
void configureADC(uint32_t adcBase);
|
||||
void configureEPWM(uint32_t epwmBase);
|
||||
void configurePPB1Limits(uint16_t soc, uint16_t limitHigh, uint16_t limitLow);
|
||||
void configureADCSOC(uint32_t adcBase, uint16_t channel);
|
||||
interrupt void adcAEvtISR(void);
|
||||
|
||||
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();
|
||||
|
||||
//
|
||||
// Map ISR functions
|
||||
//
|
||||
Interrupt_register(INT_ADCA_EVT, &adcAEvtISR);
|
||||
|
||||
//
|
||||
// Enable specific PIE & CPU interrupts:
|
||||
//
|
||||
Interrupt_enable(INT_ADCA_EVT);
|
||||
|
||||
|
||||
//
|
||||
// Configure the ADC and power it up
|
||||
//
|
||||
configureADC(ADCA_BASE);
|
||||
|
||||
//
|
||||
// Configure the ePWM
|
||||
//
|
||||
configureEPWM(EPWM1_BASE);
|
||||
|
||||
//
|
||||
// Setup the ADC for ePWM triggered conversions on channel 0
|
||||
//
|
||||
configureADCSOC(ADCA_BASE, 0);
|
||||
|
||||
//
|
||||
// Configure ADC post-processing limits
|
||||
// SOC0 will generate an interrupt if conversion is above or below limits
|
||||
//
|
||||
configurePPB1Limits(0,3000,1000);
|
||||
|
||||
//
|
||||
// Enable global Interrupts and higher priority real-time debug events:
|
||||
//
|
||||
EINT; // Enable Global interrupt INTM
|
||||
ERTM; // Enable Global realtime interrupt DBGM
|
||||
|
||||
//
|
||||
// Start ePWM:
|
||||
// Enable sync and clock to PWM
|
||||
//
|
||||
SysCtl_enablePeripheral(SYSCTL_PERIPH_CLK_TBCLKSYNC);
|
||||
|
||||
//
|
||||
// Enable SOCA trigger
|
||||
//
|
||||
EPWM_enableADCTrigger(EPWM1_BASE, EPWM_SOC_A);
|
||||
|
||||
//
|
||||
// Unfreeze epwm counter to count-up
|
||||
//
|
||||
EPWM_setTimeBaseCounterMode(EPWM1_BASE, EPWM_COUNTER_MODE_UP);
|
||||
|
||||
//
|
||||
// Take conversions indefinitely in loop
|
||||
//
|
||||
do
|
||||
{
|
||||
//
|
||||
// Wait while ePWM causes ADC conversions.
|
||||
// If the ADC conversions exceed the PPB limits, then an interrupt
|
||||
// will be generated. User can read ADC results either in idle loop
|
||||
// or ADCINT ISR as per application requirement.
|
||||
//
|
||||
}
|
||||
while(1);
|
||||
}
|
||||
|
||||
//
|
||||
// configureADC - Write ADC configurations and power up the ADC for both
|
||||
// ADC A and ADC C
|
||||
//
|
||||
void configureADC(uint32_t adcBase)
|
||||
{
|
||||
//
|
||||
// Set ADCDLK divider to /4
|
||||
//
|
||||
ADC_setPrescaler(adcBase, ADC_CLK_DIV_4_0);
|
||||
|
||||
//
|
||||
// Set resolution and signal mode (see #defines above) and load
|
||||
// corresponding trims.
|
||||
//
|
||||
#if(EX_ADC_RESOLUTION == 12)
|
||||
ADC_setMode(adcBase, ADC_RESOLUTION_12BIT, ADC_MODE_SINGLE_ENDED);
|
||||
#elif(EX_ADC_RESOLUTION == 16)
|
||||
ADC_setMode(adcBase, ADC_RESOLUTION_16BIT, ADC_MODE_DIFFERENTIAL);
|
||||
#endif
|
||||
|
||||
//
|
||||
// Set pulse positions to late
|
||||
//
|
||||
ADC_setInterruptPulseMode(adcBase, ADC_PULSE_END_OF_CONV);
|
||||
|
||||
//
|
||||
// Power up the ADCs and then delay for 1 ms
|
||||
//
|
||||
ADC_enableConverter(adcBase);
|
||||
|
||||
//
|
||||
// Delay for 1ms to allow ADC time to power up
|
||||
//
|
||||
DEVICE_DELAY_US(1000);
|
||||
}
|
||||
|
||||
//
|
||||
// configureEPWM - Setup SOC and compare values for EPWM
|
||||
//
|
||||
void configureEPWM(uint32_t epwmBase)
|
||||
{
|
||||
//
|
||||
// Disable SOCA trigger
|
||||
//
|
||||
EPWM_disableADCTrigger(epwmBase, EPWM_SOC_A);
|
||||
|
||||
//
|
||||
// Trigger SOCA on CMPA up-count
|
||||
//
|
||||
EPWM_setADCTriggerSource(epwmBase, EPWM_SOC_A, EPWM_SOC_TBCTR_U_CMPA);
|
||||
|
||||
//
|
||||
// Generate pulse on 1st event
|
||||
//
|
||||
EPWM_setADCTriggerEventPrescale(epwmBase, EPWM_SOC_A, 1U);
|
||||
|
||||
//
|
||||
// Set compare A value to 2048 counts
|
||||
//
|
||||
EPWM_setCounterCompareValue(epwmBase, EPWM_COUNTER_COMPARE_A, 2048U);
|
||||
|
||||
//
|
||||
// Set period to 4096 counts
|
||||
//
|
||||
EPWM_setTimeBasePeriod(epwmBase, 4096U);
|
||||
|
||||
//
|
||||
// Freeze counter
|
||||
//
|
||||
EPWM_setTimeBaseCounterMode(epwmBase, EPWM_COUNTER_MODE_STOP_FREEZE);
|
||||
}
|
||||
|
||||
//
|
||||
// configurePPB1Limits - Configure high and low limits for ADCPPB
|
||||
//
|
||||
void configurePPB1Limits(uint16_t soc, uint16_t limitHigh, uint16_t limitLow)
|
||||
{
|
||||
//
|
||||
// Asscociate PPB1 with soc
|
||||
//
|
||||
ADC_setupPPB(ADCA_BASE, ADC_PPB_NUMBER1, (ADC_SOCNumber)soc);
|
||||
|
||||
//
|
||||
// Set high and low limits
|
||||
//
|
||||
ADC_setPPBTripLimits(ADCA_BASE, ADC_PPB_NUMBER1, limitHigh, limitLow);
|
||||
|
||||
//
|
||||
// Enable high and low limit events to generate interrupt
|
||||
//
|
||||
ADC_enablePPBEventInterrupt(ADCA_BASE, ADC_PPB_NUMBER1,
|
||||
(ADC_EVT_TRIPHI | ADC_EVT_TRIPLO));
|
||||
}
|
||||
|
||||
//
|
||||
// configureADCSOC - Setup ADC EPWM channel and trigger settings
|
||||
//
|
||||
void configureADCSOC(uint32_t adcBase, uint16_t channel)
|
||||
{
|
||||
uint16_t acqps;
|
||||
|
||||
//
|
||||
// Determine minimum acquisition window (in SYSCLKS) based on resolution
|
||||
//
|
||||
if(EX_ADC_RESOLUTION == 12)
|
||||
{
|
||||
acqps = 14; // 75ns
|
||||
}
|
||||
else //resolution is 16-bit
|
||||
{
|
||||
acqps = 63; // 320ns
|
||||
}
|
||||
//
|
||||
// - NOTE: A longer sampling window will be required if the ADC driving
|
||||
// source is less than ideal (an ideal source would be a high bandwidth
|
||||
// op-amp with a small series resistance). See TI application report
|
||||
// SPRACT6 for guidance on ADC driver design.
|
||||
//
|
||||
|
||||
//
|
||||
// Select the channels to convert and end of conversion flag
|
||||
// ADCA
|
||||
//
|
||||
ADC_setupSOC(adcBase, ADC_SOC_NUMBER0, ADC_TRIGGER_EPWM1_SOCA,
|
||||
(ADC_Channel)channel, acqps);
|
||||
|
||||
//
|
||||
// Configure source as EOC1, clear & enable the interrupt
|
||||
//
|
||||
ADC_setInterruptSource(adcBase, ADC_INT_NUMBER1, ADC_SOC_NUMBER0);
|
||||
ADC_clearInterruptStatus(adcBase, ADC_INT_NUMBER1);
|
||||
ADC_enableInterrupt(adcBase, ADC_INT_NUMBER1);
|
||||
}
|
||||
|
||||
//
|
||||
// adcAEvtISR - ISR for ADCA PPB
|
||||
//
|
||||
interrupt void adcAEvtISR(void)
|
||||
{
|
||||
//
|
||||
// Warning, you are outside of PPB limits
|
||||
//
|
||||
intStatus = ADC_getPPBEventStatus(ADCA_BASE, ADC_PPB_NUMBER1);
|
||||
if((intStatus & ADC_EVT_TRIPHI) != 0U)
|
||||
{
|
||||
//
|
||||
// Voltage exceeded high limit
|
||||
//
|
||||
asm(" ESTOP0");
|
||||
|
||||
//
|
||||
// Clear the trip flag and continue
|
||||
//
|
||||
ADC_clearPPBEventStatus(ADCA_BASE, ADC_PPB_NUMBER1, ADC_EVT_TRIPHI);
|
||||
}
|
||||
if((intStatus & ADC_EVT_TRIPLO) != 0U)
|
||||
{
|
||||
//
|
||||
// Voltage exceeded low limit
|
||||
//
|
||||
asm(" ESTOP0");
|
||||
|
||||
//
|
||||
// Clear the trip flag and continue
|
||||
//
|
||||
ADC_clearPPBEventStatus(ADCA_BASE, ADC_PPB_NUMBER1, ADC_EVT_TRIPLO);
|
||||
}
|
||||
Interrupt_clearACKGroup(INTERRUPT_ACK_GROUP10);
|
||||
}
|
||||
|
||||
//
|
||||
// End of file
|
||||
//
|
||||
@@ -0,0 +1,503 @@
|
||||
//###########################################################################
|
||||
//
|
||||
// FILE: adc_ex9_ppb_delay.c
|
||||
//
|
||||
// TITLE: ADC delay capture using Post-Processing block.
|
||||
//
|
||||
//! \addtogroup driver_example_list
|
||||
//! <h1> ADC PPB Delay Capture (adc_ppb_delay)</h1>
|
||||
//!
|
||||
//! This example demonstrates delay capture using the post-processing block.
|
||||
//!
|
||||
//! Two asynchronous ADC triggers are setup:\n
|
||||
//! - ePWM1, with period 2048, triggering SOC0 to convert on pin A0\n
|
||||
//! - ePWM2, with period 9999, triggering SOC1 to convert on pin A2\n
|
||||
//!
|
||||
//! Each conversion generates an ISR at the end of the conversion. In the
|
||||
//! ISR for SOC0, a conversion counter is incremented and the PPB is checked
|
||||
//! to determine if the sample was delayed.\n
|
||||
//!
|
||||
//! After the program runs, the memory will contain:\n
|
||||
//! - \b conversion \b: the sequence of conversions using SOC0 that were delayed
|
||||
//! - \b delay \b: the corresponding delay of each of the delayed conversions
|
||||
//!
|
||||
//
|
||||
//#############################################################################
|
||||
//
|
||||
//
|
||||
// $Copyright:
|
||||
// Copyright (C) 2013-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"
|
||||
|
||||
|
||||
//
|
||||
// Defines
|
||||
//
|
||||
#define DELAY_BUFFER_SIZE 30
|
||||
//Number of delayed conversions to record
|
||||
#define EX_ADC_RESOLUTION 12
|
||||
// 12 for 12-bit conversion resolution, which supports (ADC_MODE_SINGLE_ENDED)
|
||||
// Sample on single pin (VREFLO is the low reference)
|
||||
// Or 16 for 16-bit conversion resolution, which supports (ADC_MODE_DIFFERENTIAL)
|
||||
// Sample on pair of pins (difference between pins is converted, subject to
|
||||
// common mode voltage requirements; see the device data manual)
|
||||
|
||||
//
|
||||
// Globals
|
||||
//
|
||||
uint32_t conversion_count;
|
||||
uint32_t conversion[DELAY_BUFFER_SIZE];
|
||||
uint16_t delay[DELAY_BUFFER_SIZE];
|
||||
volatile uint16_t delay_index;
|
||||
|
||||
//
|
||||
// Functional Prototypes
|
||||
//
|
||||
void initADC(void);
|
||||
void initADCSOC(void);
|
||||
void configureEPWM(uint32_t epwmBase, uint16_t period);
|
||||
void configureADCSOC(uint32_t adcBase, uint16_t channel);
|
||||
__interrupt void adcA1ISR(void);
|
||||
__interrupt void adcA2ISR(void);
|
||||
|
||||
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();
|
||||
|
||||
|
||||
//
|
||||
// Configure the ADC and power it up
|
||||
//
|
||||
initADC();
|
||||
|
||||
//
|
||||
// Configure the ePWMs to have async. periods
|
||||
//
|
||||
configureEPWM(EPWM1_BASE, 2048);
|
||||
configureEPWM(EPWM2_BASE, 9999);
|
||||
|
||||
//
|
||||
// Setup the ADC SOCs on ADCA
|
||||
//
|
||||
initADCSOC();
|
||||
|
||||
//
|
||||
// Map ISR functions
|
||||
//
|
||||
Interrupt_register(INT_ADCA1, &adcA1ISR);
|
||||
Interrupt_register(INT_ADCA2, &adcA2ISR);
|
||||
|
||||
//
|
||||
// initialize program variables
|
||||
//
|
||||
conversion_count = 0;
|
||||
for(delay_index = 0; delay_index < DELAY_BUFFER_SIZE; delay_index++)
|
||||
{
|
||||
delay[delay_index] = 0;
|
||||
conversion[delay_index] = 0;
|
||||
}
|
||||
|
||||
//
|
||||
// Enable specific PIE & CPU interrupts:
|
||||
//
|
||||
Interrupt_enable(INT_ADCA1);
|
||||
Interrupt_enable(INT_ADCA2);
|
||||
|
||||
//
|
||||
// Enable global Interrupts and higher priority real-time debug events:
|
||||
//
|
||||
EINT; // Enable Global interrupt INTM
|
||||
ERTM; // Enable Global realtime interrupt DBGM
|
||||
|
||||
//
|
||||
// Start ePWM:
|
||||
// Enable sync and clock to PWM
|
||||
//
|
||||
SysCtl_enablePeripheral(SYSCTL_PERIPH_CLK_TBCLKSYNC);
|
||||
|
||||
//
|
||||
// Enable SOCA triggers
|
||||
//
|
||||
EPWM_enableADCTrigger(EPWM1_BASE, EPWM_SOC_A);
|
||||
EPWM_enableADCTrigger(EPWM2_BASE, EPWM_SOC_A);
|
||||
|
||||
//
|
||||
// Unfreeze epwm counters to count-up
|
||||
//
|
||||
EPWM_setTimeBaseCounterMode(EPWM1_BASE, EPWM_COUNTER_MODE_UP);
|
||||
EPWM_setTimeBaseCounterMode(EPWM2_BASE, EPWM_COUNTER_MODE_UP);
|
||||
|
||||
//
|
||||
// Take conversions indefinitely in loop
|
||||
//
|
||||
do
|
||||
{
|
||||
delay_index = 0;
|
||||
//
|
||||
// Enable SOCA triggers
|
||||
//
|
||||
EPWM_enableADCTrigger(EPWM1_BASE, EPWM_SOC_A);
|
||||
EPWM_enableADCTrigger(EPWM2_BASE, EPWM_SOC_A);
|
||||
|
||||
//
|
||||
// Unfreeze epwm counters to count-up
|
||||
//
|
||||
EPWM_setTimeBaseCounterMode(EPWM1_BASE, EPWM_COUNTER_MODE_UP);
|
||||
EPWM_setTimeBaseCounterMode(EPWM2_BASE, EPWM_COUNTER_MODE_UP);
|
||||
|
||||
//
|
||||
//wait for list of delayed conversions to fill via interrupts
|
||||
//
|
||||
while(DELAY_BUFFER_SIZE > delay_index){}
|
||||
|
||||
//
|
||||
// Stop ePWMs, disabling SOCAs and freezing the counters
|
||||
//
|
||||
EPWM_disableADCTrigger(EPWM1_BASE, EPWM_SOC_A);
|
||||
EPWM_disableADCTrigger(EPWM2_BASE, EPWM_SOC_A);
|
||||
EPWM_setTimeBaseCounterMode(EPWM1_BASE, EPWM_COUNTER_MODE_STOP_FREEZE);
|
||||
EPWM_setTimeBaseCounterMode(EPWM2_BASE, EPWM_COUNTER_MODE_STOP_FREEZE);
|
||||
|
||||
//
|
||||
//software breakpoint
|
||||
//
|
||||
ESTOP0;
|
||||
|
||||
//
|
||||
//conversion[] will show which conversions were delayed
|
||||
//delay[] will show how long each conversion was delayed
|
||||
//conversion_count will show total number of conversions
|
||||
//conversion_count - DELAY_BUFFER_SIZE is the number of samples
|
||||
// that started immediately without any delay
|
||||
//
|
||||
}
|
||||
while(1);
|
||||
}
|
||||
|
||||
//
|
||||
// Function to configure and power up ADCA.
|
||||
//
|
||||
void initADC(void)
|
||||
{
|
||||
|
||||
//
|
||||
// Set ADCDLK divider to /4
|
||||
//
|
||||
ADC_setPrescaler(ADCA_BASE, ADC_CLK_DIV_4_0);
|
||||
|
||||
//
|
||||
// Set resolution and signal mode (see #defines above) and load
|
||||
// corresponding trims.
|
||||
//
|
||||
#if(EX_ADC_RESOLUTION == 12)
|
||||
ADC_setMode(ADCA_BASE, ADC_RESOLUTION_12BIT, ADC_MODE_SINGLE_ENDED);
|
||||
#elif(EX_ADC_RESOLUTION == 16)
|
||||
ADC_setMode(ADCA_BASE, ADC_RESOLUTION_16BIT, ADC_MODE_DIFFERENTIAL);
|
||||
#endif
|
||||
|
||||
//
|
||||
// Set pulse positions to late
|
||||
//
|
||||
ADC_setInterruptPulseMode(ADCA_BASE, ADC_PULSE_END_OF_CONV);
|
||||
|
||||
//
|
||||
// Power up the ADC and then delay for 1 ms
|
||||
//
|
||||
ADC_enableConverter(ADCA_BASE);
|
||||
DEVICE_DELAY_US(1000);
|
||||
}
|
||||
|
||||
//
|
||||
// Function to configure ADCA's SOC0 to be triggered by ePWM1 and SOC1 to be
|
||||
// triggered by ePWM2.
|
||||
//
|
||||
void initADCSOC(void)
|
||||
{
|
||||
//
|
||||
// Configure SOC0 of ADCA to convert pin A0 and SOC1 to convert A2. The
|
||||
// EPWM1SOCA signal will be the trigger for SOC0 and EPWM2SOCA will trigger
|
||||
// SOC1.
|
||||
// - For 12-bit resolution, a sampling window of 15 (75 ns at a 200MHz
|
||||
// SYSCLK rate) will be used. For 16-bit resolution, a sampling window
|
||||
// of 64 (320 ns at a 200MHz SYSCLK rate) will be used.
|
||||
// - NOTE: A longer sampling window will be required if the ADC driving
|
||||
// source is less than ideal (an ideal source would be a high bandwidth
|
||||
// op-amp with a small series resistance). See TI application report
|
||||
// SPRACT6 for guidance on ADC driver design.
|
||||
//
|
||||
|
||||
#if(EX_ADC_RESOLUTION == 12)
|
||||
ADC_setupSOC(ADCA_BASE, ADC_SOC_NUMBER0, ADC_TRIGGER_EPWM1_SOCA,
|
||||
ADC_CH_ADCIN0, 15);
|
||||
ADC_setupSOC(ADCA_BASE, ADC_SOC_NUMBER1, ADC_TRIGGER_EPWM2_SOCA,
|
||||
ADC_CH_ADCIN0, 15);
|
||||
#elif(EX_ADC_RESOLUTION == 16)
|
||||
ADC_setupSOC(ADCA_BASE, ADC_SOC_NUMBER0, ADC_TRIGGER_EPWM1_SOCA,
|
||||
ADC_CH_ADCIN0, 64);
|
||||
ADC_setupSOC(ADCA_BASE, ADC_SOC_NUMBER1, ADC_TRIGGER_EPWM2_SOCA,
|
||||
ADC_CH_ADCIN0, 64);
|
||||
#endif
|
||||
|
||||
//
|
||||
// Set SOC0 to set the interrupt 1 flag and SOC1 to set interrupt
|
||||
// 2 flag. Enable the interrupts and make sure the flags are cleared.
|
||||
//
|
||||
ADC_setInterruptSource(ADCA_BASE, ADC_INT_NUMBER1, ADC_SOC_NUMBER0);
|
||||
ADC_setInterruptSource(ADCA_BASE, ADC_INT_NUMBER2, ADC_SOC_NUMBER1);
|
||||
ADC_enableInterrupt(ADCA_BASE, ADC_INT_NUMBER1);
|
||||
ADC_enableInterrupt(ADCA_BASE, ADC_INT_NUMBER1);
|
||||
ADC_clearInterruptStatus(ADCA_BASE, ADC_INT_NUMBER1);
|
||||
ADC_clearInterruptStatus(ADCA_BASE, ADC_INT_NUMBER2);
|
||||
|
||||
//
|
||||
// Asscociate PPB1 with SOC0. This will allow delay detection for
|
||||
// this SOC.
|
||||
//
|
||||
ADC_setupPPB(ADCA_BASE, ADC_PPB_NUMBER1, ADC_SOC_NUMBER0);
|
||||
}
|
||||
|
||||
//
|
||||
// configureEPWM - Setup SOC and compare values for EPWM and set specified
|
||||
// period.
|
||||
//
|
||||
void configureEPWM(uint32_t epwmBase, uint16_t period)
|
||||
{
|
||||
//
|
||||
// Disable SOCA trigger
|
||||
//
|
||||
EPWM_disableADCTrigger(epwmBase, EPWM_SOC_A);
|
||||
|
||||
//
|
||||
// Trigger SOCA on CMPA up-count
|
||||
//
|
||||
EPWM_setADCTriggerSource(epwmBase, EPWM_SOC_A, EPWM_SOC_TBCTR_U_CMPA);
|
||||
|
||||
//
|
||||
// Generate pulse on 1st event
|
||||
//
|
||||
EPWM_setADCTriggerEventPrescale(epwmBase, EPWM_SOC_A, 1U);
|
||||
|
||||
//
|
||||
// Set compare A value to approximately half the period
|
||||
//
|
||||
EPWM_setCounterCompareValue(epwmBase, EPWM_COUNTER_COMPARE_A, period/2);
|
||||
|
||||
//
|
||||
// Set period as specified
|
||||
//
|
||||
EPWM_setTimeBasePeriod(epwmBase, period);
|
||||
|
||||
//
|
||||
// Set the local ePWM module clock divider to /1
|
||||
//
|
||||
EPWM_setClockPrescaler(epwmBase,
|
||||
EPWM_CLOCK_DIVIDER_1,
|
||||
EPWM_HSCLOCK_DIVIDER_1);
|
||||
|
||||
//
|
||||
// Freeze counter
|
||||
//
|
||||
EPWM_setTimeBaseCounterMode(epwmBase, EPWM_COUNTER_MODE_STOP_FREEZE);
|
||||
}
|
||||
|
||||
//
|
||||
// configurePPB1Limits - Configure high and low limits for ADCPPB
|
||||
//
|
||||
void configurePPB1Limits(uint16_t soc, uint16_t limitHigh, uint16_t limitLow)
|
||||
{
|
||||
//
|
||||
// Asscociate PPB1 with soc
|
||||
//
|
||||
ADC_setupPPB(ADCA_BASE, ADC_PPB_NUMBER1, (ADC_SOCNumber)soc);
|
||||
|
||||
//
|
||||
// Set high and low limits
|
||||
//
|
||||
ADC_setPPBTripLimits(ADCA_BASE, ADC_PPB_NUMBER1, limitHigh, limitLow);
|
||||
|
||||
//
|
||||
// Enable high and low limit events to generate interrupt
|
||||
//
|
||||
ADC_enablePPBEventInterrupt(ADCA_BASE, ADC_PPB_NUMBER1,
|
||||
(ADC_EVT_TRIPHI | ADC_EVT_TRIPLO));
|
||||
}
|
||||
|
||||
//
|
||||
// configureADCSOC - Setup ADC EPWM channel and trigger settings
|
||||
//
|
||||
void configureADCSOC(uint32_t adcBase, uint16_t channel)
|
||||
{
|
||||
uint16_t acqps;
|
||||
|
||||
//
|
||||
// Determine minimum acquisition window (in SYSCLKS) based on resolution
|
||||
//
|
||||
if(EX_ADC_RESOLUTION == 12)
|
||||
{
|
||||
acqps = 14; // 75ns
|
||||
}
|
||||
else //resolution is 16-bit
|
||||
{
|
||||
acqps = 63; // 320ns
|
||||
}
|
||||
//
|
||||
// - NOTE: A longer sampling window will be required if the ADC driving
|
||||
// source is less than ideal (an ideal source would be a high bandwidth
|
||||
// op-amp with a small series resistance). See TI application report
|
||||
// SPRACT6 for guidance on ADC driver design.
|
||||
//
|
||||
|
||||
//
|
||||
// Select the channels to convert and end of conversion flag
|
||||
// ADCA
|
||||
//
|
||||
ADC_setupSOC(adcBase, ADC_SOC_NUMBER0, ADC_TRIGGER_EPWM1_SOCA,
|
||||
(ADC_Channel)channel, acqps);
|
||||
|
||||
//
|
||||
// Configure source as EOC1, clear & enable the interrupt
|
||||
//
|
||||
ADC_setInterruptSource(adcBase, ADC_INT_NUMBER1, ADC_SOC_NUMBER0);
|
||||
ADC_clearInterruptStatus(adcBase, ADC_INT_NUMBER1);
|
||||
ADC_enableInterrupt(adcBase, ADC_INT_NUMBER1);
|
||||
}
|
||||
|
||||
//
|
||||
// ADC A Interrupt 1 ISR - check for delayed conversions
|
||||
//
|
||||
__interrupt void adcA1ISR(void)
|
||||
{
|
||||
//
|
||||
//DLYSTAMP will read 2 if the sample was not delayed
|
||||
//
|
||||
if(2 < ADC_getPPBDelayTimeStamp(ADCA_BASE, ADC_PPB_NUMBER1))
|
||||
{
|
||||
//
|
||||
//if DLYSTAMP > 2, then the sample was delayed by (DLYSTAMP - 2)
|
||||
//cycles (SYSCLK)
|
||||
//
|
||||
conversion[delay_index] = conversion_count;
|
||||
delay[delay_index] = ADC_getPPBDelayTimeStamp(ADCA_BASE, ADC_PPB_NUMBER1) - 2;
|
||||
delay_index++;
|
||||
|
||||
//
|
||||
//corrective action(s) for delayed sample can occur here
|
||||
//...
|
||||
//
|
||||
}
|
||||
|
||||
//
|
||||
//read ADC sample here
|
||||
//...
|
||||
//
|
||||
|
||||
conversion_count++;
|
||||
|
||||
//
|
||||
// Clear the interrupt flag
|
||||
//
|
||||
ADC_clearInterruptStatus(ADCA_BASE, ADC_INT_NUMBER1);
|
||||
|
||||
//
|
||||
// Check if overflow has occurred
|
||||
//
|
||||
if(true == ADC_getInterruptOverflowStatus(ADCA_BASE, ADC_INT_NUMBER1))
|
||||
{
|
||||
ADC_clearInterruptOverflowStatus(ADCA_BASE, ADC_INT_NUMBER1);
|
||||
ADC_clearInterruptStatus(ADCA_BASE, ADC_INT_NUMBER1);
|
||||
}
|
||||
|
||||
//
|
||||
// Acknowledge the interrupt
|
||||
//
|
||||
Interrupt_clearACKGroup(INTERRUPT_ACK_GROUP1);
|
||||
}
|
||||
|
||||
//
|
||||
// ADC A Interrupt 2 ISR - dummy ISR. Occurs async. to ADC A ISR 1.
|
||||
//
|
||||
__interrupt void adcA2ISR(void)
|
||||
{
|
||||
//
|
||||
//read ADC sample here
|
||||
//...
|
||||
//
|
||||
|
||||
//
|
||||
// Clear the interrupt flag
|
||||
//
|
||||
ADC_clearInterruptStatus(ADCA_BASE, ADC_INT_NUMBER1);
|
||||
|
||||
//
|
||||
// Check if overflow has occurred
|
||||
//
|
||||
if(true == ADC_getInterruptOverflowStatus(ADCA_BASE, ADC_INT_NUMBER1))
|
||||
{
|
||||
ADC_clearInterruptOverflowStatus(ADCA_BASE, ADC_INT_NUMBER1);
|
||||
ADC_clearInterruptStatus(ADCA_BASE, ADC_INT_NUMBER1);
|
||||
}
|
||||
|
||||
//
|
||||
// Acknowledge the interrupt
|
||||
//
|
||||
Interrupt_clearACKGroup(INTERRUPT_ACK_GROUP1);
|
||||
}
|
||||
|
||||
//
|
||||
// End of file
|
||||
//
|
||||
@@ -0,0 +1,28 @@
|
||||
<projectSpec>
|
||||
<project
|
||||
name="can_ex10_mask"
|
||||
device="TMS320F28377D"
|
||||
cgtVersion="22.6.0.LTS"
|
||||
products="C2000WARE"
|
||||
outputFormat="ELF"
|
||||
launchWizard="False"
|
||||
linkerCommandFile=""
|
||||
enableSysConfigTool="true"
|
||||
sysConfigBuildOptions="--product ${C2000WARE_ROOT}/.metadata/sdk.json --device F2837xD"
|
||||
>
|
||||
<configuration name="CPU1_RAM" compilerBuildOptions="--opt_level=off -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} -v28 -ml -mt --define=DEBUG --cla_support=cla1 --float_support=fpu32 --tmu_support=tmu0 --vcu_support=vcu2 --define=CPU1 --diag_warning=225 --diag_suppress=10063 --display_error_number" linkerBuildOptions="--entry_point code_start --stack_size=0x100 " />
|
||||
<configuration name="CPU1_FLASH" compilerBuildOptions="--opt_level=off -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} -v28 -ml -mt --define=DEBUG --define=_FLASH --cla_support=cla1 --float_support=fpu32 --tmu_support=tmu0 --vcu_support=vcu2 --define=CPU1 --diag_warning=225 --diag_suppress=10063 --display_error_number" linkerBuildOptions="--entry_point code_start --stack_size=0x100 " />
|
||||
<pathVariable name="C2000WARE_DLIB_ROOT" path="../../../../driverlib/" scope="project" />
|
||||
<pathVariable name="C2000WARE_ROOT" path="../../../../../../" scope="project" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/include/driverlib.h" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/include/device.h" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/source/device.c" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/targetConfigs/TMS320F28377D.ccxml" targetDirectory="targetConfigs" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/cmd/2837xD_RAM_lnk_cpu1.cmd" targetDirectory="" applicableConfigurations="CPU1_RAM" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/cmd/2837xD_FLASH_lnk_cpu1.cmd" targetDirectory="" applicableConfigurations="CPU1_FLASH" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/source/F2837xD_CodeStartBranch.asm" targetDirectory="device" />
|
||||
<file action="link" path="../../../../driverlib/ccs/Debug/driverlib.lib" targetDirectory="" />
|
||||
<file action="copy" path="../../../../driverlib" targetDirectory="device" excludeFromBuild="True"/>
|
||||
<file action="copy" path="../can_ex10_mask.c" targetDirectory="" />
|
||||
</project>
|
||||
</projectSpec>
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
<projectSpec>
|
||||
<project
|
||||
name="can_ex11_error_generation"
|
||||
device="TMS320F28377D"
|
||||
cgtVersion="22.6.0.LTS"
|
||||
products="C2000WARE"
|
||||
outputFormat="ELF"
|
||||
launchWizard="False"
|
||||
linkerCommandFile=""
|
||||
enableSysConfigTool="true"
|
||||
sysConfigBuildOptions="--product ${C2000WARE_ROOT}/.metadata/sdk.json --device F2837xD"
|
||||
>
|
||||
<configuration name="CPU1_RAM" compilerBuildOptions="--opt_level=off -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} -v28 -ml -mt --define=DEBUG --cla_support=cla1 --float_support=fpu32 --tmu_support=tmu0 --vcu_support=vcu2 --define=CPU1 --diag_warning=225 --diag_suppress=10063 --display_error_number" linkerBuildOptions="--entry_point code_start --stack_size=0x100 " />
|
||||
<configuration name="CPU1_FLASH" compilerBuildOptions="--opt_level=off -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} -v28 -ml -mt --define=DEBUG --define=_FLASH --cla_support=cla1 --float_support=fpu32 --tmu_support=tmu0 --vcu_support=vcu2 --define=CPU1 --diag_warning=225 --diag_suppress=10063 --display_error_number" linkerBuildOptions="--entry_point code_start --stack_size=0x100 " />
|
||||
<pathVariable name="C2000WARE_DLIB_ROOT" path="../../../../driverlib/" scope="project" />
|
||||
<pathVariable name="C2000WARE_ROOT" path="../../../../../../" scope="project" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/include/driverlib.h" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/include/device.h" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/source/device.c" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/targetConfigs/TMS320F28377D.ccxml" targetDirectory="targetConfigs" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/cmd/2837xD_RAM_lnk_cpu1.cmd" targetDirectory="" applicableConfigurations="CPU1_RAM" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/cmd/2837xD_FLASH_lnk_cpu1.cmd" targetDirectory="" applicableConfigurations="CPU1_FLASH" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/source/F2837xD_CodeStartBranch.asm" targetDirectory="device" />
|
||||
<file action="link" path="../../../../driverlib/ccs/Debug/driverlib.lib" targetDirectory="" />
|
||||
<file action="copy" path="../../../../driverlib" targetDirectory="device" excludeFromBuild="True"/>
|
||||
<file action="copy" path="../can_ex11_error_generation.c" targetDirectory="" />
|
||||
</project>
|
||||
</projectSpec>
|
||||
@@ -0,0 +1,41 @@
|
||||
<projectSpec>
|
||||
<project
|
||||
name="can_ex1_loopback"
|
||||
device="TMS320F28377D"
|
||||
cgtVersion="22.6.0.LTS"
|
||||
products="sysconfig;C2000WARE"
|
||||
outputFormat="ELF"
|
||||
launchWizard="False"
|
||||
linkerCommandFile=""
|
||||
enableSysConfigTool="true"
|
||||
sysConfigBuildOptions="--product ${C2000WARE_ROOT}/.metadata/sdk.json --device F2837xD"
|
||||
>
|
||||
<configuration name="CPU1_RAM" compilerBuildOptions="--opt_level=off -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} --define=DEBUG -v28 -ml -mt --define=CPU1 --diag_warning=225 --diag_suppress=10063 --display_error_number" linkerBuildOptions="--entry_point code_start --stack_size=0x3F8 --heap_size=0x200 --define RAM" />
|
||||
<configuration name="CPU1_FLASH" compilerBuildOptions="--opt_level=off -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} --define=DEBUG -v28 -ml -mt --define=CPU1 --define=_FLASH --diag_warning=225 --diag_suppress=10063 --display_error_number" linkerBuildOptions="--entry_point code_start --stack_size=0x3F8 --heap_size=0x200 " />
|
||||
|
||||
<configuration name="CPU1_CLB" postBuildStep="mkdir "${BuildDirectory}/simulation"
|
||||
;${CLB_SIM_COMPILER}/g++ -c -DCLB_SIM -I${SYSTEMC_INSTALL}/src -I${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/include -I${PROJECT_ROOT} -I${CLB_SIM_COMPILER}/include -Og -g -gdwarf-3 -gstrict-dwarf -Wall -MMD -MP -MF${BuildDirectory}/simulation/clb_sim.d -MT${BuildDirectory}/simulation/clb_sim.o -I${BuildDirectory}/syscfg -fno-threadsafe-statics -o${BuildDirectory}/simulation/clb_sim.o ${BuildDirectory}/syscfg/clb_sim.cpp
|
||||
;${CLB_SIM_COMPILER}/g++ -DCLB_SIM -Og -g -gdwarf-3 -gstrict-dwarf -Wall -Wl,-Map,${BuildDirectory}/simulation/simulation_output.map -L${SYSTEMC_INSTALL}/build/src -o${BuildDirectory}/simulation/simulation_output.exe ${BuildDirectory}/simulation/clb_sim.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/CLB_FSM_SC_model.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/CLB_HLC_SC_model.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/CLB_LUT4_SC_model.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/CLB_OutputLUT_SC_model.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/CLB_counter_SC_model.o -Wl,--start-group -lsystemc -Wl,--end-group;./simulation/simulation_output.exe
|
||||
;${NODE_TOOL} "${CLB_SYSCFG_ROOT}/dot_file_libraries/clbDotUtility.js" "${CLB_SYSCFG_ROOT}" "${BuildDirectory}/syscfg" "${BuildDirectory}/syscfg/clb.dot"" compilerBuildOptions="--opt_level=off -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} --define=DEBUG -v28 -ml -mt --define=CPU1 --diag_warning=225 --diag_suppress=10063 --display_error_number" linkerBuildOptions="--entry_point code_start --stack_size=0x3F8 --heap_size=0x200 --define RAM" />
|
||||
|
||||
<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" />
|
||||
|
||||
<pathVariable name="C2000WARE_DLIB_ROOT" path="../../../../driverlib/" scope="project" />
|
||||
<pathVariable name="C2000WARE_ROOT" path="../../../../../../" scope="project" />
|
||||
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/include/driverlib.h" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/include/device.h" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/source/device.c" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/targetConfigs/TMS320F28377D.ccxml" targetDirectory="targetConfigs" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/cmd/2837xD_RAM_lnk_cpu1.cmd" targetDirectory="" applicableConfigurations="CPU1_RAM,CPU1_CLB" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/cmd/2837xD_FLASH_lnk_cpu1.cmd" targetDirectory="" applicableConfigurations="CPU1_FLASH" />
|
||||
<file action="copy" path="../../../../driverlib/" targetDirectory="device" excludeFromBuild="True" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/source/F2837xD_CodeStartBranch.asm" targetDirectory="device" />
|
||||
<file action="link" path="../../../../driverlib/ccs/Debug/driverlib.lib" targetDirectory="" />
|
||||
|
||||
<file action="copy" path="../can_ex1_loopback.c" targetDirectory="" />
|
||||
<file action="copy" path="../can_ex1_loopback.syscfg" targetDirectory="" />
|
||||
</project>
|
||||
</projectSpec>
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
<projectSpec>
|
||||
<project
|
||||
name="can_ex2_loopback_interrupts"
|
||||
device="TMS320F28377D"
|
||||
cgtVersion="22.6.0.LTS"
|
||||
products="C2000WARE"
|
||||
outputFormat="ELF"
|
||||
launchWizard="False"
|
||||
linkerCommandFile=""
|
||||
enableSysConfigTool="true"
|
||||
sysConfigBuildOptions="--product ${C2000WARE_ROOT}/.metadata/sdk.json --device F2837xD"
|
||||
>
|
||||
<configuration name="CPU1_RAM" compilerBuildOptions="--opt_level=off -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} -v28 -ml -mt --define=DEBUG --cla_support=cla1 --float_support=fpu32 --tmu_support=tmu0 --vcu_support=vcu2 --define=CPU1 --diag_warning=225 --diag_suppress=10063 --display_error_number" linkerBuildOptions="--entry_point code_start --stack_size=0x100 " />
|
||||
<configuration name="CPU1_FLASH" compilerBuildOptions="--opt_level=off -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} -v28 -ml -mt --define=DEBUG --define=_FLASH --cla_support=cla1 --float_support=fpu32 --tmu_support=tmu0 --vcu_support=vcu2 --define=CPU1 --diag_warning=225 --diag_suppress=10063 --display_error_number" linkerBuildOptions="--entry_point code_start --stack_size=0x100 " />
|
||||
<pathVariable name="C2000WARE_DLIB_ROOT" path="../../../../driverlib/" scope="project" />
|
||||
<pathVariable name="C2000WARE_ROOT" path="../../../../../../" scope="project" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/include/driverlib.h" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/include/device.h" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/source/device.c" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/targetConfigs/TMS320F28377D.ccxml" targetDirectory="targetConfigs" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/cmd/2837xD_RAM_lnk_cpu1.cmd" targetDirectory="" applicableConfigurations="CPU1_RAM" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/cmd/2837xD_FLASH_lnk_cpu1.cmd" targetDirectory="" applicableConfigurations="CPU1_FLASH" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/source/F2837xD_CodeStartBranch.asm" targetDirectory="device" />
|
||||
<file action="link" path="../../../../driverlib/ccs/Debug/driverlib.lib" targetDirectory="" />
|
||||
<file action="copy" path="../../../../driverlib" targetDirectory="device" excludeFromBuild="True"/>
|
||||
<file action="copy" path="../can_ex2_loopback_interrupts.c" targetDirectory="" />
|
||||
</project>
|
||||
</projectSpec>
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
<projectSpec>
|
||||
<project
|
||||
name="can_ex3_external_transmit"
|
||||
device="TMS320F28377D"
|
||||
cgtVersion="22.6.0.LTS"
|
||||
products="C2000WARE"
|
||||
outputFormat="ELF"
|
||||
launchWizard="False"
|
||||
linkerCommandFile=""
|
||||
enableSysConfigTool="true"
|
||||
sysConfigBuildOptions="--product ${C2000WARE_ROOT}/.metadata/sdk.json --device F2837xD"
|
||||
>
|
||||
<configuration name="CPU1_RAM" compilerBuildOptions="--opt_level=off -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} -v28 -ml -mt --define=DEBUG --cla_support=cla1 --float_support=fpu32 --tmu_support=tmu0 --vcu_support=vcu2 --define=CPU1 --define=_DEBUG --define=LARGE_MODEL --diag_warning=225 --diag_suppress=10063 " linkerBuildOptions="--entry_point code_start --stack_size=0x380 " />
|
||||
<configuration name="CPU1_FLASH" compilerBuildOptions="--opt_level=off -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} -v28 -ml -mt --define=DEBUG --define=_FLASH --cla_support=cla1 --float_support=fpu32 --tmu_support=tmu0 --vcu_support=vcu2 --define=CPU1 --define=LARGE_MODEL --diag_warning=225 --diag_suppress=10063 " linkerBuildOptions="--entry_point code_start --stack_size=0x380 " />
|
||||
<pathVariable name="C2000WARE_DLIB_ROOT" path="../../../../driverlib/" scope="project" />
|
||||
<pathVariable name="C2000WARE_ROOT" path="../../../../../../" scope="project" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/include/driverlib.h" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/include/device.h" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/source/device.c" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/targetConfigs/TMS320F28377D.ccxml" targetDirectory="targetConfigs" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/cmd/2837xD_RAM_lnk_cpu1.cmd" targetDirectory="" applicableConfigurations="CPU1_RAM" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/cmd/2837xD_FLASH_lnk_cpu1.cmd" targetDirectory="" applicableConfigurations="CPU1_FLASH" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/source/F2837xD_CodeStartBranch.asm" targetDirectory="device" />
|
||||
<file action="link" path="../../../../driverlib/ccs/Debug/driverlib.lib" targetDirectory="" />
|
||||
<file action="copy" path="../../../../driverlib" targetDirectory="device" excludeFromBuild="True"/>
|
||||
<file action="copy" path="../can_ex3_external_transmit.c" targetDirectory="" />
|
||||
</project>
|
||||
</projectSpec>
|
||||
@@ -0,0 +1,28 @@
|
||||
<projectSpec>
|
||||
<project
|
||||
name="can_ex4_simple_transmit"
|
||||
device="TMS320F28377D"
|
||||
cgtVersion="22.6.0.LTS"
|
||||
products="C2000WARE"
|
||||
outputFormat="ELF"
|
||||
launchWizard="False"
|
||||
linkerCommandFile=""
|
||||
enableSysConfigTool="true"
|
||||
sysConfigBuildOptions="--product ${C2000WARE_ROOT}/.metadata/sdk.json --device F2837xD"
|
||||
>
|
||||
<configuration name="CPU1_RAM" compilerBuildOptions="--opt_level=off -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} -v28 -ml -mt --define=DEBUG --cla_support=cla1 --float_support=fpu32 --tmu_support=tmu0 --vcu_support=vcu2 --define=CPU1 --diag_warning=225 --diag_suppress=10063 --display_error_number" linkerBuildOptions="--entry_point code_start --stack_size=0x100 " />
|
||||
<configuration name="CPU1_FLASH" compilerBuildOptions="--opt_level=off -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} -v28 -ml -mt --define=DEBUG --define=_FLASH --cla_support=cla1 --float_support=fpu32 --tmu_support=tmu0 --vcu_support=vcu2 --define=CPU1 --diag_warning=225 --diag_suppress=10063 --display_error_number" linkerBuildOptions="--entry_point code_start --stack_size=0x100 " />
|
||||
<pathVariable name="C2000WARE_DLIB_ROOT" path="../../../../driverlib/" scope="project" />
|
||||
<pathVariable name="C2000WARE_ROOT" path="../../../../../../" scope="project" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/include/driverlib.h" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/include/device.h" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/source/device.c" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/targetConfigs/TMS320F28377D.ccxml" targetDirectory="targetConfigs" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/cmd/2837xD_RAM_lnk_cpu1.cmd" targetDirectory="" applicableConfigurations="CPU1_RAM" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/cmd/2837xD_FLASH_lnk_cpu1.cmd" targetDirectory="" applicableConfigurations="CPU1_FLASH" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/source/F2837xD_CodeStartBranch.asm" targetDirectory="device" />
|
||||
<file action="link" path="../../../../driverlib/ccs/Debug/driverlib.lib" targetDirectory="" />
|
||||
<file action="copy" path="../../../../driverlib" targetDirectory="device" excludeFromBuild="True"/>
|
||||
<file action="copy" path="../can_ex4_simple_transmit.c" targetDirectory="" />
|
||||
</project>
|
||||
</projectSpec>
|
||||
@@ -0,0 +1,28 @@
|
||||
<projectSpec>
|
||||
<project
|
||||
name="can_ex5_simple_receive"
|
||||
device="TMS320F28377D"
|
||||
cgtVersion="22.6.0.LTS"
|
||||
products="C2000WARE"
|
||||
outputFormat="ELF"
|
||||
launchWizard="False"
|
||||
linkerCommandFile=""
|
||||
enableSysConfigTool="true"
|
||||
sysConfigBuildOptions="--product ${C2000WARE_ROOT}/.metadata/sdk.json --device F2837xD"
|
||||
>
|
||||
<configuration name="CPU1_RAM" compilerBuildOptions="--opt_level=off -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} -v28 -ml -mt --define=DEBUG --cla_support=cla1 --float_support=fpu32 --tmu_support=tmu0 --vcu_support=vcu2 --define=CPU1 --diag_warning=225 --diag_suppress=10063 --display_error_number" linkerBuildOptions="--entry_point code_start --stack_size=0x100 " />
|
||||
<configuration name="CPU1_FLASH" compilerBuildOptions="--opt_level=off -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} -v28 -ml -mt --define=DEBUG --define=_FLASH --cla_support=cla1 --float_support=fpu32 --tmu_support=tmu0 --vcu_support=vcu2 --define=CPU1 --diag_warning=225 --diag_suppress=10063 --display_error_number" linkerBuildOptions="--entry_point code_start --stack_size=0x100 " />
|
||||
<pathVariable name="C2000WARE_DLIB_ROOT" path="../../../../driverlib/" scope="project" />
|
||||
<pathVariable name="C2000WARE_ROOT" path="../../../../../../" scope="project" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/include/driverlib.h" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/include/device.h" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/source/device.c" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/targetConfigs/TMS320F28377D.ccxml" targetDirectory="targetConfigs" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/cmd/2837xD_RAM_lnk_cpu1.cmd" targetDirectory="" applicableConfigurations="CPU1_RAM" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/cmd/2837xD_FLASH_lnk_cpu1.cmd" targetDirectory="" applicableConfigurations="CPU1_FLASH" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/source/F2837xD_CodeStartBranch.asm" targetDirectory="device" />
|
||||
<file action="link" path="../../../../driverlib/ccs/Debug/driverlib.lib" targetDirectory="" />
|
||||
<file action="copy" path="../../../../driverlib" targetDirectory="device" excludeFromBuild="True"/>
|
||||
<file action="copy" path="../can_ex5_simple_receive.c" targetDirectory="" />
|
||||
</project>
|
||||
</projectSpec>
|
||||
@@ -0,0 +1,28 @@
|
||||
<projectSpec>
|
||||
<project
|
||||
name="can_ex8_remote_tx"
|
||||
device="TMS320F28377D"
|
||||
cgtVersion="22.6.0.LTS"
|
||||
products="C2000WARE"
|
||||
outputFormat="ELF"
|
||||
launchWizard="False"
|
||||
linkerCommandFile=""
|
||||
enableSysConfigTool="true"
|
||||
sysConfigBuildOptions="--product ${C2000WARE_ROOT}/.metadata/sdk.json --device F2837xD"
|
||||
>
|
||||
<configuration name="CPU1_RAM" compilerBuildOptions="--opt_level=off -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} -v28 -ml -mt --define=DEBUG --cla_support=cla1 --float_support=fpu32 --tmu_support=tmu0 --vcu_support=vcu2 --define=CPU1 --diag_warning=225 --diag_suppress=10063 --display_error_number" linkerBuildOptions="--entry_point code_start --stack_size=0x100 " />
|
||||
<configuration name="CPU1_FLASH" compilerBuildOptions="--opt_level=off -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} -v28 -ml -mt --define=DEBUG --define=_FLASH --cla_support=cla1 --float_support=fpu32 --tmu_support=tmu0 --vcu_support=vcu2 --define=CPU1 --diag_warning=225 --diag_suppress=10063 --display_error_number" linkerBuildOptions="--entry_point code_start --stack_size=0x100 " />
|
||||
<pathVariable name="C2000WARE_DLIB_ROOT" path="../../../../driverlib/" scope="project" />
|
||||
<pathVariable name="C2000WARE_ROOT" path="../../../../../../" scope="project" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/include/driverlib.h" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/include/device.h" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/source/device.c" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/targetConfigs/TMS320F28377D.ccxml" targetDirectory="targetConfigs" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/cmd/2837xD_RAM_lnk_cpu1.cmd" targetDirectory="" applicableConfigurations="CPU1_RAM" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/cmd/2837xD_FLASH_lnk_cpu1.cmd" targetDirectory="" applicableConfigurations="CPU1_FLASH" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/source/F2837xD_CodeStartBranch.asm" targetDirectory="device" />
|
||||
<file action="link" path="../../../../driverlib/ccs/Debug/driverlib.lib" targetDirectory="" />
|
||||
<file action="copy" path="../../../../driverlib" targetDirectory="device" excludeFromBuild="True"/>
|
||||
<file action="copy" path="../can_ex8_remote_tx.c" targetDirectory="" />
|
||||
</project>
|
||||
</projectSpec>
|
||||
@@ -0,0 +1,28 @@
|
||||
<projectSpec>
|
||||
<project
|
||||
name="can_ex9_remote_answer"
|
||||
device="TMS320F28377D"
|
||||
cgtVersion="22.6.0.LTS"
|
||||
products="C2000WARE"
|
||||
outputFormat="ELF"
|
||||
launchWizard="False"
|
||||
linkerCommandFile=""
|
||||
enableSysConfigTool="true"
|
||||
sysConfigBuildOptions="--product ${C2000WARE_ROOT}/.metadata/sdk.json --device F2837xD"
|
||||
>
|
||||
<configuration name="CPU1_RAM" compilerBuildOptions="--opt_level=off -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} -v28 -ml -mt --define=DEBUG --cla_support=cla1 --float_support=fpu32 --tmu_support=tmu0 --vcu_support=vcu2 --define=CPU1 --diag_warning=225 --diag_suppress=10063 --display_error_number" linkerBuildOptions="--entry_point code_start --stack_size=0x100 " />
|
||||
<configuration name="CPU1_FLASH" compilerBuildOptions="--opt_level=off -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} -v28 -ml -mt --define=DEBUG --define=_FLASH --cla_support=cla1 --float_support=fpu32 --tmu_support=tmu0 --vcu_support=vcu2 --define=CPU1 --diag_warning=225 --diag_suppress=10063 --display_error_number" linkerBuildOptions="--entry_point code_start --stack_size=0x100 " />
|
||||
<pathVariable name="C2000WARE_DLIB_ROOT" path="../../../../driverlib/" scope="project" />
|
||||
<pathVariable name="C2000WARE_ROOT" path="../../../../../../" scope="project" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/include/driverlib.h" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/include/device.h" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/source/device.c" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/targetConfigs/TMS320F28377D.ccxml" targetDirectory="targetConfigs" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/cmd/2837xD_RAM_lnk_cpu1.cmd" targetDirectory="" applicableConfigurations="CPU1_RAM" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/cmd/2837xD_FLASH_lnk_cpu1.cmd" targetDirectory="" applicableConfigurations="CPU1_FLASH" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/source/F2837xD_CodeStartBranch.asm" targetDirectory="device" />
|
||||
<file action="link" path="../../../../driverlib/ccs/Debug/driverlib.lib" targetDirectory="" />
|
||||
<file action="copy" path="../../../../driverlib" targetDirectory="device" excludeFromBuild="True"/>
|
||||
<file action="copy" path="../can_ex9_remote_answer.c" targetDirectory="" />
|
||||
</project>
|
||||
</projectSpec>
|
||||
@@ -0,0 +1,186 @@
|
||||
//#############################################################################
|
||||
//
|
||||
// FILE: can_ex10_mask.c
|
||||
//
|
||||
// TITLE: CAN Acceptance Mask Example
|
||||
//
|
||||
//! \addtogroup driver_example_list
|
||||
//! <h1> CAN example that illustrates the usage of Mask registers </h1>
|
||||
//!
|
||||
//! This example initializes CAN module A for Reception. When a frame with a
|
||||
//! matching filter criterion is received, the data will be copied in mailbox 1
|
||||
//! and GPIO65 will be toggled a few times and the code gets ready for the next
|
||||
//! frame. If a message of any other MSGID is received, an ACK will be provided
|
||||
//! Completion of reception is determined by polling CAN_NDAT_21 register.
|
||||
//! No interrupts are used.
|
||||
//!
|
||||
//! \b Hardware \b Required \n
|
||||
//! - An external CAN node that transmits to CAN-A on the C2000 MCU
|
||||
//!
|
||||
//!
|
||||
//! \b Watch \b Variables \n
|
||||
//! - rxMsgCount - A counter for the number of messages received
|
||||
//! - rxMsgData - An array with the data that was received
|
||||
//!
|
||||
//
|
||||
//#############################################################################
|
||||
//
|
||||
// $Release Date: $
|
||||
// $Copyright:
|
||||
// Copyright (C) 2013-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"
|
||||
|
||||
//
|
||||
// Defines
|
||||
//
|
||||
#define MSG_DATA_LENGTH 0 // "Don't care" for a Receive mailbox
|
||||
#define RX_MSG_OBJ_ID 1 // Use mailbox 1
|
||||
|
||||
//
|
||||
// Globals
|
||||
//
|
||||
uint16_t rxMsgData[8]; // Buffer for received data
|
||||
uint16_t Toggle_ctr; // GPIO toggle counter
|
||||
volatile uint32_t rxMsgCount = 0;
|
||||
|
||||
//
|
||||
// Main
|
||||
//
|
||||
void main(void)
|
||||
{
|
||||
//
|
||||
// Initialize device clock and peripherals
|
||||
//
|
||||
Device_init();
|
||||
|
||||
//
|
||||
// Initialize GPIO
|
||||
//
|
||||
Device_initGPIO();
|
||||
|
||||
//
|
||||
// Configure GPIO pins for CANTX/CANRX
|
||||
//
|
||||
GPIO_setPinConfig(DEVICE_GPIO_CFG_CANRXA);
|
||||
GPIO_setPinConfig(DEVICE_GPIO_CFG_CANTXA);
|
||||
|
||||
//
|
||||
// Configure GPIO pin which is toggled upon message reception
|
||||
//
|
||||
GPIO_setPadConfig(65U, GPIO_PIN_TYPE_STD);
|
||||
GPIO_setDirectionMode(65U, GPIO_DIR_MODE_OUT);
|
||||
|
||||
//
|
||||
// Initialize the receive buffer to a known value
|
||||
//
|
||||
rxMsgData[0] = 0xDEAD;
|
||||
rxMsgData[1] = 0xDEAD;
|
||||
rxMsgData[2] = 0xDEAD;
|
||||
rxMsgData[3] = 0xDEAD;
|
||||
rxMsgData[4] = 0xDEAD;
|
||||
rxMsgData[5] = 0xDEAD;
|
||||
rxMsgData[6] = 0xDEAD;
|
||||
rxMsgData[7] = 0xDEAD;
|
||||
|
||||
//
|
||||
// Initialize the CAN controller
|
||||
//
|
||||
CAN_initModule(CANA_BASE);
|
||||
|
||||
//
|
||||
// Set up the CAN bus bit rate to 500kbps for each module
|
||||
// Refer to the Driver Library User Guide for information on how to set
|
||||
// tighter timing control. Additionally, consult the device data sheet
|
||||
// for more information about the CAN module clocking.
|
||||
//
|
||||
CAN_setBitRate(CANA_BASE, DEVICE_SYSCLK_FREQ, 500000, 16);
|
||||
|
||||
//
|
||||
// Initialize the receive message object used for receiving CAN messages.
|
||||
// Possible flags: CAN_MSG_OBJ_NO_FLAGS, CAN_MSG_OBJ_USE_EXT_FILTER,
|
||||
// CAN_MSG_OBJ_USE_DIR_FILTER
|
||||
// Message Object Parameters:
|
||||
// CAN Module: A
|
||||
// Message Object ID Number: 1
|
||||
// Message Identifier: 0x1F9FFFFA
|
||||
// Message Frame: Extended
|
||||
// Message Type: Receive
|
||||
// Message ID Mask: 0x1F000000
|
||||
// Message Object Flags: UMask, MXtd, MDir
|
||||
// Message Object flag CAN_MSG_OBJ_USE_ID_FILTER enables usage
|
||||
// of msgIDMask parameter for Message Identifier based filtering
|
||||
// Message Data Length: "Don't care" for a Receive mailbox
|
||||
CAN_setupMessageObject(CANA_BASE, RX_MSG_OBJ_ID, 0x1F9FFFFA,
|
||||
CAN_MSG_FRAME_EXT, CAN_MSG_OBJ_TYPE_RX, 0x1F000000,
|
||||
(CAN_MSG_OBJ_USE_ID_FILTER | CAN_MSG_OBJ_NO_FLAGS),
|
||||
MSG_DATA_LENGTH);
|
||||
|
||||
//
|
||||
// Start CAN module A operations
|
||||
//
|
||||
CAN_startModule(CANA_BASE);
|
||||
|
||||
//
|
||||
// Start reception - Just wait for data from another node
|
||||
//
|
||||
while(1)
|
||||
{
|
||||
//
|
||||
// Poll bit0 in CAN_NDAT_21 register to check completion of Reception
|
||||
//
|
||||
if((HWREG_BP(CANA_BASE + CAN_O_NDAT_21)) == 0x00000001)
|
||||
{
|
||||
//
|
||||
// Get the received message
|
||||
//
|
||||
asm(" NOP");
|
||||
CAN_readMessage(CANA_BASE, RX_MSG_OBJ_ID, rxMsgData); // Will this clear NewDat?
|
||||
|
||||
rxMsgCount++;
|
||||
for(Toggle_ctr=0; Toggle_ctr<100; Toggle_ctr++)
|
||||
{
|
||||
GPIO_togglePin(65U);
|
||||
DEVICE_DELAY_US(100000);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// End of File
|
||||
//
|
||||
@@ -0,0 +1,734 @@
|
||||
//#############################################################################
|
||||
//
|
||||
// FILE: can_ex11_error_generation.c
|
||||
//
|
||||
// TITLE: CAN Error Generation over GPIO Example
|
||||
//
|
||||
//! \addtogroup driver_example_list
|
||||
//! <h1> CAN Error Generation Example </h1>
|
||||
//!
|
||||
//!
|
||||
//! This example demonstrates the ways of handling CAN Error conditions
|
||||
//! It generates the CAN Packets and sends them over GPIO
|
||||
//! It is looped back externally to be received in CAN module
|
||||
//! The CAN Interrupt service routine reads the Error status and
|
||||
//! demonstrates how different Error conditions can be detected
|
||||
//!
|
||||
//! Change ERR_CFG define to the different Error Scenarios and run the
|
||||
//! example. The corresponding Error Flag will be set in status variable
|
||||
//! of canaISR() routine.
|
||||
//! Uses a CPU Timer(Timer 0) for periodic timer interrupt of CANBITRATE uSec
|
||||
//! On the Timer interrupt it sends the required CAN Frame type with
|
||||
//! the specified error conditions
|
||||
//! \note CAN modules on the device need to be connected to via CAN
|
||||
//! transceivers.
|
||||
//!
|
||||
//! Please refer to the application note titled "Configurable Error Generator
|
||||
//! for Controller Area Network" at www.ti.com/lit/pdf/spracq3 for further
|
||||
//! details on this example
|
||||
//!
|
||||
//! \b External \b Connections \n
|
||||
//! - ControlCARD GPIOTX_PIN(GPIO4) should be connected to GPIO5(CANRXA)
|
||||
//!
|
||||
//! \b Watch \b Variables \b Transmit \Configuration \n
|
||||
//! - status - variable in canaISR for checking error Status
|
||||
//!
|
||||
//
|
||||
//#############################################################################
|
||||
//!
|
||||
|
||||
//
|
||||
// Included Files
|
||||
//
|
||||
#include "driverlib.h"
|
||||
#include "device.h"
|
||||
|
||||
volatile uint32_t rxMsgCount = 0;
|
||||
volatile uint32_t errorFlag = 0;
|
||||
uint16_t txMsgData[8], rxMsgData[8]= {0,0,0,0,0,0,0,0};
|
||||
|
||||
//
|
||||
// Function Prototypes
|
||||
//
|
||||
int16_t generateCANFrame(uint32_t errCfg, int16_t remote_frame, int16_t bitNErr,
|
||||
int16_t dataByteNum, int16_t gpio);
|
||||
void selectGPIO(int16_t gpio);
|
||||
void initCPUTimers(void);
|
||||
void configCPUTimer(uint32_t cpuTimer, float freq, float bitrate);
|
||||
|
||||
//
|
||||
//Interrupt Service Routines
|
||||
//
|
||||
__interrupt void canaISR(void);
|
||||
__interrupt void cpuTimer0ISR(void);
|
||||
|
||||
//
|
||||
//Global Variables
|
||||
//
|
||||
int16_t stream[200];
|
||||
uint32_t canstream[200];
|
||||
uint16_t crcRg;
|
||||
int16_t crcNext,nbits,samebits;
|
||||
int16_t nxtBit, prev_bit, canBit=0;
|
||||
uint32_t arbID;
|
||||
int16_t bitpos=0, errpos=0, stuffbits=0;
|
||||
|
||||
#define TX_MSG_OBJ_ID 1
|
||||
#define RX_MSG_OBJ_ID 2
|
||||
|
||||
// Definitions - do not change values in this section
|
||||
#define CAN_FRAME 0
|
||||
#define REMOTE_REQUEST 1
|
||||
#define CAN_GPIO_MODE 0
|
||||
#define CAN_DATALBCK_MODE 1
|
||||
|
||||
//
|
||||
// CAN error definitions
|
||||
// Use any of these defines for ERR_CFG
|
||||
//
|
||||
//No Error is generated for this define
|
||||
//
|
||||
#define NO_ERR 0
|
||||
//
|
||||
//Bit 0/ CRC Error is generated for this Error define
|
||||
//
|
||||
#define FF_SRS_ERR 1
|
||||
//
|
||||
//Form Error is generated for this Error define
|
||||
//
|
||||
#define FF_IDE_ERR 2
|
||||
//
|
||||
//Form Error is generated for this Error define
|
||||
//
|
||||
#define FF_RTR_ERR 3
|
||||
//
|
||||
//Bit 0/ CRC Error is generated for this Error define
|
||||
//
|
||||
#define FF_R1_ERR 4
|
||||
//
|
||||
//Bit 0/ CRC Error is generated for this Error define
|
||||
//
|
||||
#define FF_R0_ERR 5
|
||||
//
|
||||
//Bit 0/ CRC Error is generated for this Error define
|
||||
//
|
||||
#define MSGID_ERR 6
|
||||
//
|
||||
//Bit 0/ CRC Error is generated for this Error define
|
||||
//
|
||||
#define DATA_ERR 8
|
||||
//
|
||||
//Bit 0/ CRC Error is generated for this Error define
|
||||
//
|
||||
#define CRC_ERR 9
|
||||
//
|
||||
//Form Error is generated for this Error define
|
||||
//
|
||||
#define STUFF_BITS_ERR 10
|
||||
|
||||
//
|
||||
//Default No Error
|
||||
//Change this NO_ERR to required Error Type as above
|
||||
//
|
||||
#define ERR_CFG FF_IDE_ERR
|
||||
|
||||
// Message data length
|
||||
#define MSG_DATA_LENGTH 4
|
||||
// CAN bit rate
|
||||
#define CANBITRATE 500000
|
||||
|
||||
// Define if GPIO CAN Frame Emulation (CAN_GPIO_MODE) or Internal CAN Data Loopback mode (CAN_DATALBCK_MODE)
|
||||
// CAN_GPIO_MODE: GPIOTX_PIN will output the emulated CAN frame which can be observed externally
|
||||
// CAN_DATALBCK_MODE: The GPIO mapped to CANRX_PAD will receive the emulated CAN frame internally. Using this
|
||||
// mode will not allow for external monitoring of emulated CAN frames. The CANRX_PAD defined should be
|
||||
// driven high when in this mode either externally or through the internal pull up.
|
||||
#define CAN_EMULATION_MODE CAN_GPIO_MODE
|
||||
|
||||
|
||||
// CAN channel setup
|
||||
// GPIO Pin to emulate CAN bit stream
|
||||
#define GPIOTX_PIN 4
|
||||
|
||||
// GPIO assignment for CANRX
|
||||
#define CANRX_PAD GPIO_5_CANRXA
|
||||
|
||||
// GPIOPORT and PIN calculation from channel assignments
|
||||
#define GPIOPORT (GPIOTX_PIN/32)
|
||||
#define GPIORX_PIN ((((CANRX_PAD >> 8) & 0xFFU) + ((CANRX_PAD >> 16) - 0x6U))>>1)
|
||||
|
||||
//
|
||||
// Main
|
||||
//
|
||||
void main(void)
|
||||
{
|
||||
int16_t frame_length;
|
||||
|
||||
//
|
||||
// Initialize System Control and device clock and peripherals
|
||||
//
|
||||
Device_init();
|
||||
|
||||
//
|
||||
// Configure GPIO pin that will be emulated as CANTX
|
||||
//
|
||||
GPIO_setPinConfig(GPIO_4_GPIO4);
|
||||
|
||||
//
|
||||
// Initialize CAN DATA
|
||||
//
|
||||
arbID = 0x1914A75B;
|
||||
|
||||
txMsgData[0] = 0x95;
|
||||
txMsgData[1] = 0x1A;
|
||||
txMsgData[2] = 0x23;
|
||||
txMsgData[3] = 0x45;
|
||||
txMsgData[4] = 0x67;
|
||||
txMsgData[5] = 0x89;
|
||||
txMsgData[6] = 0xAB;
|
||||
txMsgData[7] = 0xCD;
|
||||
|
||||
frame_length = generateCANFrame(ERR_CFG, CAN_FRAME, 0, 0, GPIOTX_PIN);
|
||||
|
||||
GPIO_setPinConfig(CANRX_PAD);
|
||||
|
||||
CAN_initModule(CANA_BASE);
|
||||
|
||||
CAN_setBitRate(CANA_BASE, DEVICE_SYSCLK_FREQ, CANBITRATE, 20);
|
||||
|
||||
CAN_enableInterrupt(CANA_BASE, CAN_INT_IE0 | CAN_INT_ERROR |
|
||||
CAN_INT_STATUS);
|
||||
|
||||
//
|
||||
// Initialize PIE, clear PIE registers, disable and clear all
|
||||
// CPU interrupts and flags
|
||||
//
|
||||
Interrupt_initModule();
|
||||
|
||||
//
|
||||
// Initialize the PIE vector table with pointers to the shell interrupt
|
||||
// Service Routines (ISR).
|
||||
//
|
||||
Interrupt_initVectorTable();
|
||||
|
||||
//
|
||||
// Enable Global Interrupt (INTM) and realtime interrupt (DBGM)
|
||||
//
|
||||
EINT;
|
||||
ERTM;
|
||||
|
||||
//
|
||||
// Interrupts that are used in this example are re-mapped to
|
||||
// ISR functions found within this file.
|
||||
// This registers the interrupt handler in PIE vector table.
|
||||
//
|
||||
Interrupt_register(INT_CANA0, &canaISR);
|
||||
Interrupt_register(INT_TIMER0, &cpuTimer0ISR);
|
||||
|
||||
//
|
||||
// Initializes the Device Peripheral. For this example, only initialize the
|
||||
// Cpu Timers.
|
||||
//
|
||||
initCPUTimers();
|
||||
|
||||
//
|
||||
// Configure CPU-Timer 0 interrupt every second:
|
||||
// CANBITRATE Period (in uSeconds)
|
||||
//
|
||||
configCPUTimer(CPUTIMER0_BASE, DEVICE_SYSCLK_FREQ, CANBITRATE);
|
||||
|
||||
//
|
||||
// To ensure precise timing, use write-only instructions to write to the
|
||||
// entire register. Therefore, if any of the configuration bits are changed
|
||||
// in configCPUTimer and initCPUTimers, the below settings must also
|
||||
// be updated.
|
||||
//
|
||||
CPUTimer_enableInterrupt(CPUTIMER0_BASE);
|
||||
|
||||
//
|
||||
// Enables CPU int1 which is connected to CPU-Timer 0,
|
||||
// Enable TINT0 in the PIE: Group 1 interrupt 7
|
||||
//
|
||||
Interrupt_enable(INT_TIMER0);
|
||||
|
||||
//
|
||||
// Enable the CAN interrupt signal
|
||||
//
|
||||
Interrupt_enable(INT_CANA0);
|
||||
CAN_enableGlobalInterrupt(CANA_BASE, CAN_GLOBAL_INT_CANINT0);
|
||||
|
||||
//
|
||||
//RX set up
|
||||
//
|
||||
CAN_setupMessageObject(CANA_BASE, RX_MSG_OBJ_ID, arbID, CAN_MSG_FRAME_EXT,
|
||||
CAN_MSG_OBJ_TYPE_RX, 0, CAN_MSG_OBJ_RX_INT_ENABLE,
|
||||
MSG_DATA_LENGTH);
|
||||
|
||||
//
|
||||
// Start CAN module operations
|
||||
//
|
||||
CAN_startModule(CANA_BASE);
|
||||
|
||||
canBit = 0;
|
||||
|
||||
//
|
||||
// Start CPU-Timer 0
|
||||
//
|
||||
CPUTimer_startTimer(CPUTIMER0_BASE);
|
||||
|
||||
for(;;)
|
||||
{
|
||||
if(canBit >= frame_length)
|
||||
canBit = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
int16_t generateCANFrame(uint32_t errCfg, int16_t remote_frame,
|
||||
int16_t bitNErr, int16_t dataByteNum, int16_t gpio)
|
||||
{
|
||||
uint32_t i, j, idLSB, idMSB;
|
||||
int16_t xtd, idndx, dlcndx, datndx, nstuffbits;
|
||||
|
||||
// initialize stream and canstream
|
||||
for(i = 0;i < 200;i++)
|
||||
{
|
||||
stream[i] = -1;
|
||||
canstream[i] = 0xFFFFFFFF;
|
||||
}
|
||||
|
||||
// arbID
|
||||
if(arbID > 0x7FF)
|
||||
{
|
||||
idLSB = arbID & 0x3FFFF;
|
||||
idMSB = ((arbID & 0x1FFFFFFF) >> 18) & 0x7FF;
|
||||
|
||||
stream[0] = 0;
|
||||
for(i = 0;i < 11;i++)
|
||||
stream[1 + i] = ((idMSB >> (10 - i)) & 1)?1:0;
|
||||
// SRS bit position
|
||||
if(errCfg == FF_SRS_ERR)
|
||||
bitpos = i + 1;
|
||||
// SRS bit
|
||||
stream[1 + i] = 1;
|
||||
// IDE bit position
|
||||
if(errCfg == FF_IDE_ERR)
|
||||
bitpos = i + 2;
|
||||
// IDE bit
|
||||
stream[2 + i] = 1;
|
||||
for(i = 0;i < 18;i++)
|
||||
stream[14 + i]=((idLSB >> (17 - i)) & 1 )?1:0;
|
||||
|
||||
idndx = 32;
|
||||
xtd = 1;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
idLSB = arbID & 0x7FF;
|
||||
stream[0] = 0;
|
||||
for(i = 0;i < 11;i++)
|
||||
stream[1 + i] = ((idLSB >> (10 -i )) & 1) ? 1:0;
|
||||
|
||||
idndx = 12;
|
||||
xtd = 0;
|
||||
}
|
||||
// If errCfg value is MSGID_ERR, or DATA_ERR or CRC_ERR, ensure that bitNErr is valid
|
||||
if(errCfg == MSGID_ERR)
|
||||
{
|
||||
if(arbID > 0x7FF)
|
||||
{
|
||||
if(bitNErr > 28)
|
||||
// bitNErr VALUE is not valid - change to valid value
|
||||
ESTOP0;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(bitNErr > 11)
|
||||
// bitNErr VALUE is not valid - change to valid value
|
||||
ESTOP0;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
//If errCfg value is DATA_ERR
|
||||
//check for valid bit position bitNErr and dataByteNum value
|
||||
//
|
||||
if(errCfg == DATA_ERR)
|
||||
{
|
||||
if(dataByteNum > (MSG_DATA_LENGTH - 1))
|
||||
// dataByteNum value is not valid - change to valid value
|
||||
ESTOP0;
|
||||
if(bitNErr > 7)
|
||||
// bitNErr value is not valid - change to valid value
|
||||
ESTOP0;
|
||||
}
|
||||
// if errCfg value is CRC_ERR, check for valid bit position bitNErr
|
||||
if(errCfg == DATA_ERR)
|
||||
{
|
||||
if(bitNErr > 14)
|
||||
// bitNErr value is not valid - change to valid value
|
||||
ESTOP0;
|
||||
}
|
||||
|
||||
//RTR, r1, r0 = 0 for now
|
||||
// RTR bit position
|
||||
if(errCfg == FF_RTR_ERR) bitpos = idndx;
|
||||
// RTR bit
|
||||
stream[idndx] = (!remote_frame)?0:1;
|
||||
// R1 bit position
|
||||
if(errCfg == FF_R1_ERR)
|
||||
bitpos = idndx + 1;
|
||||
// R1 bit
|
||||
stream[idndx + 1] = 0;
|
||||
// R0 bit position
|
||||
if(errCfg==FF_R0_ERR)
|
||||
bitpos = idndx + 2;
|
||||
// R0 bit
|
||||
stream[idndx + 2] = 0;
|
||||
|
||||
//DLC
|
||||
dlcndx = (xtd)?35:15;
|
||||
for(i = 0;i < 4;i++)
|
||||
stream[dlcndx + i]=((MSG_DATA_LENGTH >> (3 - i)) & 1)? 1: 0;
|
||||
//DATA (up to 8 bytes
|
||||
if(!remote_frame)
|
||||
{
|
||||
datndx = (xtd)?39:19;
|
||||
for(i = 0;i < MSG_DATA_LENGTH;i++)
|
||||
{
|
||||
for(j=0;j<8;j++)
|
||||
stream[datndx + (i * 8) + j] =
|
||||
((txMsgData[i] >> (7 - j)) & 1)?1:0;
|
||||
}
|
||||
}
|
||||
|
||||
//determine how long the bitstream is
|
||||
i = 0;
|
||||
nxtBit = stream[i];
|
||||
while(nxtBit == 0 || nxtBit == 1)
|
||||
nxtBit=stream[i++];
|
||||
nbits=--i;
|
||||
|
||||
crcRg = 0;
|
||||
for(i = 0;i < nbits;i++)
|
||||
{
|
||||
nxtBit = stream[i];
|
||||
crcNext = nxtBit ^ ((crcRg & 0x4000) >> 14);
|
||||
crcRg=(crcRg << 1) & 0x7FFE;
|
||||
if(crcNext)
|
||||
{
|
||||
crcRg = crcRg ^ 0x4599; // CAN-15 CRC polynomial
|
||||
}
|
||||
}
|
||||
|
||||
// Invert bitNErr position in MSGID
|
||||
if(errCfg == MSGID_ERR)
|
||||
{
|
||||
bitpos = idndx - 1 - bitNErr;
|
||||
stream[bitpos] = (stream[bitpos] == 1)?0:1;
|
||||
|
||||
}
|
||||
|
||||
// SRS ERROR
|
||||
if(errCfg == FF_SRS_ERR)
|
||||
stream[bitpos] = 0;
|
||||
// IDE ERROR
|
||||
if(errCfg == FF_IDE_ERR)
|
||||
stream[bitpos] = 0;
|
||||
// RTR ERROR
|
||||
if(errCfg == FF_RTR_ERR)
|
||||
stream[bitpos] = 1;
|
||||
// R1 ERROR
|
||||
if(errCfg == FF_R1_ERR)
|
||||
stream[bitpos] = 1;
|
||||
// R0 ERROR
|
||||
if(errCfg == FF_R0_ERR)
|
||||
stream[bitpos] = 1;
|
||||
|
||||
// Invert bitNErr position in the data byte pointed by dataByteNum
|
||||
if(errCfg == DATA_ERR)
|
||||
{
|
||||
bitpos = datndx + (7 - bitNErr) + (dataByteNum * 8);
|
||||
stream[bitpos] = (stream[bitpos] == 1)?0:1;
|
||||
}
|
||||
|
||||
//Append CRC bits (15) + delimiter
|
||||
for(i = 0;i < 15;i++)
|
||||
{
|
||||
stream[nbits + i]=((crcRg >> (14 - i)) & 1)?1:0;
|
||||
}
|
||||
|
||||
// add CRC delimiter
|
||||
stream[nbits + i] = 1;
|
||||
nbits += 1;
|
||||
|
||||
// Invert bitNErr position in the 15-bit CRC
|
||||
if(errCfg==CRC_ERR)
|
||||
{
|
||||
bitpos = nbits + 13 - bitNErr;
|
||||
stream[bitpos] = stream[bitpos] == 1?0:1;
|
||||
}
|
||||
|
||||
//
|
||||
//Stuff bits: check for 5 consecutive bit states
|
||||
//then insert opposite bit state if this occurs
|
||||
//
|
||||
prev_bit = stream[0];
|
||||
canstream[0] = stream[0];
|
||||
j = 1;
|
||||
samebits = 0;
|
||||
nstuffbits = 0;
|
||||
for(i = 1;i < (nbits + 15);i++)
|
||||
{
|
||||
canstream[j++] = stream[i];
|
||||
//determine position of flipped bit
|
||||
if(i == bitpos)
|
||||
errpos = j - 1;
|
||||
if(prev_bit == stream[i])
|
||||
{
|
||||
if(!samebits)
|
||||
samebits = 2;
|
||||
else
|
||||
samebits++;
|
||||
|
||||
if(samebits == 5)
|
||||
{
|
||||
if(errCfg != STUFF_BITS_ERR)
|
||||
canstream[j++] = (stream[i] == 1) ? 0:1;
|
||||
samebits = 0;
|
||||
nstuffbits++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
samebits = 0;
|
||||
}
|
||||
prev_bit = canstream[j - 1];
|
||||
}
|
||||
stuffbits = nstuffbits;
|
||||
i = 0;
|
||||
nxtBit = canstream[i];
|
||||
while(nxtBit == 0 || nxtBit == 1)
|
||||
nxtBit=canstream[i++];
|
||||
nbits=--i;
|
||||
|
||||
// Append 20 recessive bits at the end of the bitstream
|
||||
for(i = 0;i < 14;i++)
|
||||
if(i==0)
|
||||
canstream[nbits + i] = 0;
|
||||
else
|
||||
canstream[nbits + i] = 1;
|
||||
|
||||
// format stream as 32-bit location
|
||||
for(i = 0;i <(nbits + 14);i++)
|
||||
{
|
||||
if(CAN_EMULATION_MODE==CAN_GPIO_MODE)
|
||||
{
|
||||
if(gpio <= 15)
|
||||
{
|
||||
canstream[i] = (canstream[i]==1)?(uint32_t)(1 << gpio):0;
|
||||
}
|
||||
if(gpio > 15 && gpio <= 31)
|
||||
{
|
||||
canstream[i] =
|
||||
(canstream[i]==1) ?
|
||||
(uint32_t)(0x10000 << (gpio - 16)) : 0;
|
||||
|
||||
}
|
||||
if(gpio > 31 && gpio <= 44)
|
||||
{
|
||||
canstream[i] =
|
||||
(canstream[i] == 1) ?(uint32_t)( 1 << (gpio - 32)):0;
|
||||
}
|
||||
}
|
||||
else
|
||||
canstream[i] = (canstream[i]==0) ?
|
||||
GPIO_PIN_TYPE_INVERT : GPIO_PIN_TYPE_STD;
|
||||
|
||||
}
|
||||
|
||||
return (nbits + 14);
|
||||
}
|
||||
|
||||
//
|
||||
// initCPUTimers - This function initializes all three CPU timers
|
||||
// to a known state.
|
||||
//
|
||||
void
|
||||
initCPUTimers(void)
|
||||
{
|
||||
//
|
||||
// Initialize timer period to maximum
|
||||
//
|
||||
CPUTimer_setPeriod(CPUTIMER0_BASE, 0xFFFFFFFF);
|
||||
|
||||
//
|
||||
// Initialize pre-scale counter to divide by 1 (SYSCLKOUT)
|
||||
//
|
||||
CPUTimer_setPreScaler(CPUTIMER0_BASE, 0);
|
||||
|
||||
//
|
||||
// Make sure timer is stopped
|
||||
//
|
||||
CPUTimer_stopTimer(CPUTIMER0_BASE);
|
||||
|
||||
//
|
||||
// Reload all counter register with period value
|
||||
//
|
||||
CPUTimer_reloadTimerCounter(CPUTIMER0_BASE);
|
||||
|
||||
}
|
||||
|
||||
//
|
||||
// configCPUTimer - This function initializes the selected timer to the
|
||||
// period specified by the "freq" and "period" parameters. The "freq" is
|
||||
// entered as Hz and the period in uSeconds. The timer is held in the stopped
|
||||
// state after configuration.
|
||||
//
|
||||
void
|
||||
configCPUTimer(uint32_t cpuTimer, float freq, float bitrate)
|
||||
{
|
||||
uint32_t temp;
|
||||
|
||||
//
|
||||
// Initialize timer period:
|
||||
//
|
||||
temp = (uint32_t)(freq / bitrate);
|
||||
CPUTimer_setPeriod(cpuTimer, temp);
|
||||
|
||||
//
|
||||
// Set pre-scale counter to divide by 1 (SYSCLKOUT):
|
||||
//
|
||||
CPUTimer_setPreScaler(cpuTimer, 0);
|
||||
|
||||
//
|
||||
// Initializes timer control register. The timer is stopped, reloaded,
|
||||
// free run disabled, and interrupt enabled.
|
||||
// Additionally, the free and soft bits are set
|
||||
//
|
||||
CPUTimer_stopTimer(cpuTimer);
|
||||
CPUTimer_reloadTimerCounter(cpuTimer);
|
||||
CPUTimer_setEmulationMode(cpuTimer,
|
||||
CPUTIMER_EMULATIONMODE_STOPAFTERNEXTDECREMENT);
|
||||
CPUTimer_enableInterrupt(cpuTimer);
|
||||
|
||||
}
|
||||
|
||||
__interrupt void
|
||||
canaISR(void)
|
||||
{
|
||||
uint32_t status;
|
||||
|
||||
//
|
||||
// Read the CAN-A interrupt status to find the cause of the interrupt
|
||||
//
|
||||
status = CAN_getInterruptCause(CANA_BASE);
|
||||
|
||||
//
|
||||
// If the cause is a controller status interrupt, then get the status
|
||||
//
|
||||
if(status == CAN_INT_INT0ID_STATUS)
|
||||
{
|
||||
//
|
||||
// Read the controller status. This will return a field of status
|
||||
// error bits that can indicate various errors. Error processing
|
||||
// is not done in this example for simplicity. Refer to the
|
||||
// API documentation for details about the error status bits.
|
||||
// The act of reading this status will clear the interrupt.
|
||||
//
|
||||
status = CAN_getStatus(CANA_BASE);
|
||||
// uncomment below in order to inspect LEC in CAN_ES
|
||||
//ESTOP0;
|
||||
|
||||
|
||||
//
|
||||
// Check to see if an error occurred.
|
||||
//
|
||||
if(((status & ~(CAN_STATUS_RXOK)) != CAN_STATUS_LEC_MSK) &&
|
||||
((status & ~(CAN_STATUS_RXOK)) != CAN_STATUS_LEC_NONE))
|
||||
{
|
||||
//
|
||||
// Set a flag to indicate some errors may have occurred.
|
||||
//
|
||||
errorFlag = 1;
|
||||
// uncomment below in order to inspect LEC in CAN_ES if error occurs
|
||||
//ESTOP0;
|
||||
}
|
||||
}
|
||||
//
|
||||
// Check if the cause is the CAN-B receive message object 1
|
||||
//
|
||||
else if(status == RX_MSG_OBJ_ID)
|
||||
{
|
||||
//
|
||||
// Get the received message
|
||||
//
|
||||
CAN_readMessage(CANA_BASE, RX_MSG_OBJ_ID, rxMsgData);
|
||||
|
||||
//
|
||||
// Getting to this point means that the RX interrupt occurred on
|
||||
// message object 1, and the message RX is complete. Clear the
|
||||
// message object interrupt.
|
||||
//
|
||||
CAN_clearInterruptStatus(CANA_BASE, RX_MSG_OBJ_ID);
|
||||
|
||||
//
|
||||
// Increment a counter to keep track of how many messages have been
|
||||
// received. In a real application this could be used to set flags to
|
||||
// indicate when a message is received.
|
||||
//
|
||||
rxMsgCount++;
|
||||
|
||||
//
|
||||
// Since the message was received, clear any error flags.
|
||||
//
|
||||
errorFlag = 0;
|
||||
}
|
||||
//
|
||||
// If something unexpected caused the interrupt, this would handle it.
|
||||
//
|
||||
else
|
||||
{
|
||||
//
|
||||
// Spurious interrupt handling can go here.
|
||||
//
|
||||
}
|
||||
|
||||
//
|
||||
// Clear the global interrupt flag for the CAN interrupt line
|
||||
//
|
||||
CAN_clearGlobalInterruptStatus(CANA_BASE, CAN_GLOBAL_INT_CANINT0);
|
||||
|
||||
//
|
||||
// Acknowledge this interrupt located in group 9
|
||||
//
|
||||
Interrupt_clearACKGroup(INTERRUPT_ACK_GROUP9);
|
||||
//ESTOP0;
|
||||
|
||||
}
|
||||
|
||||
//
|
||||
// cpuTimer0ISR - Counter for CpuTimer0
|
||||
//
|
||||
__interrupt void
|
||||
cpuTimer0ISR(void)
|
||||
{
|
||||
|
||||
//
|
||||
// Write canstream data to GPIO port selected
|
||||
//
|
||||
if (CAN_EMULATION_MODE == CAN_GPIO_MODE)
|
||||
GPIO_writePortData((GPIO_Port)GPIOPORT, canstream[canBit++]);
|
||||
else
|
||||
GPIO_setPadConfig(GPIORX_PIN, canstream[canBit++]);
|
||||
//
|
||||
// Acknowledge this interrupt to receive more interrupts from group 1
|
||||
//
|
||||
Interrupt_clearACKGroup(INTERRUPT_ACK_GROUP1);
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// End of File
|
||||
//
|
||||
@@ -0,0 +1,201 @@
|
||||
//#############################################################################
|
||||
//
|
||||
// FILE: can_ex1_loopback.c
|
||||
//
|
||||
// TITLE: CAN External Loopback Example
|
||||
//
|
||||
//! \addtogroup driver_example_list
|
||||
//! <h1> CAN External Loopback </h1>
|
||||
//!
|
||||
//! This example shows the basic setup of CAN in order to transmit and receive
|
||||
//! messages on the CAN bus. The CAN peripheral is configured to transmit
|
||||
//! messages with a specific CAN ID. A message is then transmitted once per
|
||||
//! second, using a simple delay loop for timing. The message that is sent is
|
||||
//! a 2 byte message that contains an incrementing pattern.
|
||||
//!
|
||||
//! This example sets up the CAN controller in External Loopback test mode.
|
||||
//! Data transmitted is visible on the CANTXA pin and is received internally
|
||||
//! back to the CAN Core. Please refer to details of the External Loopback
|
||||
//! Test Mode in the CAN Chapter in the Technical Reference Manual.
|
||||
//!
|
||||
//! \b External \b Connections \n
|
||||
//! - None.
|
||||
//!
|
||||
//! \b Watch \b Variables \n
|
||||
//! - msgCount - A counter for the number of successful messages received
|
||||
//! - txMsgData - An array with the data being sent
|
||||
//! - rxMsgData - An array with the data that was received
|
||||
//!
|
||||
//
|
||||
//#############################################################################
|
||||
//
|
||||
//
|
||||
// $Copyright:
|
||||
// Copyright (C) 2013-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"
|
||||
|
||||
//
|
||||
// Defines
|
||||
//
|
||||
#define MSG_DATA_LENGTH 2
|
||||
|
||||
//
|
||||
// Globals
|
||||
//
|
||||
volatile unsigned long msgCount = 0;
|
||||
|
||||
//
|
||||
// Main
|
||||
//
|
||||
void main(void)
|
||||
{
|
||||
uint16_t txMsgData[2], rxMsgData[2];
|
||||
|
||||
//
|
||||
// Initialize device clock and peripherals
|
||||
//
|
||||
Device_init();
|
||||
|
||||
//
|
||||
// Initialize GPIO and configure GPIO pins for CANTX/CANRX
|
||||
//
|
||||
Device_initGPIO();
|
||||
|
||||
//
|
||||
// Board initialization
|
||||
//
|
||||
Board_init();
|
||||
|
||||
//
|
||||
// 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();
|
||||
|
||||
//
|
||||
// Enable Global Interrupt (INTM) and realtime interrupt (DBGM)
|
||||
//
|
||||
EINT;
|
||||
ERTM;
|
||||
|
||||
//
|
||||
// Start CAN module operations
|
||||
//
|
||||
CAN_startModule(myCAN0_BASE);
|
||||
|
||||
//
|
||||
// Setup send and receive buffers
|
||||
//
|
||||
txMsgData[0] = 0x01;
|
||||
txMsgData[1] = 0x02;
|
||||
*(uint16_t *)rxMsgData = 0;
|
||||
|
||||
//
|
||||
// Loop Forever - Send and Receive data continuously
|
||||
//
|
||||
for(;;)
|
||||
{
|
||||
//
|
||||
// Send CAN message data from message object 1
|
||||
//
|
||||
CAN_sendMessage(myCAN0_BASE, 1, MSG_DATA_LENGTH, txMsgData);
|
||||
|
||||
//
|
||||
// Delay before receiving the data
|
||||
//
|
||||
DEVICE_DELAY_US(500000);
|
||||
|
||||
//
|
||||
// Read CAN message object 2 and check for new data
|
||||
//
|
||||
if (CAN_readMessage(myCAN0_BASE, 2, rxMsgData))
|
||||
{
|
||||
//
|
||||
// Check that received data matches sent data.
|
||||
// Device will halt here during debug if data doesn't match.
|
||||
//
|
||||
if((txMsgData[0] != rxMsgData[0]) ||
|
||||
(txMsgData[1] != rxMsgData[1]))
|
||||
{
|
||||
asm(" ESTOP0");
|
||||
}
|
||||
else
|
||||
{
|
||||
//
|
||||
// Increment message received counter
|
||||
//
|
||||
msgCount++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//
|
||||
// Device will halt here during debug if no new data was received.
|
||||
//
|
||||
asm(" ESTOP0");
|
||||
}
|
||||
|
||||
//
|
||||
// Increment the value in the transmitted message data.
|
||||
//
|
||||
txMsgData[0] += 0x01;
|
||||
txMsgData[1] += 0x01;
|
||||
|
||||
//
|
||||
// Reset data if exceeds a byte
|
||||
//
|
||||
if(txMsgData[0] > 0xFF)
|
||||
{
|
||||
txMsgData[0] = 0;
|
||||
}
|
||||
if(txMsgData[1] > 0xFF)
|
||||
{
|
||||
txMsgData[1] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// End of File
|
||||
//
|
||||
@@ -0,0 +1,21 @@
|
||||
/**
|
||||
* Import the modules used in this configuration.
|
||||
*/
|
||||
const can = scripting.addModule("/driverlib/can.js", {}, false);
|
||||
const can1 = can.addInstance();
|
||||
|
||||
/**
|
||||
* Write custom configuration values to the imported modules.
|
||||
*/
|
||||
can1.$name = "myCAN0";
|
||||
can1.enableLoopback = true;
|
||||
can1.loopbackMode = "CAN_TEST_EXL";
|
||||
can1.msgObjs = 2;
|
||||
can1.msgObj1.$name = "msgObj0";
|
||||
can1.msgObj1.msgID = 660;
|
||||
can1.msgObj1.msgType = "CAN_MSG_OBJ_TYPE_TX";
|
||||
can1.msgObj1.msgLen = 2;
|
||||
can1.msgObj2.$name = "msgObj1";
|
||||
can1.msgObj2.msgID = 660;
|
||||
can1.msgObj2.msgType = "CAN_MSG_OBJ_TYPE_RX";
|
||||
can1.msgObj2.msgLen = 2;
|
||||
@@ -0,0 +1,406 @@
|
||||
//#############################################################################
|
||||
//
|
||||
// FILE: can_ex2_loopback_interrupts.c
|
||||
//
|
||||
// TITLE: CAN External Loopback with Interrupts Example
|
||||
//
|
||||
//! \addtogroup driver_example_list
|
||||
//! <h1> CAN External Loopback with Interrupts </h1>
|
||||
//!
|
||||
//! This example shows the basic setup of CAN in order to transmit and receive
|
||||
//! messages on the CAN bus. The CAN peripheral is configured to transmit
|
||||
//! messages with a specific CAN ID. A message is then transmitted once per
|
||||
//! second, using a simple delay loop for timing. The message that is sent is
|
||||
//! a 4 byte message that contains an incrementing pattern. A CAN interrupt
|
||||
//! handler is used to confirm message transmission and count the number of
|
||||
//! messages that have been sent.
|
||||
//!
|
||||
//! This example sets up the CAN controller in External Loopback test mode.
|
||||
//! Data transmitted is visible on the CANTXA pin and is received internally
|
||||
//! back to the CAN Core. CAN-B module is not involved.
|
||||
//!
|
||||
//! Note: "External" loopback does not mean the loopback is done externally.
|
||||
//! The loopback is done internally, but the transmitted data can be seen
|
||||
//! externally on the CANTX pin.
|
||||
//!
|
||||
//! \b External \b Connections \n
|
||||
//! - None. (Transmitting node generates its own ACK)
|
||||
//!
|
||||
//! \b Watch \b Variables \n
|
||||
//! - txMsgCount - A counter for the number of messages sent
|
||||
//! - rxMsgCount - A counter for the number of messages received
|
||||
//! - txMsgData - An array with the data being sent
|
||||
//! - rxMsgData - An array with the data that was received
|
||||
//! - errorFlag - A flag that indicates an error has occurred
|
||||
//!
|
||||
//
|
||||
//#############################################################################
|
||||
//
|
||||
//
|
||||
// $Copyright:
|
||||
// Copyright (C) 2013-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"
|
||||
|
||||
//
|
||||
// Defines
|
||||
//
|
||||
#define MSG_DATA_LENGTH 4
|
||||
#define TX_MSG_OBJ_ID 1
|
||||
#define RX_MSG_OBJ_ID 2
|
||||
|
||||
//
|
||||
// Globals
|
||||
//
|
||||
volatile uint32_t txMsgCount = 0;
|
||||
volatile uint32_t rxMsgCount = 0;
|
||||
volatile uint32_t errorFlag = 0;
|
||||
uint16_t txMsgData[4];
|
||||
uint16_t rxMsgData[4];
|
||||
|
||||
//
|
||||
// Function Prototypes
|
||||
//
|
||||
__interrupt void canISR(void);
|
||||
|
||||
//
|
||||
// Main
|
||||
//
|
||||
void main(void)
|
||||
{
|
||||
//
|
||||
// Initialize device clock and peripherals
|
||||
//
|
||||
Device_init();
|
||||
|
||||
//
|
||||
// Initialize GPIO and configure GPIO pins for CANTX/CANRX
|
||||
//
|
||||
Device_initGPIO();
|
||||
GPIO_setPinConfig(DEVICE_GPIO_CFG_CANRXA);
|
||||
GPIO_setPinConfig(DEVICE_GPIO_CFG_CANTXA);
|
||||
|
||||
//
|
||||
// Initialize the CAN controller
|
||||
//
|
||||
// Puts the module in Initialization mode, Disables the parity function
|
||||
// Initializes the MBX RAM, Initiates a S/W reset of the module
|
||||
// Seeks write-access to configuration registers.
|
||||
//
|
||||
CAN_initModule(CANA_BASE);
|
||||
|
||||
//
|
||||
// Set up the CAN bus bit rate to 500 kbps
|
||||
// Refer to the Driver Library User Guide for information on how to set
|
||||
// tighter timing control. Additionally, consult the device data sheet
|
||||
// for more information about the CAN module clocking.
|
||||
//
|
||||
CAN_setBitRate(CANA_BASE, DEVICE_SYSCLK_FREQ, 500000, 20);
|
||||
|
||||
//
|
||||
// Enable interrupts on the CAN peripheral.
|
||||
// Enables Interrupt line 0, Error & Status Change interrupts in CAN_CTL
|
||||
// register.
|
||||
//
|
||||
CAN_enableInterrupt(CANA_BASE, CAN_INT_IE0 | CAN_INT_ERROR |
|
||||
CAN_INT_STATUS);
|
||||
|
||||
//
|
||||
// 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();
|
||||
|
||||
//
|
||||
// Enable Global Interrupt (INTM) and realtime interrupt (DBGM)
|
||||
//
|
||||
EINT;
|
||||
ERTM;
|
||||
|
||||
//
|
||||
// Interrupts that are used in this example are re-mapped to
|
||||
// ISR functions found within this file.
|
||||
// This registers the interrupt handler in PIE vector table.
|
||||
//
|
||||
Interrupt_register(INT_CANA0, &canISR);
|
||||
|
||||
//
|
||||
// Enable the CAN interrupt signal
|
||||
//
|
||||
Interrupt_enable(INT_CANA0);
|
||||
CAN_enableGlobalInterrupt(CANA_BASE, CAN_GLOBAL_INT_CANINT0);
|
||||
|
||||
//
|
||||
// Enable CAN test mode with external loopback
|
||||
//
|
||||
CAN_enableTestMode(CANA_BASE, CAN_TEST_EXL);
|
||||
|
||||
//
|
||||
// Initialize the transmit message object used for sending CAN messages.
|
||||
// Message Object Parameters:
|
||||
// Message Object ID Number: 1
|
||||
// Message Identifier: 0x1
|
||||
// Message Frame: Standard
|
||||
// Message Type: Transmit
|
||||
// Message ID Mask: 0x0
|
||||
// Message Object Flags: Transmit Interrupt
|
||||
// Message Data Length: 4 Bytes
|
||||
//
|
||||
CAN_setupMessageObject(CANA_BASE, TX_MSG_OBJ_ID, 0x1, CAN_MSG_FRAME_STD,
|
||||
CAN_MSG_OBJ_TYPE_TX, 0, CAN_MSG_OBJ_TX_INT_ENABLE,
|
||||
MSG_DATA_LENGTH);
|
||||
|
||||
//
|
||||
// Initialize the receive message object used for receiving CAN messages.
|
||||
// Message Object Parameters:
|
||||
// Message Object ID Number: 2
|
||||
// Message Identifier: 0x1
|
||||
// Message Frame: Standard
|
||||
// Message Type: Receive
|
||||
// Message ID Mask: 0x0
|
||||
// Message Object Flags: Receive Interrupt
|
||||
// Message Data Length: 4 Bytes (Note that DLC field is a "don't care"
|
||||
// for a Receive mailbox)
|
||||
//
|
||||
CAN_setupMessageObject(CANA_BASE, RX_MSG_OBJ_ID, 0x1, CAN_MSG_FRAME_STD,
|
||||
CAN_MSG_OBJ_TYPE_RX, 0, CAN_MSG_OBJ_RX_INT_ENABLE,
|
||||
MSG_DATA_LENGTH);
|
||||
|
||||
//
|
||||
// Initialize the transmit message object data buffer to be sent
|
||||
//
|
||||
txMsgData[0] = 0x12;
|
||||
txMsgData[1] = 0x34;
|
||||
txMsgData[2] = 0x56;
|
||||
txMsgData[3] = 0x78;
|
||||
|
||||
//
|
||||
// Start CAN module operations
|
||||
//
|
||||
CAN_startModule(CANA_BASE);
|
||||
|
||||
//
|
||||
// Loop Forever - A new message will be sent once per second.
|
||||
//
|
||||
for(;;)
|
||||
{
|
||||
//
|
||||
// Check the error flag to see if errors occurred
|
||||
//
|
||||
if(errorFlag)
|
||||
{
|
||||
Example_Fail = 1;
|
||||
asm(" ESTOP0");
|
||||
}
|
||||
|
||||
//
|
||||
// Verify that the number of transmitted messages equal the number of
|
||||
// messages received before sending a new message
|
||||
//
|
||||
if(txMsgCount == rxMsgCount)
|
||||
{
|
||||
CAN_sendMessage(CANA_BASE, TX_MSG_OBJ_ID, MSG_DATA_LENGTH,
|
||||
txMsgData);
|
||||
|
||||
Example_PassCount++;
|
||||
}
|
||||
else
|
||||
{
|
||||
errorFlag = 1;
|
||||
}
|
||||
|
||||
//
|
||||
// Delay 1 second before continuing
|
||||
//
|
||||
DEVICE_DELAY_US(1000000);
|
||||
|
||||
//
|
||||
// Increment the value in the transmitted message data.
|
||||
//
|
||||
txMsgData[0] += 0x01;
|
||||
txMsgData[1] += 0x01;
|
||||
txMsgData[2] += 0x01;
|
||||
txMsgData[3] += 0x01;
|
||||
|
||||
//
|
||||
// Reset data if exceeds a byte
|
||||
//
|
||||
if(txMsgData[0] > 0xFF)
|
||||
{
|
||||
txMsgData[0] = 0;
|
||||
}
|
||||
if(txMsgData[1] > 0xFF)
|
||||
{
|
||||
txMsgData[1] = 0;
|
||||
}
|
||||
if(txMsgData[2] > 0xFF)
|
||||
{
|
||||
txMsgData[2] = 0;
|
||||
}
|
||||
if(txMsgData[3] > 0xFF)
|
||||
{
|
||||
txMsgData[3] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// CAN ISR - The interrupt service routine called when a CAN interrupt is
|
||||
// triggered. It checks for the cause of the interrupt, and
|
||||
// maintains a count of all messages that have been transmitted.
|
||||
//
|
||||
__interrupt void
|
||||
canISR(void)
|
||||
{
|
||||
uint32_t status;
|
||||
|
||||
//
|
||||
// Read the CAN interrupt status to find the cause of the interrupt
|
||||
//
|
||||
status = CAN_getInterruptCause(CANA_BASE);
|
||||
|
||||
//
|
||||
// If the cause is a controller status interrupt, then get the status
|
||||
//
|
||||
if(status == CAN_INT_INT0ID_STATUS)
|
||||
{
|
||||
//
|
||||
// Read the controller status. This will return a field of status
|
||||
// error bits that can indicate various errors. Error processing
|
||||
// is not done in this example for simplicity. Refer to the
|
||||
// API documentation for details about the error status bits.
|
||||
// The act of reading this status will clear the interrupt.
|
||||
//
|
||||
status = CAN_getStatus(CANA_BASE);
|
||||
|
||||
//
|
||||
// Check to see if an error occurred.
|
||||
//
|
||||
if(((status & ~(CAN_STATUS_TXOK | CAN_STATUS_RXOK)) != 7) &&
|
||||
((status & ~(CAN_STATUS_TXOK | CAN_STATUS_RXOK)) != 0))
|
||||
{
|
||||
//
|
||||
// Set a flag to indicate some errors may have occurred.
|
||||
//
|
||||
errorFlag = 1;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Check if the cause is the transmit message object 1
|
||||
//
|
||||
else if(status == TX_MSG_OBJ_ID)
|
||||
{
|
||||
//
|
||||
// Getting to this point means that the TX interrupt occurred on
|
||||
// message object 1, and the message TX is complete. Clear the
|
||||
// message object interrupt.
|
||||
//
|
||||
CAN_clearInterruptStatus(CANA_BASE, TX_MSG_OBJ_ID);
|
||||
|
||||
//
|
||||
// Increment a counter to keep track of how many messages have been
|
||||
// sent. In a real application this could be used to set flags to
|
||||
// indicate when a message is sent.
|
||||
//
|
||||
txMsgCount++;
|
||||
|
||||
//
|
||||
// Since the message was sent, clear any error flags.
|
||||
//
|
||||
errorFlag = 0;
|
||||
}
|
||||
|
||||
//
|
||||
// Check if the cause is the receive message object 2
|
||||
//
|
||||
else if(status == RX_MSG_OBJ_ID)
|
||||
{
|
||||
//
|
||||
// Get the received message
|
||||
//
|
||||
CAN_readMessage(CANA_BASE, RX_MSG_OBJ_ID, rxMsgData);
|
||||
|
||||
//
|
||||
// Getting to this point means that the RX interrupt occurred on
|
||||
// message object 2, and the message RX is complete. Clear the
|
||||
// message object interrupt.
|
||||
//
|
||||
CAN_clearInterruptStatus(CANA_BASE, RX_MSG_OBJ_ID);
|
||||
|
||||
//
|
||||
// Increment a counter to keep track of how many messages have been
|
||||
// received. In a real application this could be used to set flags to
|
||||
// indicate when a message is received.
|
||||
//
|
||||
rxMsgCount++;
|
||||
|
||||
//
|
||||
// Since the message was received, clear any error flags.
|
||||
//
|
||||
errorFlag = 0;
|
||||
}
|
||||
|
||||
//
|
||||
// If something unexpected caused the interrupt, this would handle it.
|
||||
//
|
||||
else
|
||||
{
|
||||
//
|
||||
// Spurious interrupt handling can go here.
|
||||
//
|
||||
}
|
||||
|
||||
//
|
||||
// Clear the global interrupt flag for the CAN interrupt line
|
||||
//
|
||||
CAN_clearGlobalInterruptStatus(CANA_BASE, CAN_GLOBAL_INT_CANINT0);
|
||||
|
||||
//
|
||||
// Acknowledge this interrupt located in group 9
|
||||
//
|
||||
Interrupt_clearACKGroup(INTERRUPT_ACK_GROUP9);
|
||||
}
|
||||
|
||||
//
|
||||
// End of File
|
||||
//
|
||||
@@ -0,0 +1,397 @@
|
||||
//#############################################################################
|
||||
//
|
||||
// FILE: can_ex3_external_transmit.c
|
||||
//
|
||||
// TITLE: CAN External Transmit Example
|
||||
//
|
||||
//! \addtogroup driver_example_list
|
||||
//! <h1> CAN-A to CAN-B External Transmit </h1>
|
||||
//!
|
||||
//! This example initializes CAN module A and CAN module B for external
|
||||
//! communication. CAN-A module is setup to transmit incrementing data for "n"
|
||||
//! number of times to the CAN-B module, where "n" is the value of TXCOUNT.
|
||||
//! CAN-B module is setup to trigger an interrupt service routine (ISR) when
|
||||
//! data is received. An error flag will be set if the transmitted data doesn't
|
||||
//! match the received data.
|
||||
//!
|
||||
//! \note Both CAN modules on the device need to be
|
||||
//! connected to each other via CAN transceivers. GPIOs will be different
|
||||
//! on Launchpad.
|
||||
//!
|
||||
//! \b Hardware \b Required \n
|
||||
//! - A C2000 board with two CAN transceivers
|
||||
//!
|
||||
//! \b External \b Connections \n
|
||||
//! - ControlCARD CANA is on GPIO31 (CANTXA) and GPIO30 (CANRXA)
|
||||
//! - ControlCARD CANB is on GPIO8 (CANTXB) and GPIO10 (CANRXB)
|
||||
//!
|
||||
//!
|
||||
//! \b Watch \b Variables \n
|
||||
//! - TXCOUNT - Adjust to set the number of messages to be transmitted
|
||||
//! - txMsgCount - A counter for the number of messages sent
|
||||
//! - rxMsgCount - A counter for the number of messages received
|
||||
//! - txMsgData - An array with the data being sent
|
||||
//! - rxMsgData - An array with the data that was received
|
||||
//! - errorFlag - A flag that indicates an error has occurred
|
||||
//!
|
||||
//
|
||||
//#############################################################################
|
||||
//
|
||||
// $Release Date: $
|
||||
// $Copyright:
|
||||
// Copyright (C) 2013-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"
|
||||
|
||||
//
|
||||
// Defines
|
||||
//
|
||||
#define TXCOUNT 100
|
||||
#define MSG_DATA_LENGTH 4
|
||||
#define TX_MSG_OBJ_ID 1
|
||||
#define RX_MSG_OBJ_ID 1
|
||||
|
||||
//
|
||||
// Globals
|
||||
//
|
||||
volatile unsigned long i;
|
||||
volatile uint32_t txMsgCount = 0;
|
||||
volatile uint32_t rxMsgCount = 0;
|
||||
volatile uint32_t errorFlag = 0;
|
||||
uint16_t txMsgData[4];
|
||||
uint16_t rxMsgData[4];
|
||||
|
||||
//
|
||||
// Function Prototypes
|
||||
//
|
||||
__interrupt void canbISR(void); // Receive interrupt for CAN-B.
|
||||
// No Transmit interrupt for CAN-A
|
||||
//
|
||||
// Main
|
||||
//
|
||||
void main(void)
|
||||
{
|
||||
//
|
||||
// Initialize device clock and peripherals
|
||||
//
|
||||
Device_init();
|
||||
|
||||
//
|
||||
// Initialize GPIO and configure GPIO pins for CANTX/CANRX
|
||||
// on module A and B. The device.h file may need to be modified to
|
||||
// reflect the chosen GPIO pins in your board.
|
||||
//
|
||||
Device_initGPIO();
|
||||
GPIO_setPinConfig(DEVICE_GPIO_CFG_CANRXA);
|
||||
GPIO_setPinConfig(DEVICE_GPIO_CFG_CANTXA);
|
||||
GPIO_setPinConfig(DEVICE_GPIO_CFG_CANRXB);
|
||||
GPIO_setPinConfig(DEVICE_GPIO_CFG_CANTXB);
|
||||
|
||||
//
|
||||
// Initialize the CAN controllers
|
||||
//
|
||||
CAN_initModule(CANA_BASE);
|
||||
CAN_initModule(CANB_BASE);
|
||||
|
||||
//
|
||||
// Set up the CAN bus bit rate to 500kHz for each module
|
||||
// Refer to the Driver Library User Guide for information on how to set
|
||||
// tighter timing control. Additionally, consult the device data sheet
|
||||
// for more information about the CAN module clocking.
|
||||
//
|
||||
CAN_setBitRate(CANA_BASE, DEVICE_SYSCLK_FREQ, 500000, 20);
|
||||
CAN_setBitRate(CANB_BASE, DEVICE_SYSCLK_FREQ, 500000, 20);
|
||||
|
||||
//
|
||||
// Enable interrupts on the CAN B peripheral.
|
||||
// Enables Int.line0, Error & Status Change interrupts
|
||||
//
|
||||
CAN_enableInterrupt(CANB_BASE, CAN_INT_IE0 | CAN_INT_ERROR |
|
||||
CAN_INT_STATUS);
|
||||
|
||||
//
|
||||
// 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();
|
||||
|
||||
//
|
||||
// Enable Global Interrupt (INTM) and realtime interrupt (DBGM)
|
||||
//
|
||||
EINT;
|
||||
ERTM;
|
||||
|
||||
//
|
||||
// Interrupts that are used in this example are re-mapped to
|
||||
// ISR functions found within this file.
|
||||
// This registers the interrupt handler in PIE vector table.
|
||||
//
|
||||
Interrupt_register(INT_CANB0, &canbISR);
|
||||
|
||||
//
|
||||
// Enable the CAN-B interrupt signal
|
||||
//
|
||||
Interrupt_enable(INT_CANB0);
|
||||
|
||||
//
|
||||
// Set GLBINT0_EN bit in CAN_GLB_INT_EN register
|
||||
//
|
||||
CAN_enableGlobalInterrupt(CANB_BASE, CAN_GLOBAL_INT_CANINT0);
|
||||
|
||||
//
|
||||
// Initialize the transmit message object used for sending CAN messages.
|
||||
// Message Object Parameters:
|
||||
// CAN Module: A
|
||||
// Message Object ID Number: 1
|
||||
// Message Identifier: 0x95555555
|
||||
// Message Frame: Extended
|
||||
// Message Type: Transmit
|
||||
// Message ID Mask: 0x0
|
||||
// Message Object Flags: None
|
||||
// Message Data Length: 4 Bytes
|
||||
// No interrupts are enabled for the Transmit side
|
||||
//
|
||||
CAN_setupMessageObject(CANA_BASE, TX_MSG_OBJ_ID, 0x95555555,
|
||||
CAN_MSG_FRAME_EXT, CAN_MSG_OBJ_TYPE_TX, 0,
|
||||
CAN_MSG_OBJ_NO_FLAGS, MSG_DATA_LENGTH);
|
||||
|
||||
//
|
||||
// Initialize the receive message object used for receiving CAN messages.
|
||||
// Message Object Parameters:
|
||||
// CAN Module: B
|
||||
// Message Object ID Number: 1
|
||||
// Message Identifier: 0x95555555
|
||||
// Message Frame: Extended
|
||||
// Message Type: Receive
|
||||
// Message ID Mask: 0x0
|
||||
// Message Object Flags: Receive Interrupt
|
||||
// Message Data Length: 4 Bytes (Note that DLC field is a "don't care"
|
||||
// for a Receive mailbox)
|
||||
//
|
||||
CAN_setupMessageObject(CANB_BASE, RX_MSG_OBJ_ID, 0x95555555,
|
||||
CAN_MSG_FRAME_EXT, CAN_MSG_OBJ_TYPE_RX, 0,
|
||||
CAN_MSG_OBJ_RX_INT_ENABLE, MSG_DATA_LENGTH);
|
||||
|
||||
//
|
||||
// Initialize the transmit message object data buffer to be sent
|
||||
//
|
||||
txMsgData[0] = 0x12;
|
||||
txMsgData[1] = 0x34;
|
||||
txMsgData[2] = 0x56;
|
||||
txMsgData[3] = 0x78;
|
||||
|
||||
//
|
||||
// Start CAN module A and B operations
|
||||
//
|
||||
CAN_startModule(CANA_BASE);
|
||||
CAN_startModule(CANB_BASE);
|
||||
|
||||
//
|
||||
// Transmit messages from CAN-A to CAN-B
|
||||
//
|
||||
for(i = 0; i < TXCOUNT; i++)
|
||||
{
|
||||
//
|
||||
// Check the error flag to see if errors occurred
|
||||
//
|
||||
if(errorFlag)
|
||||
{
|
||||
asm(" ESTOP0");
|
||||
}
|
||||
|
||||
//
|
||||
// Verify that the number of transmitted messages equal the number of
|
||||
// messages received before sending a new message
|
||||
//
|
||||
if(txMsgCount == rxMsgCount)
|
||||
{
|
||||
CAN_sendMessage(CANA_BASE, TX_MSG_OBJ_ID, MSG_DATA_LENGTH,
|
||||
txMsgData);
|
||||
txMsgCount++;
|
||||
}
|
||||
else
|
||||
{
|
||||
errorFlag = 1;
|
||||
}
|
||||
|
||||
//
|
||||
// Delay 0.25 second before continuing
|
||||
//
|
||||
DEVICE_DELAY_US(250000);
|
||||
|
||||
//
|
||||
// Increment the value in the transmitted message data.
|
||||
//
|
||||
txMsgData[0] += 0x01;
|
||||
txMsgData[1] += 0x01;
|
||||
txMsgData[2] += 0x01;
|
||||
txMsgData[3] += 0x01;
|
||||
|
||||
//
|
||||
// Reset data if exceeds a byte
|
||||
//
|
||||
if(txMsgData[0] > 0xFF)
|
||||
{
|
||||
txMsgData[0] = 0;
|
||||
}
|
||||
if(txMsgData[1] > 0xFF)
|
||||
{
|
||||
txMsgData[1] = 0;
|
||||
}
|
||||
if(txMsgData[2] > 0xFF)
|
||||
{
|
||||
txMsgData[2] = 0;
|
||||
}
|
||||
if(txMsgData[3] > 0xFF)
|
||||
{
|
||||
txMsgData[3] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Stop application
|
||||
//
|
||||
asm(" ESTOP0");
|
||||
}
|
||||
|
||||
//
|
||||
// CAN B ISR - The interrupt service routine is called when an interrupt is
|
||||
// triggered on CAN module B. It will be executed twice for every
|
||||
// frame received.
|
||||
// First time for status-change; second time for Mailbox receive.
|
||||
//
|
||||
__interrupt void
|
||||
canbISR(void)
|
||||
{
|
||||
uint32_t status;
|
||||
|
||||
//
|
||||
// Read the CAN-B interrupt status (in the CAN_INT register) to find the
|
||||
// cause of the interrupt
|
||||
//
|
||||
status = CAN_getInterruptCause(CANB_BASE);
|
||||
|
||||
//
|
||||
// If the cause is a controller status interrupt, then get the status.
|
||||
// During first iteration of every ISR execution, status = 0x8000,
|
||||
// which simply means CAN_ES != 0x07.
|
||||
//
|
||||
if(status == CAN_INT_INT0ID_STATUS)
|
||||
{
|
||||
//
|
||||
// Read the controller status. This will return a field of status
|
||||
// error bits that can indicate various errors. Error processing
|
||||
// is not done in this example for simplicity. Refer to the
|
||||
// API documentation for details about the error status bits.
|
||||
// The act of reading this status will clear the interrupt.
|
||||
//
|
||||
status = CAN_getStatus(CANB_BASE); // Return CAN_ES value.
|
||||
//
|
||||
// Now status = 0x00000010, indicating RxOK.
|
||||
//
|
||||
|
||||
//
|
||||
// Check to see if an error occurred.
|
||||
//
|
||||
if(((status & ~(CAN_STATUS_RXOK)) != CAN_STATUS_LEC_MSK) &&
|
||||
((status & ~(CAN_STATUS_RXOK)) != CAN_STATUS_LEC_NONE))
|
||||
{
|
||||
//
|
||||
// Set a flag to indicate some errors may have occurred.
|
||||
//
|
||||
errorFlag = 1;
|
||||
}
|
||||
}
|
||||
//
|
||||
// Check if the cause is the CAN-B receive message object 1. Will be skipped
|
||||
// in the first iteration of every ISR execution
|
||||
//
|
||||
else if(status == RX_MSG_OBJ_ID)
|
||||
{
|
||||
//
|
||||
// Get the received message
|
||||
//
|
||||
CAN_readMessage(CANB_BASE, RX_MSG_OBJ_ID, rxMsgData);
|
||||
|
||||
//
|
||||
// Getting to this point means that the RX interrupt occurred on
|
||||
// message object 1, and the message RX is complete. Clear the
|
||||
// message object interrupt.
|
||||
//
|
||||
CAN_clearInterruptStatus(CANB_BASE, RX_MSG_OBJ_ID);
|
||||
|
||||
//
|
||||
// Increment a counter to keep track of how many messages have been
|
||||
// received. In a real application this could be used to set flags to
|
||||
// indicate when a message is received.
|
||||
//
|
||||
rxMsgCount++;
|
||||
|
||||
//
|
||||
// Since the message was received, clear any error flags.
|
||||
//
|
||||
errorFlag = 0;
|
||||
}
|
||||
//
|
||||
// If something unexpected caused the interrupt, this would handle it.
|
||||
//
|
||||
else
|
||||
{
|
||||
//
|
||||
// Spurious interrupt handling can go here.
|
||||
//
|
||||
}
|
||||
|
||||
//
|
||||
// Clear the global interrupt flag for the CAN interrupt line
|
||||
//
|
||||
CAN_clearGlobalInterruptStatus(CANB_BASE, CAN_GLOBAL_INT_CANINT0);
|
||||
|
||||
//
|
||||
// Acknowledge this interrupt located in group 9
|
||||
//
|
||||
Interrupt_clearACKGroup(INTERRUPT_ACK_GROUP9);
|
||||
}
|
||||
|
||||
//
|
||||
// End of File
|
||||
//
|
||||
@@ -0,0 +1,172 @@
|
||||
//#############################################################################
|
||||
//
|
||||
// FILE: can_ex4_simple_transmit.c
|
||||
//
|
||||
// TITLE: CAN simple External Transmit Example
|
||||
//
|
||||
//! \addtogroup driver_example_list
|
||||
//! <h1> CAN-A External Transmit </h1>
|
||||
//!
|
||||
//! This example initializes CAN module A for external communication.
|
||||
//! CAN-A module is setup to transmit data for "n" number of times,
|
||||
//! where "n" is the value of TXCOUNT. Another CAN node configured for the
|
||||
//! same bit-rate is needed to provide the ACK. No interrupts are used.
|
||||
//!
|
||||
//! \b Hardware \b Required \n
|
||||
//! - A C2000 board with CAN transceiver and another CAN node configured
|
||||
//! for the same bit-rate to provide the ACK.
|
||||
//!
|
||||
//! \b Watch \b Variables \n
|
||||
//! - TXCOUNT - Adjust to set the number of messages to be transmitted
|
||||
//! - txMsgCount - A counter for the number of messages sent
|
||||
//! - txMsgData - An array with the data being sent
|
||||
//!
|
||||
//
|
||||
//#############################################################################
|
||||
// $TI Release: $
|
||||
// $Release Date: $
|
||||
// $Copyright:
|
||||
// Copyright (C) 2013-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"
|
||||
|
||||
//
|
||||
// Defines
|
||||
//
|
||||
#define TXCOUNT 100000
|
||||
#define MSG_DATA_LENGTH 8
|
||||
#define TX_MSG_OBJ_ID 1
|
||||
|
||||
//
|
||||
// Globals
|
||||
//
|
||||
volatile unsigned long i;
|
||||
volatile uint32_t txMsgCount = 0;
|
||||
uint16_t txMsgData[8];
|
||||
|
||||
//
|
||||
// Main
|
||||
//
|
||||
void main(void)
|
||||
{
|
||||
//
|
||||
// Initialize device clock and peripherals
|
||||
//
|
||||
Device_init();
|
||||
|
||||
//
|
||||
// Initialize GPIO and configure GPIO pins for CANTX/CANRX
|
||||
// on module A
|
||||
//
|
||||
Device_initGPIO();
|
||||
GPIO_setPinConfig(DEVICE_GPIO_CFG_CANRXA);
|
||||
GPIO_setPinConfig(DEVICE_GPIO_CFG_CANTXA);
|
||||
|
||||
//
|
||||
// Initialize the CAN controllers
|
||||
//
|
||||
CAN_initModule(CANA_BASE);
|
||||
|
||||
//
|
||||
// Set up the CAN bus bit rate to 500kHz for each module
|
||||
// Refer to the Driver Library User Guide for information on how to set
|
||||
// tighter timing control. Additionally, consult the device data sheet
|
||||
// for more information about the CAN module clocking.
|
||||
//
|
||||
CAN_setBitRate(CANA_BASE, DEVICE_SYSCLK_FREQ, 500000, 16);
|
||||
|
||||
//
|
||||
// Initialize the transmit message object used for sending CAN messages.
|
||||
// Message Object Parameters:
|
||||
// CAN Module: A
|
||||
// Message Object ID Number: 1
|
||||
// Message Identifier: 0x01
|
||||
// Message Frame: Standard
|
||||
// Message Type: Transmit
|
||||
// Message ID Mask: 0x0
|
||||
// Message Object Flags: None
|
||||
// Message Data Length: 4 Bytes
|
||||
//
|
||||
CAN_setupMessageObject(CANA_BASE, TX_MSG_OBJ_ID, 0x1,
|
||||
CAN_MSG_FRAME_STD, CAN_MSG_OBJ_TYPE_TX, 0,
|
||||
CAN_MSG_OBJ_NO_FLAGS, MSG_DATA_LENGTH);
|
||||
|
||||
//
|
||||
// Initialize the transmit message object data buffer to be sent
|
||||
//
|
||||
txMsgData[0] = 0x01;
|
||||
txMsgData[1] = 0x23;
|
||||
txMsgData[2] = 0x45;
|
||||
txMsgData[3] = 0x67;
|
||||
txMsgData[4] = 0x89;
|
||||
txMsgData[5] = 0xAB;
|
||||
txMsgData[6] = 0xCD;
|
||||
txMsgData[7] = 0xEF;
|
||||
|
||||
//
|
||||
// Start CAN module A operations
|
||||
//
|
||||
CAN_startModule(CANA_BASE);
|
||||
|
||||
//
|
||||
// Transmit messages from CAN-A
|
||||
//
|
||||
while(1)
|
||||
//
|
||||
// Comment for infinite transmissions
|
||||
//
|
||||
//for(i = 0; i < TXCOUNT; i++)
|
||||
//
|
||||
{
|
||||
CAN_sendMessage(CANA_BASE, TX_MSG_OBJ_ID, MSG_DATA_LENGTH, txMsgData);
|
||||
|
||||
//
|
||||
// Poll TxOk bit in CAN_ES register to check completion of transmission
|
||||
//
|
||||
while(((HWREGH(CANA_BASE + CAN_O_ES) & CAN_ES_TXOK)) != CAN_ES_TXOK)
|
||||
{
|
||||
}
|
||||
}
|
||||
//
|
||||
// Stop application
|
||||
//
|
||||
asm(" ESTOP0");
|
||||
}
|
||||
|
||||
//
|
||||
// End of File
|
||||
//
|
||||
@@ -0,0 +1,162 @@
|
||||
//#############################################################################
|
||||
//
|
||||
// FILE: can_ex5_simple_receive.c
|
||||
//
|
||||
// TITLE: CAN Simple Receive Example
|
||||
//
|
||||
//! \addtogroup driver_example_list
|
||||
//! <h1> CAN simple example that illustrates data reception </h1>
|
||||
//!
|
||||
//! This example initializes CAN module A for Reception. When a frame with a
|
||||
//! STD-MSGID of 0x1 is received, the data will be copied in mailbox 1.
|
||||
//! If a message of any other MSGID is received, an ACK will be provided.
|
||||
//! GPIO65 will be toggled in both cases. Completion of reception
|
||||
//! is determined by polling. No interrupts are used.
|
||||
//! Note: RxOK bit is set even when the MSGID does not match.
|
||||
//!
|
||||
//! \b Hardware \b Required \n
|
||||
//! - An external CAN node that transmits to CAN-A on the C2000 MCU
|
||||
//!
|
||||
//! \b Watch \b Variables \n
|
||||
//! - rxMsgCount - A counter for the number of messages received
|
||||
//! - rxMsgData - An array with the data that was received
|
||||
//!
|
||||
//
|
||||
//#############################################################################
|
||||
//
|
||||
// $Release Date: $
|
||||
// $Copyright:
|
||||
// Copyright (C) 2013-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"
|
||||
|
||||
//
|
||||
// Defines
|
||||
//
|
||||
#define MSG_DATA_LENGTH 0 // "Don't care" for a Receive mailbox
|
||||
#define RX_MSG_OBJ_ID 1 // Use mailbox 1
|
||||
|
||||
//
|
||||
// Globals
|
||||
//
|
||||
uint16_t rxMsgData[8];
|
||||
volatile uint32_t rxMsgCount = 0;
|
||||
|
||||
//
|
||||
// Main
|
||||
//
|
||||
void main(void)
|
||||
{
|
||||
//
|
||||
// Initialize device clock and peripherals
|
||||
//
|
||||
Device_init();
|
||||
|
||||
//
|
||||
// Initialize GPIO
|
||||
//
|
||||
Device_initGPIO();
|
||||
|
||||
//
|
||||
// Configure GPIO pins for CANTX/CANRX
|
||||
//
|
||||
GPIO_setPinConfig(DEVICE_GPIO_CFG_CANRXA);
|
||||
GPIO_setPinConfig(DEVICE_GPIO_CFG_CANTXA);
|
||||
|
||||
//
|
||||
// Configure GPIO pin which is toggled upon message reception
|
||||
//
|
||||
GPIO_setPadConfig(65U, GPIO_PIN_TYPE_STD);
|
||||
GPIO_setDirectionMode(65U, GPIO_DIR_MODE_OUT);
|
||||
|
||||
//
|
||||
// Initialize the CAN controller
|
||||
//
|
||||
CAN_initModule(CANA_BASE);
|
||||
|
||||
//
|
||||
// Set up the CAN bus bit rate to 500kHz for each module
|
||||
// Refer to the Driver Library User Guide for information on how to set
|
||||
// tighter timing control. Additionally, consult the device data sheet
|
||||
// for more information about the CAN module clocking.
|
||||
//
|
||||
CAN_setBitRate(CANA_BASE, DEVICE_SYSCLK_FREQ, 500000, 16);
|
||||
|
||||
//
|
||||
// Initialize the receive message object used for receiving CAN messages.
|
||||
// Message Object Parameters:
|
||||
// CAN Module: A
|
||||
// Message Object ID Number: 1
|
||||
// Message Identifier: 0x1
|
||||
// Message Frame: Standard
|
||||
// Message Type: Receive
|
||||
// Message ID Mask: 0x0
|
||||
// Message Object Flags: None
|
||||
// Message Data Length: "Don't care" for a Receive mailbox
|
||||
//
|
||||
CAN_setupMessageObject(CANA_BASE, RX_MSG_OBJ_ID, 0x1,
|
||||
CAN_MSG_FRAME_STD, CAN_MSG_OBJ_TYPE_RX, 0,
|
||||
CAN_MSG_OBJ_NO_FLAGS, MSG_DATA_LENGTH);
|
||||
|
||||
//
|
||||
// Start CAN module A operations
|
||||
//
|
||||
CAN_startModule(CANA_BASE);
|
||||
|
||||
//
|
||||
// Start reception - Just wait for data from another node
|
||||
//
|
||||
while(1)
|
||||
{
|
||||
//
|
||||
// Poll RxOk bit in CAN_ES register to check completion of Reception
|
||||
//
|
||||
if(((HWREGH(CANA_BASE + CAN_O_ES) & CAN_ES_RXOK)) == CAN_ES_RXOK)
|
||||
{
|
||||
//
|
||||
// Get the received message
|
||||
//
|
||||
CAN_readMessage(CANA_BASE, RX_MSG_OBJ_ID, rxMsgData);
|
||||
GPIO_togglePin(65U);
|
||||
rxMsgCount++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// End of File
|
||||
//
|
||||
@@ -0,0 +1,239 @@
|
||||
//#############################################################################
|
||||
//
|
||||
// FILE: can_ex8_remote_tx.c
|
||||
//
|
||||
// TITLE: CAN Remote-Frame Transmit Example
|
||||
//
|
||||
//! \addtogroup driver_example_list
|
||||
//! <h1> CAN-A Remote-Frame Transmit </h1>
|
||||
//!
|
||||
//! This example initializes CAN module A for external communication.
|
||||
//! It demonstrates the ability of the module to transmit a Remote-frame
|
||||
//! and receive a response in the same mailbox. CAN-B node is configured
|
||||
//! to respond to the Remote frame. No interrupts are used.
|
||||
//!
|
||||
//! \b Hardware \b Required \n
|
||||
//! - A C2000 board with CAN transceiver and another CAN node configured
|
||||
//! for the same bit-rate to provide the response to the Remote frame.
|
||||
//! In this example, CAN-B is the "other node".
|
||||
//!
|
||||
//! \b Watch \b Variables \n
|
||||
//! - TXCOUNT - Adjust to set the number of Remote frames to be transmitted
|
||||
//! - txMsgCount - A counter for the number of messages sent
|
||||
//! - rxMsgData - An array with the data being received
|
||||
//!
|
||||
//
|
||||
//#############################################################################
|
||||
//
|
||||
// $Release Date: $
|
||||
// $Copyright:
|
||||
// Copyright (C) 2013-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"
|
||||
|
||||
//
|
||||
// Defines
|
||||
//
|
||||
#define TXCOUNT 1
|
||||
#define MSG_DATA_LENGTH 8
|
||||
#define TX_MSG_OBJ_ID 1
|
||||
|
||||
//
|
||||
// Globals
|
||||
//
|
||||
volatile unsigned long i;
|
||||
volatile uint32_t txMsgCount = 0;
|
||||
|
||||
//
|
||||
// Buffer to store the message Received by node A
|
||||
//
|
||||
uint16_t rxMsgData[8];
|
||||
|
||||
//
|
||||
// Main
|
||||
//
|
||||
void main(void)
|
||||
{
|
||||
//
|
||||
// Initialize device clock and peripherals
|
||||
//
|
||||
Device_init();
|
||||
|
||||
//
|
||||
// Initialize GPIO and configure GPIO pins for CANTX/CANRX
|
||||
// on modules A & B
|
||||
//
|
||||
Device_initGPIO();
|
||||
GPIO_setPinConfig(DEVICE_GPIO_CFG_CANRXA);
|
||||
GPIO_setPinConfig(DEVICE_GPIO_CFG_CANTXA);
|
||||
GPIO_setPinConfig(DEVICE_GPIO_CFG_CANRXB);
|
||||
GPIO_setPinConfig(DEVICE_GPIO_CFG_CANTXB);
|
||||
|
||||
//
|
||||
// Initialize the CAN controllers
|
||||
//
|
||||
CAN_initModule(CANA_BASE);
|
||||
CAN_initModule(CANB_BASE);
|
||||
|
||||
//
|
||||
// Set up the CAN bus bit rate to 500kHz for each module
|
||||
// Refer to the Driver Library User Guide for information on how to set
|
||||
// tighter timing control. Additionally, consult the device data sheet
|
||||
// for more information about the CAN module clocking.
|
||||
//
|
||||
CAN_setBitRate(CANA_BASE, DEVICE_SYSCLK_FREQ, 500000, 16);
|
||||
CAN_setBitRate(CANB_BASE, DEVICE_SYSCLK_FREQ, 500000, 16);
|
||||
|
||||
//
|
||||
// Initialize the mailbox used for sending the remote frame
|
||||
// - and receiving the corresponding data frame
|
||||
// Message Object Parameters:
|
||||
// CAN Module: A
|
||||
// Message Object ID Number: 1
|
||||
// Message Identifier: 0x111
|
||||
// Message Frame: Standard
|
||||
// Message Type: Receive (but transmits a Remote frame first)
|
||||
// Message ID Mask: 0x0
|
||||
// Message Object Flags: None
|
||||
// Message Data Length: 8 Bytes
|
||||
//
|
||||
CAN_setupMessageObject(CANA_BASE, TX_MSG_OBJ_ID, 0x111,
|
||||
CAN_MSG_FRAME_STD, CAN_MSG_OBJ_TYPE_RX, 0,
|
||||
CAN_MSG_OBJ_NO_FLAGS, MSG_DATA_LENGTH);
|
||||
|
||||
//
|
||||
// Initialize the mailbox used for responding to the remote frame
|
||||
// Message Object Parameters:
|
||||
// CAN Module: B
|
||||
// Message Object ID Number: 1
|
||||
// Message Identifier: 0x111
|
||||
// Message Frame: Standard
|
||||
// Message Type: Transmit (Auto respond to a remote frame)
|
||||
// Message ID Mask: 0x0
|
||||
// Message Object Flags: None
|
||||
// Message Data Length: 8 Bytes ("Don't care" for this MBX)
|
||||
//
|
||||
CAN_setupMessageObject(CANB_BASE, TX_MSG_OBJ_ID, 0x111,
|
||||
CAN_MSG_FRAME_STD, CAN_MSG_OBJ_TYPE_RXTX_REMOTE, 0,
|
||||
CAN_MSG_OBJ_NO_FLAGS, MSG_DATA_LENGTH);
|
||||
|
||||
//
|
||||
// Initialize the receive buffer to a known value
|
||||
//
|
||||
rxMsgData[0] = 0;
|
||||
rxMsgData[1] = 0;
|
||||
rxMsgData[2] = 0;
|
||||
rxMsgData[3] = 0;
|
||||
rxMsgData[4] = 0;
|
||||
rxMsgData[5] = 0;
|
||||
rxMsgData[6] = 0;
|
||||
rxMsgData[7] = 0;
|
||||
|
||||
//
|
||||
// Start CAN module operations
|
||||
//
|
||||
CAN_startModule(CANA_BASE);
|
||||
CAN_startModule(CANB_BASE);
|
||||
|
||||
//
|
||||
// Copy data into the mailbox1 RAM of CAN-B. This is the data that will be
|
||||
// automatically transmitted in response to a remote frame.
|
||||
//
|
||||
// Wait for busy bit to clear
|
||||
//
|
||||
while((HWREGH(CANB_BASE + CAN_O_IF1CMD) & CAN_IF1CMD_BUSY) ==
|
||||
CAN_IF1CMD_BUSY)
|
||||
{
|
||||
}
|
||||
|
||||
//
|
||||
// Write to IF1DATA & IF1DATB registers
|
||||
//
|
||||
HWREG_BP(CANB_BASE + CAN_O_IF1DATA) = 0x67452301UL;
|
||||
HWREG_BP(CANB_BASE + CAN_O_IF1DATB) = 0xEFCDAB89UL;
|
||||
|
||||
//
|
||||
// Transfer to MBX RAM
|
||||
//
|
||||
HWREG_BP(CANB_BASE + CAN_O_IF1CMD) = 0x00830001UL;
|
||||
|
||||
//
|
||||
// Wait for busy bit to clear
|
||||
//
|
||||
while((HWREGH(CANB_BASE + CAN_O_IF1CMD) & CAN_IF1CMD_BUSY) ==
|
||||
CAN_IF1CMD_BUSY)
|
||||
{
|
||||
}
|
||||
|
||||
//
|
||||
// Transmit Remote frame(s) from CAN-A and await data frame(s) from node B
|
||||
//
|
||||
//while(1) // Uncomment for infinite transmissions
|
||||
for(i = 0; i < TXCOUNT; i++)
|
||||
{
|
||||
//
|
||||
// Initiate transmission of remote frame. "rxMsgData" is "dummy"
|
||||
// No data will go out on a Remote Frame
|
||||
//
|
||||
CAN_sendRemoteRequestMessage(CANA_BASE, TX_MSG_OBJ_ID);
|
||||
|
||||
//
|
||||
// Poll TxOk bit in CAN_ES register to check completion of transmission
|
||||
//
|
||||
while(((HWREG_BP(CANA_BASE + CAN_O_ES) & CAN_ES_TXOK)) !=
|
||||
CAN_ES_TXOK){}
|
||||
|
||||
txMsgCount++; // Increment TX counter
|
||||
|
||||
//
|
||||
// Poll RxOk bit in CAN_ES register to check completion of reception
|
||||
//
|
||||
while(((HWREG_BP(CANA_BASE + CAN_O_ES) & CAN_ES_RXOK)) !=
|
||||
CAN_ES_RXOK){}
|
||||
|
||||
CAN_readMessage(CANA_BASE, 1, rxMsgData);
|
||||
}
|
||||
|
||||
//
|
||||
// Stop application
|
||||
//
|
||||
asm(" ESTOP0");
|
||||
}
|
||||
|
||||
//
|
||||
// End of File
|
||||
//
|
||||
@@ -0,0 +1,176 @@
|
||||
//#############################################################################
|
||||
//
|
||||
// FILE: can_ex9_remote_answer.c
|
||||
//
|
||||
// TITLE: CAN Remote-Frame Auto-answer Example
|
||||
//
|
||||
//! \addtogroup driver_example_list
|
||||
//! <h1> CAN-A Remote-Frame Auto-answer </h1>
|
||||
//!
|
||||
//! This example initializes CAN module A for external communication.
|
||||
//! It demonstrates the ability of the module to respond to a Remote-frame.
|
||||
//!
|
||||
//! \b Hardware \b Required \n
|
||||
//! - A C2000 board with CAN transceiver and another CAN node configured
|
||||
//! for the same bit-rate to transmit the Remote frame.
|
||||
//!
|
||||
//!
|
||||
//! \b Watch \b Variables \n
|
||||
//!
|
||||
//! - txMsgCount - A counter for the number of data frames sent
|
||||
//!
|
||||
//
|
||||
//#############################################################################
|
||||
//
|
||||
// $Release $
|
||||
// $Copyright:
|
||||
// Copyright (C) 2013-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"
|
||||
|
||||
//
|
||||
// Defines
|
||||
//
|
||||
#define MSG_DATA_LENGTH 8
|
||||
#define TX_MSG_OBJ_ID 1
|
||||
|
||||
//
|
||||
// Globals
|
||||
//
|
||||
volatile uint32_t txMsgCount = 0;
|
||||
|
||||
//
|
||||
// Main
|
||||
//
|
||||
void main(void)
|
||||
{
|
||||
//
|
||||
// Initialize device clock and peripherals
|
||||
//
|
||||
Device_init();
|
||||
|
||||
//
|
||||
// Initialize GPIO and configure GPIO pins for CANTX/CANRX
|
||||
// on modules A & B
|
||||
//
|
||||
Device_initGPIO();
|
||||
GPIO_setPinConfig(DEVICE_GPIO_CFG_CANRXA);
|
||||
GPIO_setPinConfig(DEVICE_GPIO_CFG_CANTXA);
|
||||
|
||||
//
|
||||
// Initialize the CAN controllers
|
||||
//
|
||||
CAN_initModule(CANA_BASE);
|
||||
|
||||
//
|
||||
// Set up the CAN bus bit rate to 500kHz for each module
|
||||
// Refer to the Driver Library User Guide for information on how to set
|
||||
// tighter timing control. Additionally, consult the device data sheet
|
||||
// for more information about the CAN module clocking.
|
||||
//
|
||||
CAN_setBitRate(CANA_BASE, DEVICE_SYSCLK_FREQ, 500000, 16);
|
||||
|
||||
//
|
||||
// Initialize the mailbox used for sending the data frame
|
||||
// Message Object Parameters:
|
||||
// CAN Module: A
|
||||
// Message Object ID Number: 1
|
||||
// Message Identifier: 0x111
|
||||
// Message Frame: Standard
|
||||
// Message Type: Transmit (with auto-answer)
|
||||
// Message ID Mask: 0x0
|
||||
// Message Object Flags: None
|
||||
// Message Data Length: 8 Bytes
|
||||
//
|
||||
CAN_setupMessageObject(CANA_BASE, TX_MSG_OBJ_ID, 0x111,
|
||||
CAN_MSG_FRAME_STD, CAN_MSG_OBJ_TYPE_RXTX_REMOTE, 0,
|
||||
CAN_MSG_OBJ_NO_FLAGS, MSG_DATA_LENGTH);
|
||||
|
||||
//
|
||||
// Start CAN module operations
|
||||
//
|
||||
CAN_startModule(CANA_BASE);
|
||||
|
||||
//
|
||||
// Copy data into the mailbox1 RAM of CAN-A. This is the data that will be
|
||||
// automatically transmitted in response to a remote frame.
|
||||
|
||||
//
|
||||
// Wait for busy bit to clear
|
||||
//
|
||||
while((HWREGH(CANA_BASE +CAN_O_IF1CMD) & CAN_IF1CMD_BUSY)==CAN_IF1CMD_BUSY)
|
||||
{
|
||||
}
|
||||
|
||||
//
|
||||
// Write to IF1DATA & IF1DATB registers
|
||||
//
|
||||
HWREG_BP(CANA_BASE + CAN_O_IF1DATA) = 0x44332211UL;
|
||||
HWREG_BP(CANA_BASE + CAN_O_IF1DATB) = 0x88776655UL;
|
||||
|
||||
//
|
||||
// Transfer to MBX RAM
|
||||
//
|
||||
HWREG_BP(CANA_BASE + CAN_O_IF1CMD) = 0x00830001UL;
|
||||
|
||||
//
|
||||
// Wait for busy bit to clear
|
||||
//
|
||||
while((HWREGH(CANA_BASE + CAN_O_IF1CMD) & CAN_IF1CMD_BUSY) ==
|
||||
CAN_IF1CMD_BUSY)
|
||||
{
|
||||
}
|
||||
|
||||
//
|
||||
// Wait and Transmit data frame(s)in response to Remote frame(s)
|
||||
//
|
||||
while(1)
|
||||
{
|
||||
//
|
||||
// Poll TxOk bit in CAN_ES register to check completion of transmission
|
||||
//
|
||||
while(((HWREGH(CANA_BASE + CAN_O_ES) & CAN_ES_TXOK)) != CAN_ES_TXOK)
|
||||
{
|
||||
}
|
||||
|
||||
txMsgCount++; // Increment TX counter
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// End of File
|
||||
//
|
||||
@@ -0,0 +1,45 @@
|
||||
<projectSpec>
|
||||
<project
|
||||
name="cla_ex1_asin"
|
||||
device="TMS320F28377D"
|
||||
cgtVersion="22.6.0.LTS"
|
||||
products="sysconfig;C2000WARE"
|
||||
outputFormat="ELF"
|
||||
launchWizard="False"
|
||||
linkerCommandFile=""
|
||||
enableSysConfigTool="true"
|
||||
sysConfigBuildOptions="--product ${C2000WARE_ROOT}/.metadata/sdk.json --device F2837xD --package F2837xD_176PTP --part F2837xD_176PTP"
|
||||
postBuildStep="
|
||||
if ${CLB_DEBUG} == 1 mkdir "${BuildDirectory}/simulation"
|
||||
;if ${CLB_DEBUG} == 1 ${CLB_SIM_COMPILER}/g++ -c -DCLB_SIM -I${SYSTEMC_INSTALL}/src -I${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/include/type3 -I${PROJECT_ROOT} -I${CLB_SIM_COMPILER}/include -Og -g -gdwarf-3 -gstrict-dwarf -Wall -MMD -MP -MF${BuildDirectory}/simulation/clb_sim.d -MT${BuildDirectory}/simulation/clb_sim.o -I${BuildDirectory}/syscfg -fno-threadsafe-statics -o${BuildDirectory}/simulation/clb_sim.o ${BuildDirectory}/syscfg/clb_sim.cpp
|
||||
;if ${CLB_DEBUG} == 1 ${CLB_SIM_COMPILER}/g++ -DCLB_SIM -Og -g -gdwarf-3 -gstrict-dwarf -Wall -Wl,-Map,${BuildDirectory}/simulation/simulation_output.map -L${SYSTEMC_INSTALL}/build/src -o${BuildDirectory}/simulation/simulation_output.exe ${BuildDirectory}/simulation/clb_sim.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/type3/CLB_FSM_SC_model.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/type3/CLB_HLC_SC_model.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/type3/CLB_LUT4_SC_model.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/type3/CLB_OutputLUT_SC_model.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/type3/CLB_counter_SC_model.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/type3/CLB_counter_top_SC_model.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/type3/CLB_FSM_top_SC_model.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/type3/CLB_LUT4_top_SC_model.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/type3/CLB_OutputLUT_top_SC_model.o -Wl,--start-group -lsystemc -Wl,--end-group
|
||||
;if ${CLB_DEBUG} == 1 "./simulation/simulation_output.exe"
|
||||
;if ${CLB_DEBUG} == 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} --define=DEBUG -ml -mt -v28 --float_support=fpu32 --cla_support=cla1 --vcu_support=vcu2 --tmu_support=tmu0 --gen_func_subsections=on --define=CPU1 --diag_warning=225 --diag_suppress=10063 --diag_suppress=10068 --diag_suppress=770 --display_error_number" linkerBuildOptions="--define=CLA_C --entry_point code_start --stack_size=0x3F8 --heap_size=0x200 -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=DEBUG --define=_FLASH -ml -mt -v28 --float_support=fpu32 --cla_support=cla1 --vcu_support=vcu2 --tmu_support=tmu0 --define=CPU1 --diag_warning=225 --diag_suppress=10063 --diag_suppress=10068 --diag_suppress=770 --display_error_number --gen_func_subsections=on " linkerBuildOptions="--define=CLA_C --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/" 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="CLB_DEBUG" value="0" scope="project" />
|
||||
<buildVariable name="GENERATE_DIAGRAM" value="0" scope="project" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/include/driverlib.h" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/include/device.h" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/source/device.c" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/targetConfigs/TMS320F28377D.ccxml" targetDirectory="targetConfigs" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/cmd/2837xD_RAM_CLA_lnk_cpu1.cmd" targetDirectory="" applicableConfigurations="CPU1_RAM"/>
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/cmd/2837xD_FLASH_CLA_lnk_cpu1.cmd" targetDirectory="" applicableConfigurations="CPU1_FLASH"/>
|
||||
<file action="copy" path="../../../../driverlib/" targetDirectory="device" excludeFromBuild="True" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/source/F2837xD_CodeStartBranch.asm" targetDirectory="device" />
|
||||
<file action="link" path="../../../../driverlib/ccs/Debug/driverlib.lib" targetDirectory="" />
|
||||
<file action="copy" path="../asin.cla" targetDirectory="" />
|
||||
<file action="copy" path="../cla_ex1_asin.c" targetDirectory="" />
|
||||
<file action="copy" path="../cla_ex1_asin_shared.h" targetDirectory="" />
|
||||
<file action="copy" path="../cla_ex1_asin.syscfg" targetDirectory="" />
|
||||
</project>
|
||||
</projectSpec>
|
||||
@@ -0,0 +1,45 @@
|
||||
<projectSpec>
|
||||
<project
|
||||
name="cla_ex2_atan"
|
||||
device="TMS320F28377D"
|
||||
cgtVersion="22.6.0.LTS"
|
||||
products="sysconfig;C2000WARE"
|
||||
outputFormat="ELF"
|
||||
launchWizard="False"
|
||||
linkerCommandFile=""
|
||||
enableSysConfigTool="true"
|
||||
sysConfigBuildOptions="--product ${C2000WARE_ROOT}/.metadata/sdk.json --device F2837xD --package F2837xD_176PTP --part F2837xD_176PTP""
|
||||
postBuildStep="
|
||||
if ${CLB_DEBUG} == 1 mkdir "${BuildDirectory}/simulation"
|
||||
;if ${CLB_DEBUG} == 1 ${CLB_SIM_COMPILER}/g++ -c -DCLB_SIM -I${SYSTEMC_INSTALL}/src -I${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/include/type3 -I${PROJECT_ROOT} -I${CLB_SIM_COMPILER}/include -Og -g -gdwarf-3 -gstrict-dwarf -Wall -MMD -MP -MF${BuildDirectory}/simulation/clb_sim.d -MT${BuildDirectory}/simulation/clb_sim.o -I${BuildDirectory}/syscfg -fno-threadsafe-statics -o${BuildDirectory}/simulation/clb_sim.o ${BuildDirectory}/syscfg/clb_sim.cpp
|
||||
;if ${CLB_DEBUG} == 1 ${CLB_SIM_COMPILER}/g++ -DCLB_SIM -Og -g -gdwarf-3 -gstrict-dwarf -Wall -Wl,-Map,${BuildDirectory}/simulation/simulation_output.map -L${SYSTEMC_INSTALL}/build/src -o${BuildDirectory}/simulation/simulation_output.exe ${BuildDirectory}/simulation/clb_sim.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/type3/CLB_FSM_SC_model.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/type3/CLB_HLC_SC_model.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/type3/CLB_LUT4_SC_model.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/type3/CLB_OutputLUT_SC_model.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/type3/CLB_counter_SC_model.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/type3/CLB_counter_top_SC_model.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/type3/CLB_FSM_top_SC_model.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/type3/CLB_LUT4_top_SC_model.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/type3/CLB_OutputLUT_top_SC_model.o -Wl,--start-group -lsystemc -Wl,--end-group
|
||||
;if ${CLB_DEBUG} == 1 "./simulation/simulation_output.exe"
|
||||
;if ${CLB_DEBUG} == 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${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} -I${C2000WARE_ROOT} --gen_func_subsections=on --define=DEBUG -ml -mt -v28 --float_support=fpu32 --cla_support=cla1 --vcu_support=vcu2 --tmu_support=tmu0 --define=CPU1 --diag_warning=225 --diag_suppress=10063 --diag_suppress=10068 --diag_suppress=770 --display_error_number" linkerBuildOptions=""--define=CLA_C --entry_point code_start --stack_size=0x3F8 --heap_size=0x200 -i${C2000WARE_ROOT} -i${PROJECT_BUILD_DIR}/syscfg -lc2000ware_libraries.cmd.genlibs " />
|
||||
<configuration name="CPU1_FLASH" compilerBuildOptions="--opt_level=off -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} -I${C2000WARE_ROOT} --gen_func_subsections=on --define=DEBUG --define=_FLASH -ml -mt -v28 --float_support=fpu32 --cla_support=cla1 --vcu_support=vcu2 --tmu_support=tmu0 --define=CPU1 --diag_warning=225 --diag_suppress=10063 --diag_suppress=10068 --diag_suppress=770 --display_error_number" linkerBuildOptions="--define=CLA_C --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/" 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="CLB_DEBUG" value="0" scope="project" />
|
||||
<buildVariable name="GENERATE_DIAGRAM" value="0" scope="project" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/include/driverlib.h" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/include/device.h" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/source/device.c" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/targetConfigs/TMS320F28377D.ccxml" targetDirectory="targetConfigs" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/cmd/2837xD_RAM_CLA_lnk_cpu1.cmd" targetDirectory="" applicableConfigurations="CPU1_RAM"/>
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/cmd/2837xD_FLASH_CLA_lnk_cpu1.cmd" targetDirectory="" applicableConfigurations="CPU1_FLASH"/>
|
||||
<file action="copy" path="../../../../driverlib/" targetDirectory="device" excludeFromBuild="True" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/source/F2837xD_CodeStartBranch.asm" targetDirectory="device" />
|
||||
<file action="link" path="../../../../driverlib/ccs/Debug/driverlib.lib" targetDirectory="" />
|
||||
<file action="copy" path="../atan.cla" targetDirectory="" />
|
||||
<file action="copy" path="../cla_ex2_atan.c" targetDirectory="" />
|
||||
<file action="copy" path="../cla_ex2_atan_shared.h" targetDirectory="" />
|
||||
<file action="copy" path="../cla_ex2_atan.syscfg" targetDirectory="" />
|
||||
</project>
|
||||
</projectSpec>
|
||||
@@ -0,0 +1,162 @@
|
||||
//#############################################################################
|
||||
// \file asin.cla
|
||||
//
|
||||
// \brief Arc Sine Example
|
||||
//
|
||||
//#############################################################################
|
||||
// $Copyright:
|
||||
// Copyright (C) 2013-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 "cla_ex1_asin_shared.h"
|
||||
|
||||
//
|
||||
// Defines
|
||||
//
|
||||
|
||||
//
|
||||
// Globals
|
||||
//
|
||||
// Note that the globals defined in the .cla source are global to the cla source
|
||||
// file. i.e. they may be shared across tasks. All of the data shared between
|
||||
// the CLA and the C28x CPU must be defined in the C (or C++) code, and not the
|
||||
// CLA code.
|
||||
//
|
||||
|
||||
//
|
||||
// Function Definitions
|
||||
//
|
||||
//Task 1 : Calculate asin(X)
|
||||
// Description:
|
||||
// Step(1): Calculate absolute of the input X
|
||||
//
|
||||
// Step(2): Use the upper 6-bits of input "X" value as an
|
||||
// index into the table to obtain the coefficients
|
||||
// for a second order equation:
|
||||
//
|
||||
// _FPUasinTable:
|
||||
// CoeffA0[0]
|
||||
// CoeffA1[0]
|
||||
// CoeffA2[0]
|
||||
// .
|
||||
// .
|
||||
// CoeffA0[63]
|
||||
// CoeffA1[63]
|
||||
// CoeffA2[63]
|
||||
//
|
||||
// Step(3): Calculate the angle using the following equation:
|
||||
//
|
||||
// arctan(Ratio) = A0 + A1*Ratio + A2*Ratio*Ratio
|
||||
// arctan(Ratio) = A0 + Ratio(A1 + A2*Ratio)
|
||||
//
|
||||
// Step(4): The final angle is determined as follows:
|
||||
//
|
||||
// if( X < 0 )
|
||||
// Angle = -Angle
|
||||
__interrupt void Cla1Task1 ( void )
|
||||
{
|
||||
//
|
||||
//Local Variables
|
||||
//
|
||||
int xTblIdx; //integer valued Table index
|
||||
float A0,A1,A2; //Table coefficients
|
||||
float *entry;
|
||||
float result;
|
||||
|
||||
//
|
||||
//Preprocessing
|
||||
//
|
||||
__mdebugstop();
|
||||
xTblIdx = fVal * TABLE_SIZE_M_1; //convert table index to u16-bits
|
||||
xTblIdx = xTblIdx * 3; //Table is ordered as 3 32-bit coefficients, the
|
||||
//index points to these triplets, hence the *3*sizeof(float)
|
||||
entry = &CLAasinTable[xTblIdx];
|
||||
A0 = *entry++;
|
||||
A1 = *entry++;
|
||||
A2 = *entry;
|
||||
|
||||
|
||||
result = A0 + fVal*(A1 + A2*fVal);
|
||||
|
||||
//
|
||||
//Post processing
|
||||
//
|
||||
if(fVal < 0)
|
||||
{
|
||||
result = - result;
|
||||
}
|
||||
|
||||
fResult = result;
|
||||
}
|
||||
|
||||
interrupt void Cla1Task2 ( void )
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
interrupt void Cla1Task3 ( void )
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
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,187 @@
|
||||
//#############################################################################
|
||||
// \file atan.cla
|
||||
//
|
||||
// \brief Arc Tangent Example
|
||||
//
|
||||
//#############################################################################
|
||||
// $Copyright:
|
||||
// Copyright (C) 2013-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 "cla_ex2_atan_shared.h"
|
||||
|
||||
//
|
||||
// Defines
|
||||
//
|
||||
|
||||
//
|
||||
// Globals
|
||||
//
|
||||
// Note that the globals defined in the .cla source are global to the cla source
|
||||
// file. i.e. they may be shared across tasks. All of the data shared between
|
||||
// the CLA and the C28x CPU must be defined in the C (or C++) code, and not the
|
||||
// CLA code.
|
||||
//
|
||||
|
||||
//
|
||||
// Function Definitions
|
||||
//
|
||||
//Task 1 : Calculate atan(Y)
|
||||
// Description:
|
||||
// Step(1): if( 1.0 >= abs(Y) )
|
||||
// Numerator = abs(Y)
|
||||
// Denominator = 1.0
|
||||
// else
|
||||
// Numerator = 1.0
|
||||
// Denominator = abs(Y)
|
||||
//
|
||||
// Step(2): Ratio = Numerator/Denominator
|
||||
//
|
||||
// Note: Ratio range = 0.0 to 1.0
|
||||
//
|
||||
// Step(3): Use the upper 6-bits of the "Ratio" value as an
|
||||
// index into the table to obtain the coefficients
|
||||
// for a second order equation:
|
||||
//
|
||||
// _FPUatan2Table:
|
||||
// CoeffA0[0]
|
||||
// CoeffA1[0]
|
||||
// CoeffA2[0]
|
||||
// .
|
||||
// .
|
||||
// CoeffA0[63]
|
||||
// CoeffA1[63]
|
||||
// CoeffA2[63]
|
||||
//
|
||||
// Step(4): Calculate the angle using the following equation:
|
||||
//
|
||||
// arctan(Ratio) = A0 + A1*Ratio + A2*Ratio*Ratio
|
||||
// arctan(Ratio) = A0 + Ratio(A1 + A2*Ratio)
|
||||
//
|
||||
// Step(5): The final angle is determined as follows:
|
||||
//
|
||||
// if( Y >= 0 and 1.0 >= abs(Y) )
|
||||
// Angle = arctan(abs(Y)/1.0)
|
||||
// if( Y >= 0 and 1.0 < abs(Y) )
|
||||
// Angle = PI/2 - arctan(1.0/abs(Y))
|
||||
// if( Y < 0 )
|
||||
// Angle = -Angle
|
||||
__interrupt void Cla1Task1 ( void )
|
||||
{
|
||||
//
|
||||
//Local Variables
|
||||
//
|
||||
unsigned int uxTblIdx; //unsigned integer valued Table index
|
||||
float ratio;
|
||||
float num,den;
|
||||
float A0,A1,A2; //Table coefficients
|
||||
float *base;
|
||||
float result;
|
||||
|
||||
//
|
||||
//Preprocessing
|
||||
//
|
||||
__mdebugstop();
|
||||
num = __mminf32(fabsf(fVal),1.0f);
|
||||
den = __mmaxf32(fabsf(fVal),1.0f);
|
||||
|
||||
ratio = (num/den); //Expected the newton raphson algo for better
|
||||
//accuracy on the divide
|
||||
uxTblIdx = ratio * TABLE_SIZE_M_1 * 3; //convert table index to u16-bits
|
||||
uxTblIdx = uxTblIdx * 3; //Table is ordered as 3 32-bit coefficients, the
|
||||
//index points to these triplets, hence the *3*sizeof(float)
|
||||
|
||||
base = &CLAatan2Table[uxTblIdx];
|
||||
A0 = *base++;
|
||||
A1 = *base++;
|
||||
A2 = *base;
|
||||
|
||||
result = A0 + ratio*(A1 + A2*ratio);
|
||||
|
||||
//
|
||||
//Post processing
|
||||
//
|
||||
if(fabsf(fVal) > 1.0f)
|
||||
{
|
||||
result = PIBYTWO - result;
|
||||
}
|
||||
|
||||
if(fVal < 0.0f)
|
||||
{
|
||||
result = -result;
|
||||
}
|
||||
|
||||
fResult = result;
|
||||
}
|
||||
|
||||
interrupt void Cla1Task2 ( void )
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
interrupt void Cla1Task3 ( void )
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
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,416 @@
|
||||
//###########################################################################
|
||||
//
|
||||
// FILE: cla_ex1_asin.c
|
||||
//
|
||||
// TITLE: CLA Arcsine Example
|
||||
//
|
||||
//! \addtogroup driver_example_list
|
||||
//! <h1>CLA \f$arcsine(x)\f$ using a lookup table (cla_asin_cpu01)</h1>
|
||||
//!
|
||||
//! In this example, Task 1 of the CLA will calculate the arcsine of
|
||||
//! an input argument in the range (-1.0 to 1.0) using a lookup table.
|
||||
//!
|
||||
//! \b Memory \b Allocation \n
|
||||
//! - CLA1 Math Tables (RAMLS0)
|
||||
//! - CLAasinTable - Lookup table
|
||||
//! - CLA1 to CPU Message RAM
|
||||
//! - fResult - Result of the lookup algorithm
|
||||
//! - CPU to CLA1 Message RAM
|
||||
//! - fVal - Sample input to the lookup algorithm
|
||||
//!
|
||||
//! \b Watch \b Variables \n
|
||||
//! - fVal - Argument to task 1
|
||||
//! - fResult - Result of \f$arcsin(fVal)\f$
|
||||
//!
|
||||
//
|
||||
//###########################################################################
|
||||
// $Copyright:
|
||||
// Copyright (C) 2013-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 "cla_ex1_asin_shared.h"
|
||||
#include "board.h"
|
||||
|
||||
//
|
||||
// Defines
|
||||
//
|
||||
#define WAITSTEP asm(" RPT #255 || NOP")
|
||||
|
||||
//
|
||||
// Globals
|
||||
//
|
||||
|
||||
//
|
||||
//Task 1 (C) Variables
|
||||
// NOTE: Do not initialize the Message RAM variables globally, they will be
|
||||
// reset during the message ram initialization phase in the CLA memory
|
||||
// configuration routine
|
||||
//
|
||||
#ifdef __cplusplus
|
||||
#pragma DATA_SECTION("CpuToCla1MsgRAM");
|
||||
float fVal;
|
||||
#pragma DATA_SECTION("Cla1ToCpuMsgRAM");
|
||||
float fResult;
|
||||
#else
|
||||
#pragma DATA_SECTION(fVal,"CpuToCla1MsgRAM");
|
||||
float fVal;
|
||||
#pragma DATA_SECTION(fResult,"Cla1ToCpuMsgRAM");
|
||||
float fResult;
|
||||
#endif //__cplusplus
|
||||
float y[BUFFER_SIZE];
|
||||
|
||||
//
|
||||
//Task 2 (C) Variables
|
||||
//
|
||||
|
||||
//
|
||||
//Task 3 (C) Variables
|
||||
//
|
||||
|
||||
//
|
||||
//Task 4 (C) Variables
|
||||
//
|
||||
|
||||
//
|
||||
//Task 5 (C) Variables
|
||||
//
|
||||
|
||||
//
|
||||
//Task 6 (C) Variables
|
||||
//
|
||||
|
||||
//
|
||||
//Task 7 (C) Variables
|
||||
//
|
||||
|
||||
//
|
||||
//Task 8 (C) Variables
|
||||
//
|
||||
|
||||
//
|
||||
//Common (C) Variables
|
||||
//The Exponential table
|
||||
//
|
||||
#ifdef __cplusplus
|
||||
#pragma DATA_SECTION("CLADataLS0")
|
||||
#else
|
||||
#pragma DATA_SECTION(CLAasinTable,"CLADataLS0")
|
||||
#endif //__cplusplus
|
||||
float CLAasinTable[]={
|
||||
0.0, 1.0, 0.0,
|
||||
0.000000636202, 0.999877862610, 0.007815361896,
|
||||
0.000005099694, 0.999510644409, 0.015647916155,
|
||||
0.000017268312, 0.998895919094, 0.023514960332,
|
||||
0.000041121765, 0.998029615282, 0.031434003631,
|
||||
0.000080794520, 0.996905974725, 0.039422875916,
|
||||
0.000140631089, 0.995517492804, 0.047499840611,
|
||||
0.000225244584, 0.993854840311, 0.055683712914,
|
||||
0.000339579512, 0.991906765146, 0.063993984848,
|
||||
0.000488979852, 0.989659972212, 0.072450958820,
|
||||
0.000679263611, 0.987098979366, 0.081075891529,
|
||||
0.000916805182, 0.984205946802, 0.089891150305,
|
||||
0.001208627040, 0.980960476685, 0.098920384204,
|
||||
0.001562502549, 0.977339379243, 0.108188712551,
|
||||
0.001987071928, 0.973316400729, 0.117722933997,
|
||||
0.002491973784, 0.968861907789, 0.127551759665,
|
||||
0.003087995053, 0.963942521723, 0.137706074532,
|
||||
0.003787242692, 0.958520694794, 0.148219231941,
|
||||
0.004603341138, 0.952554219267, 0.159127386977,
|
||||
0.005551660294, 0.945995657913, 0.170469875522,
|
||||
0.006649579796, 0.938791682505, 0.182289647088,
|
||||
0.007916796475, 0.930882303984, 0.194633761132,
|
||||
0.009375683410, 0.922199974574, 0.207553958472,
|
||||
0.011051710808, 0.912668537890, 0.221107321885,
|
||||
0.012973941175, 0.902201997769, 0.235357042896,
|
||||
0.015175614174, 0.890703070035, 0.250373315541,
|
||||
0.017694840102, 0.878061473098, 0.266234382514,
|
||||
0.020575425537, 0.864151902887, 0.283027765009,
|
||||
0.023867860513, 0.848831624374, 0.300851714968,
|
||||
0.027630504055, 0.831937595031, 0.319816937941,
|
||||
0.031931014547, 0.813283013821, 0.340048646894,
|
||||
0.036848083955, 0.792653161200, 0.361689022958,
|
||||
0.042473551274, 0.769800358920, 0.384900179460,
|
||||
0.048914992206, 0.744437830278, 0.409867752228,
|
||||
0.056298910750, 0.716232177740, 0.436805274317,
|
||||
0.064774696786, 0.684794109766, 0.465959540059,
|
||||
0.074519565699, 0.649666934178, 0.497617226179,
|
||||
0.085744766889, 0.610312179660, 0.532113122767,
|
||||
0.098703445606, 0.566091493186, 0.569840443472,
|
||||
0.113700678529, 0.516243664372, 0.611263845480,
|
||||
0.131106395009, 0.459855210927, 0.656936015611,
|
||||
0.151372169232, 0.395822366759, 0.707518998893,
|
||||
0.175053263659, 0.322801460177, 0.763811905770,
|
||||
0.202837883870, 0.239143420888, 0.826787304376,
|
||||
0.235586468765, 0.142806299514, 0.897639596948,
|
||||
0.274385149825, 0.031236880585, 0.977850174820,
|
||||
0.320619535938, -0.098791845166, 1.069276441800,
|
||||
0.376078169620, -0.251407364538, 1.174275392129,
|
||||
0.443100143614, -0.431959397725, 1.295878193174,
|
||||
0.524789871827, -0.647485610469, 1.438041695773,
|
||||
0.625336471263, -0.907400624736, 1.606018804842,
|
||||
0.750500589935, -1.224540947101, 1.806917563896,
|
||||
0.908377657341, -1.616794995066, 2.050569262035,
|
||||
1.110633894185, -2.109729648039, 2.350920816737,
|
||||
1.374584721437, -2.740985157716, 2.728353889708,
|
||||
1.726848242753, -3.567962877198, 3.213722960014,
|
||||
2.210117561056, -4.682006534082, 3.855770086891,
|
||||
2.896554011854, -6.236312386687, 4.735651038017,
|
||||
3.916505715382, -8.505488022524, 5.997790945975,
|
||||
5.526855868703, -12.026617159136, 7.922628470498,
|
||||
8.298197116322, -17.983705080358, 11.123941286820,
|
||||
13.741706072449, -29.488929624542, 17.203344479111,
|
||||
27.202707817485, -57.466598393615, 31.741016484669,
|
||||
83.158101335898, -171.803399517566, 90.149831709374
|
||||
};
|
||||
|
||||
float asin_expected[BUFFER_SIZE]={
|
||||
1.570796, 1.393789, 1.320141, 1.263401, 1.215375,
|
||||
1.172892, 1.134327, 1.098718, 1.065436, 1.034046,
|
||||
1.004232, 0.9757544, 0.9484279, 0.9221048, 0.8966658,
|
||||
0.8720123, 0.8480621, 0.8247454, 0.8020028, 0.7797828,
|
||||
0.7580408, 0.7367374, 0.7158381, 0.6953120, 0.6751316,
|
||||
0.6552721, 0.6357113, 0.6164289, 0.5974064, 0.5786270,
|
||||
0.5600753, 0.5417370, 0.5235988, 0.5056486, 0.4878751,
|
||||
0.4702678, 0.4528166, 0.4355124, 0.4183464, 0.4013104,
|
||||
0.3843968, 0.3675981, 0.3509074, 0.3343180, 0.3178237,
|
||||
0.3014185, 0.2850964, 0.2688521, 0.2526802, 0.2365756,
|
||||
0.2205333, 0.2045484, 0.1886164, 0.1727327, 0.1568929,
|
||||
0.1410927, 0.1253278, 0.1095943, 0.09388787, 0.07820469,
|
||||
0.06254076, 0.04689218, 0.03125509, 0.01562564
|
||||
};
|
||||
|
||||
uint16_t pass = 0;
|
||||
uint16_t fail = 0;
|
||||
|
||||
//
|
||||
// Function Prototypes
|
||||
//
|
||||
void CLA_runTest(void);
|
||||
__interrupt void cla1Isr1();
|
||||
__interrupt void cla1Isr2();
|
||||
__interrupt void cla1Isr3();
|
||||
__interrupt void cla1Isr4();
|
||||
__interrupt void cla1Isr5();
|
||||
__interrupt void cla1Isr6();
|
||||
__interrupt void cla1Isr7();
|
||||
__interrupt void cla1Isr8();
|
||||
|
||||
//
|
||||
// Main
|
||||
//
|
||||
void main(void)
|
||||
{
|
||||
|
||||
//
|
||||
// Intialize device clock and peripherals
|
||||
//
|
||||
Device_init();
|
||||
|
||||
//
|
||||
// Disable pin locks and enable internal pullups.
|
||||
//
|
||||
//Device_initGPIO(); //skipped for this example
|
||||
|
||||
//
|
||||
// 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();
|
||||
|
||||
//
|
||||
// Initialize resources
|
||||
//
|
||||
Board_init();
|
||||
|
||||
//
|
||||
// Enable Global Interrupt (INTM) and realtime interrupt (DBGM)
|
||||
//
|
||||
EINT;
|
||||
ERTM;
|
||||
|
||||
//
|
||||
// Run the test
|
||||
//
|
||||
CLA_runTest();
|
||||
|
||||
for(;;)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// CLA_runTest - Execute CLA task tests for specified vectors
|
||||
//
|
||||
void CLA_runTest(void)
|
||||
{
|
||||
int16_t i;
|
||||
float error;
|
||||
|
||||
for(i = 0; i < BUFFER_SIZE; i++)
|
||||
{
|
||||
fVal= (float)(BUFFER_SIZE - i)/(float)BUFFER_SIZE;
|
||||
CLA_forceTasks(CLA1_BASE,CLA_TASKFLAG_1);
|
||||
WAITSTEP;
|
||||
y[i] = fResult;
|
||||
error = fabsf(asin_expected[i]-y[i]);
|
||||
|
||||
if(error < 0.1f)
|
||||
{
|
||||
pass++;
|
||||
}
|
||||
else
|
||||
{
|
||||
fail++;
|
||||
}
|
||||
}
|
||||
|
||||
#if 0
|
||||
|
||||
CLA_forceTasks(CLA1_BASE,CLA_TASKFLAG_2);
|
||||
WAITSTEP;
|
||||
|
||||
CLA_forceTasks(CLA1_BASE,CLA_TASKFLAG_3);
|
||||
WAITSTEP;
|
||||
|
||||
CLA_forceTasks(CLA1_BASE,CLA_TASKFLAG_4);
|
||||
WAITSTEP;
|
||||
|
||||
CLA_forceTasks(CLA1_BASE,CLA_TASKFLAG_5);
|
||||
WAITSTEP;
|
||||
|
||||
CLA_forceTasks(CLA1_BASE,CLA_TASKFLAG_6);
|
||||
WAITSTEP;
|
||||
|
||||
CLA_forceTasks(CLA1_BASE,CLA_TASKFLAG_7);
|
||||
WAITSTEP;
|
||||
|
||||
CLA_forceTasks(CLA1_BASE,CLA_TASKFLAG_8);
|
||||
WAITSTEP;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//
|
||||
// cla1Isr1 - CLA1 ISR 1
|
||||
//
|
||||
|
||||
__interrupt void cla1Isr1 ()
|
||||
{
|
||||
//
|
||||
// Acknowledge the end-of-task interrupt for task 1
|
||||
//
|
||||
Interrupt_clearACKGroup(INTERRUPT_ACK_GROUP11);
|
||||
|
||||
//
|
||||
// Uncomment to halt debugger and stop here
|
||||
//
|
||||
// asm(" ESTOP0");
|
||||
}
|
||||
|
||||
//
|
||||
// cla1Isr2 - CLA1 ISR 2
|
||||
//
|
||||
__interrupt void cla1Isr2 ()
|
||||
{
|
||||
asm(" ESTOP0");
|
||||
}
|
||||
|
||||
//
|
||||
// cla1Isr3 - CLA1 ISR 3
|
||||
//
|
||||
__interrupt void cla1Isr3 ()
|
||||
{
|
||||
asm(" ESTOP0");
|
||||
}
|
||||
|
||||
//
|
||||
// cla1Isr4 - CLA1 ISR 4
|
||||
//
|
||||
__interrupt void cla1Isr4 ()
|
||||
{
|
||||
asm(" ESTOP0");
|
||||
}
|
||||
|
||||
//
|
||||
// cla1Isr5 - CLA1 ISR 5
|
||||
//
|
||||
__interrupt void cla1Isr5 ()
|
||||
{
|
||||
asm(" ESTOP0");
|
||||
}
|
||||
|
||||
//
|
||||
// cla1Isr6 - CLA1 ISR 6
|
||||
//
|
||||
__interrupt void cla1Isr6 ()
|
||||
{
|
||||
asm(" ESTOP0");
|
||||
}
|
||||
|
||||
//
|
||||
// cla1Isr7 - CLA1 ISR 7
|
||||
//
|
||||
__interrupt void cla1Isr7 ()
|
||||
{
|
||||
asm(" ESTOP0");
|
||||
}
|
||||
|
||||
//
|
||||
// cla1Isr8 - CLA1 ISR 8
|
||||
//
|
||||
__interrupt void cla1Isr8 ()
|
||||
{
|
||||
//
|
||||
// Acknowledge the end-of-task interrupt for task 8
|
||||
//
|
||||
Interrupt_clearACKGroup(INTERRUPT_ACK_GROUP11);
|
||||
//
|
||||
// Uncomment to halt debugger and stop here
|
||||
//
|
||||
// asm(" ESTOP0");
|
||||
}
|
||||
|
||||
//
|
||||
// End of file
|
||||
//
|
||||
@@ -0,0 +1,20 @@
|
||||
|
||||
/**
|
||||
* Import the modules used in this configuration.
|
||||
*/
|
||||
const cla = scripting.addModule("/driverlib/cla.js", {}, false);
|
||||
const cla1 = cla.addInstance();
|
||||
const memcfg = scripting.addModule("/driverlib/memcfg.js");
|
||||
|
||||
/**
|
||||
* Write custom configuration values to the imported modules.
|
||||
*/
|
||||
cla1.$name = "myCLA0";
|
||||
|
||||
|
||||
memcfg.config_MEMCFG_SECT_LS4 = "CLA_prog";
|
||||
memcfg.config_MEMCFG_SECT_LS5 = "CLA_prog";
|
||||
memcfg.config_MEMCFG_SECT_LS0 = "CLA_data";
|
||||
memcfg.config_MEMCFG_SECT_LS1 = "CLA_data";
|
||||
memcfg.init_MEMCFG_SECT_MSGCPUTOCLA1 = true;
|
||||
memcfg.init_MEMCFG_SECT_MSGCLA1TOCPU = true;
|
||||
@@ -0,0 +1,131 @@
|
||||
#ifndef _CLA_ASIN_SHARED_H_
|
||||
#define _CLA_ASIN_SHARED_H_
|
||||
//#############################################################################
|
||||
//
|
||||
// FILE: cla_ex1_asin_shared.h
|
||||
//
|
||||
// TITLE: CLA arcsine example header file.
|
||||
//
|
||||
//#############################################################################
|
||||
// $Copyright:
|
||||
// Copyright (C) 2013-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 <stdint.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
//
|
||||
// Defines
|
||||
//
|
||||
#define BUFFER_SIZE 64
|
||||
#define TABLE_SIZE 64
|
||||
#define TABLE_SIZE_M_1 TABLE_SIZE-1
|
||||
#define PIBYTWO 1.570796327
|
||||
#define PI 3.141592653589
|
||||
#define INV2PI 0.159154943
|
||||
|
||||
//
|
||||
// Globals
|
||||
//
|
||||
|
||||
//
|
||||
//Task 1 (C) Variables
|
||||
//
|
||||
extern float y[]; //Result vector
|
||||
extern float fVal; //Holds the input argument to the task
|
||||
extern float fResult; //The arsine of the input argument
|
||||
|
||||
//
|
||||
//Task 2 (C) Variables
|
||||
//
|
||||
|
||||
//
|
||||
//Task 3 (C) Variables
|
||||
//
|
||||
|
||||
//
|
||||
//Task 4 (C) Variables
|
||||
//
|
||||
|
||||
//
|
||||
//Task 5 (C) Variables
|
||||
//
|
||||
|
||||
//
|
||||
//Task 6 (C) Variables
|
||||
//
|
||||
|
||||
//
|
||||
//Task 7 (C) Variables
|
||||
//
|
||||
|
||||
//
|
||||
//Task 8 (C) Variables
|
||||
//
|
||||
|
||||
//
|
||||
//Common (C) Variables
|
||||
//
|
||||
extern float CLAasinTable[]; //The arcsine lookup table
|
||||
|
||||
//
|
||||
// Function Prototypes
|
||||
//
|
||||
// The following are symbols defined in the CLA assembly code
|
||||
// Including them in the shared header file makes them
|
||||
// .global and the main CPU can make use of them.
|
||||
//
|
||||
__interrupt void Cla1Task1();
|
||||
__interrupt void Cla1Task2();
|
||||
__interrupt void Cla1Task3();
|
||||
__interrupt void Cla1Task4();
|
||||
__interrupt void Cla1Task5();
|
||||
__interrupt void Cla1Task6();
|
||||
__interrupt void Cla1Task7();
|
||||
__interrupt void Cla1Task8();
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif // extern "C"
|
||||
|
||||
#endif //end of _CLA_ASIN_SHARED_H_ definition
|
||||
|
||||
//
|
||||
// End of file
|
||||
//
|
||||
@@ -0,0 +1,433 @@
|
||||
//###########################################################################
|
||||
//
|
||||
// FILE: cla_ex2_atan.c
|
||||
//
|
||||
// TITLE: CLA ArcTan Example for F2837xD.
|
||||
//
|
||||
//! \addtogroup driver_example_list
|
||||
//! <h1>CLA \f$arctangent(x)\f$ using a lookup table (cla_atan_cpu01)</h1>
|
||||
//!
|
||||
//! In this example, Task 1 of the CLA will calculate the arctangent of
|
||||
//! an input argument using a lookup table.
|
||||
//!
|
||||
//! \b Memory \b Allocation \n
|
||||
//! - CLA1 Math Tables (RAMLS0)
|
||||
//! - CLAatan2Table - Lookup table
|
||||
//! - CLA1 to CPU Message RAM
|
||||
//! - fResult - Result of the lookup algorithm
|
||||
//! - CPU to CLA1 Message RAM
|
||||
//! - fNum - Numerator of sample input
|
||||
//! - fDen - Denominator of sample input
|
||||
//!
|
||||
//! \b Watch \b Variables \n
|
||||
//! - fVal - Argument to task 1
|
||||
//! - fResult - Result of \f$arctan(fVal)\f$
|
||||
//!
|
||||
//
|
||||
//###########################################################################
|
||||
//
|
||||
//
|
||||
// $Copyright:
|
||||
// Copyright (C) 2013-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 "cla_ex2_atan_shared.h"
|
||||
#include "board.h"
|
||||
//
|
||||
// Defines
|
||||
//
|
||||
#define WAITSTEP asm(" RPT #255 || NOP")
|
||||
|
||||
//
|
||||
// Globals
|
||||
//
|
||||
|
||||
//
|
||||
//Task 1 (C) Variables
|
||||
// NOTE: Do not initialize the Message RAM variables globally, they will be
|
||||
// reset during the message ram initialization phase in the CLA memory
|
||||
// configuration routine
|
||||
//
|
||||
#ifdef __cplusplus
|
||||
|
||||
#pragma DATA_SECTION("CpuToCla1MsgRAM");
|
||||
float fVal;
|
||||
#pragma DATA_SECTION("CpuToCla1MsgRAM")
|
||||
float PIBYTWO;
|
||||
#pragma DATA_SECTION("Cla1ToCpuMsgRAM");
|
||||
float fResult;
|
||||
|
||||
#else
|
||||
|
||||
#pragma DATA_SECTION(fVal,"CpuToCla1MsgRAM");
|
||||
float fVal;
|
||||
#pragma DATA_SECTION(PIBYTWO,"CpuToCla1MsgRAM")
|
||||
float PIBYTWO = 1.570796327;
|
||||
#pragma DATA_SECTION(fResult,"Cla1ToCpuMsgRAM");
|
||||
float fResult;
|
||||
#endif //__cplusplus
|
||||
float y[BUFFER_SIZE];
|
||||
|
||||
//
|
||||
//Task 2 (C) Variables
|
||||
//
|
||||
|
||||
//
|
||||
//Task 3 (C) Variables
|
||||
//
|
||||
|
||||
//
|
||||
//Task 4 (C) Variables
|
||||
//
|
||||
|
||||
//
|
||||
//Task 5 (C) Variables
|
||||
//
|
||||
|
||||
//
|
||||
//Task 6 (C) Variables
|
||||
//
|
||||
|
||||
//
|
||||
//Task 7 (C) Variables
|
||||
//
|
||||
|
||||
//
|
||||
//Task 8 (C) Variables
|
||||
//
|
||||
|
||||
//
|
||||
//Common (C) Variables
|
||||
//The Exponential table
|
||||
//
|
||||
#ifdef __cplusplus
|
||||
#pragma DATA_SECTION("CLADataLS0")
|
||||
#else
|
||||
#pragma DATA_SECTION(CLAatan2Table,"CLADataLS0")
|
||||
#endif //__cplusplus
|
||||
float CLAatan2Table[]={
|
||||
0.000000000000, 1.000040679675, -0.007811069750,
|
||||
-0.000003807022, 1.000528067772, -0.023410345493,
|
||||
-0.000018968310, 1.001498568106, -0.038941197075,
|
||||
-0.000052831927, 1.002943680965, -0.054358563160,
|
||||
-0.000112417996, 1.004850785788, -0.069618206649,
|
||||
-0.000204295885, 1.007203293243, -0.084677028723,
|
||||
-0.000334469493, 1.009980843501, -0.099493367628,
|
||||
-0.000508272606, 1.013159547023, -0.114027278430,
|
||||
-0.000730276035, 1.016712263449, -0.128240790343,
|
||||
-0.001004207980, 1.020608913557, -0.142098138715,
|
||||
-0.001332888717, 1.024816818801, -0.155565969259,
|
||||
-0.001718180431, 1.029301062569, -0.168613512667,
|
||||
-0.002160952612, 1.034024867135, -0.181212728329,
|
||||
-0.002661063159, 1.038949980222, -0.193338416410,
|
||||
-0.003217354977, 1.044037065160, -0.204968298146,
|
||||
-0.003827667546, 1.049246088868, -0.216083064706,
|
||||
-0.004488862702, 1.054536702192, -0.226666395507,
|
||||
-0.005196863579, 1.059868607573, -0.236704947279,
|
||||
-0.005946705500, 1.065201909527, -0.246188315613,
|
||||
-0.006732597422, 1.070497443994, -0.255108971022,
|
||||
-0.007547992413, 1.075717083222, -0.263462171840,
|
||||
-0.008385665599, 1.080824013499, -0.271245856476,
|
||||
-0.009237797924, 1.085782983693, -0.278460517693,
|
||||
-0.010096064139, 1.090560523211, -0.285109061650,
|
||||
-0.010951723407, 1.095125128557, -0.291196654447,
|
||||
-0.011795711029, 1.099447418304, -0.296730558920,
|
||||
-0.012618729873, 1.103500256784, -0.301719964310,
|
||||
-0.013411340199, 1.107258847274, -0.306175811325,
|
||||
-0.014164046711, 1.110700795887, -0.310110614947,
|
||||
-0.014867381831, 1.113806147717, -0.313538287176,
|
||||
-0.015511984298, 1.116557397059, -0.316473961655,
|
||||
-0.016088672395, 1.118939473766, -0.318933821948,
|
||||
-0.016588511229, 1.120939707956, -0.320934934991,
|
||||
-0.017002873645, 1.122547775367, -0.322495091022,
|
||||
-0.017323494499, 1.123755625749, -0.323632651068,
|
||||
-0.017542518140, 1.124557396633, -0.324366402860,
|
||||
-0.017652539065, 1.124949314810, -0.324715425833,
|
||||
-0.017646635823, 1.124929587773, -0.324698965683,
|
||||
-0.017518398344, 1.124498287266, -0.324336318787,
|
||||
-0.017261948920, 1.123657226955, -0.323646726613,
|
||||
-0.016871957164, 1.122409836098, -0.322649280139,
|
||||
-0.016343649294, 1.120761030918, -0.321362834119,
|
||||
-0.015672812166, 1.118717085258, -0.319805931024,
|
||||
-0.014855792451, 1.116285501852, -0.317996734279,
|
||||
-0.013889491441, 1.113474885484, -0.315952970460,
|
||||
-0.012771355912, 1.110294819035, -0.313691879968,
|
||||
-0.011499365513, 1.106755743329, -0.311230175714,
|
||||
-0.010072017131, 1.102868841531, -0.308584009287,
|
||||
-0.008488306656, 1.098645928648, -0.305768944066,
|
||||
-0.006747708579, 1.094099346648, -0.302799934724,
|
||||
-0.004850153815, 1.089241865523, -0.299691312610,
|
||||
-0.002796006119, 1.084086590517, -0.296456776409,
|
||||
-0.000586037441, 1.078646875666, -0.293109387609,
|
||||
0.001778597452, 1.072936243727, -0.289661570229,
|
||||
0.004296386804, 1.066968312440, -0.286125114351,
|
||||
0.006965487894, 1.060756727064, -0.282511182960,
|
||||
0.009783753017, 1.054315099009, -0.278830321668,
|
||||
0.012748755207, 1.047656950440, -0.275092470943,
|
||||
0.015857813546, 1.040795664582, -0.271306980411,
|
||||
0.019108017893, 1.033744441476, -0.267482624928,
|
||||
0.022496252887, 1.026516258989, -0.263627622089,
|
||||
0.026019221162, 1.019123838651, -0.259749650860,
|
||||
0.029673465636, 1.011579616186, -0.255855871106,
|
||||
0.033455390838, 1.003895716322, -0.251952943763,
|
||||
0.037361283212, 0.996083931611, -0.248047051426
|
||||
};
|
||||
|
||||
float atan_expected[BUFFER_SIZE]={
|
||||
1.5395565, 1.5385494, 1.5374753, 1.5363272,
|
||||
1.5350972, 1.5337762, 1.5323538, 1.5308176,
|
||||
1.5291537, 1.5273454, 1.5253731, 1.5232133,
|
||||
1.5208379, 1.5182133, 1.5152978, 1.5120405,
|
||||
1.5083776, 1.5042281, 1.4994888, 1.4940244,
|
||||
1.4876550, 1.4801364, 1.4711276, 1.4601392,
|
||||
1.4464413, 1.4288993, 1.4056476, 1.3734008,
|
||||
1.3258177, 1.2490457, 1.1071488, 0.7853982,
|
||||
0.0000000, -0.7853982, -1.1071488, -1.2490457,
|
||||
-1.3258177, -1.3734008, -1.4056476, -1.4288993,
|
||||
-1.4464413, -1.4601392, -1.4711276, -1.4801364,
|
||||
-1.4876550, -1.4940244, -1.4994888, -1.5042281,
|
||||
-1.5083776, -1.5120405, -1.5152978, -1.5182133,
|
||||
-1.5208379, -1.5232133, -1.5253731, -1.5273454,
|
||||
-1.5291537, -1.5308176, -1.5323538, -1.5337762,
|
||||
-1.5350972, -1.5363272, -1.5374753, -1.5385494
|
||||
};
|
||||
|
||||
uint16_t pass = 0;
|
||||
uint16_t fail = 0;
|
||||
|
||||
//
|
||||
// Function Prototypes
|
||||
//
|
||||
void CLA_runTest(void);
|
||||
__interrupt void cla1Isr1();
|
||||
__interrupt void cla1Isr2();
|
||||
__interrupt void cla1Isr3();
|
||||
__interrupt void cla1Isr4();
|
||||
__interrupt void cla1Isr5();
|
||||
__interrupt void cla1Isr6();
|
||||
__interrupt void cla1Isr7();
|
||||
__interrupt void cla1Isr8();
|
||||
|
||||
//
|
||||
// Main
|
||||
//
|
||||
void main(void)
|
||||
{
|
||||
//
|
||||
// Initialize device clock and peripherals
|
||||
//
|
||||
Device_init();
|
||||
|
||||
//
|
||||
// Disable pin locks and enable internal pullups.
|
||||
//
|
||||
//Device_initGPIO(); //skipped for this example
|
||||
|
||||
//
|
||||
// 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();
|
||||
|
||||
//
|
||||
// Initialize resources
|
||||
//
|
||||
Board_init();
|
||||
|
||||
//
|
||||
// Enable Global Interrupts (INTM) and realtime interrupt (DGBM)
|
||||
//
|
||||
EINT;
|
||||
ERTM;
|
||||
|
||||
//
|
||||
// Run the test
|
||||
//
|
||||
CLA_runTest();
|
||||
|
||||
for(;;)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// CLA_runTest - Execute CLA task tests for specified vectors
|
||||
//
|
||||
void CLA_runTest(void)
|
||||
{
|
||||
int16_t i;
|
||||
float error;
|
||||
|
||||
//
|
||||
// Initialize the CPUToCLA1MsgRam variables here
|
||||
//
|
||||
PIBYTWO = 1.570796327;
|
||||
|
||||
for(i = 0; i < BUFFER_SIZE; i++)
|
||||
{
|
||||
fVal = (float)((BUFFER_SIZE/2) - i);
|
||||
|
||||
CLA_forceTasks(CLA1_BASE,CLA_TASKFLAG_1);
|
||||
WAITSTEP;
|
||||
y[i] = fResult;
|
||||
error = fabsf(atan_expected[i]-y[i]);
|
||||
|
||||
if(error < 0.001f)
|
||||
{
|
||||
pass++;
|
||||
}
|
||||
else
|
||||
{
|
||||
fail++;
|
||||
}
|
||||
}
|
||||
|
||||
#if 0
|
||||
|
||||
CLA_forceTasks(CLA1_BASE,CLA_TASKFLAG_2);
|
||||
WAITSTEP;
|
||||
|
||||
CLA_forceTasks(CLA1_BASE,CLA_TASKFLAG_3);
|
||||
WAITSTEP;
|
||||
|
||||
CLA_forceTasks(CLA1_BASE,CLA_TASKFLAG_4);
|
||||
WAITSTEP;
|
||||
|
||||
CLA_forceTasks(CLA1_BASE,CLA_TASKFLAG_5);
|
||||
WAITSTEP;
|
||||
|
||||
CLA_forceTasks(CLA1_BASE,CLA_TASKFLAG_6);
|
||||
WAITSTEP;
|
||||
|
||||
CLA_forceTasks(CLA1_BASE,CLA_TASKFLAG_7);
|
||||
WAITSTEP;
|
||||
|
||||
CLA_forceTasks(CLA1_BASE,CLA_TASKFLAG_8);
|
||||
WAITSTEP;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//
|
||||
// cla1Isr1 - CLA1 ISR 1
|
||||
//
|
||||
__interrupt void cla1Isr1 ()
|
||||
{
|
||||
//
|
||||
// Acknowledge the end-of-task interrupt for task 1
|
||||
//
|
||||
Interrupt_clearACKGroup(INTERRUPT_ACK_GROUP11);
|
||||
|
||||
//
|
||||
// Uncomment to halt debugger and stop here
|
||||
//
|
||||
// asm(" ESTOP0");
|
||||
}
|
||||
|
||||
//
|
||||
// cla1Isr2 - CLA1 ISR 2
|
||||
//
|
||||
__interrupt void cla1Isr2 ()
|
||||
{
|
||||
asm(" ESTOP0");
|
||||
}
|
||||
|
||||
//
|
||||
// cla1Isr3 - CLA1 ISR 3
|
||||
//
|
||||
__interrupt void cla1Isr3 ()
|
||||
{
|
||||
asm(" ESTOP0");
|
||||
}
|
||||
|
||||
//
|
||||
// cla1Isr4 - CLA1 ISR 4
|
||||
//
|
||||
__interrupt void cla1Isr4 ()
|
||||
{
|
||||
asm(" ESTOP0");
|
||||
}
|
||||
|
||||
//
|
||||
// cla1Isr5 - CLA1 ISR 5
|
||||
//
|
||||
__interrupt void cla1Isr5 ()
|
||||
{
|
||||
asm(" ESTOP0");
|
||||
}
|
||||
|
||||
//
|
||||
// cla1Isr6 - CLA1 ISR 6
|
||||
//
|
||||
__interrupt void cla1Isr6 ()
|
||||
{
|
||||
asm(" ESTOP0");
|
||||
}
|
||||
|
||||
//
|
||||
// cla1Isr7 - CLA1 ISR 7
|
||||
//
|
||||
__interrupt void cla1Isr7 ()
|
||||
{
|
||||
asm(" ESTOP0");
|
||||
}
|
||||
|
||||
//
|
||||
// cla1Isr8 - CLA1 ISR 8
|
||||
//
|
||||
__interrupt void cla1Isr8 ()
|
||||
{
|
||||
//
|
||||
// Acknowledge the end-of-task interrupt for task 8
|
||||
//
|
||||
Interrupt_clearACKGroup(INTERRUPT_ACK_GROUP11);
|
||||
//
|
||||
// Uncomment to halt debugger and stop here
|
||||
//
|
||||
// asm(" ESTOP0");
|
||||
}
|
||||
|
||||
//
|
||||
// End of file
|
||||
//
|
||||
@@ -0,0 +1,20 @@
|
||||
|
||||
/**
|
||||
* Import the modules used in this configuration.
|
||||
*/
|
||||
const cla = scripting.addModule("/driverlib/cla.js", {}, false);
|
||||
const cla1 = cla.addInstance();
|
||||
const memcfg = scripting.addModule("/driverlib/memcfg.js");
|
||||
|
||||
/**
|
||||
* Write custom configuration values to the imported modules.
|
||||
*/
|
||||
cla1.$name = "myCLA0";
|
||||
|
||||
|
||||
memcfg.config_MEMCFG_SECT_LS4 = "CLA_prog";
|
||||
memcfg.config_MEMCFG_SECT_LS5 = "CLA_prog";
|
||||
memcfg.config_MEMCFG_SECT_LS0 = "CLA_data";
|
||||
memcfg.config_MEMCFG_SECT_LS1 = "CLA_data";
|
||||
memcfg.init_MEMCFG_SECT_MSGCPUTOCLA1 = true;
|
||||
memcfg.init_MEMCFG_SECT_MSGCLA1TOCPU = true;
|
||||
@@ -0,0 +1,129 @@
|
||||
#ifndef _CLA_ATAN_SHARED_H_
|
||||
#define _CLA_ATAN_SHARED_H_
|
||||
//#############################################################################
|
||||
//
|
||||
// FILE: cla_ex2_atan_shared.h
|
||||
//
|
||||
// TITLE: CLA arctangent example header file.
|
||||
//
|
||||
//#############################################################################
|
||||
// $Copyright:
|
||||
// Copyright (C) 2013-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 <stdint.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
//
|
||||
// Defines
|
||||
//
|
||||
#define BUFFER_SIZE 64
|
||||
#define TABLE_SIZE 64
|
||||
#define TABLE_SIZE_M_1 TABLE_SIZE-1
|
||||
#define INV2PI 0.159154943
|
||||
|
||||
//
|
||||
// Globals
|
||||
//
|
||||
|
||||
//
|
||||
//Task 1 (C) Variables
|
||||
//
|
||||
extern float y[]; //Result vector
|
||||
extern float fVal; //Holds the input argument to the task
|
||||
extern float fResult; //The arsine of the input argument
|
||||
|
||||
//
|
||||
//Task 2 (C) Variables
|
||||
//
|
||||
|
||||
//
|
||||
//Task 3 (C) Variables
|
||||
//
|
||||
|
||||
//
|
||||
//Task 4 (C) Variables
|
||||
//
|
||||
|
||||
//
|
||||
//Task 5 (C) Variables
|
||||
//
|
||||
|
||||
//
|
||||
//Task 6 (C) Variables
|
||||
//
|
||||
|
||||
//
|
||||
//Task 7 (C) Variables
|
||||
//
|
||||
|
||||
//
|
||||
//Task 8 (C) Variables
|
||||
//
|
||||
|
||||
//
|
||||
//Common (C) Variables
|
||||
//
|
||||
extern float PIBYTWO;
|
||||
extern float CLAatan2Table[];
|
||||
|
||||
//
|
||||
// Function Prototypes
|
||||
//
|
||||
// The following are symbols defined in the CLA assembly code
|
||||
// Including them in the shared header file makes them
|
||||
// .global and the main CPU can make use of them.
|
||||
//
|
||||
__interrupt void Cla1Task1();
|
||||
__interrupt void Cla1Task2();
|
||||
__interrupt void Cla1Task3();
|
||||
__interrupt void Cla1Task4();
|
||||
__interrupt void Cla1Task5();
|
||||
__interrupt void Cla1Task6();
|
||||
__interrupt void Cla1Task7();
|
||||
__interrupt void Cla1Task8();
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif // extern "C"
|
||||
|
||||
#endif //end of _CLA_ATAN_SHARED_H_ definition
|
||||
|
||||
//
|
||||
// End of file
|
||||
//
|
||||
@@ -0,0 +1,36 @@
|
||||
<projectSpec>
|
||||
<project
|
||||
name="clb_empty"
|
||||
device="TMS320F28377D"
|
||||
products="sysconfig;C2000WARE"
|
||||
launchWizard="False"
|
||||
linkerCommandFile=""
|
||||
outputFormat="ELF"
|
||||
enableSysConfigTool="true"
|
||||
sysConfigBuildOptions="--product ${CLB_SYSCFG_ROOT}/.metadata/product.json --device F2837xD"
|
||||
>
|
||||
<configuration name="Debug" postBuildStep="mkdir "${BuildDirectory}/simulation"
|
||||
;${CLB_SIM_COMPILER}/g++ -c -DCLB_SIM -I${SYSTEMC_INSTALL}/src -I${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/include -I${PROJECT_ROOT} -I${CLB_SIM_COMPILER}/include -Og -g -gdwarf-3 -gstrict-dwarf -Wall -MMD -MP -MF${BuildDirectory}/simulation/clb_sim.d -MT${BuildDirectory}/simulation/clb_sim.o -I${BuildDirectory}/syscfg -fno-threadsafe-statics -o${BuildDirectory}/simulation/clb_sim.o ${BuildDirectory}/syscfg/clb_sim.cpp
|
||||
;${CLB_SIM_COMPILER}/g++ -DCLB_SIM -Og -g -gdwarf-3 -gstrict-dwarf -Wall -Wl,-Map,${BuildDirectory}/simulation/simulation_output.map -L${SYSTEMC_INSTALL}/build/src -o${BuildDirectory}/simulation/simulation_output.exe ${BuildDirectory}/simulation/clb_sim.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/CLB_FSM_SC_model.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/CLB_HLC_SC_model.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/CLB_LUT4_SC_model.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/CLB_OutputLUT_SC_model.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/CLB_counter_SC_model.o -Wl,--start-group -lsystemc -Wl,--end-group;./simulation/simulation_output.exe
|
||||
;${NODE_TOOL} "${CLB_SYSCFG_ROOT}/dot_file_libraries/clbDotUtility.js" "${CLB_SYSCFG_ROOT}" "${BuildDirectory}/syscfg" "${BuildDirectory}/syscfg/clb.dot""
|
||||
compilerBuildOptions="--opt_level=off --opt_for_speed=2 --fp_mode=strict -I${C2000WARE_DLIB_ROOT} -I${C2000WARE_DEVICESUPPORT_ROOT}/common/include -I${PROJECT_ROOT}/device -I${CLB_SYSCFG_ROOT}/systemc/include -v28 -ml -mt --cla_support=cla1 --float_support=fpu32 --tmu_support=tmu0 --vcu_support=vcu2 --define=CPU1 -g --diag_warning=225 --diag_wrap=off --display_error_number " linkerBuildOptions="--stack_size=0x200 -l driverlib.lib -l libc.a -I${C2000WARE_DLIB_ROOT}/ccs/Debug" />
|
||||
|
||||
<pathVariable name="C2000WARE_ROOT" path="../../../../../../" scope="project" />
|
||||
<pathVariable name="C2000WARE_DLIB_ROOT" path="../../../../driverlib/" scope="project" />
|
||||
<pathVariable name="C2000WARE_DEVICESUPPORT_ROOT" path="../../../../../../device_support/F2837xD/" 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" />
|
||||
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/targetConfigs/TMS320F28377D.ccxml" targetDirectory="targetConfigs" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/include/driverlib.h" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/include/device.h" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/source/device.c" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/cmd/2837xD_RAM_lnk_cpu1.cmd" targetDirectory=""/>
|
||||
<file action="copy" path="../../../../driverlib/" targetDirectory="device" excludeFromBuild="True" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/source/F2837xD_CodeStartBranch.asm" targetDirectory="device" />
|
||||
|
||||
<file action="copy" path="../empty.c" targetDirectory="" />
|
||||
<file action="copy" path="../empty.syscfg" targetDirectory="" />
|
||||
</project>
|
||||
</projectSpec>
|
||||
+36
@@ -0,0 +1,36 @@
|
||||
<projectSpec>
|
||||
<project
|
||||
name="clb_ex10_timer_two_states"
|
||||
device="TMS320F28377D"
|
||||
products="sysconfig;C2000WARE"
|
||||
launchWizard="False"
|
||||
linkerCommandFile=""
|
||||
outputFormat="ELF"
|
||||
enableSysConfigTool="true"
|
||||
sysConfigBuildOptions="--product ${CLB_SYSCFG_ROOT}/.metadata/product.json --device F2837xD"
|
||||
>
|
||||
<configuration name="Debug" postBuildStep="mkdir "${BuildDirectory}/simulation"
|
||||
;${CLB_SIM_COMPILER}/g++ -c -DCLB_SIM -I${SYSTEMC_INSTALL}/src -I${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/include -I${PROJECT_ROOT} -I${CLB_SIM_COMPILER}/include -Og -g -gdwarf-3 -gstrict-dwarf -Wall -MMD -MP -MF${BuildDirectory}/simulation/clb_sim.d -MT${BuildDirectory}/simulation/clb_sim.o -I${BuildDirectory}/syscfg -fno-threadsafe-statics -o${BuildDirectory}/simulation/clb_sim.o ${BuildDirectory}/syscfg/clb_sim.cpp
|
||||
;${CLB_SIM_COMPILER}/g++ -DCLB_SIM -Og -g -gdwarf-3 -gstrict-dwarf -Wall -Wl,-Map,${BuildDirectory}/simulation/simulation_output.map -L${SYSTEMC_INSTALL}/build/src -o${BuildDirectory}/simulation/simulation_output.exe ${BuildDirectory}/simulation/clb_sim.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/CLB_FSM_SC_model.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/CLB_HLC_SC_model.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/CLB_LUT4_SC_model.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/CLB_OutputLUT_SC_model.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/CLB_counter_SC_model.o -Wl,--start-group -lsystemc -Wl,--end-group;./simulation/simulation_output.exe
|
||||
;${NODE_TOOL} "${CLB_SYSCFG_ROOT}/dot_file_libraries/clbDotUtility.js" "${CLB_SYSCFG_ROOT}" "${BuildDirectory}/syscfg" "${BuildDirectory}/syscfg/clb.dot""
|
||||
compilerBuildOptions="--opt_level=off --opt_for_speed=2 --fp_mode=strict -I${C2000WARE_DLIB_ROOT} -I${C2000WARE_DEVICESUPPORT_ROOT}/common/include -I${PROJECT_ROOT}/device -I${CLB_SYSCFG_ROOT}/systemc/include -v28 -ml -mt --cla_support=cla1 --float_support=fpu32 --tmu_support=tmu0 --vcu_support=vcu2 --define=CPU1 -g --diag_warning=225 --diag_wrap=off --display_error_number " linkerBuildOptions="--stack_size=0x200 -l driverlib.lib -l libc.a -I${C2000WARE_DLIB_ROOT}/ccs/Debug" />
|
||||
|
||||
<pathVariable name="C2000WARE_ROOT" path="../../../../../../" scope="project" />
|
||||
<pathVariable name="C2000WARE_DLIB_ROOT" path="../../../../driverlib/" scope="project" />
|
||||
<pathVariable name="C2000WARE_DEVICESUPPORT_ROOT" path="../../../../../../device_support/F2837xD/" 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" />
|
||||
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/targetConfigs/TMS320F28377D.ccxml" targetDirectory="targetConfigs" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/include/driverlib.h" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/include/device.h" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/source/device.c" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/cmd/2837xD_RAM_lnk_cpu1.cmd" targetDirectory=""/>
|
||||
<file action="copy" path="../../../../driverlib/" targetDirectory="device" excludeFromBuild="True" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/source/F2837xD_CodeStartBranch.asm" targetDirectory="device" />
|
||||
|
||||
<file action="copy" path="../clb_ex10_timer_two_states.c" targetDirectory="" />
|
||||
<file action="copy" path="../clb_ex10_timer_two_states.syscfg" targetDirectory="" />
|
||||
</project>
|
||||
</projectSpec>
|
||||
@@ -0,0 +1,36 @@
|
||||
<projectSpec>
|
||||
<project
|
||||
name="clb_ex11_interrupt_tag"
|
||||
device="TMS320F28377D"
|
||||
products="sysconfig;C2000WARE"
|
||||
launchWizard="False"
|
||||
linkerCommandFile=""
|
||||
outputFormat="ELF"
|
||||
enableSysConfigTool="true"
|
||||
sysConfigBuildOptions="--product ${CLB_SYSCFG_ROOT}/.metadata/product.json --device F2837xD"
|
||||
>
|
||||
<configuration name="Debug" postBuildStep="mkdir "${BuildDirectory}/simulation"
|
||||
;${CLB_SIM_COMPILER}/g++ -c -DCLB_SIM -I${SYSTEMC_INSTALL}/src -I${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/include -I${PROJECT_ROOT} -I${CLB_SIM_COMPILER}/include -Og -g -gdwarf-3 -gstrict-dwarf -Wall -MMD -MP -MF${BuildDirectory}/simulation/clb_sim.d -MT${BuildDirectory}/simulation/clb_sim.o -I${BuildDirectory}/syscfg -fno-threadsafe-statics -o${BuildDirectory}/simulation/clb_sim.o ${BuildDirectory}/syscfg/clb_sim.cpp
|
||||
;${CLB_SIM_COMPILER}/g++ -DCLB_SIM -Og -g -gdwarf-3 -gstrict-dwarf -Wall -Wl,-Map,${BuildDirectory}/simulation/simulation_output.map -L${SYSTEMC_INSTALL}/build/src -o${BuildDirectory}/simulation/simulation_output.exe ${BuildDirectory}/simulation/clb_sim.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/CLB_FSM_SC_model.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/CLB_HLC_SC_model.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/CLB_LUT4_SC_model.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/CLB_OutputLUT_SC_model.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/CLB_counter_SC_model.o -Wl,--start-group -lsystemc -Wl,--end-group;./simulation/simulation_output.exe
|
||||
;${NODE_TOOL} "${CLB_SYSCFG_ROOT}/dot_file_libraries/clbDotUtility.js" "${CLB_SYSCFG_ROOT}" "${BuildDirectory}/syscfg" "${BuildDirectory}/syscfg/clb.dot""
|
||||
compilerBuildOptions="--opt_level=off --opt_for_speed=2 --fp_mode=strict -I${C2000WARE_DLIB_ROOT} -I${C2000WARE_DEVICESUPPORT_ROOT}/common/include -I${PROJECT_ROOT}/device -I${CLB_SYSCFG_ROOT}/systemc/include -v28 -ml -mt --cla_support=cla1 --float_support=fpu32 --tmu_support=tmu0 --vcu_support=vcu2 --define=CPU1 -g --diag_warning=225 --diag_wrap=off --display_error_number " linkerBuildOptions="--stack_size=0x200 -l driverlib.lib -l libc.a -I${C2000WARE_DLIB_ROOT}/ccs/Debug" />
|
||||
|
||||
<pathVariable name="C2000WARE_ROOT" path="../../../../../../" scope="project" />
|
||||
<pathVariable name="C2000WARE_DLIB_ROOT" path="../../../../driverlib/" scope="project" />
|
||||
<pathVariable name="C2000WARE_DEVICESUPPORT_ROOT" path="../../../../../../device_support/F2837xD/" 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" />
|
||||
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/targetConfigs/TMS320F28377D.ccxml" targetDirectory="targetConfigs" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/include/driverlib.h" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/include/device.h" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/source/device.c" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/cmd/2837xD_RAM_lnk_cpu1.cmd" targetDirectory=""/>
|
||||
<file action="copy" path="../../../../driverlib/" targetDirectory="device" excludeFromBuild="True" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/source/F2837xD_CodeStartBranch.asm" targetDirectory="device" />
|
||||
|
||||
<file action="copy" path="../clb_ex11_interrupt_tag.c" targetDirectory="" />
|
||||
<file action="copy" path="../clb_ex11_interrupt_tag.syscfg" targetDirectory="" />
|
||||
</project>
|
||||
</projectSpec>
|
||||
+36
@@ -0,0 +1,36 @@
|
||||
<projectSpec>
|
||||
<project
|
||||
name="clb_ex12_output_intersect"
|
||||
device="TMS320F28377D"
|
||||
products="sysconfig;C2000WARE"
|
||||
launchWizard="False"
|
||||
linkerCommandFile=""
|
||||
outputFormat="ELF"
|
||||
enableSysConfigTool="true"
|
||||
sysConfigBuildOptions="--product ${CLB_SYSCFG_ROOT}/.metadata/product.json --device F2837xD"
|
||||
>
|
||||
<configuration name="Debug" postBuildStep="mkdir "${BuildDirectory}/simulation"
|
||||
;${CLB_SIM_COMPILER}/g++ -c -DCLB_SIM -I${SYSTEMC_INSTALL}/src -I${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/include -I${PROJECT_ROOT} -I${CLB_SIM_COMPILER}/include -Og -g -gdwarf-3 -gstrict-dwarf -Wall -MMD -MP -MF${BuildDirectory}/simulation/clb_sim.d -MT${BuildDirectory}/simulation/clb_sim.o -I${BuildDirectory}/syscfg -fno-threadsafe-statics -o${BuildDirectory}/simulation/clb_sim.o ${BuildDirectory}/syscfg/clb_sim.cpp
|
||||
;${CLB_SIM_COMPILER}/g++ -DCLB_SIM -Og -g -gdwarf-3 -gstrict-dwarf -Wall -Wl,-Map,${BuildDirectory}/simulation/simulation_output.map -L${SYSTEMC_INSTALL}/build/src -o${BuildDirectory}/simulation/simulation_output.exe ${BuildDirectory}/simulation/clb_sim.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/CLB_FSM_SC_model.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/CLB_HLC_SC_model.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/CLB_LUT4_SC_model.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/CLB_OutputLUT_SC_model.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/CLB_counter_SC_model.o -Wl,--start-group -lsystemc -Wl,--end-group;./simulation/simulation_output.exe
|
||||
;${NODE_TOOL} "${CLB_SYSCFG_ROOT}/dot_file_libraries/clbDotUtility.js" "${CLB_SYSCFG_ROOT}" "${BuildDirectory}/syscfg" "${BuildDirectory}/syscfg/clb.dot""
|
||||
compilerBuildOptions="--opt_level=off --opt_for_speed=2 --fp_mode=strict -I${C2000WARE_DLIB_ROOT} -I${C2000WARE_DEVICESUPPORT_ROOT}/common/include -I${PROJECT_ROOT}/device -I${CLB_SYSCFG_ROOT}/systemc/include -v28 -ml -mt --cla_support=cla1 --float_support=fpu32 --tmu_support=tmu0 --vcu_support=vcu2 --define=CPU1 -g --diag_warning=225 --diag_wrap=off --display_error_number " linkerBuildOptions="--stack_size=0x200 -l driverlib.lib -l libc.a -I${C2000WARE_DLIB_ROOT}/ccs/Debug" />
|
||||
|
||||
<pathVariable name="C2000WARE_ROOT" path="../../../../../../" scope="project" />
|
||||
<pathVariable name="C2000WARE_DLIB_ROOT" path="../../../../driverlib/" scope="project" />
|
||||
<pathVariable name="C2000WARE_DEVICESUPPORT_ROOT" path="../../../../../../device_support/F2837xD/" 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" />
|
||||
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/targetConfigs/TMS320F28377D.ccxml" targetDirectory="targetConfigs" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/include/driverlib.h" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/include/device.h" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/source/device.c" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/cmd/2837xD_RAM_lnk_cpu1.cmd" targetDirectory=""/>
|
||||
<file action="copy" path="../../../../driverlib/" targetDirectory="device" excludeFromBuild="True" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/source/F2837xD_CodeStartBranch.asm" targetDirectory="device" />
|
||||
|
||||
<file action="copy" path="../clb_ex12_output_intersect.c" targetDirectory="" />
|
||||
<file action="copy" path="../clb_ex12_output_intersect.syscfg" targetDirectory="" />
|
||||
</project>
|
||||
</projectSpec>
|
||||
@@ -0,0 +1,36 @@
|
||||
<projectSpec>
|
||||
<project
|
||||
name="clb_ex13_push_pull"
|
||||
device="TMS320F28377D"
|
||||
products="sysconfig;C2000WARE"
|
||||
launchWizard="False"
|
||||
linkerCommandFile=""
|
||||
outputFormat="ELF"
|
||||
enableSysConfigTool="true"
|
||||
sysConfigBuildOptions="--product ${CLB_SYSCFG_ROOT}/.metadata/product.json --device F2837xD"
|
||||
>
|
||||
<configuration name="Debug" postBuildStep="mkdir "${BuildDirectory}/simulation"
|
||||
;${CLB_SIM_COMPILER}/g++ -c -DCLB_SIM -I${SYSTEMC_INSTALL}/src -I${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/include -I${PROJECT_ROOT} -I${CLB_SIM_COMPILER}/include -Og -g -gdwarf-3 -gstrict-dwarf -Wall -MMD -MP -MF${BuildDirectory}/simulation/clb_sim.d -MT${BuildDirectory}/simulation/clb_sim.o -I${BuildDirectory}/syscfg -fno-threadsafe-statics -o${BuildDirectory}/simulation/clb_sim.o ${BuildDirectory}/syscfg/clb_sim.cpp
|
||||
;${CLB_SIM_COMPILER}/g++ -DCLB_SIM -Og -g -gdwarf-3 -gstrict-dwarf -Wall -Wl,-Map,${BuildDirectory}/simulation/simulation_output.map -L${SYSTEMC_INSTALL}/build/src -o${BuildDirectory}/simulation/simulation_output.exe ${BuildDirectory}/simulation/clb_sim.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/CLB_FSM_SC_model.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/CLB_HLC_SC_model.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/CLB_LUT4_SC_model.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/CLB_OutputLUT_SC_model.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/CLB_counter_SC_model.o -Wl,--start-group -lsystemc -Wl,--end-group;./simulation/simulation_output.exe
|
||||
;${NODE_TOOL} "${CLB_SYSCFG_ROOT}/dot_file_libraries/clbDotUtility.js" "${CLB_SYSCFG_ROOT}" "${BuildDirectory}/syscfg" "${BuildDirectory}/syscfg/clb.dot""
|
||||
compilerBuildOptions="--opt_level=off --opt_for_speed=2 --fp_mode=strict -I${C2000WARE_DLIB_ROOT} -I${C2000WARE_DEVICESUPPORT_ROOT}/common/include -I${PROJECT_ROOT}/device -I${CLB_SYSCFG_ROOT}/systemc/include -v28 -ml -mt --cla_support=cla1 --float_support=fpu32 --tmu_support=tmu0 --vcu_support=vcu2 --define=CPU1 -g --diag_warning=225 --diag_wrap=off --display_error_number " linkerBuildOptions="--stack_size=0x200 -l driverlib.lib -l libc.a -I${C2000WARE_DLIB_ROOT}/ccs/Debug" />
|
||||
|
||||
<pathVariable name="C2000WARE_ROOT" path="../../../../../../" scope="project" />
|
||||
<pathVariable name="C2000WARE_DLIB_ROOT" path="../../../../driverlib/" scope="project" />
|
||||
<pathVariable name="C2000WARE_DEVICESUPPORT_ROOT" path="../../../../../../device_support/F2837xD/" 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" />
|
||||
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/targetConfigs/TMS320F28377D.ccxml" targetDirectory="targetConfigs" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/include/driverlib.h" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/include/device.h" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/source/device.c" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/cmd/2837xD_RAM_lnk_cpu1.cmd" targetDirectory=""/>
|
||||
<file action="copy" path="../../../../driverlib/" targetDirectory="device" excludeFromBuild="True" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/source/F2837xD_CodeStartBranch.asm" targetDirectory="device" />
|
||||
|
||||
<file action="copy" path="../clb_ex13_push_pull.c" targetDirectory="" />
|
||||
<file action="copy" path="../clb_ex13_push_pull.syscfg" targetDirectory="" />
|
||||
</project>
|
||||
</projectSpec>
|
||||
@@ -0,0 +1,36 @@
|
||||
<projectSpec>
|
||||
<project
|
||||
name="clb_ex14_multi_tile"
|
||||
device="TMS320F28377D"
|
||||
products="sysconfig;C2000WARE"
|
||||
launchWizard="False"
|
||||
linkerCommandFile=""
|
||||
outputFormat="ELF"
|
||||
enableSysConfigTool="true"
|
||||
sysConfigBuildOptions="--product ${CLB_SYSCFG_ROOT}/.metadata/product.json --device F2837xD"
|
||||
>
|
||||
<configuration name="Debug" postBuildStep="mkdir "${BuildDirectory}/simulation"
|
||||
;${CLB_SIM_COMPILER}/g++ -c -DCLB_SIM -I${SYSTEMC_INSTALL}/src -I${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/include -I${PROJECT_ROOT} -I${CLB_SIM_COMPILER}/include -Og -g -gdwarf-3 -gstrict-dwarf -Wall -MMD -MP -MF${BuildDirectory}/simulation/clb_sim.d -MT${BuildDirectory}/simulation/clb_sim.o -I${BuildDirectory}/syscfg -fno-threadsafe-statics -o${BuildDirectory}/simulation/clb_sim.o ${BuildDirectory}/syscfg/clb_sim.cpp
|
||||
;${CLB_SIM_COMPILER}/g++ -DCLB_SIM -Og -g -gdwarf-3 -gstrict-dwarf -Wall -Wl,-Map,${BuildDirectory}/simulation/simulation_output.map -L${SYSTEMC_INSTALL}/build/src -o${BuildDirectory}/simulation/simulation_output.exe ${BuildDirectory}/simulation/clb_sim.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/CLB_FSM_SC_model.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/CLB_HLC_SC_model.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/CLB_LUT4_SC_model.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/CLB_OutputLUT_SC_model.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/CLB_counter_SC_model.o -Wl,--start-group -lsystemc -Wl,--end-group;./simulation/simulation_output.exe
|
||||
;${NODE_TOOL} "${CLB_SYSCFG_ROOT}/dot_file_libraries/clbDotUtility.js" "${CLB_SYSCFG_ROOT}" "${BuildDirectory}/syscfg" "${BuildDirectory}/syscfg/clb.dot""
|
||||
compilerBuildOptions="--opt_level=off --opt_for_speed=2 --fp_mode=strict -I${C2000WARE_DLIB_ROOT} -I${C2000WARE_DEVICESUPPORT_ROOT}/common/include -I${PROJECT_ROOT}/device -I${CLB_SYSCFG_ROOT}/systemc/include -v28 -ml -mt --cla_support=cla1 --float_support=fpu32 --tmu_support=tmu0 --vcu_support=vcu2 --define=CPU1 -g --diag_warning=225 --diag_wrap=off --display_error_number " linkerBuildOptions="--stack_size=0x200 -l driverlib.lib -l libc.a -I${C2000WARE_DLIB_ROOT}/ccs/Debug" />
|
||||
|
||||
<pathVariable name="C2000WARE_ROOT" path="../../../../../../" scope="project" />
|
||||
<pathVariable name="C2000WARE_DLIB_ROOT" path="../../../../driverlib/" scope="project" />
|
||||
<pathVariable name="C2000WARE_DEVICESUPPORT_ROOT" path="../../../../../../device_support/F2837xD/" 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" />
|
||||
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/targetConfigs/TMS320F28377D.ccxml" targetDirectory="targetConfigs" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/include/driverlib.h" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/include/device.h" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/source/device.c" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/cmd/2837xD_RAM_lnk_cpu1.cmd" targetDirectory=""/>
|
||||
<file action="copy" path="../../../../driverlib/" targetDirectory="device" excludeFromBuild="True" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/source/F2837xD_CodeStartBranch.asm" targetDirectory="device" />
|
||||
|
||||
<file action="copy" path="../clb_ex14_multi_tile.c" targetDirectory="" />
|
||||
<file action="copy" path="../clb_ex14_multi_tile.syscfg" targetDirectory="" />
|
||||
</project>
|
||||
</projectSpec>
|
||||
+36
@@ -0,0 +1,36 @@
|
||||
<projectSpec>
|
||||
<project
|
||||
name="clb_ex15_tile_to_tile_delay"
|
||||
device="TMS320F28377D"
|
||||
products="sysconfig;C2000WARE"
|
||||
launchWizard="False"
|
||||
linkerCommandFile=""
|
||||
outputFormat="ELF"
|
||||
enableSysConfigTool="true"
|
||||
sysConfigBuildOptions="--product ${CLB_SYSCFG_ROOT}/.metadata/product.json --device F2837xD"
|
||||
>
|
||||
<configuration name="Debug" postBuildStep="mkdir "${BuildDirectory}/simulation"
|
||||
;${CLB_SIM_COMPILER}/g++ -c -DCLB_SIM -I${SYSTEMC_INSTALL}/src -I${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/include -I${PROJECT_ROOT} -I${CLB_SIM_COMPILER}/include -Og -g -gdwarf-3 -gstrict-dwarf -Wall -MMD -MP -MF${BuildDirectory}/simulation/clb_sim.d -MT${BuildDirectory}/simulation/clb_sim.o -I${BuildDirectory}/syscfg -fno-threadsafe-statics -o${BuildDirectory}/simulation/clb_sim.o ${BuildDirectory}/syscfg/clb_sim.cpp
|
||||
;${CLB_SIM_COMPILER}/g++ -DCLB_SIM -Og -g -gdwarf-3 -gstrict-dwarf -Wall -Wl,-Map,${BuildDirectory}/simulation/simulation_output.map -L${SYSTEMC_INSTALL}/build/src -o${BuildDirectory}/simulation/simulation_output.exe ${BuildDirectory}/simulation/clb_sim.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/CLB_FSM_SC_model.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/CLB_HLC_SC_model.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/CLB_LUT4_SC_model.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/CLB_OutputLUT_SC_model.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/CLB_counter_SC_model.o -Wl,--start-group -lsystemc -Wl,--end-group;./simulation/simulation_output.exe
|
||||
;${NODE_TOOL} "${CLB_SYSCFG_ROOT}/dot_file_libraries/clbDotUtility.js" "${CLB_SYSCFG_ROOT}" "${BuildDirectory}/syscfg" "${BuildDirectory}/syscfg/clb.dot""
|
||||
compilerBuildOptions="--opt_level=off --opt_for_speed=2 --fp_mode=strict -I${C2000WARE_DLIB_ROOT} -I${C2000WARE_DEVICESUPPORT_ROOT}/common/include -I${PROJECT_ROOT}/device -I${CLB_SYSCFG_ROOT}/systemc/include -v28 -ml -mt --cla_support=cla1 --float_support=fpu32 --tmu_support=tmu0 --vcu_support=vcu2 --define=CPU1 -g --diag_warning=225 --diag_wrap=off --display_error_number " linkerBuildOptions="--stack_size=0x200 -l driverlib.lib -l libc.a -I${C2000WARE_DLIB_ROOT}/ccs/Debug" />
|
||||
|
||||
<pathVariable name="C2000WARE_ROOT" path="../../../../../../" scope="project" />
|
||||
<pathVariable name="C2000WARE_DLIB_ROOT" path="../../../../driverlib/" scope="project" />
|
||||
<pathVariable name="C2000WARE_DEVICESUPPORT_ROOT" path="../../../../../../device_support/F2837xD/" 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" />
|
||||
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/targetConfigs/TMS320F28377D.ccxml" targetDirectory="targetConfigs" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/include/driverlib.h" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/include/device.h" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/source/device.c" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/cmd/2837xD_RAM_lnk_cpu1.cmd" targetDirectory=""/>
|
||||
<file action="copy" path="../../../../driverlib/" targetDirectory="device" excludeFromBuild="True" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/source/F2837xD_CodeStartBranch.asm" targetDirectory="device" />
|
||||
|
||||
<file action="copy" path="../clb_ex15_tile_to_tile_delay.c" targetDirectory="" />
|
||||
<file action="copy" path="../clb_ex15_tile_to_tile_delay.syscfg" targetDirectory="" />
|
||||
</project>
|
||||
</projectSpec>
|
||||
@@ -0,0 +1,36 @@
|
||||
<projectSpec>
|
||||
<project
|
||||
name="clb_ex17_one_shot_pwm"
|
||||
device="TMS320F28377D"
|
||||
products="sysconfig;C2000WARE"
|
||||
launchWizard="False"
|
||||
linkerCommandFile=""
|
||||
outputFormat="ELF"
|
||||
enableSysConfigTool="true"
|
||||
sysConfigBuildOptions="--product ${CLB_SYSCFG_ROOT}/.metadata/product.json --device F2837xD"
|
||||
>
|
||||
<configuration name="Debug" postBuildStep="mkdir "${BuildDirectory}/simulation"
|
||||
;${CLB_SIM_COMPILER}/g++ -c -DCLB_SIM -I${SYSTEMC_INSTALL}/src -I${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/include -I${PROJECT_ROOT} -I${CLB_SIM_COMPILER}/include -Og -g -gdwarf-3 -gstrict-dwarf -Wall -MMD -MP -MF${BuildDirectory}/simulation/clb_sim.d -MT${BuildDirectory}/simulation/clb_sim.o -I${BuildDirectory}/syscfg -fno-threadsafe-statics -o${BuildDirectory}/simulation/clb_sim.o ${BuildDirectory}/syscfg/clb_sim.cpp
|
||||
;${CLB_SIM_COMPILER}/g++ -DCLB_SIM -Og -g -gdwarf-3 -gstrict-dwarf -Wall -Wl,-Map,${BuildDirectory}/simulation/simulation_output.map -L${SYSTEMC_INSTALL}/build/src -o${BuildDirectory}/simulation/simulation_output.exe ${BuildDirectory}/simulation/clb_sim.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/CLB_FSM_SC_model.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/CLB_HLC_SC_model.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/CLB_LUT4_SC_model.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/CLB_OutputLUT_SC_model.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/CLB_counter_SC_model.o -Wl,--start-group -lsystemc -Wl,--end-group;./simulation/simulation_output.exe
|
||||
;${NODE_TOOL} "${CLB_SYSCFG_ROOT}/dot_file_libraries/clbDotUtility.js" "${CLB_SYSCFG_ROOT}" "${BuildDirectory}/syscfg" "${BuildDirectory}/syscfg/clb.dot""
|
||||
compilerBuildOptions="--opt_level=off --opt_for_speed=2 --fp_mode=strict -I${C2000WARE_DLIB_ROOT} -I${C2000WARE_DEVICESUPPORT_ROOT}/common/include -I${PROJECT_ROOT}/device -I${CLB_SYSCFG_ROOT}/systemc/include -v28 -ml -mt --cla_support=cla1 --float_support=fpu32 --tmu_support=tmu0 --vcu_support=vcu2 --define=CPU1 -g --diag_warning=225 --diag_wrap=off --display_error_number " linkerBuildOptions="--stack_size=0x200 -l driverlib.lib -l libc.a -I${C2000WARE_DLIB_ROOT}/ccs/Debug" />
|
||||
|
||||
<pathVariable name="C2000WARE_ROOT" path="../../../../../../" scope="project" />
|
||||
<pathVariable name="C2000WARE_DLIB_ROOT" path="../../../../driverlib/" scope="project" />
|
||||
<pathVariable name="C2000WARE_DEVICESUPPORT_ROOT" path="../../../../../../device_support/F2837xD/" 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" />
|
||||
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/targetConfigs/TMS320F28377D.ccxml" targetDirectory="targetConfigs" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/include/driverlib.h" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/include/device.h" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/source/device.c" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/cmd/2837xD_RAM_lnk_cpu1.cmd" targetDirectory=""/>
|
||||
<file action="copy" path="../../../../driverlib/" targetDirectory="device" excludeFromBuild="True" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/source/F2837xD_CodeStartBranch.asm" targetDirectory="device" />
|
||||
|
||||
<file action="copy" path="../clb_ex17_one_shot_pwm.c" targetDirectory="" />
|
||||
<file action="copy" path="../clb_ex17_one_shot_pwm.syscfg" targetDirectory="" />
|
||||
</project>
|
||||
</projectSpec>
|
||||
+36
@@ -0,0 +1,36 @@
|
||||
<projectSpec>
|
||||
<project
|
||||
name="clb_ex1_combinatorial_logic"
|
||||
device="TMS320F28377D"
|
||||
products="sysconfig;C2000WARE"
|
||||
launchWizard="False"
|
||||
linkerCommandFile=""
|
||||
outputFormat="ELF"
|
||||
enableSysConfigTool="true"
|
||||
sysConfigBuildOptions="--product ${CLB_SYSCFG_ROOT}/.metadata/product.json --device F2837xD"
|
||||
>
|
||||
<configuration name="Debug" postBuildStep="mkdir "${BuildDirectory}/simulation"
|
||||
;${CLB_SIM_COMPILER}/g++ -c -DCLB_SIM -I${SYSTEMC_INSTALL}/src -I${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/include -I${PROJECT_ROOT} -I${CLB_SIM_COMPILER}/include -Og -g -gdwarf-3 -gstrict-dwarf -Wall -MMD -MP -MF${BuildDirectory}/simulation/clb_sim.d -MT${BuildDirectory}/simulation/clb_sim.o -I${BuildDirectory}/syscfg -fno-threadsafe-statics -o${BuildDirectory}/simulation/clb_sim.o ${BuildDirectory}/syscfg/clb_sim.cpp
|
||||
;${CLB_SIM_COMPILER}/g++ -DCLB_SIM -Og -g -gdwarf-3 -gstrict-dwarf -Wall -Wl,-Map,${BuildDirectory}/simulation/simulation_output.map -L${SYSTEMC_INSTALL}/build/src -o${BuildDirectory}/simulation/simulation_output.exe ${BuildDirectory}/simulation/clb_sim.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/CLB_FSM_SC_model.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/CLB_HLC_SC_model.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/CLB_LUT4_SC_model.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/CLB_OutputLUT_SC_model.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/CLB_counter_SC_model.o -Wl,--start-group -lsystemc -Wl,--end-group;./simulation/simulation_output.exe
|
||||
;${NODE_TOOL} "${CLB_SYSCFG_ROOT}/dot_file_libraries/clbDotUtility.js" "${CLB_SYSCFG_ROOT}" "${BuildDirectory}/syscfg" "${BuildDirectory}/syscfg/clb.dot""
|
||||
compilerBuildOptions="--opt_level=off --opt_for_speed=2 --fp_mode=strict -I${C2000WARE_DLIB_ROOT} -I${C2000WARE_DEVICESUPPORT_ROOT}/common/include -I${PROJECT_ROOT}/device -I${CLB_SYSCFG_ROOT}/systemc/include -v28 -ml -mt --cla_support=cla1 --float_support=fpu32 --tmu_support=tmu0 --vcu_support=vcu2 --define=CPU1 -g --diag_warning=225 --diag_wrap=off --display_error_number " linkerBuildOptions="--stack_size=0x200 -l driverlib.lib -l libc.a -I${C2000WARE_DLIB_ROOT}/ccs/Debug" />
|
||||
|
||||
<pathVariable name="C2000WARE_ROOT" path="../../../../../../" scope="project" />
|
||||
<pathVariable name="C2000WARE_DLIB_ROOT" path="../../../../driverlib/" scope="project" />
|
||||
<pathVariable name="C2000WARE_DEVICESUPPORT_ROOT" path="../../../../../../device_support/F2837xD/" 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" />
|
||||
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/targetConfigs/TMS320F28377D.ccxml" targetDirectory="targetConfigs" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/include/driverlib.h" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/include/device.h" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/source/device.c" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/cmd/2837xD_RAM_lnk_cpu1.cmd" targetDirectory=""/>
|
||||
<file action="copy" path="../../../../driverlib/" targetDirectory="device" excludeFromBuild="True" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/source/F2837xD_CodeStartBranch.asm" targetDirectory="device" />
|
||||
|
||||
<file action="copy" path="../clb_ex1_combinatorial_logic.c" targetDirectory="" />
|
||||
<file action="copy" path="../clb_ex1_combinatorial_logic.syscfg" targetDirectory="" />
|
||||
</project>
|
||||
</projectSpec>
|
||||
+36
@@ -0,0 +1,36 @@
|
||||
<projectSpec>
|
||||
<project
|
||||
name="clb_ex2_gpio_input_filter"
|
||||
device="TMS320F28377D"
|
||||
products="sysconfig;C2000WARE"
|
||||
launchWizard="False"
|
||||
linkerCommandFile=""
|
||||
outputFormat="ELF"
|
||||
enableSysConfigTool="true"
|
||||
sysConfigBuildOptions="--product ${CLB_SYSCFG_ROOT}/.metadata/product.json --device F2837xD"
|
||||
>
|
||||
<configuration name="Debug" postBuildStep="mkdir "${BuildDirectory}/simulation"
|
||||
;${CLB_SIM_COMPILER}/g++ -c -DCLB_SIM -I${SYSTEMC_INSTALL}/src -I${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/include -I${PROJECT_ROOT} -I${CLB_SIM_COMPILER}/include -Og -g -gdwarf-3 -gstrict-dwarf -Wall -MMD -MP -MF${BuildDirectory}/simulation/clb_sim.d -MT${BuildDirectory}/simulation/clb_sim.o -I${BuildDirectory}/syscfg -fno-threadsafe-statics -o${BuildDirectory}/simulation/clb_sim.o ${BuildDirectory}/syscfg/clb_sim.cpp
|
||||
;${CLB_SIM_COMPILER}/g++ -DCLB_SIM -Og -g -gdwarf-3 -gstrict-dwarf -Wall -Wl,-Map,${BuildDirectory}/simulation/simulation_output.map -L${SYSTEMC_INSTALL}/build/src -o${BuildDirectory}/simulation/simulation_output.exe ${BuildDirectory}/simulation/clb_sim.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/CLB_FSM_SC_model.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/CLB_HLC_SC_model.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/CLB_LUT4_SC_model.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/CLB_OutputLUT_SC_model.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/CLB_counter_SC_model.o -Wl,--start-group -lsystemc -Wl,--end-group;./simulation/simulation_output.exe
|
||||
;${NODE_TOOL} "${CLB_SYSCFG_ROOT}/dot_file_libraries/clbDotUtility.js" "${CLB_SYSCFG_ROOT}" "${BuildDirectory}/syscfg" "${BuildDirectory}/syscfg/clb.dot""
|
||||
compilerBuildOptions="--opt_level=off --opt_for_speed=2 --fp_mode=strict -I${C2000WARE_DLIB_ROOT} -I${C2000WARE_DEVICESUPPORT_ROOT}/common/include -I${PROJECT_ROOT}/device -I${CLB_SYSCFG_ROOT}/systemc/include -v28 -ml -mt --cla_support=cla1 --float_support=fpu32 --tmu_support=tmu0 --vcu_support=vcu2 --define=CPU1 -g --diag_warning=225 --diag_wrap=off --display_error_number " linkerBuildOptions="--stack_size=0x200 -l driverlib.lib -l libc.a -I${C2000WARE_DLIB_ROOT}/ccs/Debug" />
|
||||
|
||||
<pathVariable name="C2000WARE_ROOT" path="../../../../../../" scope="project" />
|
||||
<pathVariable name="C2000WARE_DLIB_ROOT" path="../../../../driverlib/" scope="project" />
|
||||
<pathVariable name="C2000WARE_DEVICESUPPORT_ROOT" path="../../../../../../device_support/F2837xD/" 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" />
|
||||
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/targetConfigs/TMS320F28377D.ccxml" targetDirectory="targetConfigs" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/include/driverlib.h" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/include/device.h" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/source/device.c" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/cmd/2837xD_RAM_lnk_cpu1.cmd" targetDirectory=""/>
|
||||
<file action="copy" path="../../../../driverlib/" targetDirectory="device" excludeFromBuild="True" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/source/F2837xD_CodeStartBranch.asm" targetDirectory="device" />
|
||||
|
||||
<file action="copy" path="../clb_ex2_gpio_input_filter.c" targetDirectory="" />
|
||||
<file action="copy" path="../clb_ex2_gpio_input_filter.syscfg" targetDirectory="" />
|
||||
</project>
|
||||
</projectSpec>
|
||||
@@ -0,0 +1,36 @@
|
||||
<projectSpec>
|
||||
<project
|
||||
name="clb_ex3_auxiliary_pwm"
|
||||
device="TMS320F28377D"
|
||||
products="sysconfig;C2000WARE"
|
||||
launchWizard="False"
|
||||
linkerCommandFile=""
|
||||
outputFormat="ELF"
|
||||
enableSysConfigTool="true"
|
||||
sysConfigBuildOptions="--product ${CLB_SYSCFG_ROOT}/.metadata/product.json --device F2837xD"
|
||||
>
|
||||
<configuration name="Debug" postBuildStep="mkdir "${BuildDirectory}/simulation"
|
||||
;${CLB_SIM_COMPILER}/g++ -c -DCLB_SIM -I${SYSTEMC_INSTALL}/src -I${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/include -I${PROJECT_ROOT} -I${CLB_SIM_COMPILER}/include -Og -g -gdwarf-3 -gstrict-dwarf -Wall -MMD -MP -MF${BuildDirectory}/simulation/clb_sim.d -MT${BuildDirectory}/simulation/clb_sim.o -I${BuildDirectory}/syscfg -fno-threadsafe-statics -o${BuildDirectory}/simulation/clb_sim.o ${BuildDirectory}/syscfg/clb_sim.cpp
|
||||
;${CLB_SIM_COMPILER}/g++ -DCLB_SIM -Og -g -gdwarf-3 -gstrict-dwarf -Wall -Wl,-Map,${BuildDirectory}/simulation/simulation_output.map -L${SYSTEMC_INSTALL}/build/src -o${BuildDirectory}/simulation/simulation_output.exe ${BuildDirectory}/simulation/clb_sim.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/CLB_FSM_SC_model.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/CLB_HLC_SC_model.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/CLB_LUT4_SC_model.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/CLB_OutputLUT_SC_model.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/CLB_counter_SC_model.o -Wl,--start-group -lsystemc -Wl,--end-group;./simulation/simulation_output.exe
|
||||
;${NODE_TOOL} "${CLB_SYSCFG_ROOT}/dot_file_libraries/clbDotUtility.js" "${CLB_SYSCFG_ROOT}" "${BuildDirectory}/syscfg" "${BuildDirectory}/syscfg/clb.dot""
|
||||
compilerBuildOptions="--opt_level=off --opt_for_speed=2 --fp_mode=strict -I${C2000WARE_DLIB_ROOT} -I${C2000WARE_DEVICESUPPORT_ROOT}/common/include -I${PROJECT_ROOT}/device -I${CLB_SYSCFG_ROOT}/systemc/include -v28 -ml -mt --cla_support=cla1 --float_support=fpu32 --tmu_support=tmu0 --vcu_support=vcu2 --define=CPU1 -g --diag_warning=225 --diag_wrap=off --display_error_number " linkerBuildOptions="--stack_size=0x200 -l driverlib.lib -l libc.a -I${C2000WARE_DLIB_ROOT}/ccs/Debug" />
|
||||
|
||||
<pathVariable name="C2000WARE_ROOT" path="../../../../../../" scope="project" />
|
||||
<pathVariable name="C2000WARE_DLIB_ROOT" path="../../../../driverlib/" scope="project" />
|
||||
<pathVariable name="C2000WARE_DEVICESUPPORT_ROOT" path="../../../../../../device_support/F2837xD/" 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" />
|
||||
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/targetConfigs/TMS320F28377D.ccxml" targetDirectory="targetConfigs" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/include/driverlib.h" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/include/device.h" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/source/device.c" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/cmd/2837xD_RAM_lnk_cpu1.cmd" targetDirectory=""/>
|
||||
<file action="copy" path="../../../../driverlib/" targetDirectory="device" excludeFromBuild="True" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/source/F2837xD_CodeStartBranch.asm" targetDirectory="device" />
|
||||
|
||||
<file action="copy" path="../clb_ex3_auxiliary_pwm.c" targetDirectory="" />
|
||||
<file action="copy" path="../clb_ex3_auxiliary_pwm.syscfg" targetDirectory="" />
|
||||
</project>
|
||||
</projectSpec>
|
||||
@@ -0,0 +1,36 @@
|
||||
<projectSpec>
|
||||
<project
|
||||
name="clb_ex4_pwm_protection"
|
||||
device="TMS320F28377D"
|
||||
products="sysconfig;C2000WARE"
|
||||
launchWizard="False"
|
||||
linkerCommandFile=""
|
||||
outputFormat="ELF"
|
||||
enableSysConfigTool="true"
|
||||
sysConfigBuildOptions="--product ${CLB_SYSCFG_ROOT}/.metadata/product.json --device F2837xD"
|
||||
>
|
||||
<configuration name="Debug" postBuildStep="mkdir "${BuildDirectory}/simulation"
|
||||
;${CLB_SIM_COMPILER}/g++ -c -DCLB_SIM -I${SYSTEMC_INSTALL}/src -I${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/include -I${PROJECT_ROOT} -I${CLB_SIM_COMPILER}/include -Og -g -gdwarf-3 -gstrict-dwarf -Wall -MMD -MP -MF${BuildDirectory}/simulation/clb_sim.d -MT${BuildDirectory}/simulation/clb_sim.o -I${BuildDirectory}/syscfg -fno-threadsafe-statics -o${BuildDirectory}/simulation/clb_sim.o ${BuildDirectory}/syscfg/clb_sim.cpp
|
||||
;${CLB_SIM_COMPILER}/g++ -DCLB_SIM -Og -g -gdwarf-3 -gstrict-dwarf -Wall -Wl,-Map,${BuildDirectory}/simulation/simulation_output.map -L${SYSTEMC_INSTALL}/build/src -o${BuildDirectory}/simulation/simulation_output.exe ${BuildDirectory}/simulation/clb_sim.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/CLB_FSM_SC_model.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/CLB_HLC_SC_model.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/CLB_LUT4_SC_model.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/CLB_OutputLUT_SC_model.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/CLB_counter_SC_model.o -Wl,--start-group -lsystemc -Wl,--end-group;./simulation/simulation_output.exe
|
||||
;${NODE_TOOL} "${CLB_SYSCFG_ROOT}/dot_file_libraries/clbDotUtility.js" "${CLB_SYSCFG_ROOT}" "${BuildDirectory}/syscfg" "${BuildDirectory}/syscfg/clb.dot""
|
||||
compilerBuildOptions="--opt_level=off --opt_for_speed=2 --fp_mode=strict -I${C2000WARE_DLIB_ROOT} -I${C2000WARE_DEVICESUPPORT_ROOT}/common/include -I${PROJECT_ROOT}/device -I${CLB_SYSCFG_ROOT}/systemc/include -v28 -ml -mt --cla_support=cla1 --float_support=fpu32 --tmu_support=tmu0 --vcu_support=vcu2 --define=CPU1 -g --diag_warning=225 --diag_wrap=off --display_error_number " linkerBuildOptions="--stack_size=0x200 -l driverlib.lib -l libc.a -I${C2000WARE_DLIB_ROOT}/ccs/Debug" />
|
||||
|
||||
<pathVariable name="C2000WARE_ROOT" path="../../../../../../" scope="project" />
|
||||
<pathVariable name="C2000WARE_DLIB_ROOT" path="../../../../driverlib/" scope="project" />
|
||||
<pathVariable name="C2000WARE_DEVICESUPPORT_ROOT" path="../../../../../../device_support/F2837xD/" 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" />
|
||||
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/targetConfigs/TMS320F28377D.ccxml" targetDirectory="targetConfigs" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/include/driverlib.h" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/include/device.h" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/source/device.c" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/cmd/2837xD_RAM_lnk_cpu1.cmd" targetDirectory=""/>
|
||||
<file action="copy" path="../../../../driverlib/" targetDirectory="device" excludeFromBuild="True" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/source/F2837xD_CodeStartBranch.asm" targetDirectory="device" />
|
||||
|
||||
<file action="copy" path="../clb_ex4_pwm_protection.c" targetDirectory="" />
|
||||
<file action="copy" path="../clb_ex4_pwm_protection.syscfg" targetDirectory="" />
|
||||
</project>
|
||||
</projectSpec>
|
||||
@@ -0,0 +1,36 @@
|
||||
<projectSpec>
|
||||
<project
|
||||
name="clb_ex5_event_window"
|
||||
device="TMS320F28377D"
|
||||
products="sysconfig;C2000WARE"
|
||||
launchWizard="False"
|
||||
linkerCommandFile=""
|
||||
outputFormat="ELF"
|
||||
enableSysConfigTool="true"
|
||||
sysConfigBuildOptions="--product ${CLB_SYSCFG_ROOT}/.metadata/product.json --device F2837xD"
|
||||
>
|
||||
<configuration name="Debug" postBuildStep="mkdir "${BuildDirectory}/simulation"
|
||||
;${CLB_SIM_COMPILER}/g++ -c -DCLB_SIM -I${SYSTEMC_INSTALL}/src -I${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/include -I${PROJECT_ROOT} -I${CLB_SIM_COMPILER}/include -Og -g -gdwarf-3 -gstrict-dwarf -Wall -MMD -MP -MF${BuildDirectory}/simulation/clb_sim.d -MT${BuildDirectory}/simulation/clb_sim.o -I${BuildDirectory}/syscfg -fno-threadsafe-statics -o${BuildDirectory}/simulation/clb_sim.o ${BuildDirectory}/syscfg/clb_sim.cpp
|
||||
;${CLB_SIM_COMPILER}/g++ -DCLB_SIM -Og -g -gdwarf-3 -gstrict-dwarf -Wall -Wl,-Map,${BuildDirectory}/simulation/simulation_output.map -L${SYSTEMC_INSTALL}/build/src -o${BuildDirectory}/simulation/simulation_output.exe ${BuildDirectory}/simulation/clb_sim.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/CLB_FSM_SC_model.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/CLB_HLC_SC_model.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/CLB_LUT4_SC_model.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/CLB_OutputLUT_SC_model.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/CLB_counter_SC_model.o -Wl,--start-group -lsystemc -Wl,--end-group;./simulation/simulation_output.exe
|
||||
;${NODE_TOOL} "${CLB_SYSCFG_ROOT}/dot_file_libraries/clbDotUtility.js" "${CLB_SYSCFG_ROOT}" "${BuildDirectory}/syscfg" "${BuildDirectory}/syscfg/clb.dot""
|
||||
compilerBuildOptions="--opt_level=off --opt_for_speed=2 --fp_mode=strict -I${C2000WARE_DLIB_ROOT} -I${C2000WARE_DEVICESUPPORT_ROOT}/common/include -I${PROJECT_ROOT}/device -I${CLB_SYSCFG_ROOT}/systemc/include -v28 -ml -mt --cla_support=cla1 --float_support=fpu32 --tmu_support=tmu0 --vcu_support=vcu2 --define=CPU1 -g --diag_warning=225 --diag_wrap=off --display_error_number " linkerBuildOptions="--stack_size=0x200 -l driverlib.lib -l libc.a -I${C2000WARE_DLIB_ROOT}/ccs/Debug" />
|
||||
|
||||
<pathVariable name="C2000WARE_ROOT" path="../../../../../../" scope="project" />
|
||||
<pathVariable name="C2000WARE_DLIB_ROOT" path="../../../../driverlib/" scope="project" />
|
||||
<pathVariable name="C2000WARE_DEVICESUPPORT_ROOT" path="../../../../../../device_support/F2837xD/" 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" />
|
||||
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/targetConfigs/TMS320F28377D.ccxml" targetDirectory="targetConfigs" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/include/driverlib.h" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/include/device.h" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/source/device.c" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/cmd/2837xD_clb_ex5_RAM_lnk.cmd" targetDirectory=""/>
|
||||
<file action="copy" path="../../../../driverlib/" targetDirectory="device" excludeFromBuild="True" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/source/F2837xD_CodeStartBranch.asm" targetDirectory="device" />
|
||||
|
||||
<file action="copy" path="../clb_ex5_event_window.c" targetDirectory="" />
|
||||
<file action="copy" path="../clb_ex5_event_window.syscfg" targetDirectory="" />
|
||||
</project>
|
||||
</projectSpec>
|
||||
@@ -0,0 +1,36 @@
|
||||
<projectSpec>
|
||||
<project
|
||||
name="clb_ex6_siggen"
|
||||
device="TMS320F28377D"
|
||||
products="sysconfig;C2000WARE"
|
||||
launchWizard="False"
|
||||
linkerCommandFile=""
|
||||
outputFormat="ELF"
|
||||
enableSysConfigTool="true"
|
||||
sysConfigBuildOptions="--product ${CLB_SYSCFG_ROOT}/.metadata/product.json --device F2837xD"
|
||||
>
|
||||
<configuration name="Debug" postBuildStep="mkdir "${BuildDirectory}/simulation"
|
||||
;${CLB_SIM_COMPILER}/g++ -c -DCLB_SIM -I${SYSTEMC_INSTALL}/src -I${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/include -I${PROJECT_ROOT} -I${CLB_SIM_COMPILER}/include -Og -g -gdwarf-3 -gstrict-dwarf -Wall -MMD -MP -MF${BuildDirectory}/simulation/clb_sim.d -MT${BuildDirectory}/simulation/clb_sim.o -I${BuildDirectory}/syscfg -fno-threadsafe-statics -o${BuildDirectory}/simulation/clb_sim.o ${BuildDirectory}/syscfg/clb_sim.cpp
|
||||
;${CLB_SIM_COMPILER}/g++ -DCLB_SIM -Og -g -gdwarf-3 -gstrict-dwarf -Wall -Wl,-Map,${BuildDirectory}/simulation/simulation_output.map -L${SYSTEMC_INSTALL}/build/src -o${BuildDirectory}/simulation/simulation_output.exe ${BuildDirectory}/simulation/clb_sim.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/CLB_FSM_SC_model.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/CLB_HLC_SC_model.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/CLB_LUT4_SC_model.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/CLB_OutputLUT_SC_model.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/CLB_counter_SC_model.o -Wl,--start-group -lsystemc -Wl,--end-group;./simulation/simulation_output.exe
|
||||
;${NODE_TOOL} "${CLB_SYSCFG_ROOT}/dot_file_libraries/clbDotUtility.js" "${CLB_SYSCFG_ROOT}" "${BuildDirectory}/syscfg" "${BuildDirectory}/syscfg/clb.dot""
|
||||
compilerBuildOptions="--opt_level=off --opt_for_speed=2 --fp_mode=strict -I${C2000WARE_DLIB_ROOT} -I${C2000WARE_DEVICESUPPORT_ROOT}/common/include -I${PROJECT_ROOT}/device -I${CLB_SYSCFG_ROOT}/systemc/include -v28 -ml -mt --cla_support=cla1 --float_support=fpu32 --tmu_support=tmu0 --vcu_support=vcu2 --define=CPU1 -g --diag_warning=225 --diag_wrap=off --display_error_number " linkerBuildOptions="--stack_size=0x200 -l driverlib.lib -l libc.a -I${C2000WARE_DLIB_ROOT}/ccs/Debug" />
|
||||
|
||||
<pathVariable name="C2000WARE_ROOT" path="../../../../../../" scope="project" />
|
||||
<pathVariable name="C2000WARE_DLIB_ROOT" path="../../../../driverlib/" scope="project" />
|
||||
<pathVariable name="C2000WARE_DEVICESUPPORT_ROOT" path="../../../../../../device_support/F2837xD/" 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" />
|
||||
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/targetConfigs/TMS320F28377D.ccxml" targetDirectory="targetConfigs" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/include/driverlib.h" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/include/device.h" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/source/device.c" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/cmd/2837xD_RAM_lnk_cpu1.cmd" targetDirectory=""/>
|
||||
<file action="copy" path="../../../../driverlib/" targetDirectory="device" excludeFromBuild="True" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/source/F2837xD_CodeStartBranch.asm" targetDirectory="device" />
|
||||
|
||||
<file action="copy" path="../clb_ex6_siggen.c" targetDirectory="" />
|
||||
<file action="copy" path="../clb_ex6_siggen.syscfg" targetDirectory="" />
|
||||
</project>
|
||||
</projectSpec>
|
||||
@@ -0,0 +1,36 @@
|
||||
<projectSpec>
|
||||
<project
|
||||
name="clb_ex7_state_machine"
|
||||
device="TMS320F28377D"
|
||||
products="sysconfig;C2000WARE"
|
||||
launchWizard="False"
|
||||
linkerCommandFile=""
|
||||
outputFormat="ELF"
|
||||
enableSysConfigTool="true"
|
||||
sysConfigBuildOptions="--product ${CLB_SYSCFG_ROOT}/.metadata/product.json --device F2837xD"
|
||||
>
|
||||
<configuration name="Debug" postBuildStep="mkdir "${BuildDirectory}/simulation"
|
||||
;${CLB_SIM_COMPILER}/g++ -c -DCLB_SIM -I${SYSTEMC_INSTALL}/src -I${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/include -I${PROJECT_ROOT} -I${CLB_SIM_COMPILER}/include -Og -g -gdwarf-3 -gstrict-dwarf -Wall -MMD -MP -MF${BuildDirectory}/simulation/clb_sim.d -MT${BuildDirectory}/simulation/clb_sim.o -I${BuildDirectory}/syscfg -fno-threadsafe-statics -o${BuildDirectory}/simulation/clb_sim.o ${BuildDirectory}/syscfg/clb_sim.cpp
|
||||
;${CLB_SIM_COMPILER}/g++ -DCLB_SIM -Og -g -gdwarf-3 -gstrict-dwarf -Wall -Wl,-Map,${BuildDirectory}/simulation/simulation_output.map -L${SYSTEMC_INSTALL}/build/src -o${BuildDirectory}/simulation/simulation_output.exe ${BuildDirectory}/simulation/clb_sim.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/CLB_FSM_SC_model.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/CLB_HLC_SC_model.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/CLB_LUT4_SC_model.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/CLB_OutputLUT_SC_model.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/CLB_counter_SC_model.o -Wl,--start-group -lsystemc -Wl,--end-group;./simulation/simulation_output.exe
|
||||
;${NODE_TOOL} "${CLB_SYSCFG_ROOT}/dot_file_libraries/clbDotUtility.js" "${CLB_SYSCFG_ROOT}" "${BuildDirectory}/syscfg" "${BuildDirectory}/syscfg/clb.dot""
|
||||
compilerBuildOptions="--opt_level=off --opt_for_speed=2 --fp_mode=strict -I${C2000WARE_DLIB_ROOT} -I${C2000WARE_DEVICESUPPORT_ROOT}/common/include -I${PROJECT_ROOT}/device -I${CLB_SYSCFG_ROOT}/systemc/include -v28 -ml -mt --cla_support=cla1 --float_support=fpu32 --tmu_support=tmu0 --vcu_support=vcu2 --define=CPU1 -g --diag_warning=225 --diag_wrap=off --display_error_number " linkerBuildOptions="--stack_size=0x200 -l driverlib.lib -l libc.a -I${C2000WARE_DLIB_ROOT}/ccs/Debug" />
|
||||
|
||||
<pathVariable name="C2000WARE_ROOT" path="../../../../../../" scope="project" />
|
||||
<pathVariable name="C2000WARE_DLIB_ROOT" path="../../../../driverlib/" scope="project" />
|
||||
<pathVariable name="C2000WARE_DEVICESUPPORT_ROOT" path="../../../../../../device_support/F2837xD/" 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" />
|
||||
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/targetConfigs/TMS320F28377D.ccxml" targetDirectory="targetConfigs" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/include/driverlib.h" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/include/device.h" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/source/device.c" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/cmd/2837xD_RAM_lnk_cpu1.cmd" targetDirectory=""/>
|
||||
<file action="copy" path="../../../../driverlib/" targetDirectory="device" excludeFromBuild="True" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/source/F2837xD_CodeStartBranch.asm" targetDirectory="device" />
|
||||
|
||||
<file action="copy" path="../clb_ex7_state_machine.c" targetDirectory="" />
|
||||
<file action="copy" path="../clb_ex7_state_machine.syscfg" targetDirectory="" />
|
||||
</project>
|
||||
</projectSpec>
|
||||
+41
@@ -0,0 +1,41 @@
|
||||
<projectSpec>
|
||||
<project
|
||||
name="clb_ex8_external_signal_AND_gate"
|
||||
device="TMS320F28377D"
|
||||
cgtVersion="22.6.0.LTS"
|
||||
products="sysconfig;C2000WARE"
|
||||
outputFormat="ELF"
|
||||
launchWizard="False"
|
||||
linkerCommandFile=""
|
||||
enableSysConfigTool="true"
|
||||
sysConfigBuildOptions="--product ${C2000WARE_ROOT}/.metadata/sdk.json --device F2837xD --package F2837xD_176PTP --part F2837xD_176PTP"
|
||||
>
|
||||
<configuration name="CPU1_RAM" compilerBuildOptions="--opt_level=off -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} --define=DEBUG -v28 -ml -mt --define=CPU1 --diag_warning=225 --diag_suppress=10063 --display_error_number" linkerBuildOptions="--entry_point code_start --stack_size=0x3F8 --heap_size=0x200 --define RAM" />
|
||||
<configuration name="CPU1_FLASH" compilerBuildOptions="--opt_level=off -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} --define=DEBUG -v28 -ml -mt --define=CPU1 --define=_FLASH --diag_warning=225 --diag_suppress=10063 --display_error_number" linkerBuildOptions="--entry_point code_start --stack_size=0x3F8 --heap_size=0x200 " />
|
||||
|
||||
<configuration name="CPU1_CLB" postBuildStep="mkdir "${BuildDirectory}/simulation"
|
||||
;${CLB_SIM_COMPILER}/g++ -c -DCLB_SIM -I${SYSTEMC_INSTALL}/src -I${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/include -I${PROJECT_ROOT} -I${CLB_SIM_COMPILER}/include -Og -g -gdwarf-3 -gstrict-dwarf -Wall -MMD -MP -MF${BuildDirectory}/simulation/clb_sim.d -MT${BuildDirectory}/simulation/clb_sim.o -I${BuildDirectory}/syscfg -fno-threadsafe-statics -o${BuildDirectory}/simulation/clb_sim.o ${BuildDirectory}/syscfg/clb_sim.cpp
|
||||
;${CLB_SIM_COMPILER}/g++ -DCLB_SIM -Og -g -gdwarf-3 -gstrict-dwarf -Wall -Wl,-Map,${BuildDirectory}/simulation/simulation_output.map -L${SYSTEMC_INSTALL}/build/src -o${BuildDirectory}/simulation/simulation_output.exe ${BuildDirectory}/simulation/clb_sim.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/CLB_FSM_SC_model.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/CLB_HLC_SC_model.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/CLB_LUT4_SC_model.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/CLB_OutputLUT_SC_model.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/CLB_counter_SC_model.o -Wl,--start-group -lsystemc -Wl,--end-group;./simulation/simulation_output.exe
|
||||
;${NODE_TOOL} "${CLB_SYSCFG_ROOT}/dot_file_libraries/clbDotUtility.js" "${CLB_SYSCFG_ROOT}" "${BuildDirectory}/syscfg" "${BuildDirectory}/syscfg/clb.dot"" compilerBuildOptions="--opt_level=off -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} --define=DEBUG -v28 -ml -mt --define=CPU1 --diag_warning=225 --diag_suppress=10063 --display_error_number" linkerBuildOptions="--entry_point code_start --stack_size=0x3F8 --heap_size=0x200 --define RAM" />
|
||||
|
||||
<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" />
|
||||
|
||||
<pathVariable name="C2000WARE_DLIB_ROOT" path="../../../../driverlib/" scope="project" />
|
||||
<pathVariable name="C2000WARE_ROOT" path="../../../../../../" scope="project" />
|
||||
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/include/driverlib.h" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/include/device.h" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/source/device.c" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/targetConfigs/TMS320F28377D.ccxml" targetDirectory="targetConfigs" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/cmd/2837xD_RAM_lnk_cpu1.cmd" targetDirectory="" applicableConfigurations="CPU1_RAM,CPU1_CLB" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/cmd/2837xD_FLASH_lnk_cpu1.cmd" targetDirectory="" applicableConfigurations="CPU1_FLASH" />
|
||||
<file action="copy" path="../../../../driverlib/" targetDirectory="device" excludeFromBuild="True" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/source/F2837xD_CodeStartBranch.asm" targetDirectory="device" />
|
||||
<file action="link" path="../../../../driverlib/ccs/Debug/driverlib.lib" targetDirectory="" />
|
||||
|
||||
<file action="copy" path="../clb_ex8_external_signal_AND_gate.c" targetDirectory="" />
|
||||
<file action="copy" path="../clb_ex8_external_signal_AND_gate.syscfg" targetDirectory="" />
|
||||
</project>
|
||||
</projectSpec>
|
||||
@@ -0,0 +1,41 @@
|
||||
<projectSpec>
|
||||
<project
|
||||
name="clb_ex9_timer"
|
||||
device="TMS320F28377D"
|
||||
cgtVersion="22.6.0.LTS"
|
||||
products="sysconfig;C2000WARE"
|
||||
outputFormat="ELF"
|
||||
launchWizard="False"
|
||||
linkerCommandFile=""
|
||||
enableSysConfigTool="true"
|
||||
sysConfigBuildOptions="--product ${C2000WARE_ROOT}/.metadata/sdk.json --device F2837xD --package F2837xD_176PTP --part F2837xD_176PTP"
|
||||
>
|
||||
<configuration name="CPU1_RAM" compilerBuildOptions="--opt_level=off -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} --define=DEBUG -v28 -ml -mt --define=CPU1 --diag_warning=225 --diag_suppress=10063 --display_error_number" linkerBuildOptions="--entry_point code_start --stack_size=0x3F8 --heap_size=0x200 --define RAM" />
|
||||
<configuration name="CPU1_FLASH" compilerBuildOptions="--opt_level=off -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} --define=DEBUG -v28 -ml -mt --define=CPU1 --define=_FLASH --diag_warning=225 --diag_suppress=10063 --display_error_number" linkerBuildOptions="--entry_point code_start --stack_size=0x3F8 --heap_size=0x200 " />
|
||||
|
||||
<configuration name="CPU1_CLB" postBuildStep="mkdir "${BuildDirectory}/simulation"
|
||||
;${CLB_SIM_COMPILER}/g++ -c -DCLB_SIM -I${SYSTEMC_INSTALL}/src -I${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/include -I${PROJECT_ROOT} -I${CLB_SIM_COMPILER}/include -Og -g -gdwarf-3 -gstrict-dwarf -Wall -MMD -MP -MF${BuildDirectory}/simulation/clb_sim.d -MT${BuildDirectory}/simulation/clb_sim.o -I${BuildDirectory}/syscfg -fno-threadsafe-statics -o${BuildDirectory}/simulation/clb_sim.o ${BuildDirectory}/syscfg/clb_sim.cpp
|
||||
;${CLB_SIM_COMPILER}/g++ -DCLB_SIM -Og -g -gdwarf-3 -gstrict-dwarf -Wall -Wl,-Map,${BuildDirectory}/simulation/simulation_output.map -L${SYSTEMC_INSTALL}/build/src -o${BuildDirectory}/simulation/simulation_output.exe ${BuildDirectory}/simulation/clb_sim.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/CLB_FSM_SC_model.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/CLB_HLC_SC_model.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/CLB_LUT4_SC_model.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/CLB_OutputLUT_SC_model.o ${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/systemc/src/CLB_counter_SC_model.o -Wl,--start-group -lsystemc -Wl,--end-group;./simulation/simulation_output.exe
|
||||
;${NODE_TOOL} "${CLB_SYSCFG_ROOT}/dot_file_libraries/clbDotUtility.js" "${CLB_SYSCFG_ROOT}" "${BuildDirectory}/syscfg" "${BuildDirectory}/syscfg/clb.dot"" compilerBuildOptions="--opt_level=off -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} --define=DEBUG -v28 -ml -mt --define=CPU1 --diag_warning=225 --diag_suppress=10063 --display_error_number" linkerBuildOptions="--entry_point code_start --stack_size=0x3F8 --heap_size=0x200 --define RAM" />
|
||||
|
||||
<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" />
|
||||
|
||||
<pathVariable name="C2000WARE_DLIB_ROOT" path="../../../../driverlib/" scope="project" />
|
||||
<pathVariable name="C2000WARE_ROOT" path="../../../../../../" scope="project" />
|
||||
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/include/driverlib.h" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/include/device.h" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/source/device.c" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/targetConfigs/TMS320F28377D.ccxml" targetDirectory="targetConfigs" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/cmd/2837xD_RAM_lnk_cpu1.cmd" targetDirectory="" applicableConfigurations="CPU1_RAM,CPU1_CLB" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/cmd/2837xD_FLASH_lnk_cpu1.cmd" targetDirectory="" applicableConfigurations="CPU1_FLASH" />
|
||||
<file action="copy" path="../../../../driverlib/" targetDirectory="device" excludeFromBuild="True" />
|
||||
<file action="copy" path="../../../../../../device_support/f2837xd/common/source/F2837xD_CodeStartBranch.asm" targetDirectory="device" />
|
||||
<file action="link" path="../../../../driverlib/ccs/Debug/driverlib.lib" targetDirectory="" />
|
||||
|
||||
<file action="copy" path="../clb_ex9_timer.c" targetDirectory="" />
|
||||
<file action="copy" path="../clb_ex9_timer.syscfg" targetDirectory="" />
|
||||
</project>
|
||||
</projectSpec>
|
||||
@@ -0,0 +1,180 @@
|
||||
//#############################################################################
|
||||
//
|
||||
// FILE: clb_ex10_timer_two_states.c
|
||||
//
|
||||
// TITLE: CLB Timer Two States.
|
||||
//
|
||||
//! \addtogroup driver_example_list
|
||||
//! <h1>CLB Timer Two States</h1>
|
||||
//!
|
||||
//! For the detailed description of this example, please refer to:
|
||||
//! C2000Ware_PATH\utilities\clb_tool\clb_syscfg\doc\CLB Tool Users Guide.pdf
|
||||
//!
|
||||
//
|
||||
//
|
||||
//#############################################################################
|
||||
//
|
||||
//
|
||||
// $Copyright:
|
||||
// Copyright (C) 2013-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.
|
||||
// $
|
||||
//#############################################################################
|
||||
|
||||
|
||||
|
||||
#include "driverlib.h"
|
||||
#include "device.h"
|
||||
#include "clb_config.h"
|
||||
#include "clb.h"
|
||||
|
||||
__interrupt void clb1ISR(void);
|
||||
|
||||
#define RESET_TIMER 1
|
||||
#define ENABLE_TIMER 2
|
||||
#define COUNTUP_MODE 4
|
||||
|
||||
|
||||
void main(void)
|
||||
{
|
||||
Device_init();
|
||||
Device_initGPIO();
|
||||
|
||||
Interrupt_initModule();
|
||||
Interrupt_initVectorTable();
|
||||
|
||||
Interrupt_register(INT_CLB1, &clb1ISR);
|
||||
Interrupt_enable(INT_CLB1);
|
||||
|
||||
//
|
||||
// Enabling EPWM1 to enable CLB1
|
||||
//
|
||||
SysCtl_enablePeripheral(SYSCTL_PERIPH_CLK_EPWM1);
|
||||
|
||||
CLB_enableCLB(CLB1_BASE);
|
||||
initTILE1(CLB1_BASE);
|
||||
|
||||
//
|
||||
// Select Global input instead of local input for all CLB IN
|
||||
//
|
||||
CLB_configLocalInputMux(CLB1_BASE, CLB_IN0, CLB_LOCAL_IN_MUX_GLOBAL_IN);
|
||||
CLB_configLocalInputMux(CLB1_BASE, CLB_IN1, CLB_LOCAL_IN_MUX_GLOBAL_IN);
|
||||
CLB_configLocalInputMux(CLB1_BASE, CLB_IN2, CLB_LOCAL_IN_MUX_GLOBAL_IN);
|
||||
CLB_configLocalInputMux(CLB1_BASE, CLB_IN3, CLB_LOCAL_IN_MUX_GLOBAL_IN);
|
||||
CLB_configLocalInputMux(CLB1_BASE, CLB_IN4, CLB_LOCAL_IN_MUX_GLOBAL_IN);
|
||||
CLB_configLocalInputMux(CLB1_BASE, CLB_IN5, CLB_LOCAL_IN_MUX_GLOBAL_IN);
|
||||
CLB_configLocalInputMux(CLB1_BASE, CLB_IN6, CLB_LOCAL_IN_MUX_GLOBAL_IN);
|
||||
CLB_configLocalInputMux(CLB1_BASE, CLB_IN7, CLB_LOCAL_IN_MUX_GLOBAL_IN);
|
||||
|
||||
|
||||
//
|
||||
// Unused Inputs below
|
||||
//
|
||||
CLB_configGlobalInputMux(CLB1_BASE, CLB_IN0, CLB_GLOBAL_IN_MUX_EPWM1A);
|
||||
CLB_configGlobalInputMux(CLB1_BASE, CLB_IN1, CLB_GLOBAL_IN_MUX_EPWM1A);
|
||||
CLB_configGlobalInputMux(CLB1_BASE, CLB_IN2, CLB_GLOBAL_IN_MUX_EPWM1A);
|
||||
CLB_configGlobalInputMux(CLB1_BASE, CLB_IN3, CLB_GLOBAL_IN_MUX_EPWM1A);
|
||||
CLB_configGlobalInputMux(CLB1_BASE, CLB_IN4, CLB_GLOBAL_IN_MUX_EPWM1A);
|
||||
CLB_configGlobalInputMux(CLB1_BASE, CLB_IN5, CLB_GLOBAL_IN_MUX_EPWM1A);
|
||||
CLB_configGlobalInputMux(CLB1_BASE, CLB_IN6, CLB_GLOBAL_IN_MUX_EPWM1A);
|
||||
CLB_configGlobalInputMux(CLB1_BASE, CLB_IN7, CLB_GLOBAL_IN_MUX_EPWM1A);
|
||||
|
||||
|
||||
//
|
||||
// Inputs set to GP register
|
||||
//
|
||||
CLB_configGPInputMux(CLB1_BASE, CLB_IN0, CLB_GP_IN_MUX_GP_REG);
|
||||
CLB_configGPInputMux(CLB1_BASE, CLB_IN1, CLB_GP_IN_MUX_GP_REG);
|
||||
CLB_configGPInputMux(CLB1_BASE, CLB_IN2, CLB_GP_IN_MUX_GP_REG);
|
||||
|
||||
//
|
||||
// Unused inputs to GP register
|
||||
//
|
||||
CLB_configGPInputMux(CLB1_BASE, CLB_IN3, CLB_GP_IN_MUX_GP_REG);
|
||||
CLB_configGPInputMux(CLB1_BASE, CLB_IN4, CLB_GP_IN_MUX_GP_REG);
|
||||
CLB_configGPInputMux(CLB1_BASE, CLB_IN5, CLB_GP_IN_MUX_GP_REG);
|
||||
CLB_configGPInputMux(CLB1_BASE, CLB_IN6, CLB_GP_IN_MUX_GP_REG);
|
||||
CLB_configGPInputMux(CLB1_BASE, CLB_IN7, CLB_GP_IN_MUX_GP_REG);
|
||||
|
||||
//
|
||||
// Configure GPIO0 for Output
|
||||
//
|
||||
GPIO_setPinConfig(GPIO_0_GPIO0);
|
||||
GPIO_setDirectionMode(0, GPIO_DIR_MODE_OUT);
|
||||
GPIO_setPadConfig(0, GPIO_PIN_TYPE_STD);
|
||||
GPIO_writePin(0, 0);
|
||||
//
|
||||
// Configure GPIO24 for OUTPUTXBAR1
|
||||
//
|
||||
GPIO_setPinConfig(GPIO_24_OUTPUTXBAR1);
|
||||
GPIO_setDirectionMode(24, GPIO_DIR_MODE_OUT);
|
||||
GPIO_setPadConfig(24, GPIO_PIN_TYPE_STD);
|
||||
|
||||
//
|
||||
// Configure OUTPUT-XBAR OUTPUT1 as CLB1_OUT4
|
||||
//
|
||||
XBAR_setOutputMuxConfig(XBAR_OUTPUT1, XBAR_OUT_MUX01_CLB1_OUT4);
|
||||
XBAR_enableOutputMux(XBAR_OUTPUT1, XBAR_MUX01);
|
||||
|
||||
CLB_setGPREG(CLB1_BASE, ENABLE_TIMER | COUNTUP_MODE);
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Enable Global Interrupt (INTM) and realtime interrupt (DBGM)
|
||||
//
|
||||
EINT;
|
||||
ERTM;
|
||||
|
||||
|
||||
CLB_clearInterruptTag(CLB1_BASE);
|
||||
|
||||
|
||||
while(1)
|
||||
{
|
||||
SysCtl_delay(20000000);
|
||||
// Change Timer Value to 2000
|
||||
CLB_configCounterLoadMatch(CLB1_BASE, CLB_CTR0, 0, 2000, 0);
|
||||
SysCtl_delay(20000000);
|
||||
// Change Timer Value to 1000
|
||||
CLB_configCounterLoadMatch(CLB1_BASE, CLB_CTR0, 0, 1000, 0);
|
||||
asm(" NOP");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
__interrupt void clb1ISR(void)
|
||||
{
|
||||
GPIO_togglePin(0);
|
||||
CLB_clearInterruptTag(CLB1_BASE);
|
||||
Interrupt_clearACKGroup(INTERRUPT_ACK_GROUP5);
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
|
||||
var TILE = scripting.addModule("/utilities/clb_tool/clb_syscfg/source/TILE");
|
||||
var TILE1 = TILE.addInstance();
|
||||
// clock_period - Period of the clock (in Nano Seconds) used for simulation in System C
|
||||
TILE.clock_period = 10;
|
||||
// sim_duration - Duration of the simulation (in Nano Seconds)
|
||||
TILE.sim_duration = 100000;
|
||||
// Name
|
||||
TILE1.$name = "TILE1";
|
||||
// in_repeat_count0 - Number of periods the waveform is repeated
|
||||
TILE1.BOUNDARY.in_repeat_count0 = 50;
|
||||
// in_repeat_count3 - Number of periods the waveform is repeated
|
||||
TILE1.BOUNDARY.in_repeat_count3 = 1;
|
||||
// in0
|
||||
TILE1.BOUNDARY.in0 = "squareWave";
|
||||
// in_repeat_count1 - Number of periods the waveform is repeated
|
||||
TILE1.BOUNDARY.in_repeat_count1 = 50;
|
||||
// in_repeat_count2 - Number of periods the waveform is repeated
|
||||
TILE1.BOUNDARY.in_repeat_count2 = 50;
|
||||
// in_period0 - Period of the square wave
|
||||
TILE1.BOUNDARY.in_period0 = 10000;
|
||||
// in_duty0 - Duty or ON time of the square wave
|
||||
TILE1.BOUNDARY.in_duty0 = 5001;
|
||||
// in_period1 - Period of the square wave
|
||||
TILE1.BOUNDARY.in_period1 = 1000;
|
||||
// in_duty1 - Duty or ON time of the square wave
|
||||
TILE1.BOUNDARY.in_duty1 = 500;
|
||||
// in_period2 - Period of the square wave
|
||||
TILE1.BOUNDARY.in_period2 = 3000;
|
||||
// in_duty2 - Duty or ON time of the square wave
|
||||
TILE1.BOUNDARY.in_duty2 = 1500;
|
||||
// in1
|
||||
TILE1.BOUNDARY.in1 = "1";
|
||||
// in2
|
||||
TILE1.BOUNDARY.in2 = "1";
|
||||
// e0 - External Input 0.
|
||||
TILE1.FSM_0.e0 = "COUNTER_0.count_match1";
|
||||
// eqn_s0 - Boolean equation on the variables e1,e0,s1,s0 for the S0 output.
|
||||
TILE1.FSM_0.eqn_s0 = "e0 ^ s0";
|
||||
// What action should be taken on an event trigger?
|
||||
TILE1.COUNTER_0.action = "Load";
|
||||
// reset - Reset the counter to 0 on next clock cycle (triggers low to high)
|
||||
TILE1.COUNTER_0.reset = "COUNTER_0.count_match1";
|
||||
// event - Trigger actions in the counter.
|
||||
TILE1.COUNTER_0.event = "BOUNDARY.in0";
|
||||
// mode0 - Enables Counting when high
|
||||
TILE1.COUNTER_0.mode0 = "BOUNDARY.in1";
|
||||
// mode1 - Controls counting direction. High enables count up. Low enables count down.
|
||||
TILE1.COUNTER_0.mode1 = "BOUNDARY.in2";
|
||||
// match1_val - Sets the value of the Match reference 1 register.
|
||||
TILE1.COUNTER_0.match1_val = "1000";
|
||||
// eqn - Boolean equation on the variables i2,i1,i0 for the OUTLUT output.
|
||||
TILE1.OUTLUT_4.eqn = "i0";
|
||||
// i0 - Input 0.
|
||||
TILE1.OUTLUT_4.i0 = "FSM_0.S0";
|
||||
// Event 0 (e0) - Event 0
|
||||
TILE1.HLC.e0 = "COUNTER_0.count_match1";
|
||||
// instruct0
|
||||
TILE1.HLC.program0.instruct0 = "INTR 0";
|
||||
|
||||
@@ -0,0 +1,204 @@
|
||||
//#############################################################################
|
||||
//
|
||||
// FILE: clb_ex11_interrupt_tag.c
|
||||
//
|
||||
// TITLE: CLB Interrupt Tag.
|
||||
//
|
||||
//! \addtogroup driver_example_list
|
||||
//! <h1>CLB Interrupt Tag</h1>
|
||||
//!
|
||||
//! For the detailed description of this example, please refer to:
|
||||
//! C2000Ware_PATH\utilities\clb_tool\clb_syscfg\doc\CLB Tool Users Guide.pdf
|
||||
//!
|
||||
//
|
||||
//
|
||||
//#############################################################################
|
||||
//
|
||||
//
|
||||
// $Copyright:
|
||||
// Copyright (C) 2013-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.
|
||||
// $
|
||||
//#############################################################################
|
||||
|
||||
|
||||
|
||||
#include "driverlib.h"
|
||||
#include "device.h"
|
||||
#include "clb_config.h"
|
||||
#include "clb.h"
|
||||
|
||||
__interrupt void clb1ISR(void);
|
||||
|
||||
#define COUNTER0_TIMER_ENABLE 0x1
|
||||
|
||||
|
||||
#define COUNTER0_INT_TAG 11
|
||||
#define COUNTER1_INT_TAG 12
|
||||
|
||||
|
||||
void main(void)
|
||||
{
|
||||
Device_init();
|
||||
Device_initGPIO();
|
||||
|
||||
Interrupt_initModule();
|
||||
Interrupt_initVectorTable();
|
||||
|
||||
Interrupt_register(INT_CLB1, &clb1ISR);
|
||||
Interrupt_enable(INT_CLB1);
|
||||
|
||||
//
|
||||
// Enabling EPWM1 to enable CLB1
|
||||
//
|
||||
SysCtl_enablePeripheral(SYSCTL_PERIPH_CLK_EPWM1);
|
||||
|
||||
CLB_enableCLB(CLB1_BASE);
|
||||
initTILE1(CLB1_BASE);
|
||||
|
||||
//
|
||||
// Select Global input instead of local input for all CLB IN
|
||||
//
|
||||
CLB_configLocalInputMux(CLB1_BASE, CLB_IN0, CLB_LOCAL_IN_MUX_GLOBAL_IN);
|
||||
CLB_configLocalInputMux(CLB1_BASE, CLB_IN1, CLB_LOCAL_IN_MUX_GLOBAL_IN);
|
||||
CLB_configLocalInputMux(CLB1_BASE, CLB_IN2, CLB_LOCAL_IN_MUX_GLOBAL_IN);
|
||||
CLB_configLocalInputMux(CLB1_BASE, CLB_IN3, CLB_LOCAL_IN_MUX_GLOBAL_IN);
|
||||
CLB_configLocalInputMux(CLB1_BASE, CLB_IN4, CLB_LOCAL_IN_MUX_GLOBAL_IN);
|
||||
CLB_configLocalInputMux(CLB1_BASE, CLB_IN5, CLB_LOCAL_IN_MUX_GLOBAL_IN);
|
||||
CLB_configLocalInputMux(CLB1_BASE, CLB_IN6, CLB_LOCAL_IN_MUX_GLOBAL_IN);
|
||||
CLB_configLocalInputMux(CLB1_BASE, CLB_IN7, CLB_LOCAL_IN_MUX_GLOBAL_IN);
|
||||
|
||||
|
||||
//
|
||||
// Unused Inputs below
|
||||
//
|
||||
CLB_configGlobalInputMux(CLB1_BASE, CLB_IN0, CLB_GLOBAL_IN_MUX_EPWM1A);
|
||||
CLB_configGlobalInputMux(CLB1_BASE, CLB_IN1, CLB_GLOBAL_IN_MUX_EPWM1A);
|
||||
CLB_configGlobalInputMux(CLB1_BASE, CLB_IN2, CLB_GLOBAL_IN_MUX_EPWM1A);
|
||||
CLB_configGlobalInputMux(CLB1_BASE, CLB_IN3, CLB_GLOBAL_IN_MUX_EPWM1A);
|
||||
CLB_configGlobalInputMux(CLB1_BASE, CLB_IN4, CLB_GLOBAL_IN_MUX_EPWM1A);
|
||||
CLB_configGlobalInputMux(CLB1_BASE, CLB_IN5, CLB_GLOBAL_IN_MUX_EPWM1A);
|
||||
CLB_configGlobalInputMux(CLB1_BASE, CLB_IN6, CLB_GLOBAL_IN_MUX_EPWM1A);
|
||||
CLB_configGlobalInputMux(CLB1_BASE, CLB_IN7, CLB_GLOBAL_IN_MUX_EPWM1A);
|
||||
|
||||
|
||||
//
|
||||
// Inputs set to GP register
|
||||
//
|
||||
CLB_configGPInputMux(CLB1_BASE, CLB_IN0, CLB_GP_IN_MUX_GP_REG);
|
||||
CLB_configGPInputMux(CLB1_BASE, CLB_IN1, CLB_GP_IN_MUX_GP_REG);
|
||||
CLB_configGPInputMux(CLB1_BASE, CLB_IN2, CLB_GP_IN_MUX_GP_REG);
|
||||
|
||||
CLB_configGPInputMux(CLB1_BASE, CLB_IN3, CLB_GP_IN_MUX_GP_REG);
|
||||
CLB_configGPInputMux(CLB1_BASE, CLB_IN4, CLB_GP_IN_MUX_GP_REG);
|
||||
CLB_configGPInputMux(CLB1_BASE, CLB_IN5, CLB_GP_IN_MUX_GP_REG);
|
||||
//
|
||||
// Unused inputs to GP register
|
||||
//
|
||||
CLB_configGPInputMux(CLB1_BASE, CLB_IN6, CLB_GP_IN_MUX_GP_REG);
|
||||
CLB_configGPInputMux(CLB1_BASE, CLB_IN7, CLB_GP_IN_MUX_GP_REG);
|
||||
|
||||
//
|
||||
// Configure GPIO0 for Output
|
||||
//
|
||||
GPIO_setPinConfig(GPIO_0_GPIO0);
|
||||
GPIO_setDirectionMode(0, GPIO_DIR_MODE_OUT);
|
||||
GPIO_setPadConfig(0, GPIO_PIN_TYPE_STD);
|
||||
|
||||
//
|
||||
// Configure GPIO1 for Output
|
||||
//
|
||||
GPIO_setPinConfig(GPIO_1_GPIO1);
|
||||
GPIO_setDirectionMode(1, GPIO_DIR_MODE_OUT);
|
||||
GPIO_setPadConfig(1, GPIO_PIN_TYPE_STD);
|
||||
|
||||
//
|
||||
// Configure GPIO24 for OUTPUTXBAR1
|
||||
//
|
||||
GPIO_setPinConfig(GPIO_24_OUTPUTXBAR1);
|
||||
GPIO_setDirectionMode(24, GPIO_DIR_MODE_OUT);
|
||||
GPIO_setPadConfig(24, GPIO_PIN_TYPE_STD);
|
||||
|
||||
//
|
||||
// Configure GPIO16 for OUTPUTXBAR7
|
||||
//
|
||||
GPIO_setPinConfig(GPIO_16_OUTPUTXBAR7);
|
||||
GPIO_setDirectionMode(16, GPIO_DIR_MODE_OUT);
|
||||
GPIO_setPadConfig(16, GPIO_PIN_TYPE_STD);
|
||||
|
||||
//
|
||||
// Configure OUTPUT-XBAR OUTPUT1 as CLB1_OUT4
|
||||
//
|
||||
XBAR_setOutputMuxConfig(XBAR_OUTPUT1, XBAR_OUT_MUX01_CLB1_OUT4);
|
||||
XBAR_enableOutputMux(XBAR_OUTPUT1, XBAR_MUX01);
|
||||
|
||||
//
|
||||
// Configure OUTPUT-XBAR OUTPUT7 as CLB1_OUT5
|
||||
//
|
||||
XBAR_setOutputMuxConfig(XBAR_OUTPUT7, XBAR_OUT_MUX03_CLB1_OUT5);
|
||||
XBAR_enableOutputMux(XBAR_OUTPUT7, XBAR_MUX03);
|
||||
|
||||
CLB_setGPREG(CLB1_BASE, COUNTER0_TIMER_ENABLE);
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Enable Global Interrupt (INTM) and realtime interrupt (DBGM)
|
||||
//
|
||||
EINT;
|
||||
ERTM;
|
||||
|
||||
|
||||
CLB_clearInterruptTag(CLB1_BASE);
|
||||
|
||||
|
||||
while(1)
|
||||
{
|
||||
asm(" NOP");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
__interrupt void clb1ISR(void)
|
||||
{
|
||||
uint16_t tag = CLB_getInterruptTag(CLB1_BASE);
|
||||
if (tag == COUNTER0_INT_TAG)
|
||||
{
|
||||
GPIO_togglePin(0);
|
||||
}
|
||||
if (tag == COUNTER1_INT_TAG)
|
||||
{
|
||||
GPIO_togglePin(1);
|
||||
}
|
||||
|
||||
CLB_clearInterruptTag(CLB1_BASE);
|
||||
Interrupt_clearACKGroup(INTERRUPT_ACK_GROUP5);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,74 @@
|
||||
|
||||
var TILE = scripting.addModule("/utilities/clb_tool/clb_syscfg/source/TILE");
|
||||
var TILE1 = TILE.addInstance();
|
||||
// clock_period - Period of the clock (in Nano Seconds) used for simulation in System C
|
||||
TILE.clock_period = 10;
|
||||
// sim_duration - Duration of the simulation (in Nano Seconds)
|
||||
TILE.sim_duration = 100000;
|
||||
// Name
|
||||
TILE1.$name = "TILE1";
|
||||
// in_repeat_count0 - Number of periods the waveform is repeated
|
||||
TILE1.BOUNDARY.in_repeat_count0 = 50;
|
||||
// in0
|
||||
TILE1.BOUNDARY.in0 = "squareWave";
|
||||
// in_repeat_count1 - Number of periods the waveform is repeated
|
||||
TILE1.BOUNDARY.in_repeat_count1 = 50;
|
||||
// in_repeat_count2 - Number of periods the waveform is repeated
|
||||
TILE1.BOUNDARY.in_repeat_count2 = 50;
|
||||
// in_period0 - Period of the square wave
|
||||
TILE1.BOUNDARY.in_period0 = 10000;
|
||||
// in_duty0 - Duty or ON time of the square wave
|
||||
TILE1.BOUNDARY.in_duty0 = 5001;
|
||||
// in_period1 - Period of the square wave
|
||||
TILE1.BOUNDARY.in_period1 = 1000;
|
||||
// in_duty1 - Duty or ON time of the square wave
|
||||
TILE1.BOUNDARY.in_duty1 = 500;
|
||||
// in_period2 - Period of the square wave
|
||||
TILE1.BOUNDARY.in_period2 = 3000;
|
||||
// in_duty2 - Duty or ON time of the square wave
|
||||
TILE1.BOUNDARY.in_duty2 = 1500;
|
||||
// in1
|
||||
TILE1.BOUNDARY.in1 = "1";
|
||||
// in2
|
||||
TILE1.BOUNDARY.in2 = "1";
|
||||
// in_period3 - Period of the square wave
|
||||
TILE1.BOUNDARY.in_period3 = 10000;
|
||||
// in_duty3 - Duty or ON time of the square wave
|
||||
TILE1.BOUNDARY.in_duty3 = 5001;
|
||||
// in_repeat_count3 - Number of periods the waveform is repeated
|
||||
TILE1.BOUNDARY.in_repeat_count3 = 50;
|
||||
// in3
|
||||
TILE1.BOUNDARY.in3 = "0";
|
||||
// in4
|
||||
TILE1.BOUNDARY.in4 = "0";
|
||||
// in5
|
||||
TILE1.BOUNDARY.in5 = "0";
|
||||
// match1_val - Sets the value of the Match reference 1 register.
|
||||
TILE1.COUNTER_0.match1_val = "700";
|
||||
// event - Trigger actions in the counter.
|
||||
TILE1.COUNTER_0.event = "COUNTER_0.count_zero";
|
||||
// match2_val - Sets the value of the Match reference 2 register.
|
||||
TILE1.COUNTER_0.match2_val = "1600";
|
||||
// event_load_val - Sets the value of the event load value register.
|
||||
TILE1.COUNTER_0.event_load_val = "2000";
|
||||
// mode0 - Enables Counting when high
|
||||
TILE1.COUNTER_0.mode0 = "BOUNDARY.in0";
|
||||
// What action should be taken on an event trigger?
|
||||
TILE1.COUNTER_0.action = "Load";
|
||||
// eqn - Boolean equation on the variables i2,i1,i0 for the OUTLUT output.
|
||||
TILE1.OUTLUT_4.eqn = "i0";
|
||||
// i0 - Input 0.
|
||||
TILE1.OUTLUT_4.i0 = "COUNTER_0.count_match1";
|
||||
// eqn - Boolean equation on the variables i2,i1,i0 for the OUTLUT output.
|
||||
TILE1.OUTLUT_5.eqn = "i0";
|
||||
// i0 - Input 0.
|
||||
TILE1.OUTLUT_5.i0 = "COUNTER_0.count_match2";
|
||||
// Event 0 (e0) - Event 0
|
||||
TILE1.HLC.e0 = "COUNTER_0.count_match1";
|
||||
// Event 1 (e1) - Event 1
|
||||
TILE1.HLC.e1 = "COUNTER_0.count_match2";
|
||||
// instruct0
|
||||
TILE1.HLC.program0.instruct0 = "INTR 11";
|
||||
// instruct0
|
||||
TILE1.HLC.program1.instruct0 = "INTR 12";
|
||||
|
||||
@@ -0,0 +1,333 @@
|
||||
//#############################################################################
|
||||
//
|
||||
// FILE: clb_ex12_output_intersect.c
|
||||
//
|
||||
// TITLE: CLB Output Intersect.
|
||||
//
|
||||
//! \addtogroup driver_example_list
|
||||
//! <h1>CLB Output Intersect</h1>
|
||||
//!
|
||||
//! For the detailed description of this example, please refer to:
|
||||
//! C2000Ware_PATH\utilities\clb_tool\clb_syscfg\doc\CLB Tool Users Guide.pdf
|
||||
//!
|
||||
//
|
||||
//
|
||||
//#############################################################################
|
||||
//
|
||||
//
|
||||
// $Copyright:
|
||||
// Copyright (C) 2013-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.
|
||||
// $
|
||||
//#############################################################################
|
||||
|
||||
|
||||
|
||||
#include "driverlib.h"
|
||||
#include "device.h"
|
||||
#include "clb_config.h"
|
||||
#include "clb.h"
|
||||
|
||||
__interrupt void clb1ISR(void);
|
||||
|
||||
|
||||
#define EPWM_TIMER_TBPRD 2000
|
||||
|
||||
//
|
||||
// Function Prototypes
|
||||
//
|
||||
void initEPWM(uint32_t epwm_base);
|
||||
void initOff180EPWM(uint32_t epwm_base);
|
||||
uint16_t dutyValue = 0;
|
||||
|
||||
void main(void)
|
||||
{
|
||||
Device_init();
|
||||
Device_initGPIO();
|
||||
|
||||
Interrupt_initModule();
|
||||
Interrupt_initVectorTable();
|
||||
|
||||
//
|
||||
// Disable sync(Freeze clock to PWM as well). GTBCLKSYNC is applicable
|
||||
// only for multiple core devices. Uncomment the below statement if
|
||||
// applicable.
|
||||
//
|
||||
// SysCtl_disablePeripheral(SYSCTL_PERIPH_CLK_GTBCLKSYNC);
|
||||
SysCtl_disablePeripheral(SYSCTL_PERIPH_CLK_TBCLKSYNC);
|
||||
initEPWM(EPWM2_BASE);
|
||||
initOff180EPWM(EPWM3_BASE);
|
||||
EPWM_setupEPWMLinks(EPWM3_BASE, EPWM_LINK_WITH_EPWM_2, EPWM_LINK_COMP_A);
|
||||
EPWM_setSyncOutPulseMode(EPWM2_BASE, EPWM_SYNC_OUT_PULSE_ON_COUNTER_ZERO);
|
||||
EPWM_enablePhaseShiftLoad(EPWM3_BASE);
|
||||
//
|
||||
// Enable sync and clock to PWM
|
||||
//
|
||||
|
||||
SysCtl_enablePeripheral(SYSCTL_PERIPH_CLK_TBCLKSYNC);
|
||||
|
||||
Interrupt_register(INT_CLB1, &clb1ISR);
|
||||
Interrupt_enable(INT_CLB1);
|
||||
|
||||
//
|
||||
// Enabling EPWM1 to enable CLB1
|
||||
//
|
||||
SysCtl_enablePeripheral(SYSCTL_PERIPH_CLK_EPWM1);
|
||||
|
||||
CLB_enableCLB(CLB1_BASE);
|
||||
initTILE1(CLB1_BASE);
|
||||
|
||||
//
|
||||
// Select Global input instead of local input for all CLB IN
|
||||
//
|
||||
CLB_configLocalInputMux(CLB1_BASE, CLB_IN0, CLB_LOCAL_IN_MUX_GLOBAL_IN);
|
||||
CLB_configLocalInputMux(CLB1_BASE, CLB_IN1, CLB_LOCAL_IN_MUX_GLOBAL_IN);
|
||||
CLB_configLocalInputMux(CLB1_BASE, CLB_IN2, CLB_LOCAL_IN_MUX_GLOBAL_IN);
|
||||
CLB_configLocalInputMux(CLB1_BASE, CLB_IN3, CLB_LOCAL_IN_MUX_GLOBAL_IN);
|
||||
CLB_configLocalInputMux(CLB1_BASE, CLB_IN4, CLB_LOCAL_IN_MUX_GLOBAL_IN);
|
||||
CLB_configLocalInputMux(CLB1_BASE, CLB_IN5, CLB_LOCAL_IN_MUX_GLOBAL_IN);
|
||||
CLB_configLocalInputMux(CLB1_BASE, CLB_IN6, CLB_LOCAL_IN_MUX_GLOBAL_IN);
|
||||
CLB_configLocalInputMux(CLB1_BASE, CLB_IN7, CLB_LOCAL_IN_MUX_GLOBAL_IN);
|
||||
|
||||
//
|
||||
// Select EPWM2A and EPWM3A
|
||||
//
|
||||
CLB_configGlobalInputMux(CLB1_BASE, CLB_IN0, CLB_GLOBAL_IN_MUX_EPWM2A);
|
||||
CLB_configGlobalInputMux(CLB1_BASE, CLB_IN1, CLB_GLOBAL_IN_MUX_EPWM3A);
|
||||
|
||||
//
|
||||
// Unused Inputs below
|
||||
//
|
||||
CLB_configGlobalInputMux(CLB1_BASE, CLB_IN2, CLB_GLOBAL_IN_MUX_EPWM1A);
|
||||
CLB_configGlobalInputMux(CLB1_BASE, CLB_IN3, CLB_GLOBAL_IN_MUX_EPWM1A);
|
||||
CLB_configGlobalInputMux(CLB1_BASE, CLB_IN4, CLB_GLOBAL_IN_MUX_EPWM1A);
|
||||
CLB_configGlobalInputMux(CLB1_BASE, CLB_IN5, CLB_GLOBAL_IN_MUX_EPWM1A);
|
||||
CLB_configGlobalInputMux(CLB1_BASE, CLB_IN6, CLB_GLOBAL_IN_MUX_EPWM1A);
|
||||
CLB_configGlobalInputMux(CLB1_BASE, CLB_IN7, CLB_GLOBAL_IN_MUX_EPWM1A);
|
||||
|
||||
|
||||
//
|
||||
// Inputs set to External
|
||||
//
|
||||
CLB_configGPInputMux(CLB1_BASE, CLB_IN0, CLB_GP_IN_MUX_EXTERNAL);
|
||||
CLB_configGPInputMux(CLB1_BASE, CLB_IN1, CLB_GP_IN_MUX_EXTERNAL);
|
||||
|
||||
//
|
||||
// Unused inputs to GP register
|
||||
//
|
||||
CLB_configGPInputMux(CLB1_BASE, CLB_IN2, CLB_GP_IN_MUX_GP_REG);
|
||||
CLB_configGPInputMux(CLB1_BASE, CLB_IN3, CLB_GP_IN_MUX_GP_REG);
|
||||
CLB_configGPInputMux(CLB1_BASE, CLB_IN4, CLB_GP_IN_MUX_GP_REG);
|
||||
CLB_configGPInputMux(CLB1_BASE, CLB_IN5, CLB_GP_IN_MUX_GP_REG);
|
||||
CLB_configGPInputMux(CLB1_BASE, CLB_IN6, CLB_GP_IN_MUX_GP_REG);
|
||||
CLB_configGPInputMux(CLB1_BASE, CLB_IN7, CLB_GP_IN_MUX_GP_REG);
|
||||
|
||||
//
|
||||
// Configure GPIO0 for EPWM1A
|
||||
//
|
||||
GPIO_setPinConfig(GPIO_0_EPWM1A);
|
||||
GPIO_setDirectionMode(0, GPIO_DIR_MODE_OUT);
|
||||
GPIO_setPadConfig(0, GPIO_PIN_TYPE_STD);
|
||||
|
||||
//
|
||||
// Configure GPIO2 for EPWM2A
|
||||
//
|
||||
GPIO_setPinConfig(GPIO_2_EPWM2A);
|
||||
GPIO_setDirectionMode(2, GPIO_DIR_MODE_OUT);
|
||||
GPIO_setPadConfig(2, GPIO_PIN_TYPE_STD);
|
||||
|
||||
//
|
||||
// Configure GPIO2 for EPWM3A
|
||||
//
|
||||
GPIO_setPinConfig(GPIO_4_EPWM3A);
|
||||
GPIO_setDirectionMode(4, GPIO_DIR_MODE_OUT);
|
||||
GPIO_setPadConfig(4, GPIO_PIN_TYPE_STD);
|
||||
|
||||
|
||||
//
|
||||
// Enable Global Interrupt (INTM) and realtime interrupt (DBGM)
|
||||
//
|
||||
EINT;
|
||||
ERTM;
|
||||
|
||||
|
||||
CLB_clearInterruptTag(CLB1_BASE);
|
||||
|
||||
//
|
||||
// Enable OUT1 to replace EPWM1A
|
||||
//
|
||||
CLB_setOutputMask(CLB1_BASE, 1 << 0, true);
|
||||
|
||||
//EPWM1A is EPWM2A ANDED with EPWM3A
|
||||
|
||||
for(;;)
|
||||
{
|
||||
SysCtl_delay(100000);
|
||||
dutyValue ++;
|
||||
if (dutyValue >= EPWM_TIMER_TBPRD)
|
||||
dutyValue = 0;
|
||||
EPWM_setCounterCompareValue(EPWM2_BASE, EPWM_COUNTER_COMPARE_A, dutyValue);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
__interrupt void clb1ISR(void)
|
||||
{
|
||||
|
||||
CLB_clearInterruptTag(CLB1_BASE);
|
||||
Interrupt_clearACKGroup(INTERRUPT_ACK_GROUP5);
|
||||
}
|
||||
|
||||
|
||||
void initEPWM(uint32_t epwm_base)
|
||||
{
|
||||
//
|
||||
// Set-up TBCLK
|
||||
//
|
||||
EPWM_setTimeBasePeriod(epwm_base, EPWM_TIMER_TBPRD);
|
||||
EPWM_setPhaseShift(epwm_base, 0U);
|
||||
EPWM_setTimeBaseCounter(epwm_base, 0U);
|
||||
|
||||
//
|
||||
// Set Compare values
|
||||
//
|
||||
EPWM_setCounterCompareValue(epwm_base,
|
||||
EPWM_COUNTER_COMPARE_A,
|
||||
2*EPWM_TIMER_TBPRD/3);
|
||||
EPWM_setCounterCompareValue(epwm_base,
|
||||
EPWM_COUNTER_COMPARE_B,
|
||||
2*EPWM_TIMER_TBPRD/3);
|
||||
|
||||
//
|
||||
// Set up counter mode
|
||||
//
|
||||
EPWM_setTimeBaseCounterMode(epwm_base, EPWM_COUNTER_MODE_UP);
|
||||
EPWM_disablePhaseShiftLoad(epwm_base);
|
||||
EPWM_setClockPrescaler(epwm_base,
|
||||
EPWM_CLOCK_DIVIDER_8,
|
||||
EPWM_HSCLOCK_DIVIDER_1);
|
||||
|
||||
//
|
||||
// Set up shadowing
|
||||
//
|
||||
EPWM_setCounterCompareShadowLoadMode(epwm_base,
|
||||
EPWM_COUNTER_COMPARE_A,
|
||||
EPWM_COMP_LOAD_ON_CNTR_ZERO);
|
||||
EPWM_setCounterCompareShadowLoadMode(epwm_base,
|
||||
EPWM_COUNTER_COMPARE_B,
|
||||
EPWM_COMP_LOAD_ON_CNTR_ZERO);
|
||||
|
||||
//
|
||||
// Set actions
|
||||
//
|
||||
|
||||
EPWM_setActionQualifierAction(epwm_base,
|
||||
EPWM_AQ_OUTPUT_A,
|
||||
EPWM_AQ_OUTPUT_HIGH,
|
||||
EPWM_AQ_OUTPUT_ON_TIMEBASE_ZERO);
|
||||
|
||||
|
||||
EPWM_setActionQualifierAction(epwm_base,
|
||||
EPWM_AQ_OUTPUT_B,
|
||||
EPWM_AQ_OUTPUT_HIGH,
|
||||
EPWM_AQ_OUTPUT_ON_TIMEBASE_ZERO);
|
||||
|
||||
EPWM_setActionQualifierAction(epwm_base,
|
||||
EPWM_AQ_OUTPUT_A,
|
||||
EPWM_AQ_OUTPUT_LOW,
|
||||
EPWM_AQ_OUTPUT_ON_TIMEBASE_UP_CMPA);
|
||||
EPWM_setActionQualifierAction(epwm_base,
|
||||
EPWM_AQ_OUTPUT_B,
|
||||
EPWM_AQ_OUTPUT_LOW,
|
||||
EPWM_AQ_OUTPUT_ON_TIMEBASE_UP_CMPB);
|
||||
|
||||
}
|
||||
|
||||
|
||||
void initOff180EPWM(uint32_t epwm_base)
|
||||
{
|
||||
//
|
||||
// Set-up TBCLK
|
||||
//
|
||||
EPWM_selectPeriodLoadEvent(epwm_base, EPWM_SHADOW_LOAD_MODE_SYNC);
|
||||
EPWM_setTimeBasePeriod(epwm_base, EPWM_TIMER_TBPRD);
|
||||
EPWM_setPhaseShift(epwm_base, EPWM_TIMER_TBPRD/2);
|
||||
EPWM_setTimeBaseCounter(epwm_base, EPWM_TIMER_TBPRD/2);
|
||||
|
||||
//
|
||||
// Set Compare values
|
||||
//
|
||||
EPWM_setCounterCompareValue(epwm_base,
|
||||
EPWM_COUNTER_COMPARE_A,
|
||||
2*EPWM_TIMER_TBPRD/3);
|
||||
EPWM_setCounterCompareValue(epwm_base,
|
||||
EPWM_COUNTER_COMPARE_B,
|
||||
2*EPWM_TIMER_TBPRD/3);
|
||||
|
||||
//
|
||||
// Set up counter mode
|
||||
//
|
||||
EPWM_setTimeBaseCounterMode(epwm_base, EPWM_COUNTER_MODE_UP);
|
||||
EPWM_disablePhaseShiftLoad(epwm_base);
|
||||
EPWM_setClockPrescaler(epwm_base,
|
||||
EPWM_CLOCK_DIVIDER_8,
|
||||
EPWM_HSCLOCK_DIVIDER_1);
|
||||
|
||||
//
|
||||
// Set up shadowing
|
||||
//
|
||||
EPWM_setCounterCompareShadowLoadMode(epwm_base,
|
||||
EPWM_COUNTER_COMPARE_A,
|
||||
EPWM_COMP_LOAD_ON_CNTR_ZERO);
|
||||
EPWM_setCounterCompareShadowLoadMode(epwm_base,
|
||||
EPWM_COUNTER_COMPARE_B,
|
||||
EPWM_COMP_LOAD_ON_CNTR_ZERO);
|
||||
|
||||
//
|
||||
// Set actions
|
||||
//
|
||||
EPWM_setActionQualifierAction(epwm_base,
|
||||
EPWM_AQ_OUTPUT_A,
|
||||
EPWM_AQ_OUTPUT_HIGH,
|
||||
EPWM_AQ_OUTPUT_ON_TIMEBASE_ZERO);
|
||||
EPWM_setActionQualifierAction(epwm_base,
|
||||
EPWM_AQ_OUTPUT_B,
|
||||
EPWM_AQ_OUTPUT_HIGH,
|
||||
EPWM_AQ_OUTPUT_ON_TIMEBASE_ZERO);
|
||||
EPWM_setActionQualifierAction(epwm_base,
|
||||
EPWM_AQ_OUTPUT_A,
|
||||
EPWM_AQ_OUTPUT_LOW,
|
||||
EPWM_AQ_OUTPUT_ON_TIMEBASE_UP_CMPA);
|
||||
EPWM_setActionQualifierAction(epwm_base,
|
||||
EPWM_AQ_OUTPUT_B,
|
||||
EPWM_AQ_OUTPUT_LOW,
|
||||
EPWM_AQ_OUTPUT_ON_TIMEBASE_UP_CMPB);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
|
||||
var TILE = scripting.addModule("/utilities/clb_tool/clb_syscfg/source/TILE");
|
||||
var TILE1 = TILE.addInstance();
|
||||
// clock_period - Period of the clock (in Nano Seconds) used for simulation in System C
|
||||
TILE.clock_period = 10;
|
||||
// sim_duration - Duration of the simulation (in Nano Seconds)
|
||||
TILE.sim_duration = 100000;
|
||||
// Name
|
||||
TILE1.$name = "TILE1";
|
||||
// in_repeat_count0 - Number of periods the waveform is repeated
|
||||
TILE1.BOUNDARY.in_repeat_count0 = 50;
|
||||
// in0
|
||||
TILE1.BOUNDARY.in0 = "squareWave";
|
||||
// in_repeat_count1 - Number of periods the waveform is repeated
|
||||
TILE1.BOUNDARY.in_repeat_count1 = 50;
|
||||
// in_repeat_count2 - Number of periods the waveform is repeated
|
||||
TILE1.BOUNDARY.in_repeat_count2 = 50;
|
||||
// in_period2 - Period of the square wave
|
||||
TILE1.BOUNDARY.in_period2 = 3000;
|
||||
// in_duty2 - Duty or ON time of the square wave
|
||||
TILE1.BOUNDARY.in_duty2 = 1500;
|
||||
// in_period3 - Period of the square wave
|
||||
TILE1.BOUNDARY.in_period3 = 10000;
|
||||
// in_duty3 - Duty or ON time of the square wave
|
||||
TILE1.BOUNDARY.in_duty3 = 5001;
|
||||
// in_repeat_count3 - Number of periods the waveform is repeated
|
||||
TILE1.BOUNDARY.in_repeat_count3 = 50;
|
||||
// in3
|
||||
TILE1.BOUNDARY.in3 = "0";
|
||||
// in4
|
||||
TILE1.BOUNDARY.in4 = "0";
|
||||
// in5
|
||||
TILE1.BOUNDARY.in5 = "0";
|
||||
// in_period0 - Period of the square wave
|
||||
TILE1.BOUNDARY.in_period0 = 500;
|
||||
// in_duty0 - Duty or ON time of the square wave
|
||||
TILE1.BOUNDARY.in_duty0 = 250;
|
||||
// in1
|
||||
TILE1.BOUNDARY.in1 = "squareWave";
|
||||
// in_period1 - Period of the square wave
|
||||
TILE1.BOUNDARY.in_period1 = 750;
|
||||
// in_duty1 - Duty or ON time of the square wave
|
||||
TILE1.BOUNDARY.in_duty1 = 250;
|
||||
// in2
|
||||
TILE1.BOUNDARY.in2 = "0";
|
||||
// i0 - Input 0.
|
||||
TILE1.LUT_0.i0 = "BOUNDARY.in0";
|
||||
// i1 - Input 1.
|
||||
TILE1.LUT_0.i1 = "BOUNDARY.in1";
|
||||
// eqn - Boolean equation on the variables i3,i2,i1,i0 for the LUT output.
|
||||
TILE1.LUT_0.eqn = "i0 & i1";
|
||||
// eqn - Boolean equation on the variables i2,i1,i0 for the OUTLUT output.
|
||||
TILE1.OUTLUT_0.eqn = "i0";
|
||||
// i0 - Input 0.
|
||||
TILE1.OUTLUT_0.i0 = "LUT_0.OUT";
|
||||
// instruct0
|
||||
TILE1.HLC.program0.instruct0 = "INTR 11";
|
||||
// instruct0
|
||||
TILE1.HLC.program1.instruct0 = "INTR 12";
|
||||
|
||||
@@ -0,0 +1,196 @@
|
||||
//#############################################################################
|
||||
//
|
||||
// FILE: clb_ex13_push_pull.c
|
||||
//
|
||||
// TITLE: CLB PUSH PULL.
|
||||
//
|
||||
//! \addtogroup driver_example_list
|
||||
//! <h1>CLB PUSH PULL</h1>
|
||||
//!
|
||||
//! For the detailed description of this example, please refer to:
|
||||
//! C2000Ware_PATH\utilities\clb_tool\clb_syscfg\doc\CLB Tool Users Guide.pdf
|
||||
//!
|
||||
//
|
||||
//
|
||||
//#############################################################################
|
||||
//
|
||||
//
|
||||
// $Copyright:
|
||||
// Copyright (C) 2013-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.
|
||||
// $
|
||||
//#############################################################################
|
||||
|
||||
|
||||
|
||||
#include "driverlib.h"
|
||||
#include "device.h"
|
||||
#include "clb_config.h"
|
||||
#include "clb.h"
|
||||
|
||||
__interrupt void clb1ISR(void);
|
||||
|
||||
#define FRC_LOAD 0x1
|
||||
|
||||
|
||||
void main(void)
|
||||
{
|
||||
Device_init();
|
||||
Device_initGPIO();
|
||||
|
||||
Interrupt_initModule();
|
||||
Interrupt_initVectorTable();
|
||||
|
||||
Interrupt_register(INT_CLB1, &clb1ISR);
|
||||
Interrupt_enable(INT_CLB1);
|
||||
|
||||
//
|
||||
// Enabling EPWM1 to enable CLB1
|
||||
//
|
||||
SysCtl_enablePeripheral(SYSCTL_PERIPH_CLK_EPWM1);
|
||||
|
||||
CLB_enableCLB(CLB1_BASE);
|
||||
initTILE1(CLB1_BASE);
|
||||
|
||||
//
|
||||
// Select Global input instead of local input for all CLB IN
|
||||
//
|
||||
CLB_configLocalInputMux(CLB1_BASE, CLB_IN0, CLB_LOCAL_IN_MUX_GLOBAL_IN);
|
||||
CLB_configLocalInputMux(CLB1_BASE, CLB_IN1, CLB_LOCAL_IN_MUX_GLOBAL_IN);
|
||||
CLB_configLocalInputMux(CLB1_BASE, CLB_IN2, CLB_LOCAL_IN_MUX_GLOBAL_IN);
|
||||
CLB_configLocalInputMux(CLB1_BASE, CLB_IN3, CLB_LOCAL_IN_MUX_GLOBAL_IN);
|
||||
CLB_configLocalInputMux(CLB1_BASE, CLB_IN4, CLB_LOCAL_IN_MUX_GLOBAL_IN);
|
||||
CLB_configLocalInputMux(CLB1_BASE, CLB_IN5, CLB_LOCAL_IN_MUX_GLOBAL_IN);
|
||||
CLB_configLocalInputMux(CLB1_BASE, CLB_IN6, CLB_LOCAL_IN_MUX_GLOBAL_IN);
|
||||
CLB_configLocalInputMux(CLB1_BASE, CLB_IN7, CLB_LOCAL_IN_MUX_GLOBAL_IN);
|
||||
|
||||
|
||||
//
|
||||
// Unused Inputs below
|
||||
//
|
||||
CLB_configGlobalInputMux(CLB1_BASE, CLB_IN0, CLB_GLOBAL_IN_MUX_EPWM1A);
|
||||
CLB_configGlobalInputMux(CLB1_BASE, CLB_IN1, CLB_GLOBAL_IN_MUX_EPWM1A);
|
||||
CLB_configGlobalInputMux(CLB1_BASE, CLB_IN2, CLB_GLOBAL_IN_MUX_EPWM1A);
|
||||
CLB_configGlobalInputMux(CLB1_BASE, CLB_IN3, CLB_GLOBAL_IN_MUX_EPWM1A);
|
||||
CLB_configGlobalInputMux(CLB1_BASE, CLB_IN4, CLB_GLOBAL_IN_MUX_EPWM1A);
|
||||
CLB_configGlobalInputMux(CLB1_BASE, CLB_IN5, CLB_GLOBAL_IN_MUX_EPWM1A);
|
||||
CLB_configGlobalInputMux(CLB1_BASE, CLB_IN6, CLB_GLOBAL_IN_MUX_EPWM1A);
|
||||
CLB_configGlobalInputMux(CLB1_BASE, CLB_IN7, CLB_GLOBAL_IN_MUX_EPWM1A);
|
||||
|
||||
|
||||
//
|
||||
// Inputs set to GP register
|
||||
//
|
||||
CLB_configGPInputMux(CLB1_BASE, CLB_IN0, CLB_GP_IN_MUX_GP_REG);
|
||||
//
|
||||
// Unused inputs to GP register
|
||||
//
|
||||
CLB_configGPInputMux(CLB1_BASE, CLB_IN1, CLB_GP_IN_MUX_GP_REG);
|
||||
CLB_configGPInputMux(CLB1_BASE, CLB_IN2, CLB_GP_IN_MUX_GP_REG);
|
||||
CLB_configGPInputMux(CLB1_BASE, CLB_IN3, CLB_GP_IN_MUX_GP_REG);
|
||||
CLB_configGPInputMux(CLB1_BASE, CLB_IN4, CLB_GP_IN_MUX_GP_REG);
|
||||
CLB_configGPInputMux(CLB1_BASE, CLB_IN5, CLB_GP_IN_MUX_GP_REG);
|
||||
CLB_configGPInputMux(CLB1_BASE, CLB_IN6, CLB_GP_IN_MUX_GP_REG);
|
||||
CLB_configGPInputMux(CLB1_BASE, CLB_IN7, CLB_GP_IN_MUX_GP_REG);
|
||||
|
||||
//
|
||||
// Configure GPIO0 for Output
|
||||
//
|
||||
GPIO_setPinConfig(GPIO_0_EPWM1A);
|
||||
GPIO_setDirectionMode(0, GPIO_DIR_MODE_OUT);
|
||||
GPIO_setPadConfig(0, GPIO_PIN_TYPE_STD);
|
||||
|
||||
//
|
||||
// Configure GPIO1 for Output
|
||||
//
|
||||
GPIO_setPinConfig(GPIO_1_EPWM1B);
|
||||
GPIO_setDirectionMode(1, GPIO_DIR_MODE_OUT);
|
||||
GPIO_setPadConfig(1, GPIO_PIN_TYPE_STD);
|
||||
|
||||
//
|
||||
// Configure GPIO24 for OUTPUTXBAR1
|
||||
//
|
||||
GPIO_setPinConfig(GPIO_24_OUTPUTXBAR1);
|
||||
GPIO_setDirectionMode(24, GPIO_DIR_MODE_OUT);
|
||||
GPIO_setPadConfig(24, GPIO_PIN_TYPE_STD);
|
||||
|
||||
//
|
||||
// Configure OUTPUT-XBAR OUTPUT1 as CLB1_OUT4
|
||||
//
|
||||
XBAR_setOutputMuxConfig(XBAR_OUTPUT1, XBAR_OUT_MUX01_CLB1_OUT4);
|
||||
XBAR_enableOutputMux(XBAR_OUTPUT1, XBAR_MUX01);
|
||||
|
||||
|
||||
CLB_setGPREG(CLB1_BASE, 0);
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Enable Global Interrupt (INTM) and realtime interrupt (DBGM)
|
||||
//
|
||||
EINT;
|
||||
ERTM;
|
||||
|
||||
|
||||
CLB_clearInterruptTag(CLB1_BASE);
|
||||
//
|
||||
// Enable OUT4 & OUT0 & OUT2
|
||||
//
|
||||
CLB_setOutputMask(CLB1_BASE, 1 << 0 | 1 << 2, true);
|
||||
|
||||
while(1)
|
||||
{
|
||||
SysCtl_delay(20000000);
|
||||
HWREG(CLB1_BASE + CLB_LOGICCTL + CLB_O_BUF_PTR) = 0U;
|
||||
HWREG(CLB1_BASE + CLB_DATAEXCH + CLB_O_PULL(0)) = 500U;
|
||||
HWREG(CLB1_BASE + CLB_DATAEXCH + CLB_O_PULL(1)) = 1000U;
|
||||
HWREG(CLB1_BASE + CLB_DATAEXCH + CLB_O_PULL(2)) = 2000U;
|
||||
CLB_setGPREG(CLB1_BASE, FRC_LOAD);
|
||||
CLB_setGPREG(CLB1_BASE, 0);
|
||||
SysCtl_delay(20000000);
|
||||
HWREG(CLB1_BASE + CLB_LOGICCTL + CLB_O_BUF_PTR) = 0U;
|
||||
HWREG(CLB1_BASE + CLB_DATAEXCH + CLB_O_PULL(0)) = 1000U;
|
||||
HWREG(CLB1_BASE + CLB_DATAEXCH + CLB_O_PULL(1)) = 2000U;
|
||||
HWREG(CLB1_BASE + CLB_DATAEXCH + CLB_O_PULL(2)) = 4000U;
|
||||
CLB_setGPREG(CLB1_BASE, FRC_LOAD);
|
||||
CLB_setGPREG(CLB1_BASE, 0);
|
||||
asm(" NOP");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
__interrupt void clb1ISR(void)
|
||||
{
|
||||
|
||||
|
||||
CLB_clearInterruptTag(CLB1_BASE);
|
||||
Interrupt_clearACKGroup(INTERRUPT_ACK_GROUP5);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,120 @@
|
||||
|
||||
var TILE = scripting.addModule("/utilities/clb_tool/clb_syscfg/source/TILE");
|
||||
var TILE1 = TILE.addInstance();
|
||||
// clock_period - Period of the clock (in Nano Seconds) used for simulation in System C
|
||||
TILE.clock_period = 10;
|
||||
// sim_duration - Duration of the simulation (in Nano Seconds)
|
||||
TILE.sim_duration = 100000;
|
||||
// Name
|
||||
TILE1.$name = "TILE1";
|
||||
// in_repeat_count0 - Number of periods the waveform is repeated
|
||||
TILE1.BOUNDARY.in_repeat_count0 = 50;
|
||||
// in_repeat_count1 - Number of periods the waveform is repeated
|
||||
TILE1.BOUNDARY.in_repeat_count1 = 50;
|
||||
// in_repeat_count2 - Number of periods the waveform is repeated
|
||||
TILE1.BOUNDARY.in_repeat_count2 = 50;
|
||||
// in_period0 - Period of the square wave
|
||||
TILE1.BOUNDARY.in_period0 = 10000;
|
||||
// in_duty0 - Duty or ON time of the square wave
|
||||
TILE1.BOUNDARY.in_duty0 = 5001;
|
||||
// in_period1 - Period of the square wave
|
||||
TILE1.BOUNDARY.in_period1 = 1000;
|
||||
// in_duty1 - Duty or ON time of the square wave
|
||||
TILE1.BOUNDARY.in_duty1 = 500;
|
||||
// in_period2 - Period of the square wave
|
||||
TILE1.BOUNDARY.in_period2 = 3000;
|
||||
// in_duty2 - Duty or ON time of the square wave
|
||||
TILE1.BOUNDARY.in_duty2 = 1500;
|
||||
// in_period3 - Period of the square wave
|
||||
TILE1.BOUNDARY.in_period3 = 10000;
|
||||
// in_duty3 - Duty or ON time of the square wave
|
||||
TILE1.BOUNDARY.in_duty3 = 5001;
|
||||
// in_repeat_count3 - Number of periods the waveform is repeated
|
||||
TILE1.BOUNDARY.in_repeat_count3 = 50;
|
||||
// in3
|
||||
TILE1.BOUNDARY.in3 = "0";
|
||||
// in4
|
||||
TILE1.BOUNDARY.in4 = "0";
|
||||
// in5
|
||||
TILE1.BOUNDARY.in5 = "0";
|
||||
// in1
|
||||
TILE1.BOUNDARY.in1 = "0";
|
||||
// in2
|
||||
TILE1.BOUNDARY.in2 = "0";
|
||||
// e0 - External Input 0.
|
||||
TILE1.FSM_0.e0 = "COUNTER_0.count_match1";
|
||||
// eqn_s0 - Boolean equation on the variables e1,e0,s1,s0 for the S0 output.
|
||||
TILE1.FSM_0.eqn_s0 = "e0 ^ s0";
|
||||
// eqn_s1 - Boolean equation on the variables e1,e0,s1,s0 for the S1 output.
|
||||
TILE1.FSM_0.eqn_s1 = "e1 ^ s1";
|
||||
// e1 - External Input 1.
|
||||
TILE1.FSM_0.e1 = "COUNTER_1.count_match1";
|
||||
// e0 - External Input 0.
|
||||
TILE1.FSM_1.e0 = "COUNTER_2.count_match1";
|
||||
// eqn_s0 - Boolean equation on the variables e1,e0,s1,s0 for the S0 output.
|
||||
TILE1.FSM_1.eqn_s0 = "e0 ^ s0";
|
||||
// What action should be taken on an event trigger?
|
||||
TILE1.COUNTER_0.action = "Load";
|
||||
// mode0 - Enables Counting when high
|
||||
TILE1.COUNTER_0.mode0 = "1";
|
||||
// mode1 - Controls counting direction. High enables count up. Low enables count down.
|
||||
TILE1.COUNTER_0.mode1 = "1";
|
||||
// reset - Reset the counter to 0 on next clock cycle (triggers low to high)
|
||||
TILE1.COUNTER_0.reset = "COUNTER_0.count_match1";
|
||||
// match1_val - Sets the value of the Match reference 1 register.
|
||||
TILE1.COUNTER_0.match1_val = "2000";
|
||||
// event - Trigger actions in the counter.
|
||||
TILE1.COUNTER_0.event = "BOUNDARY.in0";
|
||||
// reset - Reset the counter to 0 on next clock cycle (triggers low to high)
|
||||
TILE1.COUNTER_1.reset = "COUNTER_1.count_match1";
|
||||
// mode0 - Enables Counting when high
|
||||
TILE1.COUNTER_1.mode0 = "1";
|
||||
// mode1 - Controls counting direction. High enables count up. Low enables count down.
|
||||
TILE1.COUNTER_1.mode1 = "1";
|
||||
// match1_val - Sets the value of the Match reference 1 register.
|
||||
TILE1.COUNTER_1.match1_val = "4000";
|
||||
// event - Trigger actions in the counter.
|
||||
TILE1.COUNTER_1.event = "BOUNDARY.in0";
|
||||
// What action should be taken on an event trigger?
|
||||
TILE1.COUNTER_1.action = "Load";
|
||||
// reset - Reset the counter to 0 on next clock cycle (triggers low to high)
|
||||
TILE1.COUNTER_2.reset = "COUNTER_2.count_match1";
|
||||
// mode0 - Enables Counting when high
|
||||
TILE1.COUNTER_2.mode0 = "1";
|
||||
// mode1 - Controls counting direction. High enables count up. Low enables count down.
|
||||
TILE1.COUNTER_2.mode1 = "1";
|
||||
// match1_val - Sets the value of the Match reference 1 register.
|
||||
TILE1.COUNTER_2.match1_val = "8000";
|
||||
// event - Trigger actions in the counter.
|
||||
TILE1.COUNTER_2.event = "BOUNDARY.in0";
|
||||
// What action should be taken on an event trigger?
|
||||
TILE1.COUNTER_2.action = "Load";
|
||||
// i0 - Input 0.
|
||||
TILE1.OUTLUT_0.i0 = "FSM_0.S0";
|
||||
// eqn - Boolean equation on the variables i2,i1,i0 for the OUTLUT output.
|
||||
TILE1.OUTLUT_0.eqn = "i0";
|
||||
// eqn - Boolean equation on the variables i2,i1,i0 for the OUTLUT output.
|
||||
TILE1.OUTLUT_2.eqn = "i0";
|
||||
// i0 - Input 0.
|
||||
TILE1.OUTLUT_2.i0 = "FSM_0.S1";
|
||||
// eqn - Boolean equation on the variables i2,i1,i0 for the OUTLUT output.
|
||||
TILE1.OUTLUT_4.eqn = "i0";
|
||||
// i0 - Input 0.
|
||||
TILE1.OUTLUT_4.i0 = "FSM_1.S0";
|
||||
// Event 0 (e0) - Event 0
|
||||
TILE1.HLC.e0 = "BOUNDARY.in0";
|
||||
// instruct0
|
||||
TILE1.HLC.program0.instruct0 = "PULL R0";
|
||||
// instruct1
|
||||
TILE1.HLC.program0.instruct1 = "MOV_T1 R0,C0";
|
||||
// instruct2
|
||||
TILE1.HLC.program0.instruct2 = "PULL R0";
|
||||
// instruct3
|
||||
TILE1.HLC.program0.instruct3 = "MOV_T1 R0,C1";
|
||||
// instruct4
|
||||
TILE1.HLC.program0.instruct4 = "PULL R0";
|
||||
// instruct5
|
||||
TILE1.HLC.program0.instruct5 = "MOV_T1 R0,C2";
|
||||
// instruct6
|
||||
TILE1.HLC.program0.instruct6 = "PULL R0";
|
||||
|
||||
@@ -0,0 +1,203 @@
|
||||
//#############################################################################
|
||||
//
|
||||
// FILE: clb_ex14_multi_tile.c
|
||||
//
|
||||
// TITLE: CLB Multi Tile.
|
||||
//
|
||||
//! \addtogroup driver_example_list
|
||||
//! <h1>CLB Multi Tile</h1>
|
||||
//!
|
||||
//! For the detailed description of this example, please refer to:
|
||||
//! C2000Ware_PATH\utilities\clb_tool\clb_syscfg\doc\CLB Tool Users Guide.pdf
|
||||
//!
|
||||
//
|
||||
//
|
||||
//#############################################################################
|
||||
//
|
||||
//
|
||||
// $Copyright:
|
||||
// Copyright (C) 2013-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.
|
||||
// $
|
||||
//#############################################################################
|
||||
|
||||
|
||||
|
||||
#include "driverlib.h"
|
||||
#include "device.h"
|
||||
#include "clb_config.h"
|
||||
#include "clb.h"
|
||||
|
||||
|
||||
void main(void)
|
||||
{
|
||||
Device_init();
|
||||
Device_initGPIO();
|
||||
|
||||
Interrupt_initModule();
|
||||
Interrupt_initVectorTable();
|
||||
|
||||
//
|
||||
// Enabling EPWM1/2 to enable CLB1/2
|
||||
//
|
||||
SysCtl_enablePeripheral(SYSCTL_PERIPH_CLK_EPWM1);
|
||||
SysCtl_enablePeripheral(SYSCTL_PERIPH_CLK_EPWM2);
|
||||
|
||||
CLB_enableCLB(CLB2_BASE);
|
||||
initTILE1(CLB1_BASE);
|
||||
CLB_enableCLB(CLB1_BASE);
|
||||
initTILE2(CLB2_BASE);
|
||||
|
||||
//
|
||||
// Select Global input instead of local input for all CLB IN
|
||||
//
|
||||
CLB_configLocalInputMux(CLB1_BASE, CLB_IN0, CLB_LOCAL_IN_MUX_GLOBAL_IN);
|
||||
CLB_configLocalInputMux(CLB1_BASE, CLB_IN1, CLB_LOCAL_IN_MUX_GLOBAL_IN);
|
||||
CLB_configLocalInputMux(CLB1_BASE, CLB_IN2, CLB_LOCAL_IN_MUX_GLOBAL_IN);
|
||||
CLB_configLocalInputMux(CLB1_BASE, CLB_IN3, CLB_LOCAL_IN_MUX_GLOBAL_IN);
|
||||
CLB_configLocalInputMux(CLB1_BASE, CLB_IN4, CLB_LOCAL_IN_MUX_GLOBAL_IN);
|
||||
CLB_configLocalInputMux(CLB1_BASE, CLB_IN5, CLB_LOCAL_IN_MUX_GLOBAL_IN);
|
||||
CLB_configLocalInputMux(CLB1_BASE, CLB_IN6, CLB_LOCAL_IN_MUX_GLOBAL_IN);
|
||||
CLB_configLocalInputMux(CLB1_BASE, CLB_IN7, CLB_LOCAL_IN_MUX_GLOBAL_IN);
|
||||
|
||||
//
|
||||
// Select Global input instead of local input for all CLB IN
|
||||
//
|
||||
CLB_configLocalInputMux(CLB2_BASE, CLB_IN0, CLB_LOCAL_IN_MUX_GLOBAL_IN);
|
||||
CLB_configLocalInputMux(CLB2_BASE, CLB_IN1, CLB_LOCAL_IN_MUX_GLOBAL_IN);
|
||||
CLB_configLocalInputMux(CLB2_BASE, CLB_IN2, CLB_LOCAL_IN_MUX_GLOBAL_IN);
|
||||
CLB_configLocalInputMux(CLB2_BASE, CLB_IN3, CLB_LOCAL_IN_MUX_GLOBAL_IN);
|
||||
CLB_configLocalInputMux(CLB2_BASE, CLB_IN4, CLB_LOCAL_IN_MUX_GLOBAL_IN);
|
||||
CLB_configLocalInputMux(CLB2_BASE, CLB_IN5, CLB_LOCAL_IN_MUX_GLOBAL_IN);
|
||||
CLB_configLocalInputMux(CLB2_BASE, CLB_IN6, CLB_LOCAL_IN_MUX_GLOBAL_IN);
|
||||
CLB_configLocalInputMux(CLB2_BASE, CLB_IN7, CLB_LOCAL_IN_MUX_GLOBAL_IN);
|
||||
|
||||
//
|
||||
// Use CLB AUXSIG0 for IN0
|
||||
//
|
||||
CLB_configGlobalInputMux(CLB1_BASE, CLB_IN0, CLB_GLOBAL_IN_MUX_CLB_AUXSIG0);
|
||||
//
|
||||
// Unused Inputs below
|
||||
//
|
||||
CLB_configGlobalInputMux(CLB1_BASE, CLB_IN1, CLB_GLOBAL_IN_MUX_EPWM1A);
|
||||
CLB_configGlobalInputMux(CLB1_BASE, CLB_IN2, CLB_GLOBAL_IN_MUX_EPWM1A);
|
||||
CLB_configGlobalInputMux(CLB1_BASE, CLB_IN3, CLB_GLOBAL_IN_MUX_EPWM1A);
|
||||
CLB_configGlobalInputMux(CLB1_BASE, CLB_IN4, CLB_GLOBAL_IN_MUX_EPWM1A);
|
||||
CLB_configGlobalInputMux(CLB1_BASE, CLB_IN5, CLB_GLOBAL_IN_MUX_EPWM1A);
|
||||
CLB_configGlobalInputMux(CLB1_BASE, CLB_IN6, CLB_GLOBAL_IN_MUX_EPWM1A);
|
||||
CLB_configGlobalInputMux(CLB1_BASE, CLB_IN7, CLB_GLOBAL_IN_MUX_EPWM1A);
|
||||
|
||||
//
|
||||
// Unused Inputs below
|
||||
//
|
||||
CLB_configGlobalInputMux(CLB2_BASE, CLB_IN0, CLB_GLOBAL_IN_MUX_EPWM1A);
|
||||
CLB_configGlobalInputMux(CLB2_BASE, CLB_IN1, CLB_GLOBAL_IN_MUX_EPWM1A);
|
||||
CLB_configGlobalInputMux(CLB2_BASE, CLB_IN2, CLB_GLOBAL_IN_MUX_EPWM1A);
|
||||
CLB_configGlobalInputMux(CLB2_BASE, CLB_IN3, CLB_GLOBAL_IN_MUX_EPWM1A);
|
||||
CLB_configGlobalInputMux(CLB2_BASE, CLB_IN4, CLB_GLOBAL_IN_MUX_EPWM1A);
|
||||
CLB_configGlobalInputMux(CLB2_BASE, CLB_IN5, CLB_GLOBAL_IN_MUX_EPWM1A);
|
||||
CLB_configGlobalInputMux(CLB2_BASE, CLB_IN6, CLB_GLOBAL_IN_MUX_EPWM1A);
|
||||
CLB_configGlobalInputMux(CLB2_BASE, CLB_IN7, CLB_GLOBAL_IN_MUX_EPWM1A);
|
||||
|
||||
//
|
||||
// Use external signal from global input
|
||||
//
|
||||
CLB_configGPInputMux(CLB1_BASE, CLB_IN0, CLB_GP_IN_MUX_EXTERNAL);
|
||||
//
|
||||
// Unused inputs to GP register
|
||||
//
|
||||
CLB_configGPInputMux(CLB1_BASE, CLB_IN1, CLB_GP_IN_MUX_GP_REG);
|
||||
CLB_configGPInputMux(CLB1_BASE, CLB_IN2, CLB_GP_IN_MUX_GP_REG);
|
||||
CLB_configGPInputMux(CLB1_BASE, CLB_IN3, CLB_GP_IN_MUX_GP_REG);
|
||||
CLB_configGPInputMux(CLB1_BASE, CLB_IN4, CLB_GP_IN_MUX_GP_REG);
|
||||
CLB_configGPInputMux(CLB1_BASE, CLB_IN5, CLB_GP_IN_MUX_GP_REG);
|
||||
CLB_configGPInputMux(CLB1_BASE, CLB_IN6, CLB_GP_IN_MUX_GP_REG);
|
||||
CLB_configGPInputMux(CLB1_BASE, CLB_IN7, CLB_GP_IN_MUX_GP_REG);
|
||||
|
||||
//
|
||||
// Unused inputs to GP register
|
||||
//
|
||||
CLB_configGPInputMux(CLB2_BASE, CLB_IN0, CLB_GP_IN_MUX_GP_REG);
|
||||
CLB_configGPInputMux(CLB2_BASE, CLB_IN1, CLB_GP_IN_MUX_GP_REG);
|
||||
CLB_configGPInputMux(CLB2_BASE, CLB_IN2, CLB_GP_IN_MUX_GP_REG);
|
||||
CLB_configGPInputMux(CLB2_BASE, CLB_IN3, CLB_GP_IN_MUX_GP_REG);
|
||||
CLB_configGPInputMux(CLB2_BASE, CLB_IN4, CLB_GP_IN_MUX_GP_REG);
|
||||
CLB_configGPInputMux(CLB2_BASE, CLB_IN5, CLB_GP_IN_MUX_GP_REG);
|
||||
CLB_configGPInputMux(CLB2_BASE, CLB_IN6, CLB_GP_IN_MUX_GP_REG);
|
||||
CLB_configGPInputMux(CLB2_BASE, CLB_IN7, CLB_GP_IN_MUX_GP_REG);
|
||||
|
||||
//
|
||||
// Configure GPIO2 for OUTPUTXBAR1
|
||||
//
|
||||
GPIO_setPinConfig(GPIO_2_EPWM2A);
|
||||
GPIO_setDirectionMode(2, GPIO_DIR_MODE_OUT);
|
||||
GPIO_setPadConfig(2, GPIO_PIN_TYPE_STD);
|
||||
|
||||
//
|
||||
// Configure Input-XBAR INPUT1 to GPIO2
|
||||
//
|
||||
XBAR_setInputPin(XBAR_INPUT1, 2);
|
||||
|
||||
//
|
||||
// Configure CLB-XBAR AUXSIG0 as INPUT1
|
||||
//
|
||||
XBAR_setCLBMuxConfig(XBAR_AUXSIG0, XBAR_CLB_MUX01_INPUTXBAR1);
|
||||
XBAR_enableCLBMux(XBAR_AUXSIG0, XBAR_MUX01);
|
||||
|
||||
//
|
||||
// Configure GPIO24 for OUTPUTXBAR1
|
||||
//
|
||||
GPIO_setPinConfig(GPIO_24_OUTPUTXBAR1);
|
||||
GPIO_setDirectionMode(24, GPIO_DIR_MODE_OUT);
|
||||
GPIO_setPadConfig(24, GPIO_PIN_TYPE_STD);
|
||||
|
||||
//
|
||||
// Configure OUTPUT-XBAR OUTPUT1 as CLB1_OUT4
|
||||
//
|
||||
XBAR_setOutputMuxConfig(XBAR_OUTPUT1, XBAR_OUT_MUX01_CLB1_OUT4);
|
||||
XBAR_enableOutputMux(XBAR_OUTPUT1, XBAR_MUX01);
|
||||
|
||||
//
|
||||
// Enable Global Interrupt (INTM) and realtime interrupt (DBGM)
|
||||
//
|
||||
EINT;
|
||||
ERTM;
|
||||
|
||||
//
|
||||
// Enable OUT0
|
||||
//
|
||||
CLB_setOutputMask(CLB2_BASE, 1 << 0, true);
|
||||
|
||||
|
||||
while(1)
|
||||
{
|
||||
asm(" NOP");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
|
||||
var TILE = scripting.addModule("/utilities/clb_tool/clb_syscfg/source/TILE");
|
||||
var TILE1 = TILE.addInstance();
|
||||
var TILE2 = TILE.addInstance();
|
||||
// clock_period - Period of the clock (in Nano Seconds) used for simulation in System C
|
||||
TILE.clock_period = 10;
|
||||
// sim_duration - Duration of the simulation (in Nano Seconds)
|
||||
TILE.sim_duration = 100000;
|
||||
// Name
|
||||
TILE1.$name = "TILE2";
|
||||
// in_repeat_count0 - Number of periods the waveform is repeated
|
||||
TILE1.BOUNDARY.in_repeat_count0 = 50;
|
||||
// in_repeat_count3 - Number of periods the waveform is repeated
|
||||
TILE1.BOUNDARY.in_repeat_count3 = 1;
|
||||
// in_repeat_count1 - Number of periods the waveform is repeated
|
||||
TILE1.BOUNDARY.in_repeat_count1 = 50;
|
||||
// in_repeat_count2 - Number of periods the waveform is repeated
|
||||
TILE1.BOUNDARY.in_repeat_count2 = 50;
|
||||
// in_period0 - Period of the square wave
|
||||
TILE1.BOUNDARY.in_period0 = 10000;
|
||||
// in_duty0 - Duty or ON time of the square wave
|
||||
TILE1.BOUNDARY.in_duty0 = 5001;
|
||||
// in_period1 - Period of the square wave
|
||||
TILE1.BOUNDARY.in_period1 = 1000;
|
||||
// in_duty1 - Duty or ON time of the square wave
|
||||
TILE1.BOUNDARY.in_duty1 = 500;
|
||||
// in_period2 - Period of the square wave
|
||||
TILE1.BOUNDARY.in_period2 = 3000;
|
||||
// in_duty2 - Duty or ON time of the square wave
|
||||
TILE1.BOUNDARY.in_duty2 = 1500;
|
||||
// mode0 - Enables Counting when high
|
||||
TILE1.COUNTER_0.mode0 = "1";
|
||||
// mode1 - Controls counting direction. High enables count up. Low enables count down.
|
||||
TILE1.COUNTER_0.mode1 = "1";
|
||||
// match1_val - Sets the value of the Match reference 1 register.
|
||||
TILE1.COUNTER_0.match1_val = "1000";
|
||||
// reset - Reset the counter to 0 on next clock cycle (triggers low to high)
|
||||
TILE1.COUNTER_0.reset = "COUNTER_0.count_match1";
|
||||
// i0 - Input 0.
|
||||
TILE1.OUTLUT_0.i0 = "COUNTER_0.count_match1";
|
||||
// eqn - Boolean equation on the variables i2,i1,i0 for the OUTLUT output.
|
||||
TILE1.OUTLUT_0.eqn = "i0";
|
||||
// instruct0
|
||||
TILE1.HLC.program0.instruct0 = "INTR 0";
|
||||
// Name
|
||||
TILE2.$name = "TILE1";
|
||||
// in0
|
||||
TILE2.BOUNDARY.in0 = "TILE2_BOUNDARY.out0";
|
||||
// e0 - External Input 0.
|
||||
TILE2.FSM_0.e0 = "BOUNDARY.in0";
|
||||
// eqn_s0 - Boolean equation on the variables e1,e0,s1,s0 for the S0 output.
|
||||
TILE2.FSM_0.eqn_s0 = "e0 ^ s0";
|
||||
// i0 - Input 0.
|
||||
TILE2.OUTLUT_4.i0 = "FSM_0.S0";
|
||||
// eqn - Boolean equation on the variables i2,i1,i0 for the OUTLUT output.
|
||||
TILE2.OUTLUT_4.eqn = "i0";
|
||||
|
||||
@@ -0,0 +1,419 @@
|
||||
//#############################################################################
|
||||
//
|
||||
// FILE: clb_ex15_tile_to_tile_delay.c
|
||||
//
|
||||
// TITLE: CLB Tile to Tile Delay.
|
||||
//
|
||||
//! \addtogroup driver_example_list
|
||||
//! <h1>CLB Tile to Tile Delay</h1>
|
||||
//!
|
||||
//! For the detailed description of this example, please refer to:
|
||||
//! C2000Ware_PATH\utilities\clb_tool\clb_syscfg\doc\CLB Tool Users Guide.pdf
|
||||
//!
|
||||
//
|
||||
//
|
||||
//#############################################################################
|
||||
//
|
||||
//
|
||||
// $Copyright:
|
||||
// Copyright (C) 2013-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.
|
||||
// $
|
||||
//#############################################################################
|
||||
|
||||
|
||||
|
||||
#include "driverlib.h"
|
||||
#include "device.h"
|
||||
#include "clb_config.h"
|
||||
#include "clb.h"
|
||||
|
||||
uint32_t clb1delay = 0;
|
||||
uint32_t clb2delay = 0;
|
||||
uint32_t clb3delay = 0;
|
||||
uint32_t clb4delay = 0;
|
||||
|
||||
__interrupt void clb1ISR(void);
|
||||
__interrupt void clb2ISR(void);
|
||||
__interrupt void clb3ISR(void);
|
||||
__interrupt void clb4ISR(void);
|
||||
|
||||
void main(void)
|
||||
{
|
||||
Device_init();
|
||||
Device_initGPIO();
|
||||
|
||||
//
|
||||
// Configure GPIO0 for INPUTXBAR1
|
||||
//
|
||||
GPIO_setPinConfig(GPIO_0_GPIO0);
|
||||
GPIO_setDirectionMode(0, GPIO_DIR_MODE_OUT);
|
||||
GPIO_setPadConfig(0, GPIO_PIN_TYPE_STD);
|
||||
XBAR_setInputPin(XBAR_INPUT1, 0);
|
||||
GPIO_writePin(0, 0);
|
||||
|
||||
Interrupt_initModule();
|
||||
Interrupt_initVectorTable();
|
||||
|
||||
|
||||
Interrupt_register(INT_CLB1, &clb1ISR);
|
||||
Interrupt_enable(INT_CLB1);
|
||||
|
||||
Interrupt_register(INT_CLB2, &clb2ISR);
|
||||
Interrupt_enable(INT_CLB2);
|
||||
|
||||
Interrupt_register(INT_CLB3, &clb3ISR);
|
||||
Interrupt_enable(INT_CLB3);
|
||||
|
||||
Interrupt_register(INT_CLB4, &clb4ISR);
|
||||
Interrupt_enable(INT_CLB4);
|
||||
|
||||
//
|
||||
// Enabling EPWM1/2/3/4 to enable CLB1/2/3/4
|
||||
//
|
||||
SysCtl_enablePeripheral(SYSCTL_PERIPH_CLK_EPWM1);
|
||||
SysCtl_enablePeripheral(SYSCTL_PERIPH_CLK_EPWM2);
|
||||
SysCtl_enablePeripheral(SYSCTL_PERIPH_CLK_EPWM3);
|
||||
SysCtl_enablePeripheral(SYSCTL_PERIPH_CLK_EPWM4);
|
||||
|
||||
CLB_enableCLB(CLB1_BASE);
|
||||
CLB_enableCLB(CLB2_BASE);
|
||||
CLB_enableCLB(CLB3_BASE);
|
||||
CLB_enableCLB(CLB4_BASE);
|
||||
|
||||
initTILE1(CLB1_BASE);
|
||||
initTILE2(CLB2_BASE);
|
||||
initTILE3(CLB3_BASE);
|
||||
initTILE4(CLB4_BASE);
|
||||
|
||||
//
|
||||
// Configure CLB1 BOUNDARY IN
|
||||
//
|
||||
|
||||
//
|
||||
// Select Global input instead of local input for CLB IN
|
||||
//
|
||||
CLB_configLocalInputMux(CLB1_BASE, CLB_IN0, CLB_LOCAL_IN_MUX_GLOBAL_IN);
|
||||
CLB_configLocalInputMux(CLB1_BASE, CLB_IN1, CLB_LOCAL_IN_MUX_GLOBAL_IN);
|
||||
|
||||
//
|
||||
// Select AUXSIG0 for CLB1, IN0
|
||||
// Select AUXSIG1 for CLB1, IN1
|
||||
//
|
||||
CLB_configGlobalInputMux(CLB1_BASE, CLB_IN0, CLB_GLOBAL_IN_MUX_CLB_AUXSIG0);
|
||||
CLB_configGlobalInputMux(CLB1_BASE, CLB_IN1, CLB_GLOBAL_IN_MUX_CLB_AUXSIG1);
|
||||
|
||||
//
|
||||
// Select External for CLB1, IN0
|
||||
// Select External for CLB1, IN1
|
||||
//
|
||||
CLB_configGPInputMux(CLB1_BASE, CLB_IN0, CLB_GP_IN_MUX_EXTERNAL);
|
||||
CLB_configGPInputMux(CLB1_BASE, CLB_IN1, CLB_GP_IN_MUX_EXTERNAL);
|
||||
|
||||
//
|
||||
// Configure CLB2 BOUNDARY IN
|
||||
//
|
||||
|
||||
//
|
||||
// Select Global input instead of local input for CLB IN
|
||||
//
|
||||
CLB_configLocalInputMux(CLB2_BASE, CLB_IN0, CLB_LOCAL_IN_MUX_GLOBAL_IN);
|
||||
CLB_configLocalInputMux(CLB2_BASE, CLB_IN1, CLB_LOCAL_IN_MUX_GLOBAL_IN);
|
||||
|
||||
//
|
||||
// Select AUXSIG0 for CLB2, IN0
|
||||
// Select AUXSIG2 for CLB2, IN1
|
||||
//
|
||||
CLB_configGlobalInputMux(CLB2_BASE, CLB_IN0, CLB_GLOBAL_IN_MUX_CLB_AUXSIG0);
|
||||
CLB_configGlobalInputMux(CLB2_BASE, CLB_IN1, CLB_GLOBAL_IN_MUX_CLB_AUXSIG2);
|
||||
|
||||
//
|
||||
// Select External for CLB2, IN0
|
||||
// Select External for CLB2, IN1
|
||||
//
|
||||
CLB_configGPInputMux(CLB2_BASE, CLB_IN0, CLB_GP_IN_MUX_EXTERNAL);
|
||||
CLB_configGPInputMux(CLB2_BASE, CLB_IN1, CLB_GP_IN_MUX_EXTERNAL);
|
||||
|
||||
|
||||
//
|
||||
// Configure CLB3 BOUNDARY IN
|
||||
//
|
||||
|
||||
//
|
||||
// Select Global input instead of local input for CLB IN
|
||||
//
|
||||
CLB_configLocalInputMux(CLB3_BASE, CLB_IN0, CLB_LOCAL_IN_MUX_GLOBAL_IN);
|
||||
CLB_configLocalInputMux(CLB3_BASE, CLB_IN1, CLB_LOCAL_IN_MUX_GLOBAL_IN);
|
||||
|
||||
//
|
||||
// Select AUXSIG0 for CLB3, IN0
|
||||
// Select AUXSIG3 for CLB3, IN1
|
||||
//
|
||||
CLB_configGlobalInputMux(CLB3_BASE, CLB_IN0, CLB_GLOBAL_IN_MUX_CLB_AUXSIG0);
|
||||
CLB_configGlobalInputMux(CLB3_BASE, CLB_IN1, CLB_GLOBAL_IN_MUX_CLB_AUXSIG3);
|
||||
|
||||
//
|
||||
// Select External for CLB3, IN0
|
||||
// Select External for CLB3, IN1
|
||||
//
|
||||
CLB_configGPInputMux(CLB3_BASE, CLB_IN0, CLB_GP_IN_MUX_EXTERNAL);
|
||||
CLB_configGPInputMux(CLB3_BASE, CLB_IN1, CLB_GP_IN_MUX_EXTERNAL);
|
||||
|
||||
//
|
||||
// Configure CLB4 BOUNDARY IN
|
||||
//
|
||||
|
||||
//
|
||||
// Select Global input instead of local input for CLB IN
|
||||
//
|
||||
CLB_configLocalInputMux(CLB4_BASE, CLB_IN0, CLB_LOCAL_IN_MUX_GLOBAL_IN);
|
||||
CLB_configLocalInputMux(CLB4_BASE, CLB_IN1, CLB_LOCAL_IN_MUX_GLOBAL_IN);
|
||||
|
||||
//
|
||||
// Select AUXSIG0 for CLB4, IN0
|
||||
// Select AUXSIG4 for CLB4, IN1
|
||||
//
|
||||
CLB_configGlobalInputMux(CLB4_BASE, CLB_IN0, CLB_GLOBAL_IN_MUX_CLB_AUXSIG0);
|
||||
CLB_configGlobalInputMux(CLB4_BASE, CLB_IN1, CLB_GLOBAL_IN_MUX_CLB_AUXSIG4);
|
||||
|
||||
//
|
||||
// Select External for CLB4, IN0
|
||||
// Select External for CLB4, IN1
|
||||
//
|
||||
CLB_configGPInputMux(CLB4_BASE, CLB_IN0, CLB_GP_IN_MUX_EXTERNAL);
|
||||
CLB_configGPInputMux(CLB4_BASE, CLB_IN1, CLB_GP_IN_MUX_EXTERNAL);
|
||||
|
||||
|
||||
//
|
||||
// Configure CLB-XBAR AUXSIG0 as INPUT1
|
||||
//
|
||||
XBAR_setCLBMuxConfig(XBAR_AUXSIG0, XBAR_CLB_MUX01_INPUTXBAR1);
|
||||
XBAR_enableCLBMux(XBAR_AUXSIG0, XBAR_MUX01);
|
||||
|
||||
//
|
||||
// Configure CLB-XBAR AUXSIG1 as CLB2 OUT4
|
||||
//
|
||||
XBAR_setCLBMuxConfig(XBAR_AUXSIG1, XBAR_CLB_MUX05_CLB2_OUT4);
|
||||
XBAR_enableCLBMux(XBAR_AUXSIG1, XBAR_MUX05);
|
||||
|
||||
//
|
||||
// Configure CLB-XBAR AUXSIG2 as CLB1 OUT4
|
||||
//
|
||||
XBAR_setCLBMuxConfig(XBAR_AUXSIG2, XBAR_CLB_MUX01_CLB1_OUT4);
|
||||
XBAR_enableCLBMux(XBAR_AUXSIG2, XBAR_MUX01);
|
||||
|
||||
//
|
||||
// Configure CLB-XBAR AUXSIG3 as Input XBAR2 = CLB4 OUT4
|
||||
//
|
||||
XBAR_setCLBMuxConfig(XBAR_AUXSIG3, XBAR_CLB_MUX03_INPUTXBAR2);
|
||||
XBAR_enableCLBMux(XBAR_AUXSIG3, XBAR_MUX03);
|
||||
|
||||
//
|
||||
// Configure CLB-XBAR AUXSIG4 as Input XBAR3 = CLB3 OUT4
|
||||
//
|
||||
XBAR_setCLBMuxConfig(XBAR_AUXSIG4, XBAR_CLB_MUX05_INPUTXBAR3);
|
||||
XBAR_enableCLBMux(XBAR_AUXSIG4, XBAR_MUX05);
|
||||
|
||||
//
|
||||
// Configure GPIO24 for OUTPUTXBAR1
|
||||
//
|
||||
GPIO_setPinConfig(GPIO_24_OUTPUTXBAR1);
|
||||
GPIO_setDirectionMode(24, GPIO_DIR_MODE_OUT);
|
||||
GPIO_setPadConfig(24, GPIO_PIN_TYPE_STD);
|
||||
|
||||
XBAR_setOutputMuxConfig(XBAR_OUTPUT1, XBAR_OUT_MUX01_CLB1_OUT4);
|
||||
XBAR_enableOutputMux(XBAR_OUTPUT1, XBAR_MUX01);
|
||||
|
||||
//
|
||||
// Configure GPIO16 for OUTPUTXBAR7
|
||||
//
|
||||
GPIO_setPinConfig(GPIO_16_OUTPUTXBAR7);
|
||||
GPIO_setDirectionMode(16, GPIO_DIR_MODE_OUT);
|
||||
GPIO_setPadConfig(16, GPIO_PIN_TYPE_STD);
|
||||
|
||||
XBAR_setOutputMuxConfig(XBAR_OUTPUT7, XBAR_OUT_MUX05_CLB2_OUT4);
|
||||
XBAR_enableOutputMux(XBAR_OUTPUT7, XBAR_MUX05);
|
||||
|
||||
|
||||
//
|
||||
// Configure GPIO14 for OUTPUTXBAR3
|
||||
//
|
||||
GPIO_setPinConfig(GPIO_14_OUTPUTXBAR3);
|
||||
GPIO_setDirectionMode(14, GPIO_DIR_MODE_OUT);
|
||||
GPIO_setPadConfig(14, GPIO_PIN_TYPE_STD);
|
||||
|
||||
XBAR_setOutputMuxConfig(XBAR_OUTPUT3, XBAR_OUT_MUX09_CLB3_OUT4);
|
||||
XBAR_enableOutputMux(XBAR_OUTPUT3, XBAR_MUX09);
|
||||
|
||||
//
|
||||
// Input XBAR3 = CLB3 OUT4 = GPIO14
|
||||
//
|
||||
XBAR_setInputPin(XBAR_INPUT3, 14);
|
||||
|
||||
//
|
||||
// Configure GPIO15 for OUTPUTXBAR4
|
||||
//
|
||||
GPIO_setPinConfig(GPIO_15_OUTPUTXBAR4);
|
||||
GPIO_setDirectionMode(15, GPIO_DIR_MODE_OUT);
|
||||
GPIO_setPadConfig(15, GPIO_PIN_TYPE_STD);
|
||||
|
||||
XBAR_setOutputMuxConfig(XBAR_OUTPUT4, XBAR_OUT_MUX13_CLB4_OUT4);
|
||||
XBAR_enableOutputMux(XBAR_OUTPUT4, XBAR_MUX13);
|
||||
|
||||
//
|
||||
// Input XBAR2 = CLB4 OUT4 = GPIO15
|
||||
//
|
||||
XBAR_setInputPin(XBAR_INPUT2, 15);
|
||||
|
||||
//
|
||||
// Configure GPIO1 for EPWM1B = CLB1 OUT2
|
||||
//
|
||||
GPIO_setPinConfig(GPIO_1_EPWM1B);
|
||||
GPIO_setDirectionMode(1, GPIO_DIR_MODE_OUT);
|
||||
GPIO_setPadConfig(1, GPIO_PIN_TYPE_STD);
|
||||
|
||||
//
|
||||
// Configure GPIO5 for EPWM3B = CLB3 OUT2
|
||||
//
|
||||
GPIO_setPinConfig(GPIO_5_EPWM3B);
|
||||
GPIO_setDirectionMode(5, GPIO_DIR_MODE_OUT);
|
||||
GPIO_setPadConfig(5, GPIO_PIN_TYPE_STD);
|
||||
|
||||
|
||||
CLB_enableSynchronization(CLB1_BASE, CLB_IN0);
|
||||
CLB_enableSynchronization(CLB1_BASE, CLB_IN1);
|
||||
CLB_enableSynchronization(CLB2_BASE, CLB_IN0);
|
||||
CLB_enableSynchronization(CLB2_BASE, CLB_IN1);
|
||||
CLB_enableSynchronization(CLB3_BASE, CLB_IN0);
|
||||
CLB_enableSynchronization(CLB3_BASE, CLB_IN1);
|
||||
CLB_enableSynchronization(CLB4_BASE, CLB_IN0);
|
||||
CLB_enableSynchronization(CLB4_BASE, CLB_IN1);
|
||||
|
||||
//
|
||||
// Uncomment to enable asynchronous GPIO inputs
|
||||
//
|
||||
//GPIO_setQualificationMode(0, GPIO_QUAL_ASYNC);
|
||||
//GPIO_setQualificationMode(24, GPIO_QUAL_ASYNC);
|
||||
//GPIO_setQualificationMode(16, GPIO_QUAL_ASYNC);
|
||||
//GPIO_setQualificationMode(14, GPIO_QUAL_ASYNC);
|
||||
//GPIO_setQualificationMode(15, GPIO_QUAL_ASYNC);
|
||||
//GPIO_setQualificationMode(1, GPIO_QUAL_ASYNC);
|
||||
//GPIO_setQualificationMode(5, GPIO_QUAL_ASYNC);
|
||||
|
||||
//
|
||||
// Enable Global Interrupt (INTM) and realtime interrupt (DBGM)
|
||||
//
|
||||
EINT;
|
||||
ERTM;
|
||||
|
||||
//
|
||||
// Enable CLB1 OUT2
|
||||
//
|
||||
CLB_setOutputMask(CLB1_BASE, 1 << 2, true);
|
||||
|
||||
//
|
||||
// Enable CLB3 OUT2
|
||||
//
|
||||
CLB_setOutputMask(CLB3_BASE, 1 << 2, true);
|
||||
|
||||
CLB_clearInterruptTag(CLB1_BASE);
|
||||
CLB_clearInterruptTag(CLB2_BASE);
|
||||
CLB_clearInterruptTag(CLB3_BASE);
|
||||
CLB_clearInterruptTag(CLB4_BASE);
|
||||
|
||||
SysCtl_delay(1000);
|
||||
GPIO_writePin(0, 1);
|
||||
|
||||
SysCtl_delay(10000);
|
||||
ESTOP0;
|
||||
|
||||
//
|
||||
// Read the clbxdelay values to see how many cycles of delay
|
||||
// was detected.
|
||||
//
|
||||
|
||||
while(1)
|
||||
{
|
||||
|
||||
asm(" NOP");
|
||||
}
|
||||
}
|
||||
|
||||
__interrupt void clb1ISR(void)
|
||||
{
|
||||
uint16_t tag = CLB_getInterruptTag(CLB1_BASE);
|
||||
if (tag == 1)
|
||||
{
|
||||
clb1delay = CLB_getRegister(CLB1_BASE, CLB_REG_CTR_C0);
|
||||
//ESTOP0;
|
||||
}
|
||||
|
||||
CLB_clearInterruptTag(CLB1_BASE);
|
||||
Interrupt_clearACKGroup(INTERRUPT_ACK_GROUP5);
|
||||
}
|
||||
|
||||
__interrupt void clb2ISR(void)
|
||||
{
|
||||
uint16_t tag = CLB_getInterruptTag(CLB2_BASE);
|
||||
if (tag == 1)
|
||||
{
|
||||
clb2delay = CLB_getRegister(CLB2_BASE, CLB_REG_CTR_C0);
|
||||
//ESTOP0;
|
||||
}
|
||||
|
||||
CLB_clearInterruptTag(CLB2_BASE);
|
||||
Interrupt_clearACKGroup(INTERRUPT_ACK_GROUP5);
|
||||
}
|
||||
|
||||
__interrupt void clb3ISR(void)
|
||||
{
|
||||
uint16_t tag = CLB_getInterruptTag(CLB3_BASE);
|
||||
if (tag == 1)
|
||||
{
|
||||
clb3delay = CLB_getRegister(CLB3_BASE, CLB_REG_CTR_C0);
|
||||
//ESTOP0;
|
||||
}
|
||||
|
||||
CLB_clearInterruptTag(CLB3_BASE);
|
||||
Interrupt_clearACKGroup(INTERRUPT_ACK_GROUP5);
|
||||
}
|
||||
|
||||
__interrupt void clb4ISR(void)
|
||||
{
|
||||
uint16_t tag = CLB_getInterruptTag(CLB4_BASE);
|
||||
if (tag == 1)
|
||||
{
|
||||
clb4delay = CLB_getRegister(CLB4_BASE, CLB_REG_CTR_C0);
|
||||
//ESTOP0;
|
||||
}
|
||||
|
||||
CLB_clearInterruptTag(CLB4_BASE);
|
||||
Interrupt_clearACKGroup(INTERRUPT_ACK_GROUP5);
|
||||
}
|
||||
@@ -0,0 +1,331 @@
|
||||
|
||||
var TILE = scripting.addModule("/utilities/clb_tool/clb_syscfg/source/TILE");
|
||||
var TILE1 = TILE.addInstance();
|
||||
var TILE2 = TILE.addInstance();
|
||||
var TILE3 = TILE.addInstance();
|
||||
var TILE4 = TILE.addInstance();
|
||||
// Name
|
||||
TILE1.$name = "TILE1";
|
||||
// Name
|
||||
TILE1.BOUNDARY.$name = "BOUNDARY0";
|
||||
// in1
|
||||
TILE1.BOUNDARY.in1 = "TILE2_BOUNDARY.out4";
|
||||
// in0
|
||||
TILE1.BOUNDARY.in0 = "squareWave";
|
||||
// in_edge0 - Edge detection on the inputs, generates 1 cycle pulse on chosen edges - for simulation purposes only
|
||||
TILE1.BOUNDARY.in_edge0 = "rising edge";
|
||||
// in_period0 - Period of the square wave
|
||||
TILE1.BOUNDARY.in_period0 = 1000;
|
||||
// in_duty0 - Duty or ON time of the square wave
|
||||
TILE1.BOUNDARY.in_duty0 = 500;
|
||||
// in_repeat_count0 - Number of periods the waveform is repeated
|
||||
TILE1.BOUNDARY.in_repeat_count0 = 1;
|
||||
// Name
|
||||
TILE1.LUT_0.$name = "LUT_0";
|
||||
// Name
|
||||
TILE1.LUT_1.$name = "LUT_1";
|
||||
// Name
|
||||
TILE1.LUT_2.$name = "LUT_2";
|
||||
// Name
|
||||
TILE1.FSM_0.$name = "FSM_0";
|
||||
// e0 - External Input 0.
|
||||
TILE1.FSM_0.e0 = "BOUNDARY.in0";
|
||||
// e1 - External Input 1.
|
||||
TILE1.FSM_0.e1 = "BOUNDARY.in1";
|
||||
// eqn_s0 - Boolean equation on the variables e1,e0,s1,s0 for the S0 output.
|
||||
TILE1.FSM_0.eqn_s0 = "e0&!e1";
|
||||
// Name
|
||||
TILE1.FSM_1.$name = "FSM_1";
|
||||
// Name
|
||||
TILE1.FSM_2.$name = "FSM_2";
|
||||
// Name
|
||||
TILE1.COUNTER_0.$name = "COUNTER_0";
|
||||
// mode0 - Enables Counting when high
|
||||
TILE1.COUNTER_0.mode0 = "FSM_0.S0";
|
||||
// mode1 - Controls counting direction. High enables count up. Low enables count down.
|
||||
TILE1.COUNTER_0.mode1 = "1";
|
||||
// Name
|
||||
TILE1.COUNTER_1.$name = "COUNTER_1";
|
||||
// Name
|
||||
TILE1.COUNTER_2.$name = "COUNTER_2";
|
||||
// Name
|
||||
TILE1.OUTLUT_0.$name = "OUTLUT_0";
|
||||
// Name
|
||||
TILE1.OUTLUT_1.$name = "OUTLUT_1";
|
||||
// Name
|
||||
TILE1.OUTLUT_2.$name = "OUTLUT_2";
|
||||
// i0 - Input 0.
|
||||
TILE1.OUTLUT_2.i0 = "BOUNDARY.in1";
|
||||
// eqn - Boolean equation on the variables i2,i1,i0 for the OUTLUT output.
|
||||
TILE1.OUTLUT_2.eqn = "i0";
|
||||
// Name
|
||||
TILE1.OUTLUT_3.$name = "OUTLUT_3";
|
||||
// Name
|
||||
TILE1.OUTLUT_4.$name = "OUTLUT_4";
|
||||
// i0 - Input 0.
|
||||
TILE1.OUTLUT_4.i0 = "BOUNDARY.in0";
|
||||
// eqn - Boolean equation on the variables i2,i1,i0 for the OUTLUT output.
|
||||
TILE1.OUTLUT_4.eqn = "i0";
|
||||
// Name
|
||||
TILE1.OUTLUT_5.$name = "OUTLUT_5";
|
||||
// Name
|
||||
TILE1.OUTLUT_6.$name = "OUTLUT_6";
|
||||
// Name
|
||||
TILE1.OUTLUT_7.$name = "OUTLUT_7";
|
||||
// Name
|
||||
TILE1.HLC.$name = "HLC_0";
|
||||
// Event 0 (e0) - Event 0
|
||||
TILE1.HLC.e0 = "BOUNDARY.in1";
|
||||
// Name
|
||||
TILE1.HLC.program0.$name = "HLCP_0";
|
||||
// instruct0
|
||||
TILE1.HLC.program0.instruct0 = "INTR 1";
|
||||
// Name
|
||||
TILE1.HLC.program1.$name = "HLCP_1";
|
||||
// Name
|
||||
TILE1.HLC.program2.$name = "HLCP_2";
|
||||
// Name
|
||||
TILE1.HLC.program3.$name = "HLCP_3";
|
||||
var clb_run_dynamic_template_clb_h = scripting.addModule("/utilities/clb_tool/clb_syscfg/source/clb_run_dynamic_template_clb_h.js");
|
||||
var clb_run_dynamic_template_clb_c = scripting.addModule("/utilities/clb_tool/clb_syscfg/source/clb_run_dynamic_template_clb_c.js");
|
||||
var clb_run_dynamic_template_clb_sim = scripting.addModule("/utilities/clb_tool/clb_syscfg/source/clb_run_dynamic_template_clb_sim.js");
|
||||
var clb_run_dynamic_template_clb_dot = scripting.addModule("/utilities/clb_tool/clb_syscfg/source/clb_run_dynamic_template_clb_dot.js");
|
||||
// Name
|
||||
TILE2.$name = "TILE2";
|
||||
// Name
|
||||
TILE2.BOUNDARY.$name = "BOUNDARY1";
|
||||
// in1
|
||||
TILE2.BOUNDARY.in1 = "TILE1_BOUNDARY.out4";
|
||||
// in0
|
||||
TILE2.BOUNDARY.in0 = "squareWave";
|
||||
// in_edge0 - Edge detection on the inputs, generates 1 cycle pulse on chosen edges - for simulation purposes only
|
||||
TILE2.BOUNDARY.in_edge0 = "rising edge";
|
||||
// in_period0 - Period of the square wave
|
||||
TILE2.BOUNDARY.in_period0 = 1000;
|
||||
// in_duty0 - Duty or ON time of the square wave
|
||||
TILE2.BOUNDARY.in_duty0 = 500;
|
||||
// in_repeat_count0 - Number of periods the waveform is repeated
|
||||
TILE2.BOUNDARY.in_repeat_count0 = 1;
|
||||
// Name
|
||||
TILE2.LUT_0.$name = "LUT_3";
|
||||
// Name
|
||||
TILE2.LUT_1.$name = "LUT_4";
|
||||
// Name
|
||||
TILE2.LUT_2.$name = "LUT_5";
|
||||
// Name
|
||||
TILE2.FSM_0.$name = "FSM_3";
|
||||
// e0 - External Input 0.
|
||||
TILE2.FSM_0.e0 = "BOUNDARY.in0";
|
||||
// e1 - External Input 1.
|
||||
TILE2.FSM_0.e1 = "BOUNDARY.in1";
|
||||
// eqn_s0 - Boolean equation on the variables e1,e0,s1,s0 for the S0 output.
|
||||
TILE2.FSM_0.eqn_s0 = "e0&!e1";
|
||||
// Name
|
||||
TILE2.FSM_1.$name = "FSM_4";
|
||||
// Name
|
||||
TILE2.FSM_2.$name = "FSM_5";
|
||||
// Name
|
||||
TILE2.COUNTER_0.$name = "COUNTER_3";
|
||||
// mode0 - Enables Counting when high
|
||||
TILE2.COUNTER_0.mode0 = "FSM_0.S0";
|
||||
// mode1 - Controls counting direction. High enables count up. Low enables count down.
|
||||
TILE2.COUNTER_0.mode1 = "1";
|
||||
// Name
|
||||
TILE2.COUNTER_1.$name = "COUNTER_4";
|
||||
// Name
|
||||
TILE2.COUNTER_2.$name = "COUNTER_5";
|
||||
// Name
|
||||
TILE2.OUTLUT_0.$name = "OUTLUT_8";
|
||||
// Name
|
||||
TILE2.OUTLUT_1.$name = "OUTLUT_9";
|
||||
// Name
|
||||
TILE2.OUTLUT_2.$name = "OUTLUT_10";
|
||||
// Name
|
||||
TILE2.OUTLUT_3.$name = "OUTLUT_11";
|
||||
// Name
|
||||
TILE2.OUTLUT_4.$name = "OUTLUT_12";
|
||||
// i0 - Input 0.
|
||||
TILE2.OUTLUT_4.i0 = "BOUNDARY.in0";
|
||||
// eqn - Boolean equation on the variables i2,i1,i0 for the OUTLUT output.
|
||||
TILE2.OUTLUT_4.eqn = "i0";
|
||||
// Name
|
||||
TILE2.OUTLUT_5.$name = "OUTLUT_13";
|
||||
// Name
|
||||
TILE2.OUTLUT_6.$name = "OUTLUT_14";
|
||||
// Name
|
||||
TILE2.OUTLUT_7.$name = "OUTLUT_15";
|
||||
// Name
|
||||
TILE2.HLC.$name = "HLC_1";
|
||||
// Event 0 (e0) - Event 0
|
||||
TILE2.HLC.e0 = "BOUNDARY.in1";
|
||||
// Name
|
||||
TILE2.HLC.program0.$name = "HLCP_4";
|
||||
// instruct0
|
||||
TILE2.HLC.program0.instruct0 = "INTR 1";
|
||||
// Name
|
||||
TILE2.HLC.program1.$name = "HLCP_5";
|
||||
// Name
|
||||
TILE2.HLC.program2.$name = "HLCP_6";
|
||||
// Name
|
||||
TILE2.HLC.program3.$name = "HLCP_7";
|
||||
// Name
|
||||
TILE3.$name = "TILE3";
|
||||
// Name
|
||||
TILE3.BOUNDARY.$name = "BOUNDARY2";
|
||||
// in1
|
||||
TILE3.BOUNDARY.in1 = "TILE4_BOUNDARY.out4";
|
||||
// in0
|
||||
TILE3.BOUNDARY.in0 = "squareWave";
|
||||
// in_edge0 - Edge detection on the inputs, generates 1 cycle pulse on chosen edges - for simulation purposes only
|
||||
TILE3.BOUNDARY.in_edge0 = "rising edge";
|
||||
// in_period0 - Period of the square wave
|
||||
TILE3.BOUNDARY.in_period0 = 1000;
|
||||
// in_duty0 - Duty or ON time of the square wave
|
||||
TILE3.BOUNDARY.in_duty0 = 500;
|
||||
// in_repeat_count0 - Number of periods the waveform is repeated
|
||||
TILE3.BOUNDARY.in_repeat_count0 = 1;
|
||||
// Name
|
||||
TILE3.LUT_0.$name = "LUT_6";
|
||||
// Name
|
||||
TILE3.LUT_1.$name = "LUT_7";
|
||||
// Name
|
||||
TILE3.LUT_2.$name = "LUT_8";
|
||||
// Name
|
||||
TILE3.FSM_0.$name = "FSM_6";
|
||||
// e0 - External Input 0.
|
||||
TILE3.FSM_0.e0 = "BOUNDARY.in0";
|
||||
// e1 - External Input 1.
|
||||
TILE3.FSM_0.e1 = "BOUNDARY.in1";
|
||||
// eqn_s0 - Boolean equation on the variables e1,e0,s1,s0 for the S0 output.
|
||||
TILE3.FSM_0.eqn_s0 = "e0&!e1";
|
||||
// Name
|
||||
TILE3.FSM_1.$name = "FSM_7";
|
||||
// Name
|
||||
TILE3.FSM_2.$name = "FSM_8";
|
||||
// Name
|
||||
TILE3.COUNTER_0.$name = "COUNTER_6";
|
||||
// mode0 - Enables Counting when high
|
||||
TILE3.COUNTER_0.mode0 = "FSM_0.S0";
|
||||
// mode1 - Controls counting direction. High enables count up. Low enables count down.
|
||||
TILE3.COUNTER_0.mode1 = "1";
|
||||
// Name
|
||||
TILE3.COUNTER_1.$name = "COUNTER_7";
|
||||
// Name
|
||||
TILE3.COUNTER_2.$name = "COUNTER_8";
|
||||
// Name
|
||||
TILE3.OUTLUT_0.$name = "OUTLUT_16";
|
||||
// Name
|
||||
TILE3.OUTLUT_1.$name = "OUTLUT_17";
|
||||
// Name
|
||||
TILE3.OUTLUT_2.$name = "OUTLUT_18";
|
||||
// i0 - Input 0.
|
||||
TILE3.OUTLUT_2.i0 = "BOUNDARY.in1";
|
||||
// eqn - Boolean equation on the variables i2,i1,i0 for the OUTLUT output.
|
||||
TILE3.OUTLUT_2.eqn = "i0";
|
||||
// Name
|
||||
TILE3.OUTLUT_3.$name = "OUTLUT_19";
|
||||
// Name
|
||||
TILE3.OUTLUT_4.$name = "OUTLUT_20";
|
||||
// i0 - Input 0.
|
||||
TILE3.OUTLUT_4.i0 = "BOUNDARY.in0";
|
||||
// eqn - Boolean equation on the variables i2,i1,i0 for the OUTLUT output.
|
||||
TILE3.OUTLUT_4.eqn = "i0";
|
||||
// Name
|
||||
TILE3.OUTLUT_5.$name = "OUTLUT_21";
|
||||
// Name
|
||||
TILE3.OUTLUT_6.$name = "OUTLUT_22";
|
||||
// Name
|
||||
TILE3.OUTLUT_7.$name = "OUTLUT_23";
|
||||
// Name
|
||||
TILE3.HLC.$name = "HLC_2";
|
||||
// Event 0 (e0) - Event 0
|
||||
TILE3.HLC.e0 = "BOUNDARY.in1";
|
||||
// Name
|
||||
TILE3.HLC.program0.$name = "HLCP_8";
|
||||
// instruct0
|
||||
TILE3.HLC.program0.instruct0 = "INTR 1";
|
||||
// Name
|
||||
TILE3.HLC.program1.$name = "HLCP_9";
|
||||
// Name
|
||||
TILE3.HLC.program2.$name = "HLCP_10";
|
||||
// Name
|
||||
TILE3.HLC.program3.$name = "HLCP_11";
|
||||
// Name
|
||||
TILE4.$name = "TILE4";
|
||||
// Name
|
||||
TILE4.BOUNDARY.$name = "BOUNDARY3";
|
||||
// in1
|
||||
TILE4.BOUNDARY.in1 = "TILE3_BOUNDARY.out4";
|
||||
// in0
|
||||
TILE4.BOUNDARY.in0 = "squareWave";
|
||||
// in_edge0 - Edge detection on the inputs, generates 1 cycle pulse on chosen edges - for simulation purposes only
|
||||
TILE4.BOUNDARY.in_edge0 = "rising edge";
|
||||
// in_period0 - Period of the square wave
|
||||
TILE4.BOUNDARY.in_period0 = 1000;
|
||||
// in_duty0 - Duty or ON time of the square wave
|
||||
TILE4.BOUNDARY.in_duty0 = 500;
|
||||
// in_repeat_count0 - Number of periods the waveform is repeated
|
||||
TILE4.BOUNDARY.in_repeat_count0 = 1;
|
||||
// Name
|
||||
TILE4.LUT_0.$name = "LUT_9";
|
||||
// Name
|
||||
TILE4.LUT_1.$name = "LUT_10";
|
||||
// Name
|
||||
TILE4.LUT_2.$name = "LUT_11";
|
||||
// Name
|
||||
TILE4.FSM_0.$name = "FSM_9";
|
||||
// e0 - External Input 0.
|
||||
TILE4.FSM_0.e0 = "BOUNDARY.in0";
|
||||
// e1 - External Input 1.
|
||||
TILE4.FSM_0.e1 = "BOUNDARY.in1";
|
||||
// eqn_s0 - Boolean equation on the variables e1,e0,s1,s0 for the S0 output.
|
||||
TILE4.FSM_0.eqn_s0 = "e0&!e1";
|
||||
// Name
|
||||
TILE4.FSM_1.$name = "FSM_10";
|
||||
// Name
|
||||
TILE4.FSM_2.$name = "FSM_11";
|
||||
// Name
|
||||
TILE4.COUNTER_0.$name = "COUNTER_9";
|
||||
// mode0 - Enables Counting when high
|
||||
TILE4.COUNTER_0.mode0 = "FSM_0.S0";
|
||||
// mode1 - Controls counting direction. High enables count up. Low enables count down.
|
||||
TILE4.COUNTER_0.mode1 = "1";
|
||||
// Name
|
||||
TILE4.COUNTER_1.$name = "COUNTER_10";
|
||||
// Name
|
||||
TILE4.COUNTER_2.$name = "COUNTER_11";
|
||||
// Name
|
||||
TILE4.OUTLUT_0.$name = "OUTLUT_24";
|
||||
// Name
|
||||
TILE4.OUTLUT_1.$name = "OUTLUT_25";
|
||||
// Name
|
||||
TILE4.OUTLUT_2.$name = "OUTLUT_26";
|
||||
// Name
|
||||
TILE4.OUTLUT_3.$name = "OUTLUT_27";
|
||||
// Name
|
||||
TILE4.OUTLUT_4.$name = "OUTLUT_28";
|
||||
// i0 - Input 0.
|
||||
TILE4.OUTLUT_4.i0 = "BOUNDARY.in0";
|
||||
// eqn - Boolean equation on the variables i2,i1,i0 for the OUTLUT output.
|
||||
TILE4.OUTLUT_4.eqn = "i0";
|
||||
// Name
|
||||
TILE4.OUTLUT_5.$name = "OUTLUT_29";
|
||||
// Name
|
||||
TILE4.OUTLUT_6.$name = "OUTLUT_30";
|
||||
// Name
|
||||
TILE4.OUTLUT_7.$name = "OUTLUT_31";
|
||||
// Name
|
||||
TILE4.HLC.$name = "HLC_3";
|
||||
// Event 0 (e0) - Event 0
|
||||
TILE4.HLC.e0 = "BOUNDARY.in1";
|
||||
// Name
|
||||
TILE4.HLC.program0.$name = "HLCP_12";
|
||||
// instruct0
|
||||
TILE4.HLC.program0.instruct0 = "INTR 1";
|
||||
// Name
|
||||
TILE4.HLC.program1.$name = "HLCP_13";
|
||||
// Name
|
||||
TILE4.HLC.program2.$name = "HLCP_14";
|
||||
// Name
|
||||
TILE4.HLC.program3.$name = "HLCP_15";
|
||||
|
||||
@@ -0,0 +1,302 @@
|
||||
//############################################################################
|
||||
//
|
||||
// FILE: clb_ex17_one_shot_pwm.c
|
||||
//
|
||||
// TITLE: CLB based One-shot PWM
|
||||
//
|
||||
//! \addtogroup driver_example_list
|
||||
//! <h1>CLB based One-shot PWM</h1>
|
||||
//!
|
||||
//! For the detailed description of this example, please refer to :
|
||||
//! C2000Ware_PATH\utilities\clb_tool\clb_syscfg\doc\CLB Tool Users Guide.pdf
|
||||
//
|
||||
//
|
||||
//############################################################################
|
||||
//
|
||||
//
|
||||
// $Copyright:
|
||||
// Copyright (C) 2013-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.
|
||||
// $
|
||||
//############################################################################
|
||||
|
||||
|
||||
#include "driverlib.h"
|
||||
#include "device.h"
|
||||
#include "clb_config.h"
|
||||
#include "clb.h"
|
||||
|
||||
//
|
||||
// Defines
|
||||
//
|
||||
#define EXAMPLE_MODE 0U // '0' for software trigger mode and
|
||||
// '1' for external trigger mode
|
||||
#define TB_CLK DEVICE_SYSCLK_FREQ / 2 // Time base clock is SYSCLK/2
|
||||
#define PWM_CLK 1000000U // PWM frequency as 1 Mhz
|
||||
#define PRD_VAL (TB_CLK / (PWM_CLK)) // Calculate value period value
|
||||
// for up count mode
|
||||
|
||||
//
|
||||
// Function Prototypes
|
||||
//
|
||||
void initEPWM(void);
|
||||
__interrupt void clb1ISR(void);
|
||||
|
||||
//
|
||||
// Globals
|
||||
//
|
||||
uint16_t SOFT_TRIGGER = 0; // Set this from '0' to '1' (rising edge)
|
||||
// to provide software trigger for one-shot
|
||||
// PWM when "EXAMPLE_MODE = 0"
|
||||
volatile uint16_t dutyValue= 20; // Variable output pulse width
|
||||
|
||||
void main(void)
|
||||
{
|
||||
Device_init();
|
||||
Device_initGPIO();
|
||||
|
||||
Interrupt_initModule();
|
||||
Interrupt_initVectorTable();
|
||||
|
||||
Interrupt_register(INT_CLB1, &clb1ISR);
|
||||
Interrupt_enable(INT_CLB1);
|
||||
|
||||
CLB_enableCLB(CLB1_BASE);
|
||||
initTILE1(CLB1_BASE);
|
||||
|
||||
//
|
||||
// Select Global input instead of local input for all CLB IN
|
||||
//
|
||||
CLB_configLocalInputMux(CLB1_BASE, CLB_IN0, CLB_LOCAL_IN_MUX_GLOBAL_IN);
|
||||
CLB_configLocalInputMux(CLB1_BASE, CLB_IN1, CLB_LOCAL_IN_MUX_GLOBAL_IN);
|
||||
CLB_configLocalInputMux(CLB1_BASE, CLB_IN2, CLB_LOCAL_IN_MUX_GLOBAL_IN);
|
||||
CLB_configLocalInputMux(CLB1_BASE, CLB_IN3, CLB_LOCAL_IN_MUX_GLOBAL_IN);
|
||||
CLB_configLocalInputMux(CLB1_BASE, CLB_IN4, CLB_LOCAL_IN_MUX_GLOBAL_IN);
|
||||
CLB_configLocalInputMux(CLB1_BASE, CLB_IN5, CLB_LOCAL_IN_MUX_GLOBAL_IN);
|
||||
CLB_configLocalInputMux(CLB1_BASE, CLB_IN6, CLB_LOCAL_IN_MUX_GLOBAL_IN);
|
||||
CLB_configLocalInputMux(CLB1_BASE, CLB_IN7, CLB_LOCAL_IN_MUX_GLOBAL_IN);
|
||||
|
||||
#if EXAMPLE_MODE == 1
|
||||
//
|
||||
// Select AUXSIG0 for CLB1, IN0
|
||||
//
|
||||
CLB_configGlobalInputMux(CLB1_BASE, CLB_IN0, CLB_GLOBAL_IN_MUX_CLB_AUXSIG0);
|
||||
#else
|
||||
CLB_configGlobalInputMux(CLB1_BASE, CLB_IN0, CLB_GLOBAL_IN_MUX_EPWM1A);
|
||||
#endif
|
||||
|
||||
CLB_configGlobalInputMux(CLB1_BASE, CLB_IN1, CLB_GLOBAL_IN_MUX_EPWM1_CTRDIR);
|
||||
CLB_configGlobalInputMux(CLB1_BASE, CLB_IN2, CLB_GLOBAL_IN_MUX_EPWM1_CTRDIR);
|
||||
CLB_configGlobalInputMux(CLB1_BASE, CLB_IN3, CLB_GLOBAL_IN_MUX_EPWM1_CTRDIR);
|
||||
CLB_configGlobalInputMux(CLB1_BASE, CLB_IN4, CLB_GLOBAL_IN_MUX_EPWM1_CTRDIR);
|
||||
CLB_configGlobalInputMux(CLB1_BASE, CLB_IN5, CLB_GLOBAL_IN_MUX_EPWM1_CTRDIR);
|
||||
CLB_configGlobalInputMux(CLB1_BASE, CLB_IN6, CLB_GLOBAL_IN_MUX_EPWM1_CTRDIR);
|
||||
CLB_configGlobalInputMux(CLB1_BASE, CLB_IN7, CLB_GLOBAL_IN_MUX_EPWM1_CTRDIR);
|
||||
|
||||
#if EXAMPLE_MODE == 1
|
||||
//
|
||||
// Inputs set for external trigger
|
||||
//
|
||||
CLB_configGPInputMux(CLB1_BASE, CLB_IN0, CLB_GP_IN_MUX_EXTERNAL);
|
||||
#else
|
||||
//
|
||||
// Inputs set to GP register for software based trigger
|
||||
//
|
||||
CLB_configGPInputMux(CLB1_BASE, CLB_IN0, CLB_GP_IN_MUX_GP_REG);
|
||||
#endif
|
||||
|
||||
//
|
||||
// Unused inputs to GP register
|
||||
//
|
||||
CLB_configGPInputMux(CLB1_BASE, CLB_IN1, CLB_GP_IN_MUX_GP_REG);
|
||||
CLB_configGPInputMux(CLB1_BASE, CLB_IN2, CLB_GP_IN_MUX_GP_REG);
|
||||
CLB_configGPInputMux(CLB1_BASE, CLB_IN3, CLB_GP_IN_MUX_GP_REG);
|
||||
CLB_configGPInputMux(CLB1_BASE, CLB_IN4, CLB_GP_IN_MUX_GP_REG);
|
||||
CLB_configGPInputMux(CLB1_BASE, CLB_IN5, CLB_GP_IN_MUX_GP_REG);
|
||||
CLB_configGPInputMux(CLB1_BASE, CLB_IN6, CLB_GP_IN_MUX_GP_REG);
|
||||
CLB_configGPInputMux(CLB1_BASE, CLB_IN7, CLB_GP_IN_MUX_GP_REG);
|
||||
|
||||
//
|
||||
// Configure GPIO2 as OUTPUTXBAR1 to generate the one-shot
|
||||
// pulse output
|
||||
//
|
||||
GPIO_setPinConfig(GPIO_2_OUTPUTXBAR1);
|
||||
GPIO_setDirectionMode(2, GPIO_DIR_MODE_OUT);
|
||||
GPIO_setPadConfig(2, GPIO_PIN_TYPE_STD);
|
||||
|
||||
//
|
||||
// Configure Input-XBAR INPUT1 as GPIO0 to route the
|
||||
// EPWM1 output as input trigger for CLB
|
||||
//
|
||||
XBAR_setInputPin(XBAR_INPUT1, 0);
|
||||
|
||||
//
|
||||
// Configure CLB-XBAR AUXSIG0 as INPUT1
|
||||
//
|
||||
XBAR_setCLBMuxConfig(XBAR_AUXSIG0, XBAR_CLB_MUX01_INPUTXBAR1);
|
||||
XBAR_enableCLBMux(XBAR_AUXSIG0, XBAR_MUX01);
|
||||
|
||||
//
|
||||
// Configure OUTPUT-XBAR OUTPUT1 as CLB1_OUT4
|
||||
//
|
||||
XBAR_setOutputMuxConfig(XBAR_OUTPUT1, XBAR_OUT_MUX01_CLB1_OUT4);
|
||||
XBAR_enableOutputMux(XBAR_OUTPUT1, XBAR_MUX01);
|
||||
|
||||
#if EXAMPLE_MODE == 1
|
||||
//
|
||||
// Enable external trigger simulating signal using EPWM module
|
||||
//
|
||||
initEPWM();
|
||||
#endif
|
||||
|
||||
//
|
||||
// Enable Global Interrupt (INTM) and realtime interrupt (DBGM)
|
||||
//
|
||||
EINT;
|
||||
ERTM;
|
||||
|
||||
CLB_clearInterruptTag(CLB1_BASE);
|
||||
|
||||
|
||||
while(1)
|
||||
{
|
||||
|
||||
#if EXAMPLE_MODE == 0
|
||||
//
|
||||
// In case of software trigger mode, make sure to set
|
||||
// SOFT_TRIGGER first as '0' and then to '1' to simulate
|
||||
// the rising edge software trigger
|
||||
//
|
||||
CLB_setGPREG(CLB1_BASE, SOFT_TRIGGER);
|
||||
#else
|
||||
asm(" NOP");
|
||||
#endif
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// initEPWM - Function to configure ePWM1 to generate a 1 MHz Trigger signal
|
||||
//
|
||||
void
|
||||
initEPWM(void)
|
||||
{
|
||||
//
|
||||
// Initialize GPIO0 for EPWM1A
|
||||
//
|
||||
GPIO_setPinConfig(GPIO_0_EPWM1A);
|
||||
GPIO_setPadConfig(0, GPIO_PIN_TYPE_STD);
|
||||
|
||||
//
|
||||
// Disable the ePWM time base clock before configuring the module
|
||||
//
|
||||
SysCtl_disablePeripheral(SYSCTL_PERIPH_CLK_TBCLKSYNC);
|
||||
|
||||
//
|
||||
// Set phase shift to 0 and clear the time base counter
|
||||
//
|
||||
EPWM_setPhaseShift(EPWM1_BASE, 0);
|
||||
EPWM_setTimeBaseCounter(EPWM1_BASE, 0);
|
||||
|
||||
//
|
||||
// Disable the shadow load; the load will be immediate instead
|
||||
//
|
||||
EPWM_disableCounterCompareShadowLoadMode(EPWM1_BASE,
|
||||
EPWM_COUNTER_COMPARE_A);
|
||||
|
||||
//
|
||||
// Set the compare A value for 10% duty to generate a short trigger pulse
|
||||
// as the CLB based system is designed such as to respond to a rising edge
|
||||
//
|
||||
EPWM_setCounterCompareValue(EPWM1_BASE, EPWM_COUNTER_COMPARE_A, PRD_VAL / 10);
|
||||
|
||||
//
|
||||
// Set action qualifier behavior on compare A events
|
||||
// - EPWM1A --> 1 when CTR = ZERO
|
||||
// - EPWM1A --> 0 when CTR = CMPA and increasing
|
||||
//
|
||||
EPWM_setActionQualifierAction(EPWM1_BASE, EPWM_AQ_OUTPUT_A,
|
||||
EPWM_AQ_OUTPUT_LOW,
|
||||
EPWM_AQ_OUTPUT_ON_TIMEBASE_UP_CMPA);
|
||||
EPWM_setActionQualifierAction(EPWM1_BASE, EPWM_AQ_OUTPUT_A,
|
||||
EPWM_AQ_OUTPUT_HIGH,
|
||||
EPWM_AQ_OUTPUT_ON_TIMEBASE_ZERO);
|
||||
|
||||
//
|
||||
// Set the time base clock prescaler to /1
|
||||
//
|
||||
EPWM_setClockPrescaler(EPWM1_BASE, EPWM_CLOCK_DIVIDER_1,
|
||||
EPWM_HSCLOCK_DIVIDER_1);
|
||||
|
||||
//
|
||||
// Set the period value; don't shadow the register
|
||||
//
|
||||
EPWM_setPeriodLoadMode(EPWM1_BASE, EPWM_PERIOD_DIRECT_LOAD);
|
||||
EPWM_setTimeBasePeriod(EPWM1_BASE, PRD_VAL - 1);
|
||||
|
||||
//
|
||||
// Put the time base counter into up count mode
|
||||
//
|
||||
EPWM_setTimeBaseCounterMode(EPWM1_BASE, EPWM_COUNTER_MODE_UP);
|
||||
|
||||
//
|
||||
// Sync the ePWM time base clock
|
||||
//
|
||||
SysCtl_enablePeripheral(SYSCTL_PERIPH_CLK_TBCLKSYNC);
|
||||
}
|
||||
|
||||
//
|
||||
// CLB ISR generated after every 3rd input trigger event
|
||||
//
|
||||
__interrupt void clb1ISR(void)
|
||||
{
|
||||
//
|
||||
// Increase pulse width by 50 ns till it reaches max
|
||||
// Range of pulse output : 0.2us - 0.8us
|
||||
//
|
||||
dutyValue += 5;
|
||||
if(dutyValue > 80)
|
||||
{
|
||||
dutyValue = 20;
|
||||
}
|
||||
|
||||
//
|
||||
// Load new duty cycle value in HLC Registers
|
||||
//
|
||||
CLB_writeInterface(CLB1_BASE, CLB_ADDR_HLC_R0, dutyValue);
|
||||
|
||||
//
|
||||
// Clear the interrupt flag and acknowledge
|
||||
//
|
||||
CLB_clearInterruptTag(CLB1_BASE);
|
||||
Interrupt_clearACKGroup(INTERRUPT_ACK_GROUP5);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,131 @@
|
||||
|
||||
var TILE = scripting.addModule("/utilities/clb_tool/clb_syscfg/source/TILE");
|
||||
var TILE1 = TILE.addInstance();
|
||||
// clock_period - Period of the clock (in Nano Seconds) used for simulation in System C
|
||||
TILE.clock_period = 10;
|
||||
// sim_duration - Duration of the simulation (in Nano Seconds)
|
||||
TILE.sim_duration = 100000;
|
||||
// Name
|
||||
TILE1.$name = "TILE1";
|
||||
// Name
|
||||
TILE1.BOUNDARY.$name = "BOUNDARY0";
|
||||
// in0
|
||||
TILE1.BOUNDARY.in0 = "squareWave";
|
||||
// in_duty1 - Duty or ON time of the square wave
|
||||
TILE1.BOUNDARY.in_duty1 = 50;
|
||||
// in_period1 - Period of the square wave
|
||||
TILE1.BOUNDARY.in_period1 = 100;
|
||||
// in_repeat_count3 - Number of periods the waveform is repeated
|
||||
TILE1.BOUNDARY.in_repeat_count3 = 1;
|
||||
// in_repeat_count1 - Number of periods the waveform is repeated
|
||||
TILE1.BOUNDARY.in_repeat_count1 = 1000;
|
||||
// in_period0 - Period of the square wave
|
||||
TILE1.BOUNDARY.in_period0 = 100;
|
||||
// in_repeat_count0 - Number of periods the waveform is repeated
|
||||
TILE1.BOUNDARY.in_repeat_count0 = 1000;
|
||||
// Name
|
||||
TILE1.LUT_0.$name = "LUT_0";
|
||||
// i0 - Input 0.
|
||||
TILE1.LUT_0.i0 = "FSM_0.S0";
|
||||
// eqn - Boolean equation on the variables i3,i2,i1,i0 for the LUT output.
|
||||
TILE1.LUT_0.eqn = "~i0";
|
||||
// Name
|
||||
TILE1.LUT_1.$name = "LUT_1";
|
||||
// Name
|
||||
TILE1.LUT_2.$name = "LUT_2";
|
||||
// Name
|
||||
TILE1.FSM_0.$name = "FSM_0";
|
||||
// e1 - External Input 1.
|
||||
TILE1.FSM_0.e1 = "COUNTER_0.count_match2";
|
||||
// eqn_s0 - Boolean equation on the variables e1,e0,s1,s0 for the S0 output.
|
||||
TILE1.FSM_0.eqn_s0 = "(~e0 & (~e1) & s0) | e0";
|
||||
// e0 - External Input 0.
|
||||
TILE1.FSM_0.e0 = "COUNTER_2.count_match1";
|
||||
// Name
|
||||
TILE1.FSM_1.$name = "FSM_1";
|
||||
// Name
|
||||
TILE1.FSM_2.$name = "FSM_2";
|
||||
// Name
|
||||
TILE1.COUNTER_0.$name = "COUNTER_0";
|
||||
// mode1 - Controls counting direction. High enables count up. Low enables count down.
|
||||
TILE1.COUNTER_0.mode1 = "1";
|
||||
// match1_val - Sets the value of the Match reference 1 register.
|
||||
TILE1.COUNTER_0.match1_val = "";
|
||||
// mode0 - Enables Counting when high
|
||||
TILE1.COUNTER_0.mode0 = "FSM_0.S0";
|
||||
// reset - Reset the counter to 0 on next clock cycle (triggers low to high)
|
||||
TILE1.COUNTER_0.reset = "COUNTER_0.count_match2";
|
||||
// match2_val - Sets the value of the Match reference 2 register.
|
||||
TILE1.COUNTER_0.match2_val = "20";
|
||||
// Name
|
||||
TILE1.COUNTER_1.$name = "COUNTER_1";
|
||||
// mode1 - Controls counting direction. High enables count up. Low enables count down.
|
||||
TILE1.COUNTER_1.mode1 = "1";
|
||||
// What action should be taken on an event trigger?
|
||||
TILE1.COUNTER_1.action = "Add";
|
||||
// event_load_val - Sets the value of the event load value register.
|
||||
TILE1.COUNTER_1.event_load_val = "1";
|
||||
// reset - Reset the counter to 0 on next clock cycle (triggers low to high)
|
||||
TILE1.COUNTER_1.reset = "COUNTER_1.count_match1";
|
||||
// event - Trigger actions in the counter.
|
||||
TILE1.COUNTER_1.event = "BOUNDARY.in0";
|
||||
// match1_val - Sets the value of the Match reference 1 register.
|
||||
TILE1.COUNTER_1.match1_val = "3";
|
||||
// Name
|
||||
TILE1.COUNTER_2.$name = "COUNTER_2";
|
||||
// event - Trigger actions in the counter.
|
||||
TILE1.COUNTER_2.event = "BOUNDARY.in0";
|
||||
// What action should be taken on an event trigger?
|
||||
TILE1.COUNTER_2.action = "Load";
|
||||
// event_load_val - Sets the value of the event load value register.
|
||||
TILE1.COUNTER_2.event_load_val = "1";
|
||||
// match1_val - Sets the value of the Match reference 1 register.
|
||||
TILE1.COUNTER_2.match1_val = "1";
|
||||
// reset - Reset the counter to 0 on next clock cycle (triggers low to high)
|
||||
TILE1.COUNTER_2.reset = "COUNTER_2.count_match1";
|
||||
// Name
|
||||
TILE1.OUTLUT_0.$name = "OUTLUT_0";
|
||||
// Name
|
||||
TILE1.OUTLUT_1.$name = "OUTLUT_1";
|
||||
// Name
|
||||
TILE1.OUTLUT_2.$name = "OUTLUT_2";
|
||||
// Name
|
||||
TILE1.OUTLUT_3.$name = "OUTLUT_3";
|
||||
// Name
|
||||
TILE1.OUTLUT_4.$name = "OUTLUT_4";
|
||||
// i0 - Input 0.
|
||||
TILE1.OUTLUT_4.i0 = "FSM_0.S0";
|
||||
// i1 - Input 1.
|
||||
TILE1.OUTLUT_4.i1 = "COUNTER_0.count_match2";
|
||||
// eqn - Boolean equation on the variables i2,i1,i0 for the OUTLUT output.
|
||||
TILE1.OUTLUT_4.eqn = "i0 & (~i1)";
|
||||
// Name
|
||||
TILE1.OUTLUT_5.$name = "OUTLUT_5";
|
||||
// Name
|
||||
TILE1.OUTLUT_6.$name = "OUTLUT_6";
|
||||
// Name
|
||||
TILE1.OUTLUT_7.$name = "OUTLUT_7";
|
||||
// Name
|
||||
TILE1.HLC.$name = "HLC_0";
|
||||
// Event 0 (e0) - Event 0
|
||||
TILE1.HLC.e0 = "BOUNDARY.in0";
|
||||
// Event 1 (e1) - Event 1
|
||||
TILE1.HLC.e1 = "COUNTER_1.count_match1";
|
||||
// R0_init - Initial value for register R0
|
||||
TILE1.HLC.R0_init = "20";
|
||||
// Name
|
||||
TILE1.HLC.program0.$name = "HLCP_0";
|
||||
// instruct0
|
||||
TILE1.HLC.program0.instruct0 = "MOV_T2 R0, C0";
|
||||
// Name
|
||||
TILE1.HLC.program1.$name = "HLCP_1";
|
||||
// instruct0
|
||||
TILE1.HLC.program1.instruct0 = "INTR 1";
|
||||
// Name
|
||||
TILE1.HLC.program2.$name = "HLCP_2";
|
||||
// Name
|
||||
TILE1.HLC.program3.$name = "HLCP_3";
|
||||
var clb_run_dynamic_template_clb_h = scripting.addModule("/utilities/clb_tool/clb_syscfg/source/clb_run_dynamic_template_clb_h.js");
|
||||
var clb_run_dynamic_template_clb_c = scripting.addModule("/utilities/clb_tool/clb_syscfg/source/clb_run_dynamic_template_clb_c.js");
|
||||
var clb_run_dynamic_template_clb_sim = scripting.addModule("/utilities/clb_tool/clb_syscfg/source/clb_run_dynamic_template_clb_sim.js");
|
||||
var clb_run_dynamic_template_clb_dot = scripting.addModule("/utilities/clb_tool/clb_syscfg/source/clb_run_dynamic_template_clb_dot.js");
|
||||
@@ -0,0 +1,208 @@
|
||||
//#############################################################################
|
||||
//
|
||||
// FILE: clb_ex1_combinatorial_logic.c
|
||||
//
|
||||
// TITLE: CLB Combinational Logic.
|
||||
//
|
||||
//! \addtogroup driver_example_list
|
||||
//! <h1>CLB Combinational Logic</h1>
|
||||
//!
|
||||
//! For the detailed description of this example, please refer to:
|
||||
//! C2000Ware_PATH\utilities\clb_tool\clb_syscfg\doc\CLB Tool Users Guide.pdf
|
||||
//!
|
||||
//
|
||||
//
|
||||
//#############################################################################
|
||||
//
|
||||
//
|
||||
// $Copyright:
|
||||
// Copyright (C) 2013-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.
|
||||
// $
|
||||
//#############################################################################
|
||||
|
||||
|
||||
#include "driverlib.h"
|
||||
#include "device.h"
|
||||
#include "clb_config.h"
|
||||
#include "clb.h"
|
||||
|
||||
|
||||
#define EPWM1_TIMER_TBPRD 2000U
|
||||
#define EPWM1_CMPA 1333U
|
||||
#define EPWM1_CMPB 667U
|
||||
|
||||
#define EPWM2_TIMER_TBPRD 2000U
|
||||
#define EPWM2_CMPA 1333U
|
||||
#define EPWM2_CMPB 667U
|
||||
|
||||
void initEPWM1(void);
|
||||
void initEPWM2(void);
|
||||
void initCLB1(void);
|
||||
__interrupt void epwm1ISR(void);
|
||||
|
||||
uint32_t mode = 0;
|
||||
|
||||
|
||||
void main(void)
|
||||
{
|
||||
Device_init();
|
||||
Device_initGPIO();
|
||||
|
||||
Interrupt_initModule();
|
||||
Interrupt_initVectorTable();
|
||||
Interrupt_register(INT_EPWM1, &epwm1ISR);
|
||||
|
||||
GPIO_setPadConfig(0, GPIO_PIN_TYPE_STD);
|
||||
GPIO_setPinConfig(GPIO_0_EPWM1A);
|
||||
GPIO_setPadConfig(1, GPIO_PIN_TYPE_STD);
|
||||
GPIO_setPinConfig(GPIO_1_EPWM1B);
|
||||
|
||||
GPIO_setPadConfig(2, GPIO_PIN_TYPE_STD);
|
||||
GPIO_setPinConfig(GPIO_2_EPWM2A);
|
||||
GPIO_setPadConfig(3, GPIO_PIN_TYPE_STD);
|
||||
GPIO_setPinConfig(GPIO_3_EPWM2B);
|
||||
|
||||
SysCtl_disablePeripheral(SYSCTL_PERIPH_CLK_TBCLKSYNC);
|
||||
initEPWM1();
|
||||
initEPWM2();
|
||||
SysCtl_enablePeripheral(SYSCTL_PERIPH_CLK_TBCLKSYNC);
|
||||
//SysCtl_enablePeripheral((SysCtl_PeripheralPCLOCKCR)0x0011);
|
||||
|
||||
CLB_enableCLB(CLB1_BASE);
|
||||
initTILE1(CLB1_BASE);
|
||||
|
||||
//
|
||||
// Select Global input instead of local input for all CLB IN
|
||||
//
|
||||
CLB_configLocalInputMux(CLB1_BASE, CLB_IN0, CLB_LOCAL_IN_MUX_GLOBAL_IN);
|
||||
CLB_configLocalInputMux(CLB1_BASE, CLB_IN1, CLB_LOCAL_IN_MUX_GLOBAL_IN);
|
||||
CLB_configLocalInputMux(CLB1_BASE, CLB_IN2, CLB_LOCAL_IN_MUX_GLOBAL_IN);
|
||||
CLB_configLocalInputMux(CLB1_BASE, CLB_IN3, CLB_LOCAL_IN_MUX_GLOBAL_IN);
|
||||
CLB_configLocalInputMux(CLB1_BASE, CLB_IN4, CLB_LOCAL_IN_MUX_GLOBAL_IN);
|
||||
CLB_configLocalInputMux(CLB1_BASE, CLB_IN5, CLB_LOCAL_IN_MUX_GLOBAL_IN);
|
||||
CLB_configLocalInputMux(CLB1_BASE, CLB_IN6, CLB_LOCAL_IN_MUX_GLOBAL_IN);
|
||||
CLB_configLocalInputMux(CLB1_BASE, CLB_IN7, CLB_LOCAL_IN_MUX_GLOBAL_IN);
|
||||
|
||||
CLB_configGlobalInputMux(CLB1_BASE, CLB_IN0, CLB_GLOBAL_IN_MUX_EPWM1_CTRDIR);
|
||||
CLB_configGlobalInputMux(CLB1_BASE, CLB_IN1, CLB_GLOBAL_IN_MUX_EPWM1_CTRDIR);
|
||||
CLB_configGlobalInputMux(CLB1_BASE, CLB_IN2, CLB_GLOBAL_IN_MUX_EPWM1A);
|
||||
CLB_configGlobalInputMux(CLB1_BASE, CLB_IN3, CLB_GLOBAL_IN_MUX_EPWM1B);
|
||||
CLB_configGlobalInputMux(CLB1_BASE, CLB_IN4, CLB_GLOBAL_IN_MUX_EPWM1_CTRDIR);
|
||||
CLB_configGlobalInputMux(CLB1_BASE, CLB_IN5, CLB_GLOBAL_IN_MUX_EPWM1_CTRDIR);
|
||||
CLB_configGlobalInputMux(CLB1_BASE, CLB_IN6, CLB_GLOBAL_IN_MUX_EPWM1_CTRDIR);
|
||||
CLB_configGlobalInputMux(CLB1_BASE, CLB_IN7, CLB_GLOBAL_IN_MUX_EPWM1_CTRDIR);
|
||||
|
||||
//
|
||||
// Inputs set to GP register
|
||||
//
|
||||
CLB_configGPInputMux(CLB1_BASE, CLB_IN0, CLB_GP_IN_MUX_GP_REG);
|
||||
CLB_configGPInputMux(CLB1_BASE, CLB_IN1, CLB_GP_IN_MUX_GP_REG);
|
||||
CLB_configGPInputMux(CLB1_BASE, CLB_IN2, CLB_GP_IN_MUX_EXTERNAL);
|
||||
CLB_configGPInputMux(CLB1_BASE, CLB_IN3, CLB_GP_IN_MUX_EXTERNAL);
|
||||
CLB_configGPInputMux(CLB1_BASE, CLB_IN4, CLB_GP_IN_MUX_GP_REG);
|
||||
CLB_configGPInputMux(CLB1_BASE, CLB_IN5, CLB_GP_IN_MUX_GP_REG);
|
||||
CLB_configGPInputMux(CLB1_BASE, CLB_IN6, CLB_GP_IN_MUX_GP_REG);
|
||||
CLB_configGPInputMux(CLB1_BASE, CLB_IN7, CLB_GP_IN_MUX_GP_REG);
|
||||
|
||||
CLB_setGPREG(CLB1_BASE, mode);
|
||||
|
||||
CLB_setOutputMask(CLB1_BASE, 0x5, true);
|
||||
|
||||
Interrupt_enable(INT_EPWM1);
|
||||
EINT;
|
||||
EPWM_setTimeBaseCounterMode(EPWM1_BASE, EPWM_COUNTER_MODE_UP);
|
||||
EPWM_setTimeBaseCounterMode(EPWM2_BASE, EPWM_COUNTER_MODE_UP);
|
||||
|
||||
while(1)
|
||||
{
|
||||
asm(" NOP");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
__interrupt void epwm1ISR(void)
|
||||
{
|
||||
EPWM_clearEventTriggerInterruptFlag(EPWM1_BASE);
|
||||
Interrupt_clearACKGroup(INTERRUPT_ACK_GROUP3);
|
||||
CLB_setGPREG(CLB1_BASE, mode & 3UL);
|
||||
asm(" NOP");
|
||||
}
|
||||
|
||||
|
||||
void initEPWM1()
|
||||
{
|
||||
EPWM_setTimeBasePeriod(EPWM1_BASE, EPWM1_TIMER_TBPRD);
|
||||
EPWM_setPhaseShift(EPWM1_BASE, 0U);
|
||||
EPWM_setTimeBaseCounter(EPWM1_BASE, 0U);
|
||||
|
||||
EPWM_setSyncOutPulseMode(EPWM1_BASE, EPWM_SYNC_OUT_PULSE_ON_COUNTER_ZERO);
|
||||
|
||||
EPWM_setCounterCompareValue(EPWM1_BASE, EPWM_COUNTER_COMPARE_A, EPWM1_CMPA);
|
||||
EPWM_setCounterCompareValue(EPWM1_BASE, EPWM_COUNTER_COMPARE_B, EPWM1_CMPB);
|
||||
|
||||
EPWM_disablePhaseShiftLoad(EPWM1_BASE);
|
||||
EPWM_setClockPrescaler(EPWM1_BASE, EPWM_CLOCK_DIVIDER_1, EPWM_HSCLOCK_DIVIDER_1);
|
||||
|
||||
EPWM_setCounterCompareShadowLoadMode(EPWM1_BASE, EPWM_COUNTER_COMPARE_A, EPWM_COMP_LOAD_ON_CNTR_ZERO);
|
||||
EPWM_setCounterCompareShadowLoadMode(EPWM1_BASE, EPWM_COUNTER_COMPARE_B, EPWM_COMP_LOAD_ON_CNTR_ZERO);
|
||||
|
||||
EPWM_setActionQualifierAction(EPWM1_BASE, EPWM_AQ_OUTPUT_A, EPWM_AQ_OUTPUT_HIGH, EPWM_AQ_OUTPUT_ON_TIMEBASE_ZERO);
|
||||
EPWM_setActionQualifierAction(EPWM1_BASE, EPWM_AQ_OUTPUT_A, EPWM_AQ_OUTPUT_LOW, EPWM_AQ_OUTPUT_ON_TIMEBASE_UP_CMPA);
|
||||
EPWM_setActionQualifierAction(EPWM1_BASE, EPWM_AQ_OUTPUT_B, EPWM_AQ_OUTPUT_TOGGLE, EPWM_AQ_OUTPUT_ON_TIMEBASE_UP_CMPB);
|
||||
|
||||
EPWM_setInterruptSource(EPWM1_BASE, EPWM_INT_TBCTR_ZERO);
|
||||
EPWM_enableInterrupt(EPWM1_BASE);
|
||||
EPWM_setInterruptEventCount(EPWM1_BASE, 3U);
|
||||
}
|
||||
|
||||
|
||||
void initEPWM2()
|
||||
{
|
||||
EPWM_setTimeBasePeriod(EPWM2_BASE, EPWM2_TIMER_TBPRD);
|
||||
EPWM_setPhaseShift(EPWM2_BASE, 0U);
|
||||
EPWM_setTimeBaseCounter(EPWM2_BASE, 0U);
|
||||
|
||||
EPWM_enablePhaseShiftLoad(EPWM2_BASE);
|
||||
EPWM_setPhaseShift(EPWM2_BASE, 0U);
|
||||
|
||||
EPWM_setCounterCompareValue(EPWM2_BASE, EPWM_COUNTER_COMPARE_A, EPWM2_CMPA);
|
||||
EPWM_setCounterCompareValue(EPWM2_BASE, EPWM_COUNTER_COMPARE_B, EPWM2_CMPB);
|
||||
|
||||
EPWM_setClockPrescaler(EPWM2_BASE, EPWM_CLOCK_DIVIDER_1, EPWM_HSCLOCK_DIVIDER_1);
|
||||
|
||||
EPWM_setCounterCompareShadowLoadMode(EPWM2_BASE, EPWM_COUNTER_COMPARE_A, EPWM_COMP_LOAD_ON_CNTR_ZERO);
|
||||
EPWM_setCounterCompareShadowLoadMode(EPWM2_BASE, EPWM_COUNTER_COMPARE_B, EPWM_COMP_LOAD_ON_CNTR_ZERO);
|
||||
|
||||
EPWM_setActionQualifierAction(EPWM2_BASE, EPWM_AQ_OUTPUT_A, EPWM_AQ_OUTPUT_HIGH, EPWM_AQ_OUTPUT_ON_TIMEBASE_ZERO);
|
||||
EPWM_setActionQualifierAction(EPWM2_BASE, EPWM_AQ_OUTPUT_A, EPWM_AQ_OUTPUT_LOW, EPWM_AQ_OUTPUT_ON_TIMEBASE_UP_CMPA);
|
||||
EPWM_setActionQualifierAction(EPWM2_BASE, EPWM_AQ_OUTPUT_B, EPWM_AQ_OUTPUT_TOGGLE, EPWM_AQ_OUTPUT_ON_TIMEBASE_UP_CMPB);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,82 @@
|
||||
|
||||
var TILE = scripting.addModule("/utilities/clb_tool/clb_syscfg/source/TILE");
|
||||
var TILE1 = TILE.addInstance();
|
||||
// Name
|
||||
TILE1.$name = "TILE1";
|
||||
// in_period0
|
||||
TILE1.BOUNDARY.in_period0 = 4;
|
||||
// in_duty0
|
||||
TILE1.BOUNDARY.in_duty0 = 1;
|
||||
// i1 - Input 1.
|
||||
TILE1.LUT_0.i1 = "BOUNDARY.in1";
|
||||
// i2 - Input 2.
|
||||
TILE1.LUT_0.i2 = "BOUNDARY.in2";
|
||||
// i3 - Input 3.
|
||||
TILE1.LUT_0.i3 = "BOUNDARY.in3";
|
||||
// i0 - Input 0.
|
||||
TILE1.LUT_0.i0 = "BOUNDARY.in0";
|
||||
// eqn - Boolean equation on the variables i3,i2,i1,i0 for the LUT output.
|
||||
TILE1.LUT_0.eqn = "(!i0 & !i1 & i2) | (i0 & !i1 & !(i3 & !(i2 & i3))) | (!i0 & i1 & i2 & !(i2 & i3))";
|
||||
// i0 - Input 0.
|
||||
TILE1.LUT_1.i0 = "BOUNDARY.in0";
|
||||
// i1 - Input 1.
|
||||
TILE1.LUT_1.i1 = "BOUNDARY.in1";
|
||||
// i2 - Input 2.
|
||||
TILE1.LUT_1.i2 = "BOUNDARY.in2";
|
||||
// i3 - Input 3.
|
||||
TILE1.LUT_1.i3 = "BOUNDARY.in3";
|
||||
// eqn - Boolean equation on the variables i3,i2,i1,i0 for the LUT output.
|
||||
TILE1.LUT_1.eqn = "(!i0 & !i1 & i3) | (i0 & !i1 & !(i2 & !(i2 & i3))) | (!i0 & i1 & i3 & !(i2 & i3))";
|
||||
// i0 - Input 0.
|
||||
TILE1.LUT_2.i0 = "BOUNDARY.in0";
|
||||
// i1 - Input 1.
|
||||
TILE1.LUT_2.i1 = "BOUNDARY.in1";
|
||||
// i2 - Input 2.
|
||||
TILE1.LUT_2.i2 = "BOUNDARY.in2";
|
||||
// i3 - Input 3.
|
||||
TILE1.LUT_2.i3 = "BOUNDARY.in3";
|
||||
// eqn - Boolean equation on the variables i3,i2,i1,i0 for the LUT output.
|
||||
TILE1.LUT_2.eqn = "i3";
|
||||
// e0 - External Input 0.
|
||||
TILE1.FSM_0.e0 = "BOUNDARY.in1";
|
||||
// e1 - External Input 1.
|
||||
TILE1.FSM_0.e1 = "COUNTER_0.count_match1";
|
||||
// e0 - External Input 0.
|
||||
TILE1.FSM_1.e0 = "BOUNDARY.in0";
|
||||
// e1 - External Input 1.
|
||||
TILE1.FSM_1.e1 = "COUNTER_1.count_match1";
|
||||
// e0 - External Input 0.
|
||||
TILE1.FSM_2.e0 = "LUT_2.OUT";
|
||||
// e1 - External Input 1.
|
||||
TILE1.FSM_2.e1 = "COUNTER_2.count_zero";
|
||||
// eqn_out - Boolean equation on the variables e1,e0,s1,s0 for the LUT output.
|
||||
TILE1.FSM_2.eqn_out = "e1 | e0";
|
||||
// eqn_s0 - Boolean equation on the variables e1,e0,s1,s0 for the S0 output.
|
||||
TILE1.FSM_2.eqn_s0 = "e0 & e1";
|
||||
// eqn_s1 - Boolean equation on the variables e1,e0,s1,s0 for the S1 output.
|
||||
TILE1.FSM_2.eqn_s1 = "s0 | s1";
|
||||
// reset - Reset the counter to 0 on next clock cycle (triggers low to high)
|
||||
TILE1.COUNTER_0.reset = "FSM_0.OUT";
|
||||
// reset - Reset the counter to 0 on next clock cycle (triggers low to high)
|
||||
TILE1.COUNTER_1.reset = "FSM_1.OUT";
|
||||
// reset - Reset the counter to 0 on next clock cycle (triggers low to high)
|
||||
TILE1.COUNTER_2.reset = "BOUNDARY.in3";
|
||||
// event - Trigger actions in the counter.
|
||||
TILE1.COUNTER_2.event = "LUT_2.OUT";
|
||||
// What action should be taken on an event trigger?
|
||||
TILE1.COUNTER_2.action = "Add";
|
||||
// eqn - Boolean equation on the variables i2,i1,i0 for the OUTLUT output.
|
||||
TILE1.OUTLUT_0.eqn = "i0";
|
||||
// i0 - Input 0.
|
||||
TILE1.OUTLUT_0.i0 = "LUT_0.OUT";
|
||||
// eqn - Boolean equation on the variables i2,i1,i0 for the OUTLUT output.
|
||||
TILE1.OUTLUT_1.eqn = "0";
|
||||
// eqn - Boolean equation on the variables i2,i1,i0 for the OUTLUT output.
|
||||
TILE1.OUTLUT_2.eqn = "i0";
|
||||
// i0 - Input 0.
|
||||
TILE1.OUTLUT_2.i0 = "LUT_1.OUT";
|
||||
// eqn - Boolean equation on the variables i2,i1,i0 for the OUTLUT output.
|
||||
TILE1.OUTLUT_3.eqn = "0";
|
||||
// instruct0
|
||||
TILE1.HLC.program2.instruct0 = "mov r0,c0";
|
||||
|
||||
@@ -0,0 +1,161 @@
|
||||
//#############################################################################
|
||||
//
|
||||
// FILE: clb_ex2_gpio_input_filter.c
|
||||
//
|
||||
// TITLE: CLB GPIO Input Filter.
|
||||
//
|
||||
//! \addtogroup driver_example_list
|
||||
//! <h1>CLB GPIO Input Filter</h1>
|
||||
//!
|
||||
//! For the detailed description of this example, please refer to:
|
||||
//! C2000Ware_PATH\utilities\clb_tool\clb_syscfg\doc\CLB Tool Users Guide.pdf
|
||||
//!
|
||||
//
|
||||
//
|
||||
//#############################################################################
|
||||
//
|
||||
//
|
||||
// $Copyright:
|
||||
// Copyright (C) 2013-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.
|
||||
// $
|
||||
//#############################################################################
|
||||
|
||||
|
||||
#include "driverlib.h"
|
||||
#include "device.h"
|
||||
#include "clb_config.h"
|
||||
#include "clb.h"
|
||||
|
||||
#define EPWM1_TIMER_TBPRD 0xFFFF
|
||||
#define EPWM1_CMPA 0x0003
|
||||
#define EPWM1_CMPB 0xFFFC
|
||||
#define MODE_CHG_COUNT 10000U
|
||||
|
||||
void initEPWM1(void);
|
||||
void initCLB1(void);
|
||||
|
||||
uint32_t ccount = 0UL;
|
||||
uint16_t cglitch = 3U;
|
||||
|
||||
|
||||
void main(void)
|
||||
{
|
||||
Device_init();
|
||||
Device_initGPIO();
|
||||
|
||||
Interrupt_initModule();
|
||||
Interrupt_initVectorTable();
|
||||
|
||||
GPIO_setPadConfig(0, GPIO_PIN_TYPE_STD);
|
||||
GPIO_setPinConfig(GPIO_0_EPWM1A);
|
||||
GPIO_setPadConfig(1, GPIO_PIN_TYPE_STD);
|
||||
GPIO_setPinConfig(GPIO_1_EPWM1B);
|
||||
|
||||
SysCtl_disablePeripheral(SYSCTL_PERIPH_CLK_TBCLKSYNC);
|
||||
initEPWM1();
|
||||
SysCtl_enablePeripheral(SYSCTL_PERIPH_CLK_TBCLKSYNC);
|
||||
//SysCtl_enablePeripheral((SysCtl_PeripheralPCLOCKCR)0x0011);
|
||||
|
||||
CLB_enableCLB(CLB1_BASE);
|
||||
initTILE1(CLB1_BASE);
|
||||
//
|
||||
// Select Global input instead of local input for all CLB IN
|
||||
//
|
||||
CLB_configLocalInputMux(CLB1_BASE, CLB_IN0, CLB_LOCAL_IN_MUX_GLOBAL_IN);
|
||||
CLB_configLocalInputMux(CLB1_BASE, CLB_IN1, CLB_LOCAL_IN_MUX_GLOBAL_IN);
|
||||
CLB_configLocalInputMux(CLB1_BASE, CLB_IN2, CLB_LOCAL_IN_MUX_GLOBAL_IN);
|
||||
CLB_configLocalInputMux(CLB1_BASE, CLB_IN3, CLB_LOCAL_IN_MUX_GLOBAL_IN);
|
||||
CLB_configLocalInputMux(CLB1_BASE, CLB_IN4, CLB_LOCAL_IN_MUX_GLOBAL_IN);
|
||||
CLB_configLocalInputMux(CLB1_BASE, CLB_IN5, CLB_LOCAL_IN_MUX_GLOBAL_IN);
|
||||
CLB_configLocalInputMux(CLB1_BASE, CLB_IN6, CLB_LOCAL_IN_MUX_GLOBAL_IN);
|
||||
CLB_configLocalInputMux(CLB1_BASE, CLB_IN7, CLB_LOCAL_IN_MUX_GLOBAL_IN);
|
||||
|
||||
CLB_configGlobalInputMux(CLB1_BASE, CLB_IN0, CLB_GLOBAL_IN_MUX_EPWM1A);
|
||||
CLB_configGlobalInputMux(CLB1_BASE, CLB_IN1, CLB_GLOBAL_IN_MUX_EPWM1_CTRDIR);
|
||||
CLB_configGlobalInputMux(CLB1_BASE, CLB_IN2, CLB_GLOBAL_IN_MUX_EPWM1_CTRDIR);
|
||||
CLB_configGlobalInputMux(CLB1_BASE, CLB_IN3, CLB_GLOBAL_IN_MUX_EPWM1_CTRDIR);
|
||||
CLB_configGlobalInputMux(CLB1_BASE, CLB_IN4, CLB_GLOBAL_IN_MUX_EPWM1_CTRDIR);
|
||||
CLB_configGlobalInputMux(CLB1_BASE, CLB_IN5, CLB_GLOBAL_IN_MUX_EPWM1_CTRDIR);
|
||||
CLB_configGlobalInputMux(CLB1_BASE, CLB_IN6, CLB_GLOBAL_IN_MUX_EPWM1_CTRDIR);
|
||||
CLB_configGlobalInputMux(CLB1_BASE, CLB_IN7, CLB_GLOBAL_IN_MUX_EPWM1_CTRDIR);
|
||||
|
||||
//
|
||||
// Inputs set to GP register
|
||||
//
|
||||
CLB_configGPInputMux(CLB1_BASE, CLB_IN0, CLB_GP_IN_MUX_EXTERNAL);
|
||||
CLB_configGPInputMux(CLB1_BASE, CLB_IN1, CLB_GP_IN_MUX_GP_REG);
|
||||
CLB_configGPInputMux(CLB1_BASE, CLB_IN2, CLB_GP_IN_MUX_GP_REG);
|
||||
CLB_configGPInputMux(CLB1_BASE, CLB_IN3, CLB_GP_IN_MUX_GP_REG);
|
||||
CLB_configGPInputMux(CLB1_BASE, CLB_IN4, CLB_GP_IN_MUX_GP_REG);
|
||||
CLB_configGPInputMux(CLB1_BASE, CLB_IN5, CLB_GP_IN_MUX_GP_REG);
|
||||
CLB_configGPInputMux(CLB1_BASE, CLB_IN6, CLB_GP_IN_MUX_GP_REG);
|
||||
CLB_configGPInputMux(CLB1_BASE, CLB_IN7, CLB_GP_IN_MUX_GP_REG);
|
||||
|
||||
CLB_setOutputMask(CLB1_BASE, 0x1, true);
|
||||
|
||||
EPWM_setTimeBaseCounterMode(EPWM1_BASE, EPWM_COUNTER_MODE_UP);
|
||||
|
||||
while(1)
|
||||
{
|
||||
if (ccount++ > MODE_CHG_COUNT)
|
||||
{
|
||||
EPWM_setCounterCompareValue (EPWM1_BASE, EPWM_COUNTER_COMPARE_A, cglitch);
|
||||
EPWM_setCounterCompareValue (EPWM1_BASE, EPWM_COUNTER_COMPARE_B, cglitch);
|
||||
ccount = 0;
|
||||
}
|
||||
asm(" NOP");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void initEPWM1()
|
||||
{
|
||||
EPWM_setTimeBasePeriod(EPWM1_BASE, EPWM1_TIMER_TBPRD);
|
||||
EPWM_setPhaseShift(EPWM1_BASE, 0U);
|
||||
EPWM_setTimeBaseCounter(EPWM1_BASE, 0U);
|
||||
|
||||
EPWM_setSyncOutPulseMode(EPWM1_BASE, EPWM_SYNC_OUT_PULSE_ON_COUNTER_ZERO);
|
||||
|
||||
EPWM_setCounterCompareValue(EPWM1_BASE, EPWM_COUNTER_COMPARE_A, EPWM1_CMPA);
|
||||
EPWM_setCounterCompareValue(EPWM1_BASE, EPWM_COUNTER_COMPARE_B, EPWM1_CMPB);
|
||||
|
||||
EPWM_disablePhaseShiftLoad(EPWM1_BASE);
|
||||
EPWM_setClockPrescaler(EPWM1_BASE, EPWM_CLOCK_DIVIDER_1, EPWM_HSCLOCK_DIVIDER_1);
|
||||
|
||||
EPWM_setCounterCompareShadowLoadMode(EPWM1_BASE, EPWM_COUNTER_COMPARE_A, EPWM_COMP_LOAD_ON_CNTR_ZERO);
|
||||
EPWM_setCounterCompareShadowLoadMode(EPWM1_BASE, EPWM_COUNTER_COMPARE_B, EPWM_COMP_LOAD_ON_CNTR_ZERO);
|
||||
|
||||
EPWM_setActionQualifierAction(EPWM1_BASE, EPWM_AQ_OUTPUT_A, EPWM_AQ_OUTPUT_HIGH, EPWM_AQ_OUTPUT_ON_TIMEBASE_ZERO);
|
||||
EPWM_setActionQualifierAction(EPWM1_BASE, EPWM_AQ_OUTPUT_A, EPWM_AQ_OUTPUT_LOW, EPWM_AQ_OUTPUT_ON_TIMEBASE_UP_CMPA);
|
||||
EPWM_setActionQualifierAction(EPWM1_BASE, EPWM_AQ_OUTPUT_B, EPWM_AQ_OUTPUT_HIGH, EPWM_AQ_OUTPUT_ON_TIMEBASE_ZERO);
|
||||
EPWM_setActionQualifierAction(EPWM1_BASE, EPWM_AQ_OUTPUT_B, EPWM_AQ_OUTPUT_LOW, EPWM_AQ_OUTPUT_ON_TIMEBASE_UP_CMPA);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,74 @@
|
||||
|
||||
var TILE = scripting.addModule("/utilities/clb_tool/clb_syscfg/source/TILE");
|
||||
var TILE1 = TILE.addInstance();
|
||||
// clock_period - Period of the clock (in Nano Seconds) used for simulation in System C
|
||||
TILE.clock_period = 10;
|
||||
// sim_duration - Duration of the simulation (in Nano Seconds)
|
||||
TILE.sim_duration = 100000;
|
||||
// Name
|
||||
TILE1.$name = "TILE1";
|
||||
// in1
|
||||
TILE1.BOUNDARY.in1 = "squareWave";
|
||||
// in0
|
||||
TILE1.BOUNDARY.in0 = "squareWave";
|
||||
// in4
|
||||
TILE1.BOUNDARY.in4 = "1";
|
||||
// in5
|
||||
TILE1.BOUNDARY.in5 = "0";
|
||||
// in_duty1 - Duty or ON time of the square wave
|
||||
TILE1.BOUNDARY.in_duty1 = 50;
|
||||
// in_period1 - Period of the square wave
|
||||
TILE1.BOUNDARY.in_period1 = 100;
|
||||
// in2
|
||||
TILE1.BOUNDARY.in2 = "1";
|
||||
// in6
|
||||
TILE1.BOUNDARY.in6 = "1";
|
||||
// in_repeat_count0 - Number of periods the waveform is repeated
|
||||
TILE1.BOUNDARY.in_repeat_count0 = 50;
|
||||
// in3
|
||||
TILE1.BOUNDARY.in3 = "squareWave";
|
||||
// in_repeat_count3 - Number of periods the waveform is repeated
|
||||
TILE1.BOUNDARY.in_repeat_count3 = 1;
|
||||
// in_repeat_count1 - Number of periods the waveform is repeated
|
||||
TILE1.BOUNDARY.in_repeat_count1 = 1000;
|
||||
// in_duty0 - Duty or ON time of the square wave
|
||||
TILE1.BOUNDARY.in_duty0 = 20;
|
||||
// in_period0 - Period of the square wave
|
||||
TILE1.BOUNDARY.in_period0 = 40;
|
||||
// eqn - Boolean equation on the variables i3,i2,i1,i0 for the LUT output.
|
||||
TILE1.LUT_0.eqn = "~i0";
|
||||
// i0 - Input 0.
|
||||
TILE1.LUT_0.i0 = "BOUNDARY.in0";
|
||||
// e0 - External Input 0.
|
||||
TILE1.FSM_0.e0 = "COUNTER_0.count_match1";
|
||||
// e1 - External Input 1.
|
||||
TILE1.FSM_0.e1 = "COUNTER_1.count_match1";
|
||||
// eqn_s0 - Boolean equation on the variables e1,e0,s1,s0 for the S0 output.
|
||||
TILE1.FSM_0.eqn_s0 = "(~s0 & e1) | (s0 & (~e0))";
|
||||
// match1_val - Sets the value of the Match reference 1 register.
|
||||
TILE1.COUNTER_0.match1_val = "8";
|
||||
// mode1 - Controls counting direction. High enables count up. Low enables count down.
|
||||
TILE1.COUNTER_0.mode1 = "1";
|
||||
// mode0 - Enables Counting when high
|
||||
TILE1.COUNTER_0.mode0 = "LUT_0.OUT";
|
||||
// reset - Reset the counter to 0 on next clock cycle (triggers low to high)
|
||||
TILE1.COUNTER_0.reset = "BOUNDARY.in0";
|
||||
// match1_val - Sets the value of the Match reference 1 register.
|
||||
TILE1.COUNTER_1.match1_val = "8";
|
||||
// mode1 - Controls counting direction. High enables count up. Low enables count down.
|
||||
TILE1.COUNTER_1.mode1 = "1";
|
||||
// mode0 - Enables Counting when high
|
||||
TILE1.COUNTER_1.mode0 = "BOUNDARY.in0";
|
||||
// reset - Reset the counter to 0 on next clock cycle (triggers low to high)
|
||||
TILE1.COUNTER_1.reset = "LUT_0.OUT";
|
||||
// mode1 - Controls counting direction. High enables count up. Low enables count down.
|
||||
TILE1.COUNTER_2.mode1 = "1";
|
||||
// mode0 - Enables Counting when high
|
||||
TILE1.COUNTER_2.mode0 = "1";
|
||||
// reset - Reset the counter to 0 on next clock cycle (triggers low to high)
|
||||
TILE1.COUNTER_2.reset = "COUNTER_2.count_match1";
|
||||
// eqn - Boolean equation on the variables i2,i1,i0 for the OUTLUT output.
|
||||
TILE1.OUTLUT_0.eqn = "i0";
|
||||
// i0 - Input 0.
|
||||
TILE1.OUTLUT_0.i0 = "FSM_0.S0";
|
||||
|
||||
@@ -0,0 +1,172 @@
|
||||
//#############################################################################
|
||||
//
|
||||
// FILE: clb_ex3_auxiliary_pwm.c
|
||||
//
|
||||
// TITLE: CLB Auxilary PWM.
|
||||
//
|
||||
//! \addtogroup driver_example_list
|
||||
//! <h1>CLB Auxilary PWM</h1>
|
||||
//!
|
||||
//! For the detailed description of this example, please refer to:
|
||||
//! C2000Ware_PATH\utilities\clb_tool\clb_syscfg\doc\CLB Tool Users Guide.pdf
|
||||
//!
|
||||
//
|
||||
//
|
||||
//#############################################################################
|
||||
//
|
||||
//
|
||||
// $Copyright:
|
||||
// Copyright (C) 2013-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.
|
||||
// $
|
||||
//#############################################################################
|
||||
|
||||
|
||||
#include "driverlib.h"
|
||||
#include "device.h"
|
||||
#include "clb_config.h"
|
||||
#include "clb.h"
|
||||
|
||||
__interrupt void clb1ISR(void);
|
||||
|
||||
#define ENABLE_AUX_PWM 1
|
||||
volatile uint16_t dutyValue=200;
|
||||
|
||||
void main(void)
|
||||
{
|
||||
Device_init();
|
||||
Device_initGPIO();
|
||||
|
||||
Interrupt_initModule();
|
||||
Interrupt_initVectorTable();
|
||||
|
||||
Interrupt_register(INT_CLB1, &clb1ISR);
|
||||
Interrupt_enable(INT_CLB1);
|
||||
|
||||
//SysCtl_enablePeripheral((SysCtl_PeripheralPCLOCKCR)0x0011);
|
||||
|
||||
CLB_enableCLB(CLB1_BASE);
|
||||
initTILE1(CLB1_BASE);
|
||||
|
||||
CLB_configLocalInputMux(CLB1_BASE, CLB_IN0, CLB_LOCAL_IN_MUX_GLOBAL_IN);
|
||||
CLB_configLocalInputMux(CLB1_BASE, CLB_IN1, CLB_LOCAL_IN_MUX_GLOBAL_IN);
|
||||
CLB_configLocalInputMux(CLB1_BASE, CLB_IN2, CLB_LOCAL_IN_MUX_GLOBAL_IN);
|
||||
CLB_configLocalInputMux(CLB1_BASE, CLB_IN3, CLB_LOCAL_IN_MUX_GLOBAL_IN);
|
||||
CLB_configLocalInputMux(CLB1_BASE, CLB_IN4, CLB_LOCAL_IN_MUX_GLOBAL_IN);
|
||||
CLB_configLocalInputMux(CLB1_BASE, CLB_IN5, CLB_LOCAL_IN_MUX_GLOBAL_IN);
|
||||
CLB_configLocalInputMux(CLB1_BASE, CLB_IN6, CLB_LOCAL_IN_MUX_GLOBAL_IN);
|
||||
CLB_configLocalInputMux(CLB1_BASE, CLB_IN7, CLB_LOCAL_IN_MUX_GLOBAL_IN);
|
||||
|
||||
CLB_configGlobalInputMux(CLB1_BASE, CLB_IN0, CLB_GLOBAL_IN_MUX_EPWM1A);
|
||||
CLB_configGlobalInputMux(CLB1_BASE, CLB_IN1, CLB_GLOBAL_IN_MUX_EPWM1A);
|
||||
CLB_configGlobalInputMux(CLB1_BASE, CLB_IN2, CLB_GLOBAL_IN_MUX_EPWM1A);
|
||||
CLB_configGlobalInputMux(CLB1_BASE, CLB_IN3, CLB_GLOBAL_IN_MUX_EPWM1A);
|
||||
CLB_configGlobalInputMux(CLB1_BASE, CLB_IN4, CLB_GLOBAL_IN_MUX_EPWM1A);
|
||||
CLB_configGlobalInputMux(CLB1_BASE, CLB_IN5, CLB_GLOBAL_IN_MUX_EPWM1A);
|
||||
CLB_configGlobalInputMux(CLB1_BASE, CLB_IN6, CLB_GLOBAL_IN_MUX_EPWM1A);
|
||||
CLB_configGlobalInputMux(CLB1_BASE, CLB_IN7, CLB_GLOBAL_IN_MUX_EPWM1A);
|
||||
|
||||
//
|
||||
// Inputs set to GP register
|
||||
//
|
||||
CLB_configGPInputMux(CLB1_BASE, CLB_IN0, CLB_GP_IN_MUX_GP_REG);
|
||||
|
||||
//
|
||||
// Unused inputs to GP register
|
||||
//
|
||||
CLB_configGPInputMux(CLB1_BASE, CLB_IN1, CLB_GP_IN_MUX_GP_REG);
|
||||
CLB_configGPInputMux(CLB1_BASE, CLB_IN2, CLB_GP_IN_MUX_GP_REG);
|
||||
CLB_configGPInputMux(CLB1_BASE, CLB_IN3, CLB_GP_IN_MUX_GP_REG);
|
||||
CLB_configGPInputMux(CLB1_BASE, CLB_IN4, CLB_GP_IN_MUX_GP_REG);
|
||||
CLB_configGPInputMux(CLB1_BASE, CLB_IN5, CLB_GP_IN_MUX_GP_REG);
|
||||
CLB_configGPInputMux(CLB1_BASE, CLB_IN6, CLB_GP_IN_MUX_GP_REG);
|
||||
CLB_configGPInputMux(CLB1_BASE, CLB_IN7, CLB_GP_IN_MUX_GP_REG);
|
||||
|
||||
//
|
||||
// Configure GPIO0 for Output
|
||||
// Used to see trigger of ISR
|
||||
//
|
||||
GPIO_setPinConfig(GPIO_0_GPIO0);
|
||||
GPIO_setDirectionMode(0, GPIO_DIR_MODE_OUT);
|
||||
GPIO_setPadConfig(0, GPIO_PIN_TYPE_STD);
|
||||
|
||||
//
|
||||
// Configure GPIO24 for OUTPUTXBAR1
|
||||
//
|
||||
GPIO_setPinConfig(GPIO_24_OUTPUTXBAR1);
|
||||
GPIO_setDirectionMode(24, GPIO_DIR_MODE_OUT);
|
||||
GPIO_setPadConfig(24, GPIO_PIN_TYPE_STD);
|
||||
|
||||
//
|
||||
// Configure OUTPUT-XBAR OUTPUT1 as CLB1_OUT4
|
||||
//
|
||||
XBAR_setOutputMuxConfig(XBAR_OUTPUT1, XBAR_OUT_MUX01_CLB1_OUT4);
|
||||
XBAR_enableOutputMux(XBAR_OUTPUT1, XBAR_MUX01);
|
||||
|
||||
CLB_setGPREG(CLB1_BASE, ENABLE_AUX_PWM);
|
||||
|
||||
//
|
||||
// Enable Global Interrupt (INTM) and realtime interrupt (DBGM)
|
||||
//
|
||||
EINT;
|
||||
ERTM;
|
||||
|
||||
CLB_clearInterruptTag(CLB1_BASE);
|
||||
|
||||
while(1)
|
||||
{
|
||||
asm(" NOP");
|
||||
}
|
||||
}
|
||||
|
||||
__interrupt void clb1ISR(void)
|
||||
{
|
||||
GPIO_togglePin(0); // Debug: Used to determine if interrupt is being set
|
||||
|
||||
//
|
||||
// Change duty cycle of PWM signal at the end of a period
|
||||
//
|
||||
if (dutyValue == 150)
|
||||
{
|
||||
dutyValue = 100U;
|
||||
}
|
||||
else
|
||||
{
|
||||
dutyValue = 150U;
|
||||
}
|
||||
|
||||
//
|
||||
// Load new duty cycle value in HLC Registers
|
||||
//
|
||||
CLB_setHLCRegisters(CLB1_BASE, dutyValue, 0, 0, 0);
|
||||
|
||||
CLB_clearInterruptTag(CLB1_BASE);
|
||||
Interrupt_clearACKGroup(INTERRUPT_ACK_GROUP5);
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
|
||||
var TILE = scripting.addModule("/utilities/clb_tool/clb_syscfg/source/TILE");
|
||||
var TILE1 = TILE.addInstance();
|
||||
// clock_period - Period of the clock (in Nano Seconds) used for simulation in System C
|
||||
TILE.clock_period = 10;
|
||||
// sim_duration - Duration of the simulation (in Nano Seconds)
|
||||
TILE.sim_duration = 100000;
|
||||
// Name
|
||||
TILE1.$name = "TILE1";
|
||||
// in0
|
||||
TILE1.BOUNDARY.in0 = "squareWave";
|
||||
// in_duty1 - Duty or ON time of the square wave
|
||||
TILE1.BOUNDARY.in_duty1 = 50;
|
||||
// in_period1 - Period of the square wave
|
||||
TILE1.BOUNDARY.in_period1 = 100;
|
||||
// in_repeat_count0 - Number of periods the waveform is repeated
|
||||
TILE1.BOUNDARY.in_repeat_count0 = 50;
|
||||
// in_repeat_count3 - Number of periods the waveform is repeated
|
||||
TILE1.BOUNDARY.in_repeat_count3 = 1;
|
||||
// in_repeat_count1 - Number of periods the waveform is repeated
|
||||
TILE1.BOUNDARY.in_repeat_count1 = 1000;
|
||||
// in_period0 - Period of the square wave
|
||||
TILE1.BOUNDARY.in_period0 = 50000;
|
||||
// in_duty0 - Duty or ON time of the square wave
|
||||
TILE1.BOUNDARY.in_duty0 = 49000;
|
||||
// i0 - Input 0.
|
||||
TILE1.LUT_0.i0 = "BOUNDARY.in0";
|
||||
// i1 - Input 1.
|
||||
TILE1.LUT_0.i1 = "COUNTER_0.count_match1";
|
||||
// eqn - Boolean equation on the variables i3,i2,i1,i0 for the LUT output.
|
||||
TILE1.LUT_0.eqn = "~i0 | i1";
|
||||
// eqn_s0 - Boolean equation on the variables e1,e0,s1,s0 for the S0 output.
|
||||
TILE1.FSM_0.eqn_s0 = "(~s0 & e0) | (s0 & (~e1))";
|
||||
// e0 - External Input 0.
|
||||
TILE1.FSM_0.e0 = "COUNTER_0.count_match2";
|
||||
// e1 - External Input 1.
|
||||
TILE1.FSM_0.e1 = "COUNTER_0.count_match1";
|
||||
// mode1 - Controls counting direction. High enables count up. Low enables count down.
|
||||
TILE1.COUNTER_0.mode1 = "1";
|
||||
// reset - Reset the counter to 0 on next clock cycle (triggers low to high)
|
||||
TILE1.COUNTER_0.reset = "LUT_0.OUT";
|
||||
// mode0 - Enables Counting when high
|
||||
TILE1.COUNTER_0.mode0 = "1";
|
||||
// match1_val - Sets the value of the Match reference 1 register.
|
||||
TILE1.COUNTER_0.match1_val = "300";
|
||||
// match2_val - Sets the value of the Match reference 2 register.
|
||||
TILE1.COUNTER_0.match2_val = "100";
|
||||
// eqn - Boolean equation on the variables i2,i1,i0 for the OUTLUT output.
|
||||
TILE1.OUTLUT_4.eqn = "i0";
|
||||
// i0 - Input 0.
|
||||
TILE1.OUTLUT_4.i0 = "FSM_0.S0";
|
||||
// R0_init - Initial value for register R0
|
||||
TILE1.HLC.R0_init = "200";
|
||||
// Event 0 (e0) - Event 0
|
||||
TILE1.HLC.e0 = "COUNTER_0.count_match1";
|
||||
// instruct0
|
||||
TILE1.HLC.program0.instruct0 = "MOV_T2 R0, C0";
|
||||
// instruct1
|
||||
TILE1.HLC.program0.instruct1 = "INTR 1";
|
||||
|
||||
@@ -0,0 +1,400 @@
|
||||
//#############################################################################
|
||||
//
|
||||
// FILE: clb_ex4_pwm_protection.c
|
||||
//
|
||||
// TITLE: CLB PWM Protection.
|
||||
//
|
||||
//! \addtogroup driver_example_list
|
||||
//! <h1>CLB PWM Protection</h1>
|
||||
//!
|
||||
//! For the detailed description of this example, please refer to:
|
||||
//! C2000Ware_PATH\utilities\clb_tool\clb_syscfg\doc\CLB Tool Users Guide.pdf
|
||||
//!
|
||||
//
|
||||
//
|
||||
//#############################################################################
|
||||
//
|
||||
//
|
||||
// $Copyright:
|
||||
// Copyright (C) 2013-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.
|
||||
// $
|
||||
//#############################################################################
|
||||
|
||||
|
||||
#include "driverlib.h"
|
||||
#include "device.h"
|
||||
#include "clb_config.h"
|
||||
#include "clb.h"
|
||||
|
||||
#define EPWM1_TIMER_TBPRD 2000U
|
||||
#define EPWM1_CMPA 933U
|
||||
#define EPWM1_CMPB 933U
|
||||
|
||||
#define EPWM2_TIMER_TBPRD 2000U
|
||||
#define EPWM2_CMPA 933U
|
||||
#define EPWM2_CMPB 933U
|
||||
|
||||
#define EPWM3_TIMER_TBPRD 2000U
|
||||
#define EPWM3_CMPA 933U
|
||||
#define EPWM3_CMPB 933U
|
||||
|
||||
#define EPWM4_TIMER_TBPRD 2000U
|
||||
#define EPWM4_CMPA 933U
|
||||
#define EPWM4_CMPB 933U
|
||||
|
||||
|
||||
void initEPWM1(void);
|
||||
void initEPWM2(void);
|
||||
void initEPWM3(void);
|
||||
void initEPWM4(void);
|
||||
__interrupt void epwm1ISR(void);
|
||||
|
||||
uint32_t mode = 0;
|
||||
|
||||
|
||||
void main(void)
|
||||
{
|
||||
Device_init();
|
||||
Device_initGPIO();
|
||||
|
||||
Interrupt_initModule();
|
||||
Interrupt_initVectorTable();
|
||||
Interrupt_register(INT_EPWM1, &epwm1ISR);
|
||||
|
||||
GPIO_setPadConfig(0, GPIO_PIN_TYPE_STD);
|
||||
GPIO_setPinConfig(GPIO_0_EPWM1A);
|
||||
GPIO_setPadConfig(1, GPIO_PIN_TYPE_STD);
|
||||
GPIO_setPinConfig(GPIO_1_EPWM1B);
|
||||
|
||||
GPIO_setPadConfig(2, GPIO_PIN_TYPE_STD);
|
||||
GPIO_setPinConfig(GPIO_2_EPWM2A);
|
||||
GPIO_setPadConfig(3, GPIO_PIN_TYPE_STD);
|
||||
GPIO_setPinConfig(GPIO_3_EPWM2B);
|
||||
|
||||
GPIO_setPadConfig(4, GPIO_PIN_TYPE_STD);
|
||||
GPIO_setPinConfig(GPIO_4_EPWM3A);
|
||||
GPIO_setPadConfig(5, GPIO_PIN_TYPE_STD);
|
||||
GPIO_setPinConfig(GPIO_5_EPWM3B);
|
||||
|
||||
GPIO_setPadConfig(6, GPIO_PIN_TYPE_STD);
|
||||
GPIO_setPinConfig(GPIO_6_EPWM4A);
|
||||
GPIO_setPadConfig(7, GPIO_PIN_TYPE_STD);
|
||||
GPIO_setPinConfig(GPIO_7_EPWM4B);
|
||||
|
||||
SysCtl_disablePeripheral(SYSCTL_PERIPH_CLK_TBCLKSYNC);
|
||||
initEPWM1();
|
||||
initEPWM2();
|
||||
initEPWM3();
|
||||
initEPWM4();
|
||||
SysCtl_enablePeripheral(SYSCTL_PERIPH_CLK_TBCLKSYNC);
|
||||
//SysCtl_enablePeripheral((SysCtl_PeripheralPCLOCKCR)0x0011);
|
||||
SysCtl_enablePeripheral((SysCtl_PeripheralPCLOCKCR)0x0111);
|
||||
SysCtl_enablePeripheral((SysCtl_PeripheralPCLOCKCR)0x0211);
|
||||
SysCtl_enablePeripheral((SysCtl_PeripheralPCLOCKCR)0x0311);
|
||||
|
||||
// initialize all CLB tiles
|
||||
CLB_enableCLB(CLB1_BASE);
|
||||
CLB_enableCLB(CLB2_BASE);
|
||||
CLB_enableCLB(CLB3_BASE);
|
||||
CLB_enableCLB(CLB4_BASE);
|
||||
|
||||
initTILE1(CLB1_BASE);
|
||||
initTILE2(CLB2_BASE);
|
||||
initTILE3(CLB3_BASE);
|
||||
initTILE4(CLB4_BASE);
|
||||
|
||||
// CLB tile 1 configuration
|
||||
CLB_configLocalInputMux(CLB1_BASE, CLB_IN0, CLB_LOCAL_IN_MUX_GLOBAL_IN);
|
||||
CLB_configLocalInputMux(CLB1_BASE, CLB_IN1, CLB_LOCAL_IN_MUX_GLOBAL_IN);
|
||||
CLB_configLocalInputMux(CLB1_BASE, CLB_IN2, CLB_LOCAL_IN_MUX_GLOBAL_IN);
|
||||
CLB_configLocalInputMux(CLB1_BASE, CLB_IN3, CLB_LOCAL_IN_MUX_GLOBAL_IN);
|
||||
CLB_configLocalInputMux(CLB1_BASE, CLB_IN4, CLB_LOCAL_IN_MUX_GLOBAL_IN);
|
||||
CLB_configLocalInputMux(CLB1_BASE, CLB_IN5, CLB_LOCAL_IN_MUX_GLOBAL_IN);
|
||||
CLB_configLocalInputMux(CLB1_BASE, CLB_IN6, CLB_LOCAL_IN_MUX_GLOBAL_IN);
|
||||
CLB_configLocalInputMux(CLB1_BASE, CLB_IN7, CLB_LOCAL_IN_MUX_GLOBAL_IN);
|
||||
|
||||
CLB_configGlobalInputMux(CLB1_BASE, CLB_IN0, CLB_GLOBAL_IN_MUX_EPWM1A);
|
||||
CLB_configGlobalInputMux(CLB1_BASE, CLB_IN1, CLB_GLOBAL_IN_MUX_EPWM1A);
|
||||
CLB_configGlobalInputMux(CLB1_BASE, CLB_IN2, CLB_GLOBAL_IN_MUX_EPWM1B);
|
||||
CLB_configGlobalInputMux(CLB1_BASE, CLB_IN3, CLB_GLOBAL_IN_MUX_EPWM1B);
|
||||
CLB_configGlobalInputMux(CLB1_BASE, CLB_IN4, CLB_GLOBAL_IN_MUX_EPWM1_CTRDIR);
|
||||
CLB_configGlobalInputMux(CLB1_BASE, CLB_IN5, CLB_GLOBAL_IN_MUX_EPWM1_CTRDIR);
|
||||
CLB_configGlobalInputMux(CLB1_BASE, CLB_IN6, CLB_GLOBAL_IN_MUX_EPWM1_CTRDIR);
|
||||
CLB_configGlobalInputMux(CLB1_BASE, CLB_IN7, CLB_GLOBAL_IN_MUX_EPWM1_CTRDIR);
|
||||
|
||||
CLB_configGPInputMux(CLB1_BASE, CLB_IN0, CLB_GP_IN_MUX_EXTERNAL);
|
||||
CLB_configGPInputMux(CLB1_BASE, CLB_IN1, CLB_GP_IN_MUX_EXTERNAL);
|
||||
CLB_configGPInputMux(CLB1_BASE, CLB_IN2, CLB_GP_IN_MUX_EXTERNAL);
|
||||
CLB_configGPInputMux(CLB1_BASE, CLB_IN3, CLB_GP_IN_MUX_EXTERNAL);
|
||||
CLB_configGPInputMux(CLB1_BASE, CLB_IN4, CLB_GP_IN_MUX_GP_REG);
|
||||
CLB_configGPInputMux(CLB1_BASE, CLB_IN5, CLB_GP_IN_MUX_GP_REG);
|
||||
CLB_configGPInputMux(CLB1_BASE, CLB_IN6, CLB_GP_IN_MUX_GP_REG);
|
||||
CLB_configGPInputMux(CLB1_BASE, CLB_IN7, CLB_GP_IN_MUX_GP_REG);
|
||||
|
||||
CLB_selectInputFilter(CLB1_BASE, CLB_IN0, CLB_FILTER_FALLING_EDGE);
|
||||
CLB_selectInputFilter(CLB1_BASE, CLB_IN2, CLB_FILTER_FALLING_EDGE);
|
||||
|
||||
// CLB tile 2 configuration
|
||||
CLB_configLocalInputMux(CLB2_BASE, CLB_IN0, CLB_LOCAL_IN_MUX_GLOBAL_IN);
|
||||
CLB_configLocalInputMux(CLB2_BASE, CLB_IN1, CLB_LOCAL_IN_MUX_GLOBAL_IN);
|
||||
CLB_configLocalInputMux(CLB2_BASE, CLB_IN2, CLB_LOCAL_IN_MUX_GLOBAL_IN);
|
||||
CLB_configLocalInputMux(CLB2_BASE, CLB_IN3, CLB_LOCAL_IN_MUX_GLOBAL_IN);
|
||||
CLB_configLocalInputMux(CLB2_BASE, CLB_IN4, CLB_LOCAL_IN_MUX_GLOBAL_IN);
|
||||
CLB_configLocalInputMux(CLB2_BASE, CLB_IN5, CLB_LOCAL_IN_MUX_GLOBAL_IN);
|
||||
CLB_configLocalInputMux(CLB2_BASE, CLB_IN6, CLB_LOCAL_IN_MUX_GLOBAL_IN);
|
||||
CLB_configLocalInputMux(CLB2_BASE, CLB_IN7, CLB_LOCAL_IN_MUX_GLOBAL_IN);
|
||||
|
||||
CLB_configGlobalInputMux(CLB2_BASE, CLB_IN0, CLB_GLOBAL_IN_MUX_EPWM2A);
|
||||
CLB_configGlobalInputMux(CLB2_BASE, CLB_IN1, CLB_GLOBAL_IN_MUX_EPWM2A);
|
||||
CLB_configGlobalInputMux(CLB2_BASE, CLB_IN2, CLB_GLOBAL_IN_MUX_EPWM2B);
|
||||
CLB_configGlobalInputMux(CLB2_BASE, CLB_IN3, CLB_GLOBAL_IN_MUX_EPWM2B);
|
||||
CLB_configGlobalInputMux(CLB2_BASE, CLB_IN4, CLB_GLOBAL_IN_MUX_EPWM2_CTRDIR);
|
||||
CLB_configGlobalInputMux(CLB2_BASE, CLB_IN5, CLB_GLOBAL_IN_MUX_EPWM2_CTRDIR);
|
||||
CLB_configGlobalInputMux(CLB2_BASE, CLB_IN6, CLB_GLOBAL_IN_MUX_EPWM2_CTRDIR);
|
||||
CLB_configGlobalInputMux(CLB2_BASE, CLB_IN7, CLB_GLOBAL_IN_MUX_EPWM2_CTRDIR);
|
||||
|
||||
CLB_configGPInputMux(CLB2_BASE, CLB_IN0, CLB_GP_IN_MUX_EXTERNAL);
|
||||
CLB_configGPInputMux(CLB2_BASE, CLB_IN1, CLB_GP_IN_MUX_EXTERNAL);
|
||||
CLB_configGPInputMux(CLB2_BASE, CLB_IN2, CLB_GP_IN_MUX_EXTERNAL);
|
||||
CLB_configGPInputMux(CLB2_BASE, CLB_IN3, CLB_GP_IN_MUX_EXTERNAL);
|
||||
CLB_configGPInputMux(CLB2_BASE, CLB_IN4, CLB_GP_IN_MUX_GP_REG);
|
||||
CLB_configGPInputMux(CLB2_BASE, CLB_IN5, CLB_GP_IN_MUX_GP_REG);
|
||||
CLB_configGPInputMux(CLB2_BASE, CLB_IN6, CLB_GP_IN_MUX_GP_REG);
|
||||
CLB_configGPInputMux(CLB2_BASE, CLB_IN7, CLB_GP_IN_MUX_GP_REG);
|
||||
|
||||
CLB_selectInputFilter(CLB2_BASE, CLB_IN0, CLB_FILTER_FALLING_EDGE);
|
||||
CLB_selectInputFilter(CLB2_BASE, CLB_IN2, CLB_FILTER_FALLING_EDGE);
|
||||
|
||||
// CLB tile 3 configuration
|
||||
CLB_configLocalInputMux(CLB3_BASE, CLB_IN0, CLB_LOCAL_IN_MUX_GLOBAL_IN);
|
||||
CLB_configLocalInputMux(CLB3_BASE, CLB_IN1, CLB_LOCAL_IN_MUX_GLOBAL_IN);
|
||||
CLB_configLocalInputMux(CLB3_BASE, CLB_IN2, CLB_LOCAL_IN_MUX_GLOBAL_IN);
|
||||
CLB_configLocalInputMux(CLB3_BASE, CLB_IN3, CLB_LOCAL_IN_MUX_GLOBAL_IN);
|
||||
CLB_configLocalInputMux(CLB3_BASE, CLB_IN4, CLB_LOCAL_IN_MUX_GLOBAL_IN);
|
||||
CLB_configLocalInputMux(CLB3_BASE, CLB_IN5, CLB_LOCAL_IN_MUX_GLOBAL_IN);
|
||||
CLB_configLocalInputMux(CLB3_BASE, CLB_IN6, CLB_LOCAL_IN_MUX_GLOBAL_IN);
|
||||
CLB_configLocalInputMux(CLB3_BASE, CLB_IN7, CLB_LOCAL_IN_MUX_GLOBAL_IN);
|
||||
|
||||
CLB_configGlobalInputMux(CLB3_BASE, CLB_IN0, CLB_GLOBAL_IN_MUX_EPWM3A);
|
||||
CLB_configGlobalInputMux(CLB3_BASE, CLB_IN1, CLB_GLOBAL_IN_MUX_EPWM3A);
|
||||
CLB_configGlobalInputMux(CLB3_BASE, CLB_IN2, CLB_GLOBAL_IN_MUX_EPWM3B);
|
||||
CLB_configGlobalInputMux(CLB3_BASE, CLB_IN3, CLB_GLOBAL_IN_MUX_EPWM3B);
|
||||
CLB_configGlobalInputMux(CLB3_BASE, CLB_IN4, CLB_GLOBAL_IN_MUX_EPWM3_CTRDIR);
|
||||
CLB_configGlobalInputMux(CLB3_BASE, CLB_IN5, CLB_GLOBAL_IN_MUX_EPWM3_CTRDIR);
|
||||
CLB_configGlobalInputMux(CLB3_BASE, CLB_IN6, CLB_GLOBAL_IN_MUX_EPWM3_CTRDIR);
|
||||
CLB_configGlobalInputMux(CLB3_BASE, CLB_IN7, CLB_GLOBAL_IN_MUX_EPWM3_CTRDIR);
|
||||
|
||||
CLB_configGPInputMux(CLB3_BASE, CLB_IN0, CLB_GP_IN_MUX_EXTERNAL);
|
||||
CLB_configGPInputMux(CLB3_BASE, CLB_IN1, CLB_GP_IN_MUX_EXTERNAL);
|
||||
CLB_configGPInputMux(CLB3_BASE, CLB_IN2, CLB_GP_IN_MUX_EXTERNAL);
|
||||
CLB_configGPInputMux(CLB3_BASE, CLB_IN3, CLB_GP_IN_MUX_EXTERNAL);
|
||||
CLB_configGPInputMux(CLB3_BASE, CLB_IN4, CLB_GP_IN_MUX_GP_REG);
|
||||
CLB_configGPInputMux(CLB3_BASE, CLB_IN5, CLB_GP_IN_MUX_GP_REG);
|
||||
CLB_configGPInputMux(CLB3_BASE, CLB_IN6, CLB_GP_IN_MUX_GP_REG);
|
||||
CLB_configGPInputMux(CLB3_BASE, CLB_IN7, CLB_GP_IN_MUX_GP_REG);
|
||||
|
||||
CLB_selectInputFilter(CLB3_BASE, CLB_IN0, CLB_FILTER_FALLING_EDGE);
|
||||
CLB_selectInputFilter(CLB3_BASE, CLB_IN2, CLB_FILTER_FALLING_EDGE);
|
||||
|
||||
// CLB tile 4 configuration
|
||||
CLB_configLocalInputMux(CLB4_BASE, CLB_IN0, CLB_LOCAL_IN_MUX_GLOBAL_IN);
|
||||
CLB_configLocalInputMux(CLB4_BASE, CLB_IN1, CLB_LOCAL_IN_MUX_GLOBAL_IN);
|
||||
CLB_configLocalInputMux(CLB4_BASE, CLB_IN2, CLB_LOCAL_IN_MUX_GLOBAL_IN);
|
||||
CLB_configLocalInputMux(CLB4_BASE, CLB_IN3, CLB_LOCAL_IN_MUX_GLOBAL_IN);
|
||||
CLB_configLocalInputMux(CLB4_BASE, CLB_IN4, CLB_LOCAL_IN_MUX_GLOBAL_IN);
|
||||
CLB_configLocalInputMux(CLB4_BASE, CLB_IN5, CLB_LOCAL_IN_MUX_GLOBAL_IN);
|
||||
CLB_configLocalInputMux(CLB4_BASE, CLB_IN6, CLB_LOCAL_IN_MUX_GLOBAL_IN);
|
||||
CLB_configLocalInputMux(CLB4_BASE, CLB_IN7, CLB_LOCAL_IN_MUX_GLOBAL_IN);
|
||||
|
||||
CLB_configGlobalInputMux(CLB4_BASE, CLB_IN0, CLB_GLOBAL_IN_MUX_EPWM4A);
|
||||
CLB_configGlobalInputMux(CLB4_BASE, CLB_IN1, CLB_GLOBAL_IN_MUX_EPWM4A);
|
||||
CLB_configGlobalInputMux(CLB4_BASE, CLB_IN2, CLB_GLOBAL_IN_MUX_EPWM4B);
|
||||
CLB_configGlobalInputMux(CLB4_BASE, CLB_IN3, CLB_GLOBAL_IN_MUX_EPWM4B);
|
||||
CLB_configGlobalInputMux(CLB4_BASE, CLB_IN4, CLB_GLOBAL_IN_MUX_EPWM4_CTRDIR);
|
||||
CLB_configGlobalInputMux(CLB4_BASE, CLB_IN5, CLB_GLOBAL_IN_MUX_EPWM4_CTRDIR);
|
||||
CLB_configGlobalInputMux(CLB4_BASE, CLB_IN6, CLB_GLOBAL_IN_MUX_EPWM4_CTRDIR);
|
||||
CLB_configGlobalInputMux(CLB4_BASE, CLB_IN7, CLB_GLOBAL_IN_MUX_EPWM4_CTRDIR);
|
||||
|
||||
CLB_configGPInputMux(CLB4_BASE, CLB_IN0, CLB_GP_IN_MUX_EXTERNAL);
|
||||
CLB_configGPInputMux(CLB4_BASE, CLB_IN1, CLB_GP_IN_MUX_EXTERNAL);
|
||||
CLB_configGPInputMux(CLB4_BASE, CLB_IN2, CLB_GP_IN_MUX_EXTERNAL);
|
||||
CLB_configGPInputMux(CLB4_BASE, CLB_IN3, CLB_GP_IN_MUX_EXTERNAL);
|
||||
CLB_configGPInputMux(CLB4_BASE, CLB_IN4, CLB_GP_IN_MUX_GP_REG);
|
||||
CLB_configGPInputMux(CLB4_BASE, CLB_IN5, CLB_GP_IN_MUX_GP_REG);
|
||||
CLB_configGPInputMux(CLB4_BASE, CLB_IN6, CLB_GP_IN_MUX_GP_REG);
|
||||
CLB_configGPInputMux(CLB4_BASE, CLB_IN7, CLB_GP_IN_MUX_GP_REG);
|
||||
|
||||
CLB_selectInputFilter(CLB4_BASE, CLB_IN0, CLB_FILTER_FALLING_EDGE);
|
||||
CLB_selectInputFilter(CLB4_BASE, CLB_IN2, CLB_FILTER_FALLING_EDGE);
|
||||
|
||||
// start PWMs
|
||||
EPWM_setTimeBaseCounterMode(EPWM1_BASE, EPWM_COUNTER_MODE_UP);
|
||||
EPWM_setTimeBaseCounterMode(EPWM2_BASE, EPWM_COUNTER_MODE_UP);
|
||||
EPWM_setTimeBaseCounterMode(EPWM3_BASE, EPWM_COUNTER_MODE_UP);
|
||||
EPWM_setTimeBaseCounterMode(EPWM4_BASE, EPWM_COUNTER_MODE_UP);
|
||||
|
||||
Interrupt_enable(INT_EPWM1);
|
||||
EINT;
|
||||
|
||||
while(1)
|
||||
{
|
||||
asm(" NOP");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void initEPWM1()
|
||||
{
|
||||
EPWM_setTimeBasePeriod(EPWM1_BASE, EPWM1_TIMER_TBPRD);
|
||||
EPWM_setPhaseShift(EPWM1_BASE, 0U);
|
||||
EPWM_setTimeBaseCounter(EPWM1_BASE, 0U);
|
||||
|
||||
EPWM_setSyncOutPulseMode(EPWM1_BASE, EPWM_SYNC_OUT_PULSE_ON_COUNTER_ZERO);
|
||||
|
||||
EPWM_setCounterCompareValue(EPWM1_BASE, EPWM_COUNTER_COMPARE_A, EPWM1_CMPA);
|
||||
EPWM_setCounterCompareValue(EPWM1_BASE, EPWM_COUNTER_COMPARE_B, EPWM1_CMPB);
|
||||
|
||||
EPWM_disablePhaseShiftLoad(EPWM1_BASE);
|
||||
EPWM_setClockPrescaler(EPWM1_BASE, EPWM_CLOCK_DIVIDER_1, EPWM_HSCLOCK_DIVIDER_1);
|
||||
|
||||
EPWM_setCounterCompareShadowLoadMode(EPWM1_BASE, EPWM_COUNTER_COMPARE_A, EPWM_COMP_LOAD_ON_CNTR_ZERO);
|
||||
EPWM_setCounterCompareShadowLoadMode(EPWM1_BASE, EPWM_COUNTER_COMPARE_B, EPWM_COMP_LOAD_ON_CNTR_ZERO);
|
||||
|
||||
EPWM_setActionQualifierAction(EPWM1_BASE, EPWM_AQ_OUTPUT_A, EPWM_AQ_OUTPUT_HIGH, EPWM_AQ_OUTPUT_ON_TIMEBASE_ZERO);
|
||||
EPWM_setActionQualifierAction(EPWM1_BASE, EPWM_AQ_OUTPUT_A, EPWM_AQ_OUTPUT_LOW, EPWM_AQ_OUTPUT_ON_TIMEBASE_UP_CMPA);
|
||||
|
||||
EPWM_setActionQualifierAction(EPWM1_BASE, EPWM_AQ_OUTPUT_B, EPWM_AQ_OUTPUT_LOW, EPWM_AQ_OUTPUT_ON_TIMEBASE_ZERO);
|
||||
EPWM_setActionQualifierAction(EPWM1_BASE, EPWM_AQ_OUTPUT_B, EPWM_AQ_OUTPUT_HIGH, EPWM_AQ_OUTPUT_ON_TIMEBASE_UP_CMPB);
|
||||
|
||||
EPWM_setInterruptSource(EPWM1_BASE, EPWM_INT_TBCTR_ZERO);
|
||||
EPWM_enableInterrupt(EPWM1_BASE);
|
||||
EPWM_setInterruptEventCount(EPWM1_BASE, 3U);
|
||||
}
|
||||
|
||||
|
||||
void initEPWM2()
|
||||
{
|
||||
EPWM_setTimeBasePeriod(EPWM2_BASE, EPWM2_TIMER_TBPRD);
|
||||
EPWM_setPhaseShift(EPWM2_BASE, 0U);
|
||||
EPWM_setTimeBaseCounter(EPWM2_BASE, 0U);
|
||||
|
||||
EPWM_enablePhaseShiftLoad(EPWM2_BASE);
|
||||
EPWM_setPhaseShift(EPWM2_BASE, 0U);
|
||||
|
||||
EPWM_setCounterCompareValue(EPWM2_BASE, EPWM_COUNTER_COMPARE_A, EPWM2_CMPA);
|
||||
EPWM_setCounterCompareValue(EPWM2_BASE, EPWM_COUNTER_COMPARE_B, EPWM2_CMPB);
|
||||
|
||||
EPWM_setClockPrescaler(EPWM2_BASE, EPWM_CLOCK_DIVIDER_1, EPWM_HSCLOCK_DIVIDER_1);
|
||||
|
||||
EPWM_setCounterCompareShadowLoadMode(EPWM2_BASE, EPWM_COUNTER_COMPARE_A, EPWM_COMP_LOAD_ON_CNTR_ZERO);
|
||||
EPWM_setCounterCompareShadowLoadMode(EPWM2_BASE, EPWM_COUNTER_COMPARE_B, EPWM_COMP_LOAD_ON_CNTR_ZERO);
|
||||
|
||||
EPWM_setActionQualifierAction(EPWM2_BASE, EPWM_AQ_OUTPUT_A, EPWM_AQ_OUTPUT_HIGH, EPWM_AQ_OUTPUT_ON_TIMEBASE_ZERO);
|
||||
EPWM_setActionQualifierAction(EPWM2_BASE, EPWM_AQ_OUTPUT_A, EPWM_AQ_OUTPUT_LOW, EPWM_AQ_OUTPUT_ON_TIMEBASE_UP_CMPA);
|
||||
|
||||
EPWM_setActionQualifierAction(EPWM2_BASE, EPWM_AQ_OUTPUT_B, EPWM_AQ_OUTPUT_LOW, EPWM_AQ_OUTPUT_ON_TIMEBASE_ZERO);
|
||||
EPWM_setActionQualifierAction(EPWM2_BASE, EPWM_AQ_OUTPUT_B, EPWM_AQ_OUTPUT_HIGH, EPWM_AQ_OUTPUT_ON_TIMEBASE_UP_CMPB);
|
||||
}
|
||||
|
||||
|
||||
void initEPWM3()
|
||||
{
|
||||
EPWM_setTimeBasePeriod(EPWM3_BASE, EPWM3_TIMER_TBPRD);
|
||||
EPWM_setPhaseShift(EPWM3_BASE, 0U);
|
||||
EPWM_setTimeBaseCounter(EPWM3_BASE, 0U);
|
||||
|
||||
EPWM_enablePhaseShiftLoad(EPWM3_BASE);
|
||||
EPWM_setPhaseShift(EPWM3_BASE, 0U);
|
||||
|
||||
EPWM_setCounterCompareValue(EPWM3_BASE, EPWM_COUNTER_COMPARE_A, EPWM3_CMPA);
|
||||
EPWM_setCounterCompareValue(EPWM3_BASE, EPWM_COUNTER_COMPARE_B, EPWM3_CMPB);
|
||||
|
||||
EPWM_setClockPrescaler(EPWM3_BASE, EPWM_CLOCK_DIVIDER_1, EPWM_HSCLOCK_DIVIDER_1);
|
||||
|
||||
EPWM_setCounterCompareShadowLoadMode(EPWM3_BASE, EPWM_COUNTER_COMPARE_A, EPWM_COMP_LOAD_ON_CNTR_ZERO);
|
||||
EPWM_setCounterCompareShadowLoadMode(EPWM3_BASE, EPWM_COUNTER_COMPARE_B, EPWM_COMP_LOAD_ON_CNTR_ZERO);
|
||||
|
||||
EPWM_setActionQualifierAction(EPWM3_BASE, EPWM_AQ_OUTPUT_A, EPWM_AQ_OUTPUT_HIGH, EPWM_AQ_OUTPUT_ON_TIMEBASE_ZERO);
|
||||
EPWM_setActionQualifierAction(EPWM3_BASE, EPWM_AQ_OUTPUT_A, EPWM_AQ_OUTPUT_LOW, EPWM_AQ_OUTPUT_ON_TIMEBASE_UP_CMPA);
|
||||
|
||||
EPWM_setActionQualifierAction(EPWM3_BASE, EPWM_AQ_OUTPUT_B, EPWM_AQ_OUTPUT_LOW, EPWM_AQ_OUTPUT_ON_TIMEBASE_ZERO);
|
||||
EPWM_setActionQualifierAction(EPWM3_BASE, EPWM_AQ_OUTPUT_B, EPWM_AQ_OUTPUT_HIGH, EPWM_AQ_OUTPUT_ON_TIMEBASE_UP_CMPB);
|
||||
}
|
||||
|
||||
|
||||
void initEPWM4()
|
||||
{
|
||||
EPWM_setTimeBasePeriod(EPWM4_BASE, EPWM4_TIMER_TBPRD);
|
||||
EPWM_setPhaseShift(EPWM4_BASE, 0U);
|
||||
EPWM_setTimeBaseCounter(EPWM4_BASE, 0U);
|
||||
|
||||
EPWM_enablePhaseShiftLoad(EPWM4_BASE);
|
||||
EPWM_setPhaseShift(EPWM4_BASE, 0U);
|
||||
|
||||
EPWM_setCounterCompareValue(EPWM4_BASE, EPWM_COUNTER_COMPARE_A, EPWM4_CMPA);
|
||||
EPWM_setCounterCompareValue(EPWM4_BASE, EPWM_COUNTER_COMPARE_B, EPWM4_CMPB);
|
||||
|
||||
EPWM_setClockPrescaler(EPWM4_BASE, EPWM_CLOCK_DIVIDER_1, EPWM_HSCLOCK_DIVIDER_1);
|
||||
|
||||
EPWM_setCounterCompareShadowLoadMode(EPWM4_BASE, EPWM_COUNTER_COMPARE_A, EPWM_COMP_LOAD_ON_CNTR_ZERO);
|
||||
EPWM_setCounterCompareShadowLoadMode(EPWM4_BASE, EPWM_COUNTER_COMPARE_B, EPWM_COMP_LOAD_ON_CNTR_ZERO);
|
||||
|
||||
EPWM_setActionQualifierAction(EPWM4_BASE, EPWM_AQ_OUTPUT_A, EPWM_AQ_OUTPUT_HIGH, EPWM_AQ_OUTPUT_ON_TIMEBASE_ZERO);
|
||||
EPWM_setActionQualifierAction(EPWM4_BASE, EPWM_AQ_OUTPUT_A, EPWM_AQ_OUTPUT_LOW, EPWM_AQ_OUTPUT_ON_TIMEBASE_UP_CMPA);
|
||||
|
||||
EPWM_setActionQualifierAction(EPWM4_BASE, EPWM_AQ_OUTPUT_B, EPWM_AQ_OUTPUT_LOW, EPWM_AQ_OUTPUT_ON_TIMEBASE_ZERO);
|
||||
EPWM_setActionQualifierAction(EPWM4_BASE, EPWM_AQ_OUTPUT_B, EPWM_AQ_OUTPUT_HIGH, EPWM_AQ_OUTPUT_ON_TIMEBASE_UP_CMPB);
|
||||
}
|
||||
|
||||
|
||||
__interrupt void epwm1ISR(void)
|
||||
{
|
||||
EPWM_clearEventTriggerInterruptFlag(EPWM1_BASE);
|
||||
Interrupt_clearACKGroup(INTERRUPT_ACK_GROUP3);
|
||||
|
||||
if (mode == 0)
|
||||
{
|
||||
CLB_setOutputMask(CLB1_BASE, 0x5, false);
|
||||
CLB_setOutputMask(CLB2_BASE, 0x5, false);
|
||||
CLB_setOutputMask(CLB3_BASE, 0x5, false);
|
||||
CLB_setOutputMask(CLB4_BASE, 0x5, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
CLB_setOutputMask(CLB1_BASE, 0x5, true);
|
||||
CLB_setOutputMask(CLB2_BASE, 0x5, true);
|
||||
CLB_setOutputMask(CLB3_BASE, 0x5, true);
|
||||
CLB_setOutputMask(CLB4_BASE, 0x5, true);
|
||||
}
|
||||
asm(" NOP");
|
||||
}
|
||||
|
||||
/* end of file */
|
||||
@@ -0,0 +1,476 @@
|
||||
|
||||
var TILE = scripting.addModule("/utilities/clb_tool/clb_syscfg/source/TILE");
|
||||
var TILE1 = TILE.addInstance();
|
||||
var TILE2 = TILE.addInstance();
|
||||
var TILE3 = TILE.addInstance();
|
||||
var TILE4 = TILE.addInstance();
|
||||
// sim_duration - Duration of the simulation (in Nano Seconds)
|
||||
TILE.sim_duration = 500000;
|
||||
// Name
|
||||
TILE1.$name = "TILE1";
|
||||
// Name
|
||||
TILE1.BOUNDARY.$name = "BOUNDARY0";
|
||||
// in0
|
||||
TILE1.BOUNDARY.in0 = "squareWave";
|
||||
// in1
|
||||
TILE1.BOUNDARY.in1 = "squareWave";
|
||||
// in2
|
||||
TILE1.BOUNDARY.in2 = "squareWave";
|
||||
// in3
|
||||
TILE1.BOUNDARY.in3 = "squareWave";
|
||||
// in_edge2 - Edge detection on the inputs, generates 1 cycle pulse on chosen edges - for simulation purposes only
|
||||
TILE1.BOUNDARY.in_edge2 = "falling edge";
|
||||
// in_edge0 - Edge detection on the inputs, generates 1 cycle pulse on chosen edges - for simulation purposes only
|
||||
TILE1.BOUNDARY.in_edge0 = "falling edge";
|
||||
// in_period0 - Period of the square wave
|
||||
TILE1.BOUNDARY.in_period0 = 1000;
|
||||
// in_duty0 - Duty or ON time of the square wave
|
||||
TILE1.BOUNDARY.in_duty0 = 500;
|
||||
// in_period1 - Period of the square wave
|
||||
TILE1.BOUNDARY.in_period1 = 1000;
|
||||
// in_duty1 - Duty or ON time of the square wave
|
||||
TILE1.BOUNDARY.in_duty1 = 500;
|
||||
// in_period2 - Period of the square wave
|
||||
TILE1.BOUNDARY.in_period2 = 500;
|
||||
// in_duty2 - Duty or ON time of the square wave
|
||||
TILE1.BOUNDARY.in_duty2 = 250;
|
||||
// in_period3 - Period of the square wave
|
||||
TILE1.BOUNDARY.in_period3 = 500;
|
||||
// in_duty3 - Duty or ON time of the square wave
|
||||
TILE1.BOUNDARY.in_duty3 = 250;
|
||||
// Name
|
||||
TILE1.LUT_0.$name = "LUT_0";
|
||||
// Name
|
||||
TILE1.LUT_1.$name = "LUT_1";
|
||||
// i0 - Input 0.
|
||||
TILE1.LUT_1.i0 = "FSM_0.S0";
|
||||
// eqn - Boolean equation on the variables i3,i2,i1,i0 for the LUT output.
|
||||
TILE1.LUT_1.eqn = "~(i0 | i1)";
|
||||
// i1 - Input 1.
|
||||
TILE1.LUT_1.i1 = "BOUNDARY.in0";
|
||||
// Name
|
||||
TILE1.LUT_2.$name = "LUT_2";
|
||||
// i0 - Input 0.
|
||||
TILE1.LUT_2.i0 = "FSM_1.S0";
|
||||
// eqn - Boolean equation on the variables i3,i2,i1,i0 for the LUT output.
|
||||
TILE1.LUT_2.eqn = "~(i0 | i1)";
|
||||
// i1 - Input 1.
|
||||
TILE1.LUT_2.i1 = "BOUNDARY.in2";
|
||||
// Name
|
||||
TILE1.FSM_0.$name = "FSM_0";
|
||||
// e1 - External Input 1.
|
||||
TILE1.FSM_0.e1 = "COUNTER_0.count_match1";
|
||||
// eqn_out - Boolean equation on the variables e1,e0,s1,s0 for the LUT output.
|
||||
TILE1.FSM_0.eqn_out = "~s0";
|
||||
// e0 - External Input 0.
|
||||
TILE1.FSM_0.e0 = "BOUNDARY.in0";
|
||||
// eqn_s0 - Boolean equation on the variables e1,e0,s1,s0 for the S0 output.
|
||||
TILE1.FSM_0.eqn_s0 = "(~s0 & e0) | (s0 & (~e1)) ";
|
||||
// Name
|
||||
TILE1.FSM_1.$name = "FSM_1";
|
||||
// e1 - External Input 1.
|
||||
TILE1.FSM_1.e1 = "COUNTER_1.count_match1";
|
||||
// eqn_s0 - Boolean equation on the variables e1,e0,s1,s0 for the S0 output.
|
||||
TILE1.FSM_1.eqn_s0 = "(~s0 & e0) | (s0 & (~e1)) ";
|
||||
// eqn_out - Boolean equation on the variables e1,e0,s1,s0 for the LUT output.
|
||||
TILE1.FSM_1.eqn_out = "~s0";
|
||||
// e0 - External Input 0.
|
||||
TILE1.FSM_1.e0 = "BOUNDARY.in2";
|
||||
// Name
|
||||
TILE1.FSM_2.$name = "FSM_2";
|
||||
// Name
|
||||
TILE1.COUNTER_0.$name = "COUNTER_0";
|
||||
// reset - Reset the counter to 0 on next clock cycle (triggers low to high)
|
||||
TILE1.COUNTER_0.reset = "FSM_0.OUT";
|
||||
// mode1 - Controls counting direction. High enables count up. Low enables count down.
|
||||
TILE1.COUNTER_0.mode1 = "1";
|
||||
// match1_val - Sets the value of the Match reference 1 register.
|
||||
TILE1.COUNTER_0.match1_val = "10";
|
||||
// mode0 - Enables Counting when high
|
||||
TILE1.COUNTER_0.mode0 = "FSM_0.S0";
|
||||
// Name
|
||||
TILE1.COUNTER_1.$name = "COUNTER_1";
|
||||
// reset - Reset the counter to 0 on next clock cycle (triggers low to high)
|
||||
TILE1.COUNTER_1.reset = "FSM_1.OUT";
|
||||
// mode0 - Enables Counting when high
|
||||
TILE1.COUNTER_1.mode0 = "FSM_1.S0";
|
||||
// match1_val - Sets the value of the Match reference 1 register.
|
||||
TILE1.COUNTER_1.match1_val = "10";
|
||||
// mode1 - Controls counting direction. High enables count up. Low enables count down.
|
||||
TILE1.COUNTER_1.mode1 = "1";
|
||||
// Name
|
||||
TILE1.COUNTER_2.$name = "COUNTER_2";
|
||||
// Name
|
||||
TILE1.OUTLUT_0.$name = "OUTLUT_0";
|
||||
// i1 - Input 1.
|
||||
TILE1.OUTLUT_0.i1 = "BOUNDARY.in1";
|
||||
// i0 - Input 0.
|
||||
TILE1.OUTLUT_0.i0 = "LUT_2.OUT";
|
||||
// i2 - Input 2.
|
||||
TILE1.OUTLUT_0.i2 = "BOUNDARY.in3";
|
||||
// eqn - Boolean equation on the variables i2,i1,i0 for the OUTLUT output.
|
||||
TILE1.OUTLUT_0.eqn = "i0 & (~(i1 & i2)) & i1";
|
||||
// Name
|
||||
TILE1.OUTLUT_1.$name = "OUTLUT_1";
|
||||
// Name
|
||||
TILE1.OUTLUT_2.$name = "OUTLUT_2";
|
||||
// i1 - Input 1.
|
||||
TILE1.OUTLUT_2.i1 = "BOUNDARY.in3";
|
||||
// i0 - Input 0.
|
||||
TILE1.OUTLUT_2.i0 = "LUT_1.OUT";
|
||||
// i2 - Input 2.
|
||||
TILE1.OUTLUT_2.i2 = "BOUNDARY.in1";
|
||||
// eqn - Boolean equation on the variables i2,i1,i0 for the OUTLUT output.
|
||||
TILE1.OUTLUT_2.eqn = "i0 & (~(i1 & i2)) & i1";
|
||||
// Name
|
||||
TILE1.OUTLUT_3.$name = "OUTLUT_3";
|
||||
// eqn - Boolean equation on the variables i2,i1,i0 for the OUTLUT output.
|
||||
TILE1.OUTLUT_3.eqn = "0";
|
||||
// Name
|
||||
TILE1.OUTLUT_4.$name = "OUTLUT_4";
|
||||
// Name
|
||||
TILE1.OUTLUT_5.$name = "OUTLUT_5";
|
||||
// Name
|
||||
TILE1.OUTLUT_6.$name = "OUTLUT_6";
|
||||
// Name
|
||||
TILE1.OUTLUT_7.$name = "OUTLUT_7";
|
||||
// Name
|
||||
TILE1.HLC.$name = "HLC_0";
|
||||
// Name
|
||||
TILE1.HLC.program0.$name = "HLCP_0";
|
||||
// Name
|
||||
TILE1.HLC.program1.$name = "HLCP_1";
|
||||
// Name
|
||||
TILE1.HLC.program2.$name = "HLCP_2";
|
||||
// instruct0
|
||||
TILE1.HLC.program2.instruct0 = "mov r0,c0";
|
||||
// Name
|
||||
TILE1.HLC.program3.$name = "HLCP_3";
|
||||
var clb_run_dynamic_template_clb_h = scripting.addModule("/utilities/clb_tool/clb_syscfg/source/clb_run_dynamic_template_clb_h.js");
|
||||
var clb_run_dynamic_template_clb_c = scripting.addModule("/utilities/clb_tool/clb_syscfg/source/clb_run_dynamic_template_clb_c.js");
|
||||
var clb_run_dynamic_template_clb_sim = scripting.addModule("/utilities/clb_tool/clb_syscfg/source/clb_run_dynamic_template_clb_sim.js");
|
||||
var clb_run_dynamic_template_clb_dot = scripting.addModule("/utilities/clb_tool/clb_syscfg/source/clb_run_dynamic_template_clb_dot.js");
|
||||
// Name
|
||||
TILE2.$name = "TILE2";
|
||||
// Name
|
||||
TILE2.BOUNDARY.$name = "BOUNDARY1";
|
||||
// Name
|
||||
TILE2.LUT_0.$name = "LUT_3";
|
||||
// Name
|
||||
TILE2.LUT_1.$name = "LUT_4";
|
||||
// eqn - Boolean equation on the variables i3,i2,i1,i0 for the LUT output.
|
||||
TILE2.LUT_1.eqn = "~(i0 | i1)";
|
||||
// i0 - Input 0.
|
||||
TILE2.LUT_1.i0 = "FSM_0.S0";
|
||||
// i1 - Input 1.
|
||||
TILE2.LUT_1.i1 = "BOUNDARY.in0";
|
||||
// Name
|
||||
TILE2.LUT_2.$name = "LUT_5";
|
||||
// eqn - Boolean equation on the variables i3,i2,i1,i0 for the LUT output.
|
||||
TILE2.LUT_2.eqn = "~(i0 | i1)";
|
||||
// i1 - Input 1.
|
||||
TILE2.LUT_2.i1 = "BOUNDARY.in2";
|
||||
// i0 - Input 0.
|
||||
TILE2.LUT_2.i0 = "FSM_1.S0";
|
||||
// Name
|
||||
TILE2.FSM_0.$name = "FSM_3";
|
||||
// eqn_out - Boolean equation on the variables e1,e0,s1,s0 for the LUT output.
|
||||
TILE2.FSM_0.eqn_out = "~s0";
|
||||
// e0 - External Input 0.
|
||||
TILE2.FSM_0.e0 = "BOUNDARY.in0";
|
||||
// e1 - External Input 1.
|
||||
TILE2.FSM_0.e1 = "COUNTER_0.count_match1";
|
||||
// eqn_s0 - Boolean equation on the variables e1,e0,s1,s0 for the S0 output.
|
||||
TILE2.FSM_0.eqn_s0 = "(~s0 & e0) | (s0 & (~e1)) ";
|
||||
// Name
|
||||
TILE2.FSM_1.$name = "FSM_4";
|
||||
// eqn_s0 - Boolean equation on the variables e1,e0,s1,s0 for the S0 output.
|
||||
TILE2.FSM_1.eqn_s0 = "(~s0 & e0) | (s0 & (~e1)) ";
|
||||
// eqn_out - Boolean equation on the variables e1,e0,s1,s0 for the LUT output.
|
||||
TILE2.FSM_1.eqn_out = "~s0";
|
||||
// e0 - External Input 0.
|
||||
TILE2.FSM_1.e0 = "BOUNDARY.in2";
|
||||
// e1 - External Input 1.
|
||||
TILE2.FSM_1.e1 = "COUNTER_1.count_match1";
|
||||
// Name
|
||||
TILE2.FSM_2.$name = "FSM_5";
|
||||
// Name
|
||||
TILE2.COUNTER_0.$name = "COUNTER_3";
|
||||
// reset - Reset the counter to 0 on next clock cycle (triggers low to high)
|
||||
TILE2.COUNTER_0.reset = "FSM_0.OUT";
|
||||
// mode0 - Enables Counting when high
|
||||
TILE2.COUNTER_0.mode0 = "FSM_0.S0";
|
||||
// mode1 - Controls counting direction. High enables count up. Low enables count down.
|
||||
TILE2.COUNTER_0.mode1 = "1";
|
||||
// match1_val - Sets the value of the Match reference 1 register.
|
||||
TILE2.COUNTER_0.match1_val = "10";
|
||||
// Name
|
||||
TILE2.COUNTER_1.$name = "COUNTER_4";
|
||||
// reset - Reset the counter to 0 on next clock cycle (triggers low to high)
|
||||
TILE2.COUNTER_1.reset = "FSM_1.OUT";
|
||||
// mode0 - Enables Counting when high
|
||||
TILE2.COUNTER_1.mode0 = "FSM_1.S0";
|
||||
// mode1 - Controls counting direction. High enables count up. Low enables count down.
|
||||
TILE2.COUNTER_1.mode1 = "1";
|
||||
// match1_val - Sets the value of the Match reference 1 register.
|
||||
TILE2.COUNTER_1.match1_val = "10";
|
||||
// Name
|
||||
TILE2.COUNTER_2.$name = "COUNTER_5";
|
||||
// Name
|
||||
TILE2.OUTLUT_0.$name = "OUTLUT_8";
|
||||
// eqn - Boolean equation on the variables i2,i1,i0 for the OUTLUT output.
|
||||
TILE2.OUTLUT_0.eqn = "i0 & (~(i1 & i2)) & i1";
|
||||
// i0 - Input 0.
|
||||
TILE2.OUTLUT_0.i0 = "LUT_2.OUT";
|
||||
// i1 - Input 1.
|
||||
TILE2.OUTLUT_0.i1 = "BOUNDARY.in1";
|
||||
// i2 - Input 2.
|
||||
TILE2.OUTLUT_0.i2 = "BOUNDARY.in3";
|
||||
// Name
|
||||
TILE2.OUTLUT_1.$name = "OUTLUT_9";
|
||||
// Name
|
||||
TILE2.OUTLUT_2.$name = "OUTLUT_10";
|
||||
// eqn - Boolean equation on the variables i2,i1,i0 for the OUTLUT output.
|
||||
TILE2.OUTLUT_2.eqn = "i0 & (~(i1 & i2)) & i1";
|
||||
// i0 - Input 0.
|
||||
TILE2.OUTLUT_2.i0 = "LUT_1.OUT";
|
||||
// i1 - Input 1.
|
||||
TILE2.OUTLUT_2.i1 = "BOUNDARY.in3";
|
||||
// i2 - Input 2.
|
||||
TILE2.OUTLUT_2.i2 = "BOUNDARY.in1";
|
||||
// Name
|
||||
TILE2.OUTLUT_3.$name = "OUTLUT_11";
|
||||
// Name
|
||||
TILE2.OUTLUT_4.$name = "OUTLUT_12";
|
||||
// Name
|
||||
TILE2.OUTLUT_5.$name = "OUTLUT_13";
|
||||
// Name
|
||||
TILE2.OUTLUT_6.$name = "OUTLUT_14";
|
||||
// Name
|
||||
TILE2.OUTLUT_7.$name = "OUTLUT_15";
|
||||
// Name
|
||||
TILE2.HLC.$name = "HLC_1";
|
||||
// Name
|
||||
TILE2.HLC.program0.$name = "HLCP_4";
|
||||
// Name
|
||||
TILE2.HLC.program1.$name = "HLCP_5";
|
||||
// Name
|
||||
TILE2.HLC.program2.$name = "HLCP_6";
|
||||
// Name
|
||||
TILE2.HLC.program3.$name = "HLCP_7";
|
||||
// Name
|
||||
TILE3.$name = "TILE3";
|
||||
// Name
|
||||
TILE3.BOUNDARY.$name = "BOUNDARY2";
|
||||
// Name
|
||||
TILE3.LUT_0.$name = "LUT_6";
|
||||
// Name
|
||||
TILE3.LUT_1.$name = "LUT_7";
|
||||
// eqn - Boolean equation on the variables i3,i2,i1,i0 for the LUT output.
|
||||
TILE3.LUT_1.eqn = "~(i0 | i1)";
|
||||
// i0 - Input 0.
|
||||
TILE3.LUT_1.i0 = "FSM_0.S0";
|
||||
// i1 - Input 1.
|
||||
TILE3.LUT_1.i1 = "BOUNDARY.in0";
|
||||
// Name
|
||||
TILE3.LUT_2.$name = "LUT_8";
|
||||
// eqn - Boolean equation on the variables i3,i2,i1,i0 for the LUT output.
|
||||
TILE3.LUT_2.eqn = "~(i0 | i1)";
|
||||
// i0 - Input 0.
|
||||
TILE3.LUT_2.i0 = "FSM_1.S0";
|
||||
// i1 - Input 1.
|
||||
TILE3.LUT_2.i1 = "BOUNDARY.in2";
|
||||
// Name
|
||||
TILE3.FSM_0.$name = "FSM_6";
|
||||
// eqn_s0 - Boolean equation on the variables e1,e0,s1,s0 for the S0 output.
|
||||
TILE3.FSM_0.eqn_s0 = "(~s0 & e0) | (s0 & (~e1)) ";
|
||||
// eqn_out - Boolean equation on the variables e1,e0,s1,s0 for the LUT output.
|
||||
TILE3.FSM_0.eqn_out = "~s0";
|
||||
// e0 - External Input 0.
|
||||
TILE3.FSM_0.e0 = "BOUNDARY.in0";
|
||||
// e1 - External Input 1.
|
||||
TILE3.FSM_0.e1 = "COUNTER_0.count_match1";
|
||||
// Name
|
||||
TILE3.FSM_1.$name = "FSM_7";
|
||||
// eqn_out - Boolean equation on the variables e1,e0,s1,s0 for the LUT output.
|
||||
TILE3.FSM_1.eqn_out = "~s0";
|
||||
// eqn_s0 - Boolean equation on the variables e1,e0,s1,s0 for the S0 output.
|
||||
TILE3.FSM_1.eqn_s0 = "(~s0 & e0) | (s0 & (~e1)) ";
|
||||
// e0 - External Input 0.
|
||||
TILE3.FSM_1.e0 = "BOUNDARY.in2";
|
||||
// e1 - External Input 1.
|
||||
TILE3.FSM_1.e1 = "COUNTER_1.count_match1";
|
||||
// Name
|
||||
TILE3.FSM_2.$name = "FSM_8";
|
||||
// Name
|
||||
TILE3.COUNTER_0.$name = "COUNTER_6";
|
||||
// reset - Reset the counter to 0 on next clock cycle (triggers low to high)
|
||||
TILE3.COUNTER_0.reset = "FSM_0.OUT";
|
||||
// mode0 - Enables Counting when high
|
||||
TILE3.COUNTER_0.mode0 = "FSM_0.S0";
|
||||
// mode1 - Controls counting direction. High enables count up. Low enables count down.
|
||||
TILE3.COUNTER_0.mode1 = "1";
|
||||
// match1_val - Sets the value of the Match reference 1 register.
|
||||
TILE3.COUNTER_0.match1_val = "10";
|
||||
// Name
|
||||
TILE3.COUNTER_1.$name = "COUNTER_7";
|
||||
// reset - Reset the counter to 0 on next clock cycle (triggers low to high)
|
||||
TILE3.COUNTER_1.reset = "FSM_1.OUT";
|
||||
// mode1 - Controls counting direction. High enables count up. Low enables count down.
|
||||
TILE3.COUNTER_1.mode1 = "1";
|
||||
// match1_val - Sets the value of the Match reference 1 register.
|
||||
TILE3.COUNTER_1.match1_val = "10";
|
||||
// mode0 - Enables Counting when high
|
||||
TILE3.COUNTER_1.mode0 = "FSM_1.S0";
|
||||
// Name
|
||||
TILE3.COUNTER_2.$name = "COUNTER_8";
|
||||
// Name
|
||||
TILE3.OUTLUT_0.$name = "OUTLUT_16";
|
||||
// eqn - Boolean equation on the variables i2,i1,i0 for the OUTLUT output.
|
||||
TILE3.OUTLUT_0.eqn = "i0 & (~(i1 & i2)) & i1";
|
||||
// i0 - Input 0.
|
||||
TILE3.OUTLUT_0.i0 = "LUT_2.OUT";
|
||||
// i1 - Input 1.
|
||||
TILE3.OUTLUT_0.i1 = "BOUNDARY.in1";
|
||||
// i2 - Input 2.
|
||||
TILE3.OUTLUT_0.i2 = "BOUNDARY.in3";
|
||||
// Name
|
||||
TILE3.OUTLUT_1.$name = "OUTLUT_17";
|
||||
// Name
|
||||
TILE3.OUTLUT_2.$name = "OUTLUT_18";
|
||||
// eqn - Boolean equation on the variables i2,i1,i0 for the OUTLUT output.
|
||||
TILE3.OUTLUT_2.eqn = "i0 & (~(i1 & i2)) & i1";
|
||||
// i0 - Input 0.
|
||||
TILE3.OUTLUT_2.i0 = "LUT_1.OUT";
|
||||
// i1 - Input 1.
|
||||
TILE3.OUTLUT_2.i1 = "BOUNDARY.in3";
|
||||
// i2 - Input 2.
|
||||
TILE3.OUTLUT_2.i2 = "BOUNDARY.in1";
|
||||
// Name
|
||||
TILE3.OUTLUT_3.$name = "OUTLUT_19";
|
||||
// Name
|
||||
TILE3.OUTLUT_4.$name = "OUTLUT_20";
|
||||
// Name
|
||||
TILE3.OUTLUT_5.$name = "OUTLUT_21";
|
||||
// Name
|
||||
TILE3.OUTLUT_6.$name = "OUTLUT_22";
|
||||
// Name
|
||||
TILE3.OUTLUT_7.$name = "OUTLUT_23";
|
||||
// Name
|
||||
TILE3.HLC.$name = "HLC_2";
|
||||
// Name
|
||||
TILE3.HLC.program0.$name = "HLCP_8";
|
||||
// Name
|
||||
TILE3.HLC.program1.$name = "HLCP_9";
|
||||
// Name
|
||||
TILE3.HLC.program2.$name = "HLCP_10";
|
||||
// Name
|
||||
TILE3.HLC.program3.$name = "HLCP_11";
|
||||
// Name
|
||||
TILE4.$name = "TILE4";
|
||||
// Name
|
||||
TILE4.BOUNDARY.$name = "BOUNDARY3";
|
||||
// Name
|
||||
TILE4.LUT_0.$name = "LUT_9";
|
||||
// Name
|
||||
TILE4.LUT_1.$name = "LUT_10";
|
||||
// eqn - Boolean equation on the variables i3,i2,i1,i0 for the LUT output.
|
||||
TILE4.LUT_1.eqn = "~(i0 | i1)";
|
||||
// i0 - Input 0.
|
||||
TILE4.LUT_1.i0 = "FSM_0.S0";
|
||||
// i1 - Input 1.
|
||||
TILE4.LUT_1.i1 = "BOUNDARY.in0";
|
||||
// Name
|
||||
TILE4.LUT_2.$name = "LUT_11";
|
||||
// eqn - Boolean equation on the variables i3,i2,i1,i0 for the LUT output.
|
||||
TILE4.LUT_2.eqn = "~(i0 | i1)";
|
||||
// i0 - Input 0.
|
||||
TILE4.LUT_2.i0 = "FSM_1.S0";
|
||||
// i1 - Input 1.
|
||||
TILE4.LUT_2.i1 = "BOUNDARY.in2";
|
||||
// Name
|
||||
TILE4.FSM_0.$name = "FSM_9";
|
||||
// eqn_out - Boolean equation on the variables e1,e0,s1,s0 for the LUT output.
|
||||
TILE4.FSM_0.eqn_out = "~s0";
|
||||
// eqn_s0 - Boolean equation on the variables e1,e0,s1,s0 for the S0 output.
|
||||
TILE4.FSM_0.eqn_s0 = "(~s0 & e0) | (s0 & (~e1)) ";
|
||||
// e0 - External Input 0.
|
||||
TILE4.FSM_0.e0 = "BOUNDARY.in0";
|
||||
// e1 - External Input 1.
|
||||
TILE4.FSM_0.e1 = "COUNTER_0.count_match1";
|
||||
// Name
|
||||
TILE4.FSM_1.$name = "FSM_10";
|
||||
// eqn_out - Boolean equation on the variables e1,e0,s1,s0 for the LUT output.
|
||||
TILE4.FSM_1.eqn_out = "~s0";
|
||||
// eqn_s0 - Boolean equation on the variables e1,e0,s1,s0 for the S0 output.
|
||||
TILE4.FSM_1.eqn_s0 = "(~s0 & e0) | (s0 & (~e1)) ";
|
||||
// e0 - External Input 0.
|
||||
TILE4.FSM_1.e0 = "BOUNDARY.in2";
|
||||
// e1 - External Input 1.
|
||||
TILE4.FSM_1.e1 = "COUNTER_1.count_match1";
|
||||
// Name
|
||||
TILE4.FSM_2.$name = "FSM_11";
|
||||
// Name
|
||||
TILE4.COUNTER_0.$name = "COUNTER_9";
|
||||
// reset - Reset the counter to 0 on next clock cycle (triggers low to high)
|
||||
TILE4.COUNTER_0.reset = "FSM_0.OUT";
|
||||
// mode0 - Enables Counting when high
|
||||
TILE4.COUNTER_0.mode0 = "FSM_0.S0";
|
||||
// mode1 - Controls counting direction. High enables count up. Low enables count down.
|
||||
TILE4.COUNTER_0.mode1 = "1";
|
||||
// match1_val - Sets the value of the Match reference 1 register.
|
||||
TILE4.COUNTER_0.match1_val = "10";
|
||||
// Name
|
||||
TILE4.COUNTER_1.$name = "COUNTER_10";
|
||||
// reset - Reset the counter to 0 on next clock cycle (triggers low to high)
|
||||
TILE4.COUNTER_1.reset = "FSM_1.OUT";
|
||||
// mode0 - Enables Counting when high
|
||||
TILE4.COUNTER_1.mode0 = "FSM_1.S0";
|
||||
// mode1 - Controls counting direction. High enables count up. Low enables count down.
|
||||
TILE4.COUNTER_1.mode1 = "1";
|
||||
// match1_val - Sets the value of the Match reference 1 register.
|
||||
TILE4.COUNTER_1.match1_val = "10";
|
||||
// Name
|
||||
TILE4.COUNTER_2.$name = "COUNTER_11";
|
||||
// Name
|
||||
TILE4.OUTLUT_0.$name = "OUTLUT_24";
|
||||
// eqn - Boolean equation on the variables i2,i1,i0 for the OUTLUT output.
|
||||
TILE4.OUTLUT_0.eqn = "i0 & (~(i1 & i2)) & i1";
|
||||
// i0 - Input 0.
|
||||
TILE4.OUTLUT_0.i0 = "LUT_2.OUT";
|
||||
// i1 - Input 1.
|
||||
TILE4.OUTLUT_0.i1 = "BOUNDARY.in1";
|
||||
// i2 - Input 2.
|
||||
TILE4.OUTLUT_0.i2 = "BOUNDARY.in3";
|
||||
// Name
|
||||
TILE4.OUTLUT_1.$name = "OUTLUT_25";
|
||||
// Name
|
||||
TILE4.OUTLUT_2.$name = "OUTLUT_26";
|
||||
// eqn - Boolean equation on the variables i2,i1,i0 for the OUTLUT output.
|
||||
TILE4.OUTLUT_2.eqn = "i0 & (~(i1 & i2)) & i1";
|
||||
// i0 - Input 0.
|
||||
TILE4.OUTLUT_2.i0 = "LUT_1.OUT";
|
||||
// i1 - Input 1.
|
||||
TILE4.OUTLUT_2.i1 = "BOUNDARY.in3";
|
||||
// i2 - Input 2.
|
||||
TILE4.OUTLUT_2.i2 = "BOUNDARY.in1";
|
||||
// Name
|
||||
TILE4.OUTLUT_3.$name = "OUTLUT_27";
|
||||
// Name
|
||||
TILE4.OUTLUT_4.$name = "OUTLUT_28";
|
||||
// Name
|
||||
TILE4.OUTLUT_5.$name = "OUTLUT_29";
|
||||
// Name
|
||||
TILE4.OUTLUT_6.$name = "OUTLUT_30";
|
||||
// Name
|
||||
TILE4.OUTLUT_7.$name = "OUTLUT_31";
|
||||
// Name
|
||||
TILE4.HLC.$name = "HLC_3";
|
||||
// Name
|
||||
TILE4.HLC.program0.$name = "HLCP_12";
|
||||
// Name
|
||||
TILE4.HLC.program1.$name = "HLCP_13";
|
||||
// Name
|
||||
TILE4.HLC.program2.$name = "HLCP_14";
|
||||
// Name
|
||||
TILE4.HLC.program3.$name = "HLCP_15";
|
||||
@@ -0,0 +1,581 @@
|
||||
//#############################################################################
|
||||
//
|
||||
// FILE: clb_ex5_event_window.c
|
||||
//
|
||||
// TITLE: CLB Event Window.
|
||||
//
|
||||
//! \addtogroup driver_example_list
|
||||
//! <h1>CLB Event Window</h1>
|
||||
//!
|
||||
//! For the detailed description of this example, please refer to:
|
||||
//! C2000Ware_PATH\utilities\clb_tool\clb_syscfg\doc\CLB Tool Users Guide.pdf
|
||||
//!
|
||||
//
|
||||
//
|
||||
//#############################################################################
|
||||
//
|
||||
//
|
||||
// $Copyright:
|
||||
// Copyright (C) 2013-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.
|
||||
// $
|
||||
//#############################################################################
|
||||
|
||||
|
||||
#include "driverlib.h"
|
||||
#include "device.h"
|
||||
#include "clb_config.h"
|
||||
#include "clb.h"
|
||||
|
||||
#define EPWM1_TIMER_TBPRD 20000U
|
||||
#define EPWM1_CMPA 1933U
|
||||
#define EPWM1_CMPB 1933U
|
||||
|
||||
#define EPWM2_TIMER_TBPRD 25000U
|
||||
#define EPWM2_CMPA 1933U
|
||||
#define EPWM2_CMPB 1933U
|
||||
|
||||
#define EPWM3_TIMER_TBPRD 30000U
|
||||
#define EPWM3_CMPA 1933U
|
||||
#define EPWM3_CMPB 1933U
|
||||
|
||||
#define EPWM4_TIMER_TBPRD 35000U
|
||||
#define EPWM4_CMPA 1933U
|
||||
#define EPWM4_CMPB 1933U
|
||||
|
||||
// default interrupt payloads
|
||||
#define ISR1_PAYLOAD 45U
|
||||
#define ISR2_PAYLOAD 45U
|
||||
#define ISR3_PAYLOAD 45U
|
||||
#define ISR4_PAYLOAD 45U
|
||||
|
||||
void initEPWM1(void);
|
||||
void initEPWM2(void);
|
||||
void initEPWM3(void);
|
||||
void initEPWM4(void);
|
||||
|
||||
__interrupt void epwm1ISR(void);
|
||||
__interrupt void epwm2ISR(void);
|
||||
__interrupt void epwm3ISR(void);
|
||||
__interrupt void epwm4ISR(void);
|
||||
__interrupt void clb1ISR(void);
|
||||
__interrupt void clb2ISR(void);
|
||||
__interrupt void clb3ISR(void);
|
||||
__interrupt void clb4ISR(void);
|
||||
|
||||
// GPREG settings:
|
||||
// bit 2 = enable
|
||||
// bit 1 = ISR end flag
|
||||
// bit 0 not used
|
||||
uint32_t gpreg1 = 4;
|
||||
uint32_t gpreg2 = 4;
|
||||
uint32_t gpreg3 = 4;
|
||||
uint32_t gpreg4 = 4;
|
||||
|
||||
uint32_t payload_1 = ISR1_PAYLOAD;
|
||||
uint32_t payload_2 = ISR2_PAYLOAD;
|
||||
uint32_t payload_3 = ISR3_PAYLOAD;
|
||||
uint32_t payload_4 = ISR4_PAYLOAD;
|
||||
|
||||
volatile uint16_t i = 0;
|
||||
bool first_trip_1 = false;
|
||||
bool first_trip_2 = false;
|
||||
bool first_trip_3 = false;
|
||||
bool first_trip_4 = false;
|
||||
|
||||
|
||||
void main(void)
|
||||
{
|
||||
Device_init();
|
||||
Device_initGPIO();
|
||||
|
||||
// map interrupts
|
||||
Interrupt_initModule();
|
||||
Interrupt_initVectorTable();
|
||||
Interrupt_register(INT_EPWM1, &epwm1ISR);
|
||||
Interrupt_register(INT_EPWM2, &epwm2ISR);
|
||||
Interrupt_register(INT_EPWM3, &epwm3ISR);
|
||||
Interrupt_register(INT_EPWM4, &epwm4ISR);
|
||||
Interrupt_register(INT_CLB1, &clb1ISR);
|
||||
Interrupt_register(INT_CLB2, &clb2ISR);
|
||||
Interrupt_register(INT_CLB3, &clb3ISR);
|
||||
Interrupt_register(INT_CLB4, &clb4ISR);
|
||||
|
||||
// GPIO configuration
|
||||
GPIO_setPadConfig(0, GPIO_PIN_TYPE_STD);
|
||||
GPIO_setPinConfig(GPIO_0_EPWM1A);
|
||||
GPIO_setPadConfig(1, GPIO_PIN_TYPE_STD);
|
||||
GPIO_setPinConfig(GPIO_1_EPWM1B);
|
||||
|
||||
GPIO_setPadConfig(2, GPIO_PIN_TYPE_STD);
|
||||
GPIO_setPinConfig(GPIO_2_EPWM2A);
|
||||
GPIO_setPadConfig(3, GPIO_PIN_TYPE_STD);
|
||||
GPIO_setPinConfig(GPIO_3_EPWM2B);
|
||||
|
||||
GPIO_setPadConfig(4, GPIO_PIN_TYPE_STD);
|
||||
GPIO_setPinConfig(GPIO_4_EPWM3A);
|
||||
GPIO_setPadConfig(5, GPIO_PIN_TYPE_STD);
|
||||
GPIO_setPinConfig(GPIO_5_EPWM3B);
|
||||
|
||||
GPIO_setPadConfig(6, GPIO_PIN_TYPE_STD);
|
||||
GPIO_setPinConfig(GPIO_6_EPWM4A);
|
||||
GPIO_setPadConfig(7, GPIO_PIN_TYPE_STD);
|
||||
GPIO_setPinConfig(GPIO_7_EPWM4B);
|
||||
|
||||
// initialize PWMs
|
||||
SysCtl_disablePeripheral(SYSCTL_PERIPH_CLK_TBCLKSYNC);
|
||||
initEPWM1();
|
||||
initEPWM2();
|
||||
initEPWM3();
|
||||
initEPWM4();
|
||||
|
||||
// initialize CLB tiles
|
||||
//SysCtl_enablePeripheral((SysCtl_PeripheralPCLOCKCR)0x0011);
|
||||
SysCtl_enablePeripheral((SysCtl_PeripheralPCLOCKCR)0x0111);
|
||||
SysCtl_enablePeripheral((SysCtl_PeripheralPCLOCKCR)0x0211);
|
||||
SysCtl_enablePeripheral((SysCtl_PeripheralPCLOCKCR)0x0311);
|
||||
|
||||
CLB_enableCLB(CLB1_BASE);
|
||||
CLB_enableCLB(CLB2_BASE);
|
||||
CLB_enableCLB(CLB3_BASE);
|
||||
CLB_enableCLB(CLB4_BASE);
|
||||
initTILE1(CLB1_BASE);
|
||||
initTILE2(CLB2_BASE);
|
||||
initTILE3(CLB3_BASE);
|
||||
initTILE4(CLB4_BASE);
|
||||
|
||||
// CLB tile 1 configuration
|
||||
CLB_selectInputFilter(CLB1_BASE, CLB_IN0, CLB_FILTER_RISING_EDGE);
|
||||
|
||||
CLB_configGPInputMux(CLB1_BASE, CLB_IN0, CLB_GP_IN_MUX_EXTERNAL);
|
||||
CLB_configGPInputMux(CLB1_BASE, CLB_IN1, CLB_GP_IN_MUX_GP_REG);
|
||||
CLB_configGPInputMux(CLB1_BASE, CLB_IN2, CLB_GP_IN_MUX_GP_REG);
|
||||
CLB_configGPInputMux(CLB1_BASE, CLB_IN3, CLB_GP_IN_MUX_GP_REG);
|
||||
CLB_configGPInputMux(CLB1_BASE, CLB_IN4, CLB_GP_IN_MUX_GP_REG);
|
||||
CLB_configGPInputMux(CLB1_BASE, CLB_IN5, CLB_GP_IN_MUX_GP_REG);
|
||||
CLB_configGPInputMux(CLB1_BASE, CLB_IN6, CLB_GP_IN_MUX_GP_REG);
|
||||
CLB_configGPInputMux(CLB1_BASE, CLB_IN7, CLB_GP_IN_MUX_GP_REG);
|
||||
|
||||
CLB_configLocalInputMux(CLB1_BASE, CLB_IN0, CLB_LOCAL_IN_MUX_GLOBAL_IN);
|
||||
CLB_configLocalInputMux(CLB1_BASE, CLB_IN1, CLB_LOCAL_IN_MUX_GLOBAL_IN);
|
||||
CLB_configLocalInputMux(CLB1_BASE, CLB_IN2, CLB_LOCAL_IN_MUX_GLOBAL_IN);
|
||||
CLB_configLocalInputMux(CLB1_BASE, CLB_IN3, CLB_LOCAL_IN_MUX_GLOBAL_IN);
|
||||
CLB_configLocalInputMux(CLB1_BASE, CLB_IN4, CLB_LOCAL_IN_MUX_GLOBAL_IN);
|
||||
CLB_configLocalInputMux(CLB1_BASE, CLB_IN5, CLB_LOCAL_IN_MUX_GLOBAL_IN);
|
||||
CLB_configLocalInputMux(CLB1_BASE, CLB_IN6, CLB_LOCAL_IN_MUX_GLOBAL_IN);
|
||||
CLB_configLocalInputMux(CLB1_BASE, CLB_IN7, CLB_LOCAL_IN_MUX_GLOBAL_IN);
|
||||
|
||||
CLB_configGlobalInputMux(CLB1_BASE, CLB_IN0, CLB_GLOBAL_IN_MUX_EPWM1A);
|
||||
CLB_configGlobalInputMux(CLB1_BASE, CLB_IN1, CLB_GLOBAL_IN_MUX_EPWM1A);
|
||||
CLB_configGlobalInputMux(CLB1_BASE, CLB_IN2, CLB_GLOBAL_IN_MUX_EPWM1B);
|
||||
CLB_configGlobalInputMux(CLB1_BASE, CLB_IN3, CLB_GLOBAL_IN_MUX_EPWM1B);
|
||||
CLB_configGlobalInputMux(CLB1_BASE, CLB_IN4, CLB_GLOBAL_IN_MUX_EPWM1_CTRDIR);
|
||||
CLB_configGlobalInputMux(CLB1_BASE, CLB_IN5, CLB_GLOBAL_IN_MUX_EPWM1_CTRDIR);
|
||||
CLB_configGlobalInputMux(CLB1_BASE, CLB_IN6, CLB_GLOBAL_IN_MUX_EPWM1_CTRDIR);
|
||||
CLB_configGlobalInputMux(CLB1_BASE, CLB_IN7, CLB_GLOBAL_IN_MUX_EPWM1_CTRDIR);
|
||||
|
||||
// CLB tile 2 configuration
|
||||
CLB_selectInputFilter(CLB2_BASE, CLB_IN0, CLB_FILTER_RISING_EDGE);
|
||||
|
||||
CLB_configGPInputMux(CLB2_BASE, CLB_IN0, CLB_GP_IN_MUX_EXTERNAL);
|
||||
CLB_configGPInputMux(CLB2_BASE, CLB_IN1, CLB_GP_IN_MUX_GP_REG);
|
||||
CLB_configGPInputMux(CLB2_BASE, CLB_IN2, CLB_GP_IN_MUX_GP_REG);
|
||||
CLB_configGPInputMux(CLB2_BASE, CLB_IN3, CLB_GP_IN_MUX_GP_REG);
|
||||
CLB_configGPInputMux(CLB2_BASE, CLB_IN4, CLB_GP_IN_MUX_GP_REG);
|
||||
CLB_configGPInputMux(CLB2_BASE, CLB_IN5, CLB_GP_IN_MUX_GP_REG);
|
||||
CLB_configGPInputMux(CLB2_BASE, CLB_IN6, CLB_GP_IN_MUX_GP_REG);
|
||||
CLB_configGPInputMux(CLB2_BASE, CLB_IN7, CLB_GP_IN_MUX_GP_REG);
|
||||
|
||||
CLB_configLocalInputMux(CLB2_BASE, CLB_IN0, CLB_LOCAL_IN_MUX_GLOBAL_IN);
|
||||
CLB_configLocalInputMux(CLB2_BASE, CLB_IN1, CLB_LOCAL_IN_MUX_GLOBAL_IN);
|
||||
CLB_configLocalInputMux(CLB2_BASE, CLB_IN2, CLB_LOCAL_IN_MUX_GLOBAL_IN);
|
||||
CLB_configLocalInputMux(CLB2_BASE, CLB_IN3, CLB_LOCAL_IN_MUX_GLOBAL_IN);
|
||||
CLB_configLocalInputMux(CLB2_BASE, CLB_IN4, CLB_LOCAL_IN_MUX_GLOBAL_IN);
|
||||
CLB_configLocalInputMux(CLB2_BASE, CLB_IN5, CLB_LOCAL_IN_MUX_GLOBAL_IN);
|
||||
CLB_configLocalInputMux(CLB2_BASE, CLB_IN6, CLB_LOCAL_IN_MUX_GLOBAL_IN);
|
||||
CLB_configLocalInputMux(CLB2_BASE, CLB_IN7, CLB_LOCAL_IN_MUX_GLOBAL_IN);
|
||||
|
||||
CLB_configGlobalInputMux(CLB2_BASE, CLB_IN0, CLB_GLOBAL_IN_MUX_EPWM2A);
|
||||
CLB_configGlobalInputMux(CLB2_BASE, CLB_IN1, CLB_GLOBAL_IN_MUX_EPWM2A);
|
||||
CLB_configGlobalInputMux(CLB2_BASE, CLB_IN2, CLB_GLOBAL_IN_MUX_EPWM2B);
|
||||
CLB_configGlobalInputMux(CLB2_BASE, CLB_IN3, CLB_GLOBAL_IN_MUX_EPWM2B);
|
||||
CLB_configGlobalInputMux(CLB2_BASE, CLB_IN4, CLB_GLOBAL_IN_MUX_EPWM2_CTRDIR);
|
||||
CLB_configGlobalInputMux(CLB2_BASE, CLB_IN5, CLB_GLOBAL_IN_MUX_EPWM2_CTRDIR);
|
||||
CLB_configGlobalInputMux(CLB2_BASE, CLB_IN6, CLB_GLOBAL_IN_MUX_EPWM2_CTRDIR);
|
||||
CLB_configGlobalInputMux(CLB2_BASE, CLB_IN7, CLB_GLOBAL_IN_MUX_EPWM2_CTRDIR);
|
||||
|
||||
// CLB tile 3 configuration
|
||||
CLB_selectInputFilter(CLB3_BASE, CLB_IN0, CLB_FILTER_RISING_EDGE);
|
||||
|
||||
CLB_configGPInputMux(CLB3_BASE, CLB_IN0, CLB_GP_IN_MUX_EXTERNAL);
|
||||
CLB_configGPInputMux(CLB3_BASE, CLB_IN1, CLB_GP_IN_MUX_GP_REG);
|
||||
CLB_configGPInputMux(CLB3_BASE, CLB_IN2, CLB_GP_IN_MUX_GP_REG);
|
||||
CLB_configGPInputMux(CLB3_BASE, CLB_IN3, CLB_GP_IN_MUX_GP_REG);
|
||||
CLB_configGPInputMux(CLB3_BASE, CLB_IN4, CLB_GP_IN_MUX_GP_REG);
|
||||
CLB_configGPInputMux(CLB3_BASE, CLB_IN5, CLB_GP_IN_MUX_GP_REG);
|
||||
CLB_configGPInputMux(CLB3_BASE, CLB_IN6, CLB_GP_IN_MUX_GP_REG);
|
||||
CLB_configGPInputMux(CLB3_BASE, CLB_IN7, CLB_GP_IN_MUX_GP_REG);
|
||||
|
||||
CLB_configLocalInputMux(CLB3_BASE, CLB_IN0, CLB_LOCAL_IN_MUX_GLOBAL_IN);
|
||||
CLB_configLocalInputMux(CLB3_BASE, CLB_IN1, CLB_LOCAL_IN_MUX_GLOBAL_IN);
|
||||
CLB_configLocalInputMux(CLB3_BASE, CLB_IN2, CLB_LOCAL_IN_MUX_GLOBAL_IN);
|
||||
CLB_configLocalInputMux(CLB3_BASE, CLB_IN3, CLB_LOCAL_IN_MUX_GLOBAL_IN);
|
||||
CLB_configLocalInputMux(CLB3_BASE, CLB_IN4, CLB_LOCAL_IN_MUX_GLOBAL_IN);
|
||||
CLB_configLocalInputMux(CLB3_BASE, CLB_IN5, CLB_LOCAL_IN_MUX_GLOBAL_IN);
|
||||
CLB_configLocalInputMux(CLB3_BASE, CLB_IN6, CLB_LOCAL_IN_MUX_GLOBAL_IN);
|
||||
CLB_configLocalInputMux(CLB3_BASE, CLB_IN7, CLB_LOCAL_IN_MUX_GLOBAL_IN);
|
||||
|
||||
CLB_configGlobalInputMux(CLB3_BASE, CLB_IN0, CLB_GLOBAL_IN_MUX_EPWM3A);
|
||||
CLB_configGlobalInputMux(CLB3_BASE, CLB_IN1, CLB_GLOBAL_IN_MUX_EPWM3A);
|
||||
CLB_configGlobalInputMux(CLB3_BASE, CLB_IN2, CLB_GLOBAL_IN_MUX_EPWM3B);
|
||||
CLB_configGlobalInputMux(CLB3_BASE, CLB_IN3, CLB_GLOBAL_IN_MUX_EPWM3B);
|
||||
CLB_configGlobalInputMux(CLB3_BASE, CLB_IN4, CLB_GLOBAL_IN_MUX_EPWM3_CTRDIR);
|
||||
CLB_configGlobalInputMux(CLB3_BASE, CLB_IN5, CLB_GLOBAL_IN_MUX_EPWM3_CTRDIR);
|
||||
CLB_configGlobalInputMux(CLB3_BASE, CLB_IN6, CLB_GLOBAL_IN_MUX_EPWM3_CTRDIR);
|
||||
CLB_configGlobalInputMux(CLB3_BASE, CLB_IN7, CLB_GLOBAL_IN_MUX_EPWM3_CTRDIR);
|
||||
|
||||
// CLB tile 4 configuration
|
||||
CLB_selectInputFilter(CLB4_BASE, CLB_IN0, CLB_FILTER_RISING_EDGE);
|
||||
|
||||
CLB_configGPInputMux(CLB4_BASE, CLB_IN0, CLB_GP_IN_MUX_EXTERNAL);
|
||||
CLB_configGPInputMux(CLB4_BASE, CLB_IN1, CLB_GP_IN_MUX_GP_REG);
|
||||
CLB_configGPInputMux(CLB4_BASE, CLB_IN2, CLB_GP_IN_MUX_GP_REG);
|
||||
CLB_configGPInputMux(CLB4_BASE, CLB_IN3, CLB_GP_IN_MUX_GP_REG);
|
||||
CLB_configGPInputMux(CLB4_BASE, CLB_IN4, CLB_GP_IN_MUX_GP_REG);
|
||||
CLB_configGPInputMux(CLB4_BASE, CLB_IN5, CLB_GP_IN_MUX_GP_REG);
|
||||
CLB_configGPInputMux(CLB4_BASE, CLB_IN6, CLB_GP_IN_MUX_GP_REG);
|
||||
CLB_configGPInputMux(CLB4_BASE, CLB_IN7, CLB_GP_IN_MUX_GP_REG);
|
||||
|
||||
CLB_configLocalInputMux(CLB4_BASE, CLB_IN0, CLB_LOCAL_IN_MUX_GLOBAL_IN);
|
||||
CLB_configLocalInputMux(CLB4_BASE, CLB_IN1, CLB_LOCAL_IN_MUX_GLOBAL_IN);
|
||||
CLB_configLocalInputMux(CLB4_BASE, CLB_IN2, CLB_LOCAL_IN_MUX_GLOBAL_IN);
|
||||
CLB_configLocalInputMux(CLB4_BASE, CLB_IN3, CLB_LOCAL_IN_MUX_GLOBAL_IN);
|
||||
CLB_configLocalInputMux(CLB4_BASE, CLB_IN4, CLB_LOCAL_IN_MUX_GLOBAL_IN);
|
||||
CLB_configLocalInputMux(CLB4_BASE, CLB_IN5, CLB_LOCAL_IN_MUX_GLOBAL_IN);
|
||||
CLB_configLocalInputMux(CLB4_BASE, CLB_IN6, CLB_LOCAL_IN_MUX_GLOBAL_IN);
|
||||
CLB_configLocalInputMux(CLB4_BASE, CLB_IN7, CLB_LOCAL_IN_MUX_GLOBAL_IN);
|
||||
|
||||
CLB_configGlobalInputMux(CLB4_BASE, CLB_IN0, CLB_GLOBAL_IN_MUX_EPWM4A);
|
||||
CLB_configGlobalInputMux(CLB4_BASE, CLB_IN1, CLB_GLOBAL_IN_MUX_EPWM4A);
|
||||
CLB_configGlobalInputMux(CLB4_BASE, CLB_IN2, CLB_GLOBAL_IN_MUX_EPWM4B);
|
||||
CLB_configGlobalInputMux(CLB4_BASE, CLB_IN3, CLB_GLOBAL_IN_MUX_EPWM4B);
|
||||
CLB_configGlobalInputMux(CLB4_BASE, CLB_IN4, CLB_GLOBAL_IN_MUX_EPWM4_CTRDIR);
|
||||
CLB_configGlobalInputMux(CLB4_BASE, CLB_IN5, CLB_GLOBAL_IN_MUX_EPWM4_CTRDIR);
|
||||
CLB_configGlobalInputMux(CLB4_BASE, CLB_IN6, CLB_GLOBAL_IN_MUX_EPWM4_CTRDIR);
|
||||
CLB_configGlobalInputMux(CLB4_BASE, CLB_IN7, CLB_GLOBAL_IN_MUX_EPWM4_CTRDIR);
|
||||
|
||||
// enable interrupts
|
||||
Interrupt_enable(INT_EPWM1);
|
||||
Interrupt_enable(INT_EPWM2);
|
||||
Interrupt_enable(INT_EPWM3);
|
||||
Interrupt_enable(INT_EPWM4);
|
||||
Interrupt_enable(INT_CLB1);
|
||||
Interrupt_enable(INT_CLB2);
|
||||
Interrupt_enable(INT_CLB3);
|
||||
Interrupt_enable(INT_CLB4);
|
||||
EINT;
|
||||
|
||||
// enable CLB counters
|
||||
HWREG(0x3100) = 0x6;
|
||||
HWREG(0x3500) = 0x6;
|
||||
HWREG(0x3900) = 0x6;
|
||||
HWREG(0x3D00) = 0x6;
|
||||
CLB_setGPREG(CLB1_BASE, gpreg1);
|
||||
CLB_setGPREG(CLB2_BASE, gpreg2);
|
||||
CLB_setGPREG(CLB3_BASE, gpreg3);
|
||||
CLB_setGPREG(CLB4_BASE, gpreg4);
|
||||
|
||||
// start PWMs
|
||||
EPWM_setTimeBaseCounterMode(EPWM1_BASE, EPWM_COUNTER_MODE_UP);
|
||||
EPWM_setTimeBaseCounterMode(EPWM2_BASE, EPWM_COUNTER_MODE_UP);
|
||||
EPWM_setTimeBaseCounterMode(EPWM3_BASE, EPWM_COUNTER_MODE_UP);
|
||||
EPWM_setTimeBaseCounterMode(EPWM4_BASE, EPWM_COUNTER_MODE_UP);
|
||||
SysCtl_enablePeripheral(SYSCTL_PERIPH_CLK_TBCLKSYNC);
|
||||
|
||||
while(1)
|
||||
{
|
||||
asm(" NOP");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//--- PWM initialization ---
|
||||
|
||||
void initEPWM1()
|
||||
{
|
||||
EPWM_setTimeBasePeriod(EPWM1_BASE, EPWM1_TIMER_TBPRD);
|
||||
EPWM_setPhaseShift(EPWM1_BASE, 0U);
|
||||
EPWM_setTimeBaseCounter(EPWM1_BASE, 0U);
|
||||
|
||||
EPWM_setSyncOutPulseMode(EPWM1_BASE, EPWM_SYNC_OUT_PULSE_ON_COUNTER_ZERO);
|
||||
|
||||
EPWM_setCounterCompareValue(EPWM1_BASE, EPWM_COUNTER_COMPARE_A, EPWM1_CMPA);
|
||||
EPWM_setCounterCompareValue(EPWM1_BASE, EPWM_COUNTER_COMPARE_B, EPWM1_CMPB);
|
||||
|
||||
EPWM_disablePhaseShiftLoad(EPWM1_BASE);
|
||||
EPWM_setClockPrescaler(EPWM1_BASE, EPWM_CLOCK_DIVIDER_1, EPWM_HSCLOCK_DIVIDER_1);
|
||||
|
||||
EPWM_setCounterCompareShadowLoadMode(EPWM1_BASE, EPWM_COUNTER_COMPARE_A, EPWM_COMP_LOAD_ON_CNTR_ZERO);
|
||||
EPWM_setCounterCompareShadowLoadMode(EPWM1_BASE, EPWM_COUNTER_COMPARE_B, EPWM_COMP_LOAD_ON_CNTR_ZERO);
|
||||
|
||||
EPWM_setActionQualifierAction(EPWM1_BASE, EPWM_AQ_OUTPUT_A, EPWM_AQ_OUTPUT_HIGH, EPWM_AQ_OUTPUT_ON_TIMEBASE_ZERO);
|
||||
EPWM_setActionQualifierAction(EPWM1_BASE, EPWM_AQ_OUTPUT_A, EPWM_AQ_OUTPUT_LOW, EPWM_AQ_OUTPUT_ON_TIMEBASE_UP_CMPA);
|
||||
|
||||
EPWM_setActionQualifierAction(EPWM1_BASE, EPWM_AQ_OUTPUT_B, EPWM_AQ_OUTPUT_LOW, EPWM_AQ_OUTPUT_ON_TIMEBASE_ZERO);
|
||||
EPWM_setActionQualifierAction(EPWM1_BASE, EPWM_AQ_OUTPUT_B, EPWM_AQ_OUTPUT_HIGH, EPWM_AQ_OUTPUT_ON_TIMEBASE_UP_CMPB);
|
||||
|
||||
EPWM_setInterruptSource(EPWM1_BASE, EPWM_INT_TBCTR_ZERO);
|
||||
EPWM_enableInterrupt(EPWM1_BASE);
|
||||
EPWM_setInterruptEventCount(EPWM1_BASE, 1U);
|
||||
}
|
||||
|
||||
|
||||
void initEPWM2()
|
||||
{
|
||||
EPWM_setTimeBasePeriod(EPWM2_BASE, EPWM2_TIMER_TBPRD);
|
||||
EPWM_setPhaseShift(EPWM2_BASE, 0U);
|
||||
EPWM_setTimeBaseCounter(EPWM2_BASE, 0U);
|
||||
|
||||
EPWM_disablePhaseShiftLoad(EPWM2_BASE);
|
||||
EPWM_setPhaseShift(EPWM2_BASE, 0U);
|
||||
|
||||
EPWM_setCounterCompareValue(EPWM2_BASE, EPWM_COUNTER_COMPARE_A, EPWM2_CMPA);
|
||||
EPWM_setCounterCompareValue(EPWM2_BASE, EPWM_COUNTER_COMPARE_B, EPWM2_CMPB);
|
||||
|
||||
EPWM_setClockPrescaler(EPWM2_BASE, EPWM_CLOCK_DIVIDER_1, EPWM_HSCLOCK_DIVIDER_1);
|
||||
|
||||
EPWM_setCounterCompareShadowLoadMode(EPWM2_BASE, EPWM_COUNTER_COMPARE_A, EPWM_COMP_LOAD_ON_CNTR_ZERO);
|
||||
EPWM_setCounterCompareShadowLoadMode(EPWM2_BASE, EPWM_COUNTER_COMPARE_B, EPWM_COMP_LOAD_ON_CNTR_ZERO);
|
||||
|
||||
EPWM_setActionQualifierAction(EPWM2_BASE, EPWM_AQ_OUTPUT_A, EPWM_AQ_OUTPUT_HIGH, EPWM_AQ_OUTPUT_ON_TIMEBASE_ZERO);
|
||||
EPWM_setActionQualifierAction(EPWM2_BASE, EPWM_AQ_OUTPUT_A, EPWM_AQ_OUTPUT_LOW, EPWM_AQ_OUTPUT_ON_TIMEBASE_UP_CMPA);
|
||||
|
||||
EPWM_setActionQualifierAction(EPWM2_BASE, EPWM_AQ_OUTPUT_B, EPWM_AQ_OUTPUT_LOW, EPWM_AQ_OUTPUT_ON_TIMEBASE_ZERO);
|
||||
EPWM_setActionQualifierAction(EPWM2_BASE, EPWM_AQ_OUTPUT_B, EPWM_AQ_OUTPUT_HIGH, EPWM_AQ_OUTPUT_ON_TIMEBASE_UP_CMPB);
|
||||
|
||||
EPWM_setInterruptSource(EPWM2_BASE, EPWM_INT_TBCTR_ZERO);
|
||||
EPWM_enableInterrupt(EPWM2_BASE);
|
||||
EPWM_setInterruptEventCount(EPWM2_BASE, 1U);
|
||||
}
|
||||
|
||||
|
||||
void initEPWM3()
|
||||
{
|
||||
EPWM_setTimeBasePeriod(EPWM3_BASE, EPWM3_TIMER_TBPRD);
|
||||
EPWM_setPhaseShift(EPWM3_BASE, 0U);
|
||||
EPWM_setTimeBaseCounter(EPWM3_BASE, 0U);
|
||||
|
||||
EPWM_disablePhaseShiftLoad(EPWM3_BASE);
|
||||
EPWM_setPhaseShift(EPWM3_BASE, 0U);
|
||||
|
||||
EPWM_setCounterCompareValue(EPWM3_BASE, EPWM_COUNTER_COMPARE_A, EPWM3_CMPA);
|
||||
EPWM_setCounterCompareValue(EPWM3_BASE, EPWM_COUNTER_COMPARE_B, EPWM3_CMPB);
|
||||
|
||||
EPWM_setClockPrescaler(EPWM3_BASE, EPWM_CLOCK_DIVIDER_1, EPWM_HSCLOCK_DIVIDER_1);
|
||||
|
||||
EPWM_setCounterCompareShadowLoadMode(EPWM3_BASE, EPWM_COUNTER_COMPARE_A, EPWM_COMP_LOAD_ON_CNTR_ZERO);
|
||||
EPWM_setCounterCompareShadowLoadMode(EPWM3_BASE, EPWM_COUNTER_COMPARE_B, EPWM_COMP_LOAD_ON_CNTR_ZERO);
|
||||
|
||||
EPWM_setActionQualifierAction(EPWM3_BASE, EPWM_AQ_OUTPUT_A, EPWM_AQ_OUTPUT_HIGH, EPWM_AQ_OUTPUT_ON_TIMEBASE_ZERO);
|
||||
EPWM_setActionQualifierAction(EPWM3_BASE, EPWM_AQ_OUTPUT_A, EPWM_AQ_OUTPUT_LOW, EPWM_AQ_OUTPUT_ON_TIMEBASE_UP_CMPA);
|
||||
|
||||
EPWM_setActionQualifierAction(EPWM3_BASE, EPWM_AQ_OUTPUT_B, EPWM_AQ_OUTPUT_LOW, EPWM_AQ_OUTPUT_ON_TIMEBASE_ZERO);
|
||||
EPWM_setActionQualifierAction(EPWM3_BASE, EPWM_AQ_OUTPUT_B, EPWM_AQ_OUTPUT_HIGH, EPWM_AQ_OUTPUT_ON_TIMEBASE_UP_CMPB);
|
||||
|
||||
EPWM_setInterruptSource(EPWM3_BASE, EPWM_INT_TBCTR_ZERO);
|
||||
EPWM_enableInterrupt(EPWM3_BASE);
|
||||
EPWM_setInterruptEventCount(EPWM3_BASE, 1U);
|
||||
}
|
||||
|
||||
|
||||
void initEPWM4()
|
||||
{
|
||||
EPWM_setTimeBasePeriod(EPWM4_BASE, EPWM4_TIMER_TBPRD);
|
||||
EPWM_setPhaseShift(EPWM4_BASE, 0U);
|
||||
EPWM_setTimeBaseCounter(EPWM4_BASE, 0U);
|
||||
|
||||
EPWM_disablePhaseShiftLoad(EPWM4_BASE);
|
||||
EPWM_setPhaseShift(EPWM4_BASE, 0U);
|
||||
|
||||
EPWM_setCounterCompareValue(EPWM4_BASE, EPWM_COUNTER_COMPARE_A, EPWM4_CMPA);
|
||||
EPWM_setCounterCompareValue(EPWM4_BASE, EPWM_COUNTER_COMPARE_B, EPWM4_CMPB);
|
||||
|
||||
EPWM_setClockPrescaler(EPWM4_BASE, EPWM_CLOCK_DIVIDER_1, EPWM_HSCLOCK_DIVIDER_1);
|
||||
|
||||
EPWM_setCounterCompareShadowLoadMode(EPWM4_BASE, EPWM_COUNTER_COMPARE_A, EPWM_COMP_LOAD_ON_CNTR_ZERO);
|
||||
EPWM_setCounterCompareShadowLoadMode(EPWM4_BASE, EPWM_COUNTER_COMPARE_B, EPWM_COMP_LOAD_ON_CNTR_ZERO);
|
||||
|
||||
EPWM_setActionQualifierAction(EPWM4_BASE, EPWM_AQ_OUTPUT_A, EPWM_AQ_OUTPUT_HIGH, EPWM_AQ_OUTPUT_ON_TIMEBASE_ZERO);
|
||||
EPWM_setActionQualifierAction(EPWM4_BASE, EPWM_AQ_OUTPUT_A, EPWM_AQ_OUTPUT_LOW, EPWM_AQ_OUTPUT_ON_TIMEBASE_UP_CMPA);
|
||||
|
||||
EPWM_setActionQualifierAction(EPWM4_BASE, EPWM_AQ_OUTPUT_B, EPWM_AQ_OUTPUT_LOW, EPWM_AQ_OUTPUT_ON_TIMEBASE_ZERO);
|
||||
EPWM_setActionQualifierAction(EPWM4_BASE, EPWM_AQ_OUTPUT_B, EPWM_AQ_OUTPUT_HIGH, EPWM_AQ_OUTPUT_ON_TIMEBASE_UP_CMPB);
|
||||
|
||||
EPWM_setInterruptSource(EPWM4_BASE, EPWM_INT_TBCTR_ZERO);
|
||||
EPWM_enableInterrupt(EPWM4_BASE);
|
||||
EPWM_setInterruptEventCount(EPWM4_BASE, 1U);
|
||||
}
|
||||
|
||||
|
||||
//--- interrupt service routines ---
|
||||
|
||||
__interrupt void epwm1ISR(void)
|
||||
{
|
||||
EPWM_clearEventTriggerInterruptFlag(EPWM1_BASE);
|
||||
Interrupt_clearACKGroup(INTERRUPT_ACK_GROUP3);
|
||||
|
||||
// ISR payload
|
||||
for (i=0; i<payload_1; i++)
|
||||
{
|
||||
asm(" NOP");
|
||||
}
|
||||
|
||||
// pulse GPREG bit 2 to indicate ISR finished
|
||||
CLB_setGPREG(CLB1_BASE, gpreg1 | 0x00000002);
|
||||
asm(" NOP");
|
||||
CLB_setGPREG(CLB1_BASE, gpreg1);
|
||||
}
|
||||
|
||||
|
||||
__interrupt void epwm2ISR(void)
|
||||
{
|
||||
EPWM_clearEventTriggerInterruptFlag(EPWM2_BASE);
|
||||
Interrupt_clearACKGroup(INTERRUPT_ACK_GROUP3);
|
||||
|
||||
// ISR payload
|
||||
for (i=0; i<payload_2; i++)
|
||||
{
|
||||
asm(" NOP");
|
||||
}
|
||||
|
||||
// pulse GPREG bit 2 to indicate ISR finished
|
||||
CLB_setGPREG(CLB2_BASE, gpreg2 | 0x00000002);
|
||||
asm(" NOP");
|
||||
CLB_setGPREG(CLB2_BASE, gpreg2);
|
||||
}
|
||||
|
||||
|
||||
__interrupt void epwm3ISR(void)
|
||||
{
|
||||
EPWM_clearEventTriggerInterruptFlag(EPWM3_BASE);
|
||||
Interrupt_clearACKGroup(INTERRUPT_ACK_GROUP3);
|
||||
|
||||
// ISR payload
|
||||
for (i=0; i<payload_3; i++)
|
||||
{
|
||||
asm(" NOP");
|
||||
}
|
||||
|
||||
// pulse GPREG bit 2 to indicate ISR finished
|
||||
CLB_setGPREG(CLB3_BASE, gpreg3 | 0x00000002);
|
||||
asm(" NOP");
|
||||
CLB_setGPREG(CLB3_BASE, gpreg3);
|
||||
}
|
||||
|
||||
|
||||
__interrupt void epwm4ISR(void)
|
||||
{
|
||||
EPWM_clearEventTriggerInterruptFlag(EPWM4_BASE);
|
||||
Interrupt_clearACKGroup(INTERRUPT_ACK_GROUP3);
|
||||
|
||||
// ISR payload
|
||||
for (i=0; i<payload_4; i++)
|
||||
{
|
||||
asm(" NOP");
|
||||
}
|
||||
|
||||
// pulse GPREG bit 2 to indicate ISR finished
|
||||
CLB_setGPREG(CLB4_BASE, gpreg4 | 0x00000002);
|
||||
asm(" NOP");
|
||||
CLB_setGPREG(CLB4_BASE, gpreg4);
|
||||
}
|
||||
|
||||
|
||||
__interrupt void clb1ISR(void)
|
||||
{
|
||||
if (!first_trip_1)
|
||||
{
|
||||
first_trip_1 = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
asm(" ESTOP0");
|
||||
}
|
||||
|
||||
Interrupt_clearACKGroup(INTERRUPT_ACK_GROUP5);
|
||||
}
|
||||
|
||||
|
||||
__interrupt void clb2ISR(void)
|
||||
{
|
||||
if (!first_trip_2)
|
||||
{
|
||||
first_trip_2 = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
asm(" ESTOP0");
|
||||
}
|
||||
|
||||
Interrupt_clearACKGroup(INTERRUPT_ACK_GROUP5);
|
||||
}
|
||||
|
||||
|
||||
__interrupt void clb3ISR(void)
|
||||
{
|
||||
if (!first_trip_3)
|
||||
{
|
||||
first_trip_3 = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
asm(" ESTOP0");
|
||||
}
|
||||
|
||||
Interrupt_clearACKGroup(INTERRUPT_ACK_GROUP5);
|
||||
}
|
||||
|
||||
|
||||
__interrupt void clb4ISR(void)
|
||||
{
|
||||
if (!first_trip_4)
|
||||
{
|
||||
first_trip_4 = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
asm(" ESTOP0");
|
||||
}
|
||||
|
||||
Interrupt_clearACKGroup(INTERRUPT_ACK_GROUP5);
|
||||
}
|
||||
|
||||
|
||||
/* end of file */
|
||||
@@ -0,0 +1,344 @@
|
||||
|
||||
var TILE = scripting.addModule("/utilities/clb_tool/clb_syscfg/source/TILE");
|
||||
var TILE1 = TILE.addInstance();
|
||||
var TILE2 = TILE.addInstance();
|
||||
var TILE3 = TILE.addInstance();
|
||||
var TILE4 = TILE.addInstance();
|
||||
// sim_duration - Duration of the simulation (in Nano Seconds)
|
||||
TILE.sim_duration = 500000;
|
||||
// Name
|
||||
TILE1.$name = "TILE1";
|
||||
// Name
|
||||
TILE1.BOUNDARY.$name = "BOUNDARY0";
|
||||
// in0
|
||||
TILE1.BOUNDARY.in0 = "squareWave";
|
||||
// in_edge0 - Edge detection on the inputs, generates 1 cycle pulse on chosen edges - for simulation purposes only
|
||||
TILE1.BOUNDARY.in_edge0 = "rising edge";
|
||||
// in_period0 - Period of the square wave
|
||||
TILE1.BOUNDARY.in_period0 = 1000;
|
||||
// in_duty0 - Duty or ON time of the square wave
|
||||
TILE1.BOUNDARY.in_duty0 = 4;
|
||||
// in_repeat_count0 - Number of periods the waveform is repeated
|
||||
TILE1.BOUNDARY.in_repeat_count0 = 1000;
|
||||
// in1
|
||||
TILE1.BOUNDARY.in1 = "squareWave";
|
||||
// in_repeat_count1 - Number of periods the waveform is repeated
|
||||
TILE1.BOUNDARY.in_repeat_count1 = 1000;
|
||||
// in_edge1 - Edge detection on the inputs, generates 1 cycle pulse on chosen edges - for simulation purposes only
|
||||
TILE1.BOUNDARY.in_edge1 = "rising edge";
|
||||
// in2
|
||||
TILE1.BOUNDARY.in2 = "1";
|
||||
// in_period1 - Period of the square wave
|
||||
TILE1.BOUNDARY.in_period1 = 1800;
|
||||
// Name
|
||||
TILE1.LUT_0.$name = "LUT_0";
|
||||
// Name
|
||||
TILE1.LUT_1.$name = "LUT_1";
|
||||
// Name
|
||||
TILE1.LUT_2.$name = "LUT_2";
|
||||
// i0 - Input 0.
|
||||
TILE1.LUT_2.i0 = "FSM_0.S0";
|
||||
// i1 - Input 1.
|
||||
TILE1.LUT_2.i1 = "COUNTER_0.count_match1";
|
||||
// i2 - Input 2.
|
||||
TILE1.LUT_2.i2 = "COUNTER_0.count_match2";
|
||||
// eqn - Boolean equation on the variables i3,i2,i1,i0 for the LUT output.
|
||||
TILE1.LUT_2.eqn = "(~i0 & i1) | (i0 & i2)";
|
||||
// Name
|
||||
TILE1.FSM_0.$name = "FSM_0";
|
||||
// e0 - External Input 0.
|
||||
TILE1.FSM_0.e0 = "BOUNDARY.in0";
|
||||
// e1 - External Input 1.
|
||||
TILE1.FSM_0.e1 = "BOUNDARY.in1";
|
||||
// eqn_s0 - Boolean equation on the variables e1,e0,s1,s0 for the S0 output.
|
||||
TILE1.FSM_0.eqn_s0 = "(~s0 & e0) | (s0 & (~e1))";
|
||||
// eqn_out - Boolean equation on the variables e1,e0,s1,s0 for the LUT output.
|
||||
TILE1.FSM_0.eqn_out = "~s0";
|
||||
// Name
|
||||
TILE1.FSM_1.$name = "FSM_1";
|
||||
// Name
|
||||
TILE1.FSM_2.$name = "FSM_2";
|
||||
// Name
|
||||
TILE1.COUNTER_0.$name = "COUNTER_0";
|
||||
// mode1 - Controls counting direction. High enables count up. Low enables count down.
|
||||
TILE1.COUNTER_0.mode1 = "1";
|
||||
// mode0 - Enables Counting when high
|
||||
TILE1.COUNTER_0.mode0 = "BOUNDARY.in2";
|
||||
// reset - Reset the counter to 0 on next clock cycle (triggers low to high)
|
||||
TILE1.COUNTER_0.reset = "FSM_0.OUT";
|
||||
// match1_val - Sets the value of the Match reference 1 register.
|
||||
TILE1.COUNTER_0.match1_val = "50";
|
||||
// match2_val - Sets the value of the Match reference 2 register.
|
||||
TILE1.COUNTER_0.match2_val = "3200";
|
||||
// Name
|
||||
TILE1.COUNTER_1.$name = "COUNTER_1";
|
||||
// Name
|
||||
TILE1.COUNTER_2.$name = "COUNTER_2";
|
||||
// Name
|
||||
TILE1.OUTLUT_0.$name = "OUTLUT_0";
|
||||
// Name
|
||||
TILE1.OUTLUT_1.$name = "OUTLUT_1";
|
||||
// Name
|
||||
TILE1.OUTLUT_2.$name = "OUTLUT_2";
|
||||
// Name
|
||||
TILE1.OUTLUT_3.$name = "OUTLUT_3";
|
||||
// Name
|
||||
TILE1.OUTLUT_4.$name = "OUTLUT_4";
|
||||
// Name
|
||||
TILE1.OUTLUT_5.$name = "OUTLUT_5";
|
||||
// Name
|
||||
TILE1.OUTLUT_6.$name = "OUTLUT_6";
|
||||
// Name
|
||||
TILE1.OUTLUT_7.$name = "OUTLUT_7";
|
||||
// Name
|
||||
TILE1.HLC.$name = "HLC_0";
|
||||
// Event 0 (e0) - Event 0
|
||||
TILE1.HLC.e0 = "LUT_2.OUT";
|
||||
// Name
|
||||
TILE1.HLC.program0.$name = "HLCP_0";
|
||||
// instruct0
|
||||
TILE1.HLC.program0.instruct0 = "INTR 1";
|
||||
// Name
|
||||
TILE1.HLC.program1.$name = "HLCP_1";
|
||||
// Name
|
||||
TILE1.HLC.program2.$name = "HLCP_2";
|
||||
// Name
|
||||
TILE1.HLC.program3.$name = "HLCP_3";
|
||||
var clb_run_dynamic_template_clb_h = scripting.addModule("/utilities/clb_tool/clb_syscfg/source/clb_run_dynamic_template_clb_h.js");
|
||||
var clb_run_dynamic_template_clb_c = scripting.addModule("/utilities/clb_tool/clb_syscfg/source/clb_run_dynamic_template_clb_c.js");
|
||||
var clb_run_dynamic_template_clb_sim = scripting.addModule("/utilities/clb_tool/clb_syscfg/source/clb_run_dynamic_template_clb_sim.js");
|
||||
var clb_run_dynamic_template_clb_dot = scripting.addModule("/utilities/clb_tool/clb_syscfg/source/clb_run_dynamic_template_clb_dot.js");
|
||||
// Name
|
||||
TILE2.$name = "TILE2";
|
||||
// Name
|
||||
TILE2.BOUNDARY.$name = "BOUNDARY1";
|
||||
// Name
|
||||
TILE2.LUT_0.$name = "LUT_3";
|
||||
// Name
|
||||
TILE2.LUT_1.$name = "LUT_4";
|
||||
// Name
|
||||
TILE2.LUT_2.$name = "LUT_5";
|
||||
// eqn - Boolean equation on the variables i3,i2,i1,i0 for the LUT output.
|
||||
TILE2.LUT_2.eqn = "(~i0 & i1) | (i0 & i2)";
|
||||
// i0 - Input 0.
|
||||
TILE2.LUT_2.i0 = "FSM_0.S0";
|
||||
// i1 - Input 1.
|
||||
TILE2.LUT_2.i1 = "COUNTER_0.count_match1";
|
||||
// i2 - Input 2.
|
||||
TILE2.LUT_2.i2 = "COUNTER_0.count_match2";
|
||||
// Name
|
||||
TILE2.FSM_0.$name = "FSM_3";
|
||||
// eqn_s0 - Boolean equation on the variables e1,e0,s1,s0 for the S0 output.
|
||||
TILE2.FSM_0.eqn_s0 = "(~s0 & e0) | (s0 & (~e1))";
|
||||
// e0 - External Input 0.
|
||||
TILE2.FSM_0.e0 = "BOUNDARY.in0";
|
||||
// e1 - External Input 1.
|
||||
TILE2.FSM_0.e1 = "BOUNDARY.in1";
|
||||
// eqn_out - Boolean equation on the variables e1,e0,s1,s0 for the LUT output.
|
||||
TILE2.FSM_0.eqn_out = "~s0";
|
||||
// Name
|
||||
TILE2.FSM_1.$name = "FSM_4";
|
||||
// Name
|
||||
TILE2.FSM_2.$name = "FSM_5";
|
||||
// Name
|
||||
TILE2.COUNTER_0.$name = "COUNTER_3";
|
||||
// mode1 - Controls counting direction. High enables count up. Low enables count down.
|
||||
TILE2.COUNTER_0.mode1 = "1";
|
||||
// mode0 - Enables Counting when high
|
||||
TILE2.COUNTER_0.mode0 = "BOUNDARY.in2";
|
||||
// reset - Reset the counter to 0 on next clock cycle (triggers low to high)
|
||||
TILE2.COUNTER_0.reset = "FSM_0.OUT";
|
||||
// match1_val - Sets the value of the Match reference 1 register.
|
||||
TILE2.COUNTER_0.match1_val = "50";
|
||||
// match2_val - Sets the value of the Match reference 2 register.
|
||||
TILE2.COUNTER_0.match2_val = "3200";
|
||||
// Name
|
||||
TILE2.COUNTER_1.$name = "COUNTER_4";
|
||||
// Name
|
||||
TILE2.COUNTER_2.$name = "COUNTER_5";
|
||||
// Name
|
||||
TILE2.OUTLUT_0.$name = "OUTLUT_8";
|
||||
// Name
|
||||
TILE2.OUTLUT_1.$name = "OUTLUT_9";
|
||||
// Name
|
||||
TILE2.OUTLUT_2.$name = "OUTLUT_10";
|
||||
// Name
|
||||
TILE2.OUTLUT_3.$name = "OUTLUT_11";
|
||||
// Name
|
||||
TILE2.OUTLUT_4.$name = "OUTLUT_12";
|
||||
// Name
|
||||
TILE2.OUTLUT_5.$name = "OUTLUT_13";
|
||||
// Name
|
||||
TILE2.OUTLUT_6.$name = "OUTLUT_14";
|
||||
// Name
|
||||
TILE2.OUTLUT_7.$name = "OUTLUT_15";
|
||||
// Name
|
||||
TILE2.HLC.$name = "HLC_1";
|
||||
// Event 0 (e0) - Event 0
|
||||
TILE2.HLC.e0 = "LUT_2.OUT";
|
||||
// Name
|
||||
TILE2.HLC.program0.$name = "HLCP_4";
|
||||
// instruct0
|
||||
TILE2.HLC.program0.instruct0 = "INTR 2";
|
||||
// Name
|
||||
TILE2.HLC.program1.$name = "HLCP_5";
|
||||
// Name
|
||||
TILE2.HLC.program2.$name = "HLCP_6";
|
||||
// Name
|
||||
TILE2.HLC.program3.$name = "HLCP_7";
|
||||
// Name
|
||||
TILE3.$name = "TILE3";
|
||||
// Name
|
||||
TILE3.BOUNDARY.$name = "BOUNDARY2";
|
||||
// Name
|
||||
TILE3.LUT_0.$name = "LUT_6";
|
||||
// Name
|
||||
TILE3.LUT_1.$name = "LUT_7";
|
||||
// Name
|
||||
TILE3.LUT_2.$name = "LUT_8";
|
||||
// eqn - Boolean equation on the variables i3,i2,i1,i0 for the LUT output.
|
||||
TILE3.LUT_2.eqn = "(~i0 & i1) | (i0 & i2)";
|
||||
// i0 - Input 0.
|
||||
TILE3.LUT_2.i0 = "FSM_0.S0";
|
||||
// i1 - Input 1.
|
||||
TILE3.LUT_2.i1 = "COUNTER_0.count_match1";
|
||||
// i2 - Input 2.
|
||||
TILE3.LUT_2.i2 = "COUNTER_0.count_match2";
|
||||
// Name
|
||||
TILE3.FSM_0.$name = "FSM_6";
|
||||
// eqn_s0 - Boolean equation on the variables e1,e0,s1,s0 for the S0 output.
|
||||
TILE3.FSM_0.eqn_s0 = "(~s0 & e0) | (s0 & (~e1))";
|
||||
// e0 - External Input 0.
|
||||
TILE3.FSM_0.e0 = "BOUNDARY.in0";
|
||||
// e1 - External Input 1.
|
||||
TILE3.FSM_0.e1 = "BOUNDARY.in1";
|
||||
// eqn_out - Boolean equation on the variables e1,e0,s1,s0 for the LUT output.
|
||||
TILE3.FSM_0.eqn_out = "~s0";
|
||||
// Name
|
||||
TILE3.FSM_1.$name = "FSM_7";
|
||||
// Name
|
||||
TILE3.FSM_2.$name = "FSM_8";
|
||||
// Name
|
||||
TILE3.COUNTER_0.$name = "COUNTER_6";
|
||||
// mode0 - Enables Counting when high
|
||||
TILE3.COUNTER_0.mode0 = "BOUNDARY.in2";
|
||||
// mode1 - Controls counting direction. High enables count up. Low enables count down.
|
||||
TILE3.COUNTER_0.mode1 = "1";
|
||||
// reset - Reset the counter to 0 on next clock cycle (triggers low to high)
|
||||
TILE3.COUNTER_0.reset = "FSM_0.OUT";
|
||||
// match1_val - Sets the value of the Match reference 1 register.
|
||||
TILE3.COUNTER_0.match1_val = "50";
|
||||
// match2_val - Sets the value of the Match reference 2 register.
|
||||
TILE3.COUNTER_0.match2_val = "3200";
|
||||
// Name
|
||||
TILE3.COUNTER_1.$name = "COUNTER_7";
|
||||
// Name
|
||||
TILE3.COUNTER_2.$name = "COUNTER_8";
|
||||
// Name
|
||||
TILE3.OUTLUT_0.$name = "OUTLUT_16";
|
||||
// Name
|
||||
TILE3.OUTLUT_1.$name = "OUTLUT_17";
|
||||
// Name
|
||||
TILE3.OUTLUT_2.$name = "OUTLUT_18";
|
||||
// Name
|
||||
TILE3.OUTLUT_3.$name = "OUTLUT_19";
|
||||
// Name
|
||||
TILE3.OUTLUT_4.$name = "OUTLUT_20";
|
||||
// Name
|
||||
TILE3.OUTLUT_5.$name = "OUTLUT_21";
|
||||
// Name
|
||||
TILE3.OUTLUT_6.$name = "OUTLUT_22";
|
||||
// Name
|
||||
TILE3.OUTLUT_7.$name = "OUTLUT_23";
|
||||
// Name
|
||||
TILE3.HLC.$name = "HLC_2";
|
||||
// Event 0 (e0) - Event 0
|
||||
TILE3.HLC.e0 = "LUT_2.OUT";
|
||||
// Name
|
||||
TILE3.HLC.program0.$name = "HLCP_8";
|
||||
// instruct0
|
||||
TILE3.HLC.program0.instruct0 = "INTR 3";
|
||||
// Name
|
||||
TILE3.HLC.program1.$name = "HLCP_9";
|
||||
// Name
|
||||
TILE3.HLC.program2.$name = "HLCP_10";
|
||||
// Name
|
||||
TILE3.HLC.program3.$name = "HLCP_11";
|
||||
// Name
|
||||
TILE4.$name = "TILE4";
|
||||
// Name
|
||||
TILE4.BOUNDARY.$name = "BOUNDARY3";
|
||||
// Name
|
||||
TILE4.LUT_0.$name = "LUT_9";
|
||||
// Name
|
||||
TILE4.LUT_1.$name = "LUT_10";
|
||||
// Name
|
||||
TILE4.LUT_2.$name = "LUT_11";
|
||||
// eqn - Boolean equation on the variables i3,i2,i1,i0 for the LUT output.
|
||||
TILE4.LUT_2.eqn = "(~i0 & i1) | (i0 & i2)";
|
||||
// i0 - Input 0.
|
||||
TILE4.LUT_2.i0 = "FSM_0.S0";
|
||||
// i1 - Input 1.
|
||||
TILE4.LUT_2.i1 = "COUNTER_0.count_match1";
|
||||
// i2 - Input 2.
|
||||
TILE4.LUT_2.i2 = "COUNTER_0.count_match2";
|
||||
// Name
|
||||
TILE4.FSM_0.$name = "FSM_9";
|
||||
// eqn_s0 - Boolean equation on the variables e1,e0,s1,s0 for the S0 output.
|
||||
TILE4.FSM_0.eqn_s0 = "(~s0 & e0) | (s0 & (~e1))";
|
||||
// e0 - External Input 0.
|
||||
TILE4.FSM_0.e0 = "BOUNDARY.in0";
|
||||
// e1 - External Input 1.
|
||||
TILE4.FSM_0.e1 = "BOUNDARY.in1";
|
||||
// eqn_out - Boolean equation on the variables e1,e0,s1,s0 for the LUT output.
|
||||
TILE4.FSM_0.eqn_out = "~s0";
|
||||
// Name
|
||||
TILE4.FSM_1.$name = "FSM_10";
|
||||
// Name
|
||||
TILE4.FSM_2.$name = "FSM_11";
|
||||
// Name
|
||||
TILE4.COUNTER_0.$name = "COUNTER_9";
|
||||
// mode0 - Enables Counting when high
|
||||
TILE4.COUNTER_0.mode0 = "BOUNDARY.in2";
|
||||
// mode1 - Controls counting direction. High enables count up. Low enables count down.
|
||||
TILE4.COUNTER_0.mode1 = "1";
|
||||
// reset - Reset the counter to 0 on next clock cycle (triggers low to high)
|
||||
TILE4.COUNTER_0.reset = "FSM_0.OUT";
|
||||
// match1_val - Sets the value of the Match reference 1 register.
|
||||
TILE4.COUNTER_0.match1_val = "50";
|
||||
// match2_val - Sets the value of the Match reference 2 register.
|
||||
TILE4.COUNTER_0.match2_val = "3200";
|
||||
// Name
|
||||
TILE4.COUNTER_1.$name = "COUNTER_10";
|
||||
// Name
|
||||
TILE4.COUNTER_2.$name = "COUNTER_11";
|
||||
// Name
|
||||
TILE4.OUTLUT_0.$name = "OUTLUT_24";
|
||||
// Name
|
||||
TILE4.OUTLUT_1.$name = "OUTLUT_25";
|
||||
// Name
|
||||
TILE4.OUTLUT_2.$name = "OUTLUT_26";
|
||||
// Name
|
||||
TILE4.OUTLUT_3.$name = "OUTLUT_27";
|
||||
// Name
|
||||
TILE4.OUTLUT_4.$name = "OUTLUT_28";
|
||||
// Name
|
||||
TILE4.OUTLUT_5.$name = "OUTLUT_29";
|
||||
// Name
|
||||
TILE4.OUTLUT_6.$name = "OUTLUT_30";
|
||||
// Name
|
||||
TILE4.OUTLUT_7.$name = "OUTLUT_31";
|
||||
// Name
|
||||
TILE4.HLC.$name = "HLC_3";
|
||||
// Event 0 (e0) - Event 0
|
||||
TILE4.HLC.e0 = "LUT_2.OUT";
|
||||
// Name
|
||||
TILE4.HLC.program0.$name = "HLCP_12";
|
||||
// instruct0
|
||||
TILE4.HLC.program0.instruct0 = "INTR 4";
|
||||
// Name
|
||||
TILE4.HLC.program1.$name = "HLCP_13";
|
||||
// Name
|
||||
TILE4.HLC.program2.$name = "HLCP_14";
|
||||
// Name
|
||||
TILE4.HLC.program3.$name = "HLCP_15";
|
||||
@@ -0,0 +1,201 @@
|
||||
//#############################################################################
|
||||
//
|
||||
// FILE: clb_ex6_siggen.c
|
||||
//
|
||||
// TITLE: CLB Signal Generator.
|
||||
//
|
||||
//! \addtogroup driver_example_list
|
||||
//! <h1>CLB Signal Generator</h1>
|
||||
//!
|
||||
//! For the detailed description of this example, please refer to:
|
||||
//! C2000Ware_PATH\utilities\clb_tool\clb_syscfg\doc\CLB Tool Users Guide.pdf
|
||||
//!
|
||||
//
|
||||
//
|
||||
//#############################################################################
|
||||
//
|
||||
//
|
||||
// $Copyright:
|
||||
// Copyright (C) 2013-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.
|
||||
// $
|
||||
//#############################################################################
|
||||
|
||||
|
||||
#include "driverlib.h"
|
||||
#include "device.h"
|
||||
#include "clb_config.h"
|
||||
#include "clb.h"
|
||||
|
||||
|
||||
__interrupt void clb2ISR(void);
|
||||
|
||||
// GPREG settings:
|
||||
// bit 2 = enable
|
||||
// bit 1 = ISR end flag
|
||||
// bit 0 not used
|
||||
uint32_t gpreg1 = 1;
|
||||
|
||||
|
||||
bool error_low = false;
|
||||
bool error_hi = false;
|
||||
|
||||
|
||||
void main(void)
|
||||
{
|
||||
Device_init();
|
||||
Device_initGPIO();
|
||||
|
||||
//
|
||||
// map interrupts
|
||||
//
|
||||
Interrupt_initModule();
|
||||
Interrupt_initVectorTable();
|
||||
|
||||
Interrupt_register(INT_CLB2, &clb2ISR);
|
||||
|
||||
//
|
||||
// initialize CLB tiles
|
||||
//
|
||||
//SysCtl_enablePeripheral((SysCtl_PeripheralPCLOCKCR)0x0011);
|
||||
SysCtl_enablePeripheral((SysCtl_PeripheralPCLOCKCR)0x0111);
|
||||
|
||||
CLB_enableCLB(CLB1_BASE);
|
||||
CLB_enableCLB(CLB2_BASE);
|
||||
initTILE1(CLB1_BASE);
|
||||
initTILE2(CLB2_BASE);
|
||||
|
||||
//
|
||||
// CLB tile 1 configuration
|
||||
//
|
||||
CLB_configGPInputMux(CLB1_BASE, CLB_IN0, CLB_GP_IN_MUX_GP_REG);
|
||||
CLB_configGPInputMux(CLB1_BASE, CLB_IN1, CLB_GP_IN_MUX_GP_REG);
|
||||
CLB_configGPInputMux(CLB1_BASE, CLB_IN2, CLB_GP_IN_MUX_GP_REG);
|
||||
CLB_configGPInputMux(CLB1_BASE, CLB_IN3, CLB_GP_IN_MUX_GP_REG);
|
||||
CLB_configGPInputMux(CLB1_BASE, CLB_IN4, CLB_GP_IN_MUX_GP_REG);
|
||||
CLB_configGPInputMux(CLB1_BASE, CLB_IN5, CLB_GP_IN_MUX_GP_REG);
|
||||
CLB_configGPInputMux(CLB1_BASE, CLB_IN6, CLB_GP_IN_MUX_GP_REG);
|
||||
CLB_configGPInputMux(CLB1_BASE, CLB_IN7, CLB_GP_IN_MUX_GP_REG);
|
||||
|
||||
CLB_configLocalInputMux(CLB1_BASE, CLB_IN0, CLB_LOCAL_IN_MUX_GLOBAL_IN);
|
||||
CLB_configLocalInputMux(CLB1_BASE, CLB_IN1, CLB_LOCAL_IN_MUX_GLOBAL_IN);
|
||||
CLB_configLocalInputMux(CLB1_BASE, CLB_IN2, CLB_LOCAL_IN_MUX_GLOBAL_IN);
|
||||
CLB_configLocalInputMux(CLB1_BASE, CLB_IN3, CLB_LOCAL_IN_MUX_GLOBAL_IN);
|
||||
CLB_configLocalInputMux(CLB1_BASE, CLB_IN4, CLB_LOCAL_IN_MUX_GLOBAL_IN);
|
||||
CLB_configLocalInputMux(CLB1_BASE, CLB_IN5, CLB_LOCAL_IN_MUX_GLOBAL_IN);
|
||||
CLB_configLocalInputMux(CLB1_BASE, CLB_IN6, CLB_LOCAL_IN_MUX_GLOBAL_IN);
|
||||
CLB_configLocalInputMux(CLB1_BASE, CLB_IN7, CLB_LOCAL_IN_MUX_GLOBAL_IN);
|
||||
|
||||
CLB_configGlobalInputMux(CLB1_BASE, CLB_IN0, CLB_GLOBAL_IN_MUX_EPWM1A);
|
||||
CLB_configGlobalInputMux(CLB1_BASE, CLB_IN1, CLB_GLOBAL_IN_MUX_EPWM1A);
|
||||
CLB_configGlobalInputMux(CLB1_BASE, CLB_IN2, CLB_GLOBAL_IN_MUX_EPWM1A);
|
||||
CLB_configGlobalInputMux(CLB1_BASE, CLB_IN3, CLB_GLOBAL_IN_MUX_EPWM1A);
|
||||
CLB_configGlobalInputMux(CLB1_BASE, CLB_IN4, CLB_GLOBAL_IN_MUX_EPWM1A);
|
||||
CLB_configGlobalInputMux(CLB1_BASE, CLB_IN5, CLB_GLOBAL_IN_MUX_EPWM1A);
|
||||
CLB_configGlobalInputMux(CLB1_BASE, CLB_IN6, CLB_GLOBAL_IN_MUX_EPWM1A);
|
||||
CLB_configGlobalInputMux(CLB1_BASE, CLB_IN7, CLB_GLOBAL_IN_MUX_EPWM1A);
|
||||
|
||||
//
|
||||
// CLB tile 2 configuration
|
||||
//
|
||||
CLB_configGPInputMux(CLB2_BASE, CLB_IN0, CLB_GP_IN_MUX_EXTERNAL);
|
||||
CLB_configGPInputMux(CLB2_BASE, CLB_IN1, CLB_GP_IN_MUX_EXTERNAL);
|
||||
CLB_configGPInputMux(CLB2_BASE, CLB_IN2, CLB_GP_IN_MUX_GP_REG);
|
||||
CLB_configGPInputMux(CLB2_BASE, CLB_IN3, CLB_GP_IN_MUX_GP_REG);
|
||||
CLB_configGPInputMux(CLB2_BASE, CLB_IN4, CLB_GP_IN_MUX_GP_REG);
|
||||
CLB_configGPInputMux(CLB2_BASE, CLB_IN5, CLB_GP_IN_MUX_GP_REG);
|
||||
CLB_configGPInputMux(CLB2_BASE, CLB_IN6, CLB_GP_IN_MUX_GP_REG);
|
||||
CLB_configGPInputMux(CLB2_BASE, CLB_IN7, CLB_GP_IN_MUX_GP_REG);
|
||||
|
||||
CLB_configLocalInputMux(CLB2_BASE, CLB_IN0, CLB_LOCAL_IN_MUX_GLOBAL_IN);
|
||||
CLB_configLocalInputMux(CLB2_BASE, CLB_IN1, CLB_LOCAL_IN_MUX_GLOBAL_IN);
|
||||
CLB_configLocalInputMux(CLB2_BASE, CLB_IN2, CLB_LOCAL_IN_MUX_GLOBAL_IN);
|
||||
CLB_configLocalInputMux(CLB2_BASE, CLB_IN3, CLB_LOCAL_IN_MUX_GLOBAL_IN);
|
||||
CLB_configLocalInputMux(CLB2_BASE, CLB_IN4, CLB_LOCAL_IN_MUX_GLOBAL_IN);
|
||||
CLB_configLocalInputMux(CLB2_BASE, CLB_IN5, CLB_LOCAL_IN_MUX_GLOBAL_IN);
|
||||
CLB_configLocalInputMux(CLB2_BASE, CLB_IN6, CLB_LOCAL_IN_MUX_GLOBAL_IN);
|
||||
CLB_configLocalInputMux(CLB2_BASE, CLB_IN7, CLB_LOCAL_IN_MUX_GLOBAL_IN);
|
||||
|
||||
CLB_configGlobalInputMux(CLB2_BASE, CLB_IN0, CLB_GLOBAL_IN_MUX_CLB_AUXSIG0);
|
||||
CLB_configGlobalInputMux(CLB2_BASE, CLB_IN1, CLB_GLOBAL_IN_MUX_CLB_AUXSIG1);
|
||||
CLB_configGlobalInputMux(CLB2_BASE, CLB_IN2, CLB_GLOBAL_IN_MUX_EPWM2B);
|
||||
CLB_configGlobalInputMux(CLB2_BASE, CLB_IN3, CLB_GLOBAL_IN_MUX_EPWM2B);
|
||||
CLB_configGlobalInputMux(CLB2_BASE, CLB_IN4, CLB_GLOBAL_IN_MUX_EPWM2_CTRDIR);
|
||||
CLB_configGlobalInputMux(CLB2_BASE, CLB_IN5, CLB_GLOBAL_IN_MUX_EPWM2_CTRDIR);
|
||||
CLB_configGlobalInputMux(CLB2_BASE, CLB_IN6, CLB_GLOBAL_IN_MUX_EPWM2_CTRDIR);
|
||||
CLB_configGlobalInputMux(CLB2_BASE, CLB_IN7, CLB_GLOBAL_IN_MUX_EPWM2_CTRDIR);
|
||||
|
||||
CLB_enableSynchronization(CLB2_BASE, CLB_IN0);
|
||||
CLB_enableSynchronization(CLB2_BASE, CLB_IN1);
|
||||
|
||||
//
|
||||
// Configure CLB-XBAR AUXSIG0 as CLB1_4
|
||||
//
|
||||
XBAR_setCLBMuxConfig(XBAR_AUXSIG0, XBAR_CLB_MUX01_CLB1_OUT4);
|
||||
XBAR_enableCLBMux(XBAR_AUXSIG0, XBAR_MUX01);
|
||||
|
||||
//
|
||||
// Configure CLB-XBAR AUXSIG1 as CLB1_5
|
||||
//
|
||||
XBAR_setCLBMuxConfig(XBAR_AUXSIG1, XBAR_CLB_MUX03_CLB1_OUT5);
|
||||
XBAR_enableCLBMux(XBAR_AUXSIG1, XBAR_MUX03);
|
||||
|
||||
//
|
||||
// enable interrupts
|
||||
//
|
||||
Interrupt_enable(INT_CLB2);
|
||||
EINT;
|
||||
|
||||
//
|
||||
// enable CLB counters
|
||||
//
|
||||
HWREG(0x3100) = 0x6;
|
||||
HWREG(0x3500) = 0x6;
|
||||
CLB_setGPREG(CLB1_BASE, gpreg1);
|
||||
|
||||
|
||||
while(1)
|
||||
{
|
||||
asm(" NOP");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
__interrupt void clb2ISR(void)
|
||||
{
|
||||
asm(" ESTOP0");
|
||||
|
||||
Interrupt_clearACKGroup(INTERRUPT_ACK_GROUP5);
|
||||
}
|
||||
|
||||
//
|
||||
// end of file //
|
||||
//
|
||||
@@ -0,0 +1,193 @@
|
||||
|
||||
var TILE = scripting.addModule("/utilities/clb_tool/clb_syscfg/source/TILE");
|
||||
var TILE1 = TILE.addInstance();
|
||||
var TILE2 = TILE.addInstance();
|
||||
// sim_duration - Duration of the simulation (in Nano Seconds)
|
||||
TILE.sim_duration = 500000;
|
||||
// Name
|
||||
TILE1.$name = "TILE1";
|
||||
// Name
|
||||
TILE1.BOUNDARY.$name = "BOUNDARY0";
|
||||
// in0
|
||||
TILE1.BOUNDARY.in0 = "squareWave";
|
||||
// in_period0 - Period of the square wave
|
||||
TILE1.BOUNDARY.in_period0 = 10000;
|
||||
// in_duty0 - Duty or ON time of the square wave
|
||||
TILE1.BOUNDARY.in_duty0 = 8000;
|
||||
// in_repeat_count0 - Number of periods the waveform is repeated
|
||||
TILE1.BOUNDARY.in_repeat_count0 = 10;
|
||||
// Name
|
||||
TILE1.LUT_0.$name = "LUT_0";
|
||||
// Name
|
||||
TILE1.LUT_1.$name = "LUT_1";
|
||||
// Name
|
||||
TILE1.LUT_2.$name = "LUT_2";
|
||||
// Name
|
||||
TILE1.FSM_0.$name = "FSM_0";
|
||||
// e0 - External Input 0.
|
||||
TILE1.FSM_0.e0 = "COUNTER_0.count_match1";
|
||||
// e1 - External Input 1.
|
||||
TILE1.FSM_0.e1 = "COUNTER_0.count_match2";
|
||||
// eqn_s0 - Boolean equation on the variables e1,e0,s1,s0 for the S0 output.
|
||||
TILE1.FSM_0.eqn_s0 = "(~s0 & e0) | (s0 & ~e1)";
|
||||
// Name
|
||||
TILE1.FSM_1.$name = "FSM_1";
|
||||
// Name
|
||||
TILE1.FSM_2.$name = "FSM_2";
|
||||
// Name
|
||||
TILE1.COUNTER_0.$name = "COUNTER_0";
|
||||
// mode0 - Enables Counting when high
|
||||
TILE1.COUNTER_0.mode0 = "BOUNDARY.in0";
|
||||
// mode1 - Controls counting direction. High enables count up. Low enables count down.
|
||||
TILE1.COUNTER_0.mode1 = "1";
|
||||
// reset - Reset the counter to 0 on next clock cycle (triggers low to high)
|
||||
TILE1.COUNTER_0.reset = "COUNTER_0.count_match2";
|
||||
// match1_val - Sets the value of the Match reference 1 register.
|
||||
TILE1.COUNTER_0.match1_val = "500";
|
||||
// match2_val - Sets the value of the Match reference 2 register.
|
||||
TILE1.COUNTER_0.match2_val = "1000";
|
||||
// Name
|
||||
TILE1.COUNTER_1.$name = "COUNTER_1";
|
||||
// Name
|
||||
TILE1.COUNTER_2.$name = "COUNTER_2";
|
||||
// Name
|
||||
TILE1.OUTLUT_0.$name = "OUTLUT_0";
|
||||
// Name
|
||||
TILE1.OUTLUT_1.$name = "OUTLUT_1";
|
||||
// Name
|
||||
TILE1.OUTLUT_2.$name = "OUTLUT_2";
|
||||
// Name
|
||||
TILE1.OUTLUT_3.$name = "OUTLUT_3";
|
||||
// Name
|
||||
TILE1.OUTLUT_4.$name = "OUTLUT_4";
|
||||
// i0 - Input 0.
|
||||
TILE1.OUTLUT_4.i0 = "FSM_0.S0";
|
||||
// eqn - Boolean equation on the variables i2,i1,i0 for the OUTLUT output.
|
||||
TILE1.OUTLUT_4.eqn = "i0";
|
||||
// Name
|
||||
TILE1.OUTLUT_5.$name = "OUTLUT_5";
|
||||
// i0 - Input 0.
|
||||
TILE1.OUTLUT_5.i0 = "BOUNDARY.in0";
|
||||
// eqn - Boolean equation on the variables i2,i1,i0 for the OUTLUT output.
|
||||
TILE1.OUTLUT_5.eqn = "i0";
|
||||
// Name
|
||||
TILE1.OUTLUT_6.$name = "OUTLUT_6";
|
||||
// Name
|
||||
TILE1.OUTLUT_7.$name = "OUTLUT_7";
|
||||
// Name
|
||||
TILE1.HLC.$name = "HLC_0";
|
||||
// Name
|
||||
TILE1.HLC.program0.$name = "HLCP_0";
|
||||
// Name
|
||||
TILE1.HLC.program1.$name = "HLCP_1";
|
||||
// Name
|
||||
TILE1.HLC.program2.$name = "HLCP_2";
|
||||
// Name
|
||||
TILE1.HLC.program3.$name = "HLCP_3";
|
||||
var clb_run_dynamic_template_clb_h = scripting.addModule("/utilities/clb_tool/clb_syscfg/source/clb_run_dynamic_template_clb_h.js");
|
||||
var clb_run_dynamic_template_clb_c = scripting.addModule("/utilities/clb_tool/clb_syscfg/source/clb_run_dynamic_template_clb_c.js");
|
||||
var clb_run_dynamic_template_clb_sim = scripting.addModule("/utilities/clb_tool/clb_syscfg/source/clb_run_dynamic_template_clb_sim.js");
|
||||
var clb_run_dynamic_template_clb_dot = scripting.addModule("/utilities/clb_tool/clb_syscfg/source/clb_run_dynamic_template_clb_dot.js");
|
||||
// Name
|
||||
TILE2.$name = "TILE2";
|
||||
// Name
|
||||
TILE2.BOUNDARY.$name = "BOUNDARY1";
|
||||
// in0
|
||||
TILE2.BOUNDARY.in0 = "TILE1_BOUNDARY.out4";
|
||||
// in1
|
||||
TILE2.BOUNDARY.in1 = "TILE1_BOUNDARY.out5";
|
||||
// Name
|
||||
TILE2.LUT_0.$name = "LUT_3";
|
||||
// eqn - Boolean equation on the variables i3,i2,i1,i0 for the LUT output.
|
||||
TILE2.LUT_0.eqn = "i0 & i1";
|
||||
// i0 - Input 0.
|
||||
TILE2.LUT_0.i0 = "BOUNDARY.in0";
|
||||
// i1 - Input 1.
|
||||
TILE2.LUT_0.i1 = "BOUNDARY.in1";
|
||||
// Name
|
||||
TILE2.LUT_1.$name = "LUT_4";
|
||||
// i0 - Input 0.
|
||||
TILE2.LUT_1.i0 = "BOUNDARY.in0";
|
||||
// i1 - Input 1.
|
||||
TILE2.LUT_1.i1 = "BOUNDARY.in1";
|
||||
// eqn - Boolean equation on the variables i3,i2,i1,i0 for the LUT output.
|
||||
TILE2.LUT_1.eqn = "~i0 & i1";
|
||||
// Name
|
||||
TILE2.LUT_2.$name = "LUT_5";
|
||||
// i1 - Input 1.
|
||||
TILE2.LUT_2.i1 = "COUNTER_0.count_match1";
|
||||
// i2 - Input 2.
|
||||
TILE2.LUT_2.i2 = "COUNTER_1.count_match1";
|
||||
// i0 - Input 0.
|
||||
TILE2.LUT_2.i0 = "BOUNDARY.in1";
|
||||
// eqn - Boolean equation on the variables i3,i2,i1,i0 for the LUT output.
|
||||
TILE2.LUT_2.eqn = "i0 & (i1 |i2)";
|
||||
// Name
|
||||
TILE2.FSM_0.$name = "FSM_3";
|
||||
// Name
|
||||
TILE2.FSM_1.$name = "FSM_4";
|
||||
// e0 - External Input 0.
|
||||
TILE2.FSM_1.e0 = "LUT_0.OUT";
|
||||
// eqn_s0 - Boolean equation on the variables e1,e0,s1,s0 for the S0 output.
|
||||
TILE2.FSM_1.eqn_s0 = "e0";
|
||||
// eqn_out - Boolean equation on the variables e1,e0,s1,s0 for the LUT output.
|
||||
TILE2.FSM_1.eqn_out = "e0 & ~s0";
|
||||
// Name
|
||||
TILE2.FSM_2.$name = "FSM_5";
|
||||
// Name
|
||||
TILE2.COUNTER_0.$name = "COUNTER_3";
|
||||
// mode0 - Enables Counting when high
|
||||
TILE2.COUNTER_0.mode0 = "LUT_0.OUT";
|
||||
// mode1 - Controls counting direction. High enables count up. Low enables count down.
|
||||
TILE2.COUNTER_0.mode1 = "1";
|
||||
// reset - Reset the counter to 0 on next clock cycle (triggers low to high)
|
||||
TILE2.COUNTER_0.reset = "LUT_1.OUT";
|
||||
// match2_val - Sets the value of the Match reference 2 register.
|
||||
TILE2.COUNTER_0.match2_val = "";
|
||||
// match1_val - Sets the value of the Match reference 1 register.
|
||||
TILE2.COUNTER_0.match1_val = "520";
|
||||
// Name
|
||||
TILE2.COUNTER_1.$name = "COUNTER_4";
|
||||
// mode1 - Controls counting direction. High enables count up. Low enables count down.
|
||||
TILE2.COUNTER_1.mode1 = "1";
|
||||
// reset - Reset the counter to 0 on next clock cycle (triggers low to high)
|
||||
TILE2.COUNTER_1.reset = "FSM_1.OUT";
|
||||
// mode0 - Enables Counting when high
|
||||
TILE2.COUNTER_1.mode0 = "BOUNDARY.in1";
|
||||
// match2_val - Sets the value of the Match reference 2 register.
|
||||
TILE2.COUNTER_1.match2_val = "";
|
||||
// match1_val - Sets the value of the Match reference 1 register.
|
||||
TILE2.COUNTER_1.match1_val = "1020";
|
||||
// Name
|
||||
TILE2.COUNTER_2.$name = "COUNTER_5";
|
||||
// Name
|
||||
TILE2.OUTLUT_0.$name = "OUTLUT_8";
|
||||
// Name
|
||||
TILE2.OUTLUT_1.$name = "OUTLUT_9";
|
||||
// Name
|
||||
TILE2.OUTLUT_2.$name = "OUTLUT_10";
|
||||
// Name
|
||||
TILE2.OUTLUT_3.$name = "OUTLUT_11";
|
||||
// Name
|
||||
TILE2.OUTLUT_4.$name = "OUTLUT_12";
|
||||
// Name
|
||||
TILE2.OUTLUT_5.$name = "OUTLUT_13";
|
||||
// Name
|
||||
TILE2.OUTLUT_6.$name = "OUTLUT_14";
|
||||
// Name
|
||||
TILE2.OUTLUT_7.$name = "OUTLUT_15";
|
||||
// Name
|
||||
TILE2.HLC.$name = "HLC_1";
|
||||
// Event 0 (e0) - Event 0
|
||||
TILE2.HLC.e0 = "LUT_2.OUT";
|
||||
// Name
|
||||
TILE2.HLC.program0.$name = "HLCP_4";
|
||||
// instruct0
|
||||
TILE2.HLC.program0.instruct0 = "INTR 5";
|
||||
// Name
|
||||
TILE2.HLC.program1.$name = "HLCP_5";
|
||||
// Name
|
||||
TILE2.HLC.program2.$name = "HLCP_6";
|
||||
// Name
|
||||
TILE2.HLC.program3.$name = "HLCP_7";
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user