Update repo
This commit is contained in:
1 parent
749dab5721
commit
ce65a0f59a
14950 files changed
+4408250
-1
No files matched your search
+40
@@ -0,0 +1,40 @@
|
||||
<projectSpec>
|
||||
<project
|
||||
name="adc_ex10_multiple_soc_epwm"
|
||||
device="TMS320F28388D"
|
||||
cgtVersion="22.6.1.LTS"
|
||||
products="sysconfig;C2000WARE"
|
||||
outputFormat="ELF"
|
||||
launchWizard="False"
|
||||
linkerCommandFile=""
|
||||
enableSysConfigTool="true"
|
||||
sysConfigBuildOptions="--product ${C2000WARE_ROOT}/.metadata/sdk.json --device F2838x --package 337bga --part F2838x_337bga"
|
||||
postBuildStep="
|
||||
echo "========= Build of the CLB simulation has moved to the CLB Tool. Click the '?' icon by the _Generate CLB Simulation File_ enable for more details (located in the Global Parameters of the Tile Design SysConfig module) ============="
|
||||
;if ${GENERATE_DIAGRAM} == 1 ${NODE_TOOL} "${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/dot_file_libraries/clbDotUtility.js" "${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/" "${BuildDirectory}/syscfg" "${BuildDirectory}/syscfg/clb.dot"
|
||||
;if ${GENERATE_DIAGRAM} == 1 mkdir "${BuildDirectory}/diagrams"
|
||||
;if ${GENERATE_DIAGRAM} == 1 ${NODE_TOOL} "${C2000WARE_ROOT}/driverlib/.meta/generate_diagrams.js" "${C2000WARE_ROOT}" "${BuildDirectory}/diagrams" "${BuildDirectory}/syscfg"
|
||||
"
|
||||
>
|
||||
<configuration name="CPU1_RAM" compilerBuildOptions= "--opt_level=off -I${C2000WARE_ROOT} -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} -v28 -ml -mt --cla_support=cla2 --define=RAM --float_support=fpu64 --tmu_support=tmu0 --define=DEBUG --define=CPU1 --gen_func_subsections=on --diag_warning=225 --diag_suppress=10063" linkerBuildOptions="--entry_point code_start --stack_size=0x3F8 --heap_size=0x200 --define=RAM -i${C2000WARE_ROOT} -i${PROJECT_BUILD_DIR}/syscfg -lc2000ware_libraries.cmd.genlibs " />
|
||||
<configuration name="CPU1_FLASH" compilerBuildOptions="--opt_level=off -I${C2000WARE_ROOT} -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} --define=_FLASH -v28 -ml -mt --cla_support=cla2 --float_support=fpu64 --tmu_support=tmu0 --define=DEBUG --define=CPU1 --gen_func_subsections=on --diag_warning=225 --diag_suppress=10063" linkerBuildOptions="--entry_point code_start --stack_size=0x3F8 --heap_size=0x200 --define=_FLASH -i${C2000WARE_ROOT} -i${PROJECT_BUILD_DIR}/syscfg -lc2000ware_libraries.cmd.genlibs " />
|
||||
|
||||
<pathVariable name="C2000WARE_DLIB_ROOT" path="../../../../../../driverlib/f2838x/driverlib/" scope="project" />
|
||||
<pathVariable name="C2000WARE_ROOT" path="../../../../../../" scope="project" />
|
||||
<pathVariable name="CLB_SYSCFG_ROOT" path="../../../../../../utilities/clb_tool/clb_syscfg/" scope="project" />
|
||||
<pathVariable name="SYSTEMC_INSTALL" path="../../../../../../utilities/clb_tool/clb_syscfg/systemc-2.3.3" scope="project" />
|
||||
<pathVariable name="CLB_SIM_COMPILER" path="C:/TDM-GCC-64/bin" scope="project" />
|
||||
<buildVariable name="GENERATE_DIAGRAM" value="0" scope="project" />
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/include/driverlib.h" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/include/device.h" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/source/device.c" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/targetConfigs/TMS320F28388D.ccxml" targetDirectory="targetConfigs" />
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/cmd/2838x_RAM_lnk_cpu1.cmd" targetDirectory="" applicableConfigurations="CPU1_RAM" />
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/cmd/2838x_FLASH_lnk_cpu1.cmd" targetDirectory="" applicableConfigurations="CPU1_FLASH" />
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/source/f2838x_codestartbranch.asm" targetDirectory="device" />
|
||||
<file action="link" path="../../../../../../driverlib/f2838x/driverlib/ccs/Debug/driverlib.lib" targetDirectory="" />
|
||||
<file action="copy" path="../../../../../../driverlib/f2838x/driverlib/" targetDirectory="device" excludeFromBuild="True" />
|
||||
<file action="copy" path="../adc_ex10_multiple_soc_epwm.c" targetDirectory="" />
|
||||
<file action="copy" path="../adc_ex10_multiple_soc_epwm.syscfg" targetDirectory=""/>
|
||||
</project>
|
||||
</projectSpec>
|
||||
@@ -0,0 +1,40 @@
|
||||
<projectSpec>
|
||||
<project
|
||||
name="adc_ex11_burst_mode_epwm"
|
||||
device="TMS320F28388D"
|
||||
cgtVersion="22.6.1.LTS"
|
||||
products="sysconfig;C2000WARE"
|
||||
outputFormat="ELF"
|
||||
launchWizard="False"
|
||||
linkerCommandFile=""
|
||||
enableSysConfigTool="true"
|
||||
sysConfigBuildOptions="--product ${C2000WARE_ROOT}/.metadata/sdk.json --device F2838x --package 337bga --part F2838x_337bga"
|
||||
postBuildStep="
|
||||
echo "========= Build of the CLB simulation has moved to the CLB Tool. Click the '?' icon by the _Generate CLB Simulation File_ enable for more details (located in the Global Parameters of the Tile Design SysConfig module) ============="
|
||||
;if ${GENERATE_DIAGRAM} == 1 ${NODE_TOOL} "${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/dot_file_libraries/clbDotUtility.js" "${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/" "${BuildDirectory}/syscfg" "${BuildDirectory}/syscfg/clb.dot"
|
||||
;if ${GENERATE_DIAGRAM} == 1 mkdir "${BuildDirectory}/diagrams"
|
||||
;if ${GENERATE_DIAGRAM} == 1 ${NODE_TOOL} "${C2000WARE_ROOT}/driverlib/.meta/generate_diagrams.js" "${C2000WARE_ROOT}" "${BuildDirectory}/diagrams" "${BuildDirectory}/syscfg"
|
||||
"
|
||||
>
|
||||
<configuration name="CPU1_RAM" compilerBuildOptions= "--opt_level=off -I${C2000WARE_ROOT} -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} -v28 -ml -mt --cla_support=cla2 --define=RAM --float_support=fpu64 --tmu_support=tmu0 --define=DEBUG --define=CPU1 --gen_func_subsections=on --diag_warning=225 --diag_suppress=10063" linkerBuildOptions="--entry_point code_start --stack_size=0x3F8 --heap_size=0x200 --define=RAM -i${C2000WARE_ROOT} -i${PROJECT_BUILD_DIR}/syscfg -lc2000ware_libraries.cmd.genlibs " />
|
||||
<configuration name="CPU1_FLASH" compilerBuildOptions="--opt_level=off -I${C2000WARE_ROOT} -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} --define=_FLASH -v28 -ml -mt --cla_support=cla2 --float_support=fpu64 --tmu_support=tmu0 --define=DEBUG --define=CPU1 --gen_func_subsections=on --diag_warning=225 --diag_suppress=10063" linkerBuildOptions="--entry_point code_start --stack_size=0x3F8 --heap_size=0x200 --define=_FLASH -i${C2000WARE_ROOT} -i${PROJECT_BUILD_DIR}/syscfg -lc2000ware_libraries.cmd.genlibs " />
|
||||
|
||||
<pathVariable name="C2000WARE_DLIB_ROOT" path="../../../../../../driverlib/f2838x/driverlib/" scope="project" />
|
||||
<pathVariable name="C2000WARE_ROOT" path="../../../../../../" scope="project" />
|
||||
<pathVariable name="CLB_SYSCFG_ROOT" path="../../../../../../utilities/clb_tool/clb_syscfg/" scope="project" />
|
||||
<pathVariable name="SYSTEMC_INSTALL" path="../../../../../../utilities/clb_tool/clb_syscfg/systemc-2.3.3" scope="project" />
|
||||
<pathVariable name="CLB_SIM_COMPILER" path="C:/TDM-GCC-64/bin" scope="project" />
|
||||
<buildVariable name="GENERATE_DIAGRAM" value="0" scope="project" />
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/include/driverlib.h" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/include/device.h" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/source/device.c" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/targetConfigs/TMS320F28388D.ccxml" targetDirectory="targetConfigs" />
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/cmd/2838x_RAM_lnk_cpu1.cmd" targetDirectory="" applicableConfigurations="CPU1_RAM" />
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/cmd/2838x_FLASH_lnk_cpu1.cmd" targetDirectory="" applicableConfigurations="CPU1_FLASH" />
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/source/f2838x_codestartbranch.asm" targetDirectory="device" />
|
||||
<file action="link" path="../../../../../../driverlib/f2838x/driverlib/ccs/Debug/driverlib.lib" targetDirectory="" />
|
||||
<file action="copy" path="../../../../../../driverlib/f2838x/driverlib/" targetDirectory="device" excludeFromBuild="True" />
|
||||
<file action="copy" path="../adc_ex11_burst_mode_epwm.c" targetDirectory="" />
|
||||
<file action="copy" path="../adc_ex11_burst_mode_epwm.syscfg" targetDirectory=""/>
|
||||
</project>
|
||||
</projectSpec>
|
||||
+40
@@ -0,0 +1,40 @@
|
||||
<projectSpec>
|
||||
<project
|
||||
name="adc_ex12_burst_mode_oversampling"
|
||||
device="TMS320F28388D"
|
||||
cgtVersion="22.6.1.LTS"
|
||||
products="sysconfig;C2000WARE"
|
||||
outputFormat="ELF"
|
||||
launchWizard="False"
|
||||
linkerCommandFile=""
|
||||
enableSysConfigTool="true"
|
||||
sysConfigBuildOptions="--product ${C2000WARE_ROOT}/.metadata/sdk.json --device F2838x --package 337bga --part F2838x_337bga"
|
||||
postBuildStep="
|
||||
echo "========= Build of the CLB simulation has moved to the CLB Tool. Click the '?' icon by the _Generate CLB Simulation File_ enable for more details (located in the Global Parameters of the Tile Design SysConfig module) ============="
|
||||
;if ${GENERATE_DIAGRAM} == 1 ${NODE_TOOL} "${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/dot_file_libraries/clbDotUtility.js" "${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/" "${BuildDirectory}/syscfg" "${BuildDirectory}/syscfg/clb.dot"
|
||||
;if ${GENERATE_DIAGRAM} == 1 mkdir "${BuildDirectory}/diagrams"
|
||||
;if ${GENERATE_DIAGRAM} == 1 ${NODE_TOOL} "${C2000WARE_ROOT}/driverlib/.meta/generate_diagrams.js" "${C2000WARE_ROOT}" "${BuildDirectory}/diagrams" "${BuildDirectory}/syscfg"
|
||||
"
|
||||
>
|
||||
<configuration name="CPU1_RAM" compilerBuildOptions= "--opt_level=off -I${C2000WARE_ROOT} -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} -v28 -ml -mt --cla_support=cla2 --define=RAM --float_support=fpu64 --tmu_support=tmu0 --define=DEBUG --define=CPU1 --gen_func_subsections=on --diag_warning=225 --diag_suppress=10063" linkerBuildOptions="--entry_point code_start --stack_size=0x3F8 --heap_size=0x200 --define=RAM -i${C2000WARE_ROOT} -i${PROJECT_BUILD_DIR}/syscfg -lc2000ware_libraries.cmd.genlibs " />
|
||||
<configuration name="CPU1_FLASH" compilerBuildOptions="--opt_level=off -I${C2000WARE_ROOT} -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} --define=_FLASH -v28 -ml -mt --cla_support=cla2 --float_support=fpu64 --tmu_support=tmu0 --define=DEBUG --define=CPU1 --gen_func_subsections=on --diag_warning=225 --diag_suppress=10063" linkerBuildOptions="--entry_point code_start --stack_size=0x3F8 --heap_size=0x200 --define=_FLASH -i${C2000WARE_ROOT} -i${PROJECT_BUILD_DIR}/syscfg -lc2000ware_libraries.cmd.genlibs " />
|
||||
|
||||
<pathVariable name="C2000WARE_DLIB_ROOT" path="../../../../../../driverlib/f2838x/driverlib/" scope="project" />
|
||||
<pathVariable name="C2000WARE_ROOT" path="../../../../../../" scope="project" />
|
||||
<pathVariable name="CLB_SYSCFG_ROOT" path="../../../../../../utilities/clb_tool/clb_syscfg/" scope="project" />
|
||||
<pathVariable name="SYSTEMC_INSTALL" path="../../../../../../utilities/clb_tool/clb_syscfg/systemc-2.3.3" scope="project" />
|
||||
<pathVariable name="CLB_SIM_COMPILER" path="C:/TDM-GCC-64/bin" scope="project" />
|
||||
<buildVariable name="GENERATE_DIAGRAM" value="0" scope="project" />
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/include/driverlib.h" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/include/device.h" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/source/device.c" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/targetConfigs/TMS320F28388D.ccxml" targetDirectory="targetConfigs" />
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/cmd/2838x_RAM_lnk_cpu1.cmd" targetDirectory="" applicableConfigurations="CPU1_RAM" />
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/cmd/2838x_FLASH_lnk_cpu1.cmd" targetDirectory="" applicableConfigurations="CPU1_FLASH" />
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/source/f2838x_codestartbranch.asm" targetDirectory="device" />
|
||||
<file action="link" path="../../../../../../driverlib/f2838x/driverlib/ccs/Debug/driverlib.lib" targetDirectory="" />
|
||||
<file action="copy" path="../../../../../../driverlib/f2838x/driverlib/" targetDirectory="device" excludeFromBuild="True" />
|
||||
<file action="copy" path="../adc_ex12_burst_mode_oversampling.c" targetDirectory="" />
|
||||
<file action="copy" path="../adc_ex12_burst_mode_oversampling.syscfg" targetDirectory=""/>
|
||||
</project>
|
||||
</projectSpec>
|
||||
+40
@@ -0,0 +1,40 @@
|
||||
<projectSpec>
|
||||
<project
|
||||
name="adc_ex13_soc_oversampling"
|
||||
device="TMS320F28388D"
|
||||
cgtVersion="22.6.1.LTS"
|
||||
products="sysconfig;C2000WARE"
|
||||
outputFormat="ELF"
|
||||
launchWizard="False"
|
||||
linkerCommandFile=""
|
||||
enableSysConfigTool="true"
|
||||
sysConfigBuildOptions="--product ${C2000WARE_ROOT}/.metadata/sdk.json --device F2838x --package 337bga --part F2838x_337bga"
|
||||
postBuildStep="
|
||||
echo "========= Build of the CLB simulation has moved to the CLB Tool. Click the '?' icon by the _Generate CLB Simulation File_ enable for more details (located in the Global Parameters of the Tile Design SysConfig module) ============="
|
||||
;if ${GENERATE_DIAGRAM} == 1 ${NODE_TOOL} "${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/dot_file_libraries/clbDotUtility.js" "${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/" "${BuildDirectory}/syscfg" "${BuildDirectory}/syscfg/clb.dot"
|
||||
;if ${GENERATE_DIAGRAM} == 1 mkdir "${BuildDirectory}/diagrams"
|
||||
;if ${GENERATE_DIAGRAM} == 1 ${NODE_TOOL} "${C2000WARE_ROOT}/driverlib/.meta/generate_diagrams.js" "${C2000WARE_ROOT}" "${BuildDirectory}/diagrams" "${BuildDirectory}/syscfg"
|
||||
"
|
||||
>
|
||||
<configuration name="CPU1_RAM" compilerBuildOptions= "--opt_level=off -I${C2000WARE_ROOT} -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} -v28 -ml -mt --cla_support=cla2 --define=RAM --float_support=fpu64 --tmu_support=tmu0 --define=DEBUG --define=CPU1 --gen_func_subsections=on --diag_warning=225 --diag_suppress=10063" linkerBuildOptions="--entry_point code_start --stack_size=0x3F8 --heap_size=0x200 --define=RAM -i${C2000WARE_ROOT} -i${PROJECT_BUILD_DIR}/syscfg -lc2000ware_libraries.cmd.genlibs " />
|
||||
<configuration name="CPU1_FLASH" compilerBuildOptions="--opt_level=off -I${C2000WARE_ROOT} -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} --define=_FLASH -v28 -ml -mt --cla_support=cla2 --float_support=fpu64 --tmu_support=tmu0 --define=DEBUG --define=CPU1 --gen_func_subsections=on --diag_warning=225 --diag_suppress=10063" linkerBuildOptions="--entry_point code_start --stack_size=0x3F8 --heap_size=0x200 --define=_FLASH -i${C2000WARE_ROOT} -i${PROJECT_BUILD_DIR}/syscfg -lc2000ware_libraries.cmd.genlibs " />
|
||||
|
||||
<pathVariable name="C2000WARE_DLIB_ROOT" path="../../../../../../driverlib/f2838x/driverlib/" scope="project" />
|
||||
<pathVariable name="C2000WARE_ROOT" path="../../../../../../" scope="project" />
|
||||
<pathVariable name="CLB_SYSCFG_ROOT" path="../../../../../../utilities/clb_tool/clb_syscfg/" scope="project" />
|
||||
<pathVariable name="SYSTEMC_INSTALL" path="../../../../../../utilities/clb_tool/clb_syscfg/systemc-2.3.3" scope="project" />
|
||||
<pathVariable name="CLB_SIM_COMPILER" path="C:/TDM-GCC-64/bin" scope="project" />
|
||||
<buildVariable name="GENERATE_DIAGRAM" value="0" scope="project" />
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/include/driverlib.h" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/include/device.h" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/source/device.c" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/targetConfigs/TMS320F28388D.ccxml" targetDirectory="targetConfigs" />
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/cmd/2838x_RAM_lnk_cpu1.cmd" targetDirectory="" applicableConfigurations="CPU1_RAM" />
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/cmd/2838x_FLASH_lnk_cpu1.cmd" targetDirectory="" applicableConfigurations="CPU1_FLASH" />
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/source/f2838x_codestartbranch.asm" targetDirectory="device" />
|
||||
<file action="link" path="../../../../../../driverlib/f2838x/driverlib/ccs/Debug/driverlib.lib" targetDirectory="" />
|
||||
<file action="copy" path="../../../../../../driverlib/f2838x/driverlib/" targetDirectory="device" excludeFromBuild="True" />
|
||||
<file action="copy" path="../adc_ex13_soc_oversampling.c" targetDirectory="" />
|
||||
<file action="copy" path="../adc_ex13_soc_oversampling.syscfg" targetDirectory=""/>
|
||||
</project>
|
||||
</projectSpec>
|
||||
@@ -0,0 +1,40 @@
|
||||
<projectSpec>
|
||||
<project
|
||||
name="adc_ex14_ppb_pwm_trip"
|
||||
device="TMS320F28388D"
|
||||
cgtVersion="22.6.1.LTS"
|
||||
products="sysconfig;C2000WARE"
|
||||
outputFormat="ELF"
|
||||
launchWizard="False"
|
||||
linkerCommandFile=""
|
||||
enableSysConfigTool="true"
|
||||
sysConfigBuildOptions="--product ${C2000WARE_ROOT}/.metadata/sdk.json --device F2838x --package 337bga --part F2838x_337bga"
|
||||
postBuildStep="
|
||||
echo "========= Build of the CLB simulation has moved to the CLB Tool. Click the '?' icon by the _Generate CLB Simulation File_ enable for more details (located in the Global Parameters of the Tile Design SysConfig module) ============="
|
||||
;if ${GENERATE_DIAGRAM} == 1 ${NODE_TOOL} "${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/dot_file_libraries/clbDotUtility.js" "${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/" "${BuildDirectory}/syscfg" "${BuildDirectory}/syscfg/clb.dot"
|
||||
;if ${GENERATE_DIAGRAM} == 1 mkdir "${BuildDirectory}/diagrams"
|
||||
;if ${GENERATE_DIAGRAM} == 1 ${NODE_TOOL} "${C2000WARE_ROOT}/driverlib/.meta/generate_diagrams.js" "${C2000WARE_ROOT}" "${BuildDirectory}/diagrams" "${BuildDirectory}/syscfg"
|
||||
"
|
||||
>
|
||||
<configuration name="CPU1_RAM" compilerBuildOptions= "--opt_level=off -I${C2000WARE_ROOT} -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} -v28 -ml -mt --cla_support=cla2 --define=RAM --float_support=fpu64 --tmu_support=tmu0 --define=DEBUG --define=CPU1 --gen_func_subsections=on --diag_warning=225 --diag_suppress=10063" linkerBuildOptions="--entry_point code_start --stack_size=0x3F8 --heap_size=0x200 --define=RAM -i${C2000WARE_ROOT} -i${PROJECT_BUILD_DIR}/syscfg -lc2000ware_libraries.cmd.genlibs " />
|
||||
<configuration name="CPU1_FLASH" compilerBuildOptions="--opt_level=off -I${C2000WARE_ROOT} -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} --define=_FLASH -v28 -ml -mt --cla_support=cla2 --float_support=fpu64 --tmu_support=tmu0 --define=DEBUG --define=CPU1 --gen_func_subsections=on --diag_warning=225 --diag_suppress=10063" linkerBuildOptions="--entry_point code_start --stack_size=0x3F8 --heap_size=0x200 --define=_FLASH -i${C2000WARE_ROOT} -i${PROJECT_BUILD_DIR}/syscfg -lc2000ware_libraries.cmd.genlibs " />
|
||||
|
||||
<pathVariable name="C2000WARE_DLIB_ROOT" path="../../../../../../driverlib/f2838x/driverlib/" scope="project" />
|
||||
<pathVariable name="C2000WARE_ROOT" path="../../../../../../" scope="project" />
|
||||
<pathVariable name="CLB_SYSCFG_ROOT" path="../../../../../../utilities/clb_tool/clb_syscfg/" scope="project" />
|
||||
<pathVariable name="SYSTEMC_INSTALL" path="../../../../../../utilities/clb_tool/clb_syscfg/systemc-2.3.3" scope="project" />
|
||||
<pathVariable name="CLB_SIM_COMPILER" path="C:/TDM-GCC-64/bin" scope="project" />
|
||||
<buildVariable name="GENERATE_DIAGRAM" value="0" scope="project" />
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/include/driverlib.h" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/include/device.h" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/source/device.c" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/targetConfigs/TMS320F28388D.ccxml" targetDirectory="targetConfigs" />
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/cmd/2838x_RAM_lnk_cpu1.cmd" targetDirectory="" applicableConfigurations="CPU1_RAM" />
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/cmd/2838x_FLASH_lnk_cpu1.cmd" targetDirectory="" applicableConfigurations="CPU1_FLASH" />
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/source/f2838x_codestartbranch.asm" targetDirectory="device" />
|
||||
<file action="link" path="../../../../../../driverlib/f2838x/driverlib/ccs/Debug/driverlib.lib" targetDirectory="" />
|
||||
<file action="copy" path="../../../../../../driverlib/f2838x/driverlib/" targetDirectory="device" excludeFromBuild="True" />
|
||||
<file action="copy" path="../adc_ex14_ppb_pwm_trip.c" targetDirectory="" />
|
||||
<file action="copy" path="../adc_ex14_ppb_pwm_trip.syscfg" targetDirectory=""/>
|
||||
</project>
|
||||
</projectSpec>
|
||||
+40
@@ -0,0 +1,40 @@
|
||||
<projectSpec>
|
||||
<project
|
||||
name="adc_ex15_high_priority_soc"
|
||||
device="TMS320F28388D"
|
||||
cgtVersion="22.6.1.LTS"
|
||||
products="sysconfig;C2000WARE"
|
||||
outputFormat="ELF"
|
||||
launchWizard="False"
|
||||
linkerCommandFile=""
|
||||
enableSysConfigTool="true"
|
||||
sysConfigBuildOptions="--product ${C2000WARE_ROOT}/.metadata/sdk.json --device F2838x --package 337bga --part F2838x_337bga"
|
||||
postBuildStep="
|
||||
echo "========= Build of the CLB simulation has moved to the CLB Tool. Click the '?' icon by the _Generate CLB Simulation File_ enable for more details (located in the Global Parameters of the Tile Design SysConfig module) ============="
|
||||
;if ${GENERATE_DIAGRAM} == 1 ${NODE_TOOL} "${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/dot_file_libraries/clbDotUtility.js" "${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/" "${BuildDirectory}/syscfg" "${BuildDirectory}/syscfg/clb.dot"
|
||||
;if ${GENERATE_DIAGRAM} == 1 mkdir "${BuildDirectory}/diagrams"
|
||||
;if ${GENERATE_DIAGRAM} == 1 ${NODE_TOOL} "${C2000WARE_ROOT}/driverlib/.meta/generate_diagrams.js" "${C2000WARE_ROOT}" "${BuildDirectory}/diagrams" "${BuildDirectory}/syscfg"
|
||||
"
|
||||
>
|
||||
<configuration name="CPU1_RAM" compilerBuildOptions= "--opt_level=off -I${C2000WARE_ROOT} -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} -v28 -ml -mt --cla_support=cla2 --define=RAM --float_support=fpu64 --tmu_support=tmu0 --define=DEBUG --define=CPU1 --gen_func_subsections=on --diag_warning=225 --diag_suppress=10063" linkerBuildOptions="--entry_point code_start --stack_size=0x3F8 --heap_size=0x200 --define=RAM -i${C2000WARE_ROOT} -i${PROJECT_BUILD_DIR}/syscfg -lc2000ware_libraries.cmd.genlibs " />
|
||||
<configuration name="CPU1_FLASH" compilerBuildOptions="--opt_level=off -I${C2000WARE_ROOT} -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} --define=_FLASH -v28 -ml -mt --cla_support=cla2 --float_support=fpu64 --tmu_support=tmu0 --define=DEBUG --define=CPU1 --gen_func_subsections=on --diag_warning=225 --diag_suppress=10063" linkerBuildOptions="--entry_point code_start --stack_size=0x3F8 --heap_size=0x200 --define=_FLASH -i${C2000WARE_ROOT} -i${PROJECT_BUILD_DIR}/syscfg -lc2000ware_libraries.cmd.genlibs " />
|
||||
|
||||
<pathVariable name="C2000WARE_DLIB_ROOT" path="../../../../../../driverlib/f2838x/driverlib/" scope="project" />
|
||||
<pathVariable name="C2000WARE_ROOT" path="../../../../../../" scope="project" />
|
||||
<pathVariable name="CLB_SYSCFG_ROOT" path="../../../../../../utilities/clb_tool/clb_syscfg/" scope="project" />
|
||||
<pathVariable name="SYSTEMC_INSTALL" path="../../../../../../utilities/clb_tool/clb_syscfg/systemc-2.3.3" scope="project" />
|
||||
<pathVariable name="CLB_SIM_COMPILER" path="C:/TDM-GCC-64/bin" scope="project" />
|
||||
<buildVariable name="GENERATE_DIAGRAM" value="0" scope="project" />
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/include/driverlib.h" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/include/device.h" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/source/device.c" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/targetConfigs/TMS320F28388D.ccxml" targetDirectory="targetConfigs" />
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/cmd/2838x_RAM_lnk_cpu1.cmd" targetDirectory="" applicableConfigurations="CPU1_RAM" />
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/cmd/2838x_FLASH_lnk_cpu1.cmd" targetDirectory="" applicableConfigurations="CPU1_FLASH" />
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/source/f2838x_codestartbranch.asm" targetDirectory="device" />
|
||||
<file action="link" path="../../../../../../driverlib/f2838x/driverlib/ccs/Debug/driverlib.lib" targetDirectory="" />
|
||||
<file action="copy" path="../../../../../../driverlib/f2838x/driverlib/" targetDirectory="device" excludeFromBuild="True" />
|
||||
<file action="copy" path="../adc_ex15_high_priority_soc.c" targetDirectory="" />
|
||||
<file action="copy" path="../../empty_projects/c2000.syscfg" targetDirectory="" />
|
||||
</project>
|
||||
</projectSpec>
|
||||
+40
@@ -0,0 +1,40 @@
|
||||
<projectSpec>
|
||||
<project
|
||||
name="adc_ex16_sw_interleaved_averaging"
|
||||
device="TMS320F28388D"
|
||||
cgtVersion="22.6.1.LTS"
|
||||
products="sysconfig;C2000WARE"
|
||||
outputFormat="ELF"
|
||||
launchWizard="False"
|
||||
linkerCommandFile=""
|
||||
enableSysConfigTool="true"
|
||||
sysConfigBuildOptions="--product ${C2000WARE_ROOT}/.metadata/sdk.json --device F2838x --package 337bga --part F2838x_337bga"
|
||||
postBuildStep="
|
||||
echo "========= Build of the CLB simulation has moved to the CLB Tool. Click the '?' icon by the _Generate CLB Simulation File_ enable for more details (located in the Global Parameters of the Tile Design SysConfig module) ============="
|
||||
;if ${GENERATE_DIAGRAM} == 1 ${NODE_TOOL} "${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/dot_file_libraries/clbDotUtility.js" "${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/" "${BuildDirectory}/syscfg" "${BuildDirectory}/syscfg/clb.dot"
|
||||
;if ${GENERATE_DIAGRAM} == 1 mkdir "${BuildDirectory}/diagrams"
|
||||
;if ${GENERATE_DIAGRAM} == 1 ${NODE_TOOL} "${C2000WARE_ROOT}/driverlib/.meta/generate_diagrams.js" "${C2000WARE_ROOT}" "${BuildDirectory}/diagrams" "${BuildDirectory}/syscfg"
|
||||
"
|
||||
>
|
||||
<configuration name="CPU1_RAM" compilerBuildOptions= "--opt_level=off -I${C2000WARE_ROOT} -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} -v28 -ml -mt --cla_support=cla2 --define=RAM --float_support=fpu64 --tmu_support=tmu0 --define=DEBUG --define=CPU1 --gen_func_subsections=on --diag_warning=225 --diag_suppress=10063" linkerBuildOptions="--entry_point code_start --stack_size=0x3F8 --heap_size=0x200 --define=RAM -i${C2000WARE_ROOT} -i${PROJECT_BUILD_DIR}/syscfg -lc2000ware_libraries.cmd.genlibs " />
|
||||
<configuration name="CPU1_FLASH" compilerBuildOptions="--opt_level=off -I${C2000WARE_ROOT} -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} --define=_FLASH -v28 -ml -mt --cla_support=cla2 --float_support=fpu64 --tmu_support=tmu0 --define=DEBUG --define=CPU1 --gen_func_subsections=on --diag_warning=225 --diag_suppress=10063" linkerBuildOptions="--entry_point code_start --stack_size=0x3F8 --heap_size=0x200 --define=_FLASH -i${C2000WARE_ROOT} -i${PROJECT_BUILD_DIR}/syscfg -lc2000ware_libraries.cmd.genlibs " />
|
||||
|
||||
<pathVariable name="C2000WARE_DLIB_ROOT" path="../../../../../../driverlib/f2838x/driverlib/" scope="project" />
|
||||
<pathVariable name="C2000WARE_ROOT" path="../../../../../../" scope="project" />
|
||||
<pathVariable name="CLB_SYSCFG_ROOT" path="../../../../../../utilities/clb_tool/clb_syscfg/" scope="project" />
|
||||
<pathVariable name="SYSTEMC_INSTALL" path="../../../../../../utilities/clb_tool/clb_syscfg/systemc-2.3.3" scope="project" />
|
||||
<pathVariable name="CLB_SIM_COMPILER" path="C:/TDM-GCC-64/bin" scope="project" />
|
||||
<buildVariable name="GENERATE_DIAGRAM" value="0" scope="project" />
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/include/driverlib.h" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/include/device.h" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/source/device.c" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/targetConfigs/TMS320F28388D.ccxml" targetDirectory="targetConfigs" />
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/cmd/2838x_RAM_lnk_cpu1.cmd" targetDirectory="" applicableConfigurations="CPU1_RAM" />
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/cmd/2838x_FLASH_lnk_cpu1.cmd" targetDirectory="" applicableConfigurations="CPU1_FLASH" />
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/source/f2838x_codestartbranch.asm" targetDirectory="device" />
|
||||
<file action="link" path="../../../../../../driverlib/f2838x/driverlib/ccs/Debug/driverlib.lib" targetDirectory="" />
|
||||
<file action="copy" path="../../../../../../driverlib/f2838x/driverlib/" targetDirectory="device" excludeFromBuild="True" />
|
||||
<file action="copy" path="../adc_ex16_sw_interleaved_averaging.c" targetDirectory="" />
|
||||
<file action="copy" path="../../empty_projects/c2000.syscfg" targetDirectory="" />
|
||||
</project>
|
||||
</projectSpec>
|
||||
+40
@@ -0,0 +1,40 @@
|
||||
<projectSpec>
|
||||
<project
|
||||
name="adc_ex17_open_shorts_detection"
|
||||
device="TMS320F28388D"
|
||||
cgtVersion="22.6.1.LTS"
|
||||
products="sysconfig;C2000WARE"
|
||||
outputFormat="ELF"
|
||||
launchWizard="False"
|
||||
linkerCommandFile=""
|
||||
enableSysConfigTool="true"
|
||||
sysConfigBuildOptions="--product ${C2000WARE_ROOT}/.metadata/sdk.json --device F2838x --package 337bga --part F2838x_337bga"
|
||||
postBuildStep="
|
||||
echo "========= Build of the CLB simulation has moved to the CLB Tool. Click the '?' icon by the _Generate CLB Simulation File_ enable for more details (located in the Global Parameters of the Tile Design SysConfig module) ============="
|
||||
;if ${GENERATE_DIAGRAM} == 1 ${NODE_TOOL} "${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/dot_file_libraries/clbDotUtility.js" "${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/" "${BuildDirectory}/syscfg" "${BuildDirectory}/syscfg/clb.dot"
|
||||
;if ${GENERATE_DIAGRAM} == 1 mkdir "${BuildDirectory}/diagrams"
|
||||
;if ${GENERATE_DIAGRAM} == 1 ${NODE_TOOL} "${C2000WARE_ROOT}/driverlib/.meta/generate_diagrams.js" "${C2000WARE_ROOT}" "${BuildDirectory}/diagrams" "${BuildDirectory}/syscfg"
|
||||
"
|
||||
>
|
||||
<configuration name="CPU1_RAM" compilerBuildOptions= "--opt_level=off -I${C2000WARE_ROOT} -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} -v28 -ml -mt --cla_support=cla2 --define=RAM --float_support=fpu64 --tmu_support=tmu0 --define=DEBUG --define=CPU1 --gen_func_subsections=on --diag_warning=225 --diag_suppress=10063" linkerBuildOptions="--entry_point code_start --stack_size=0x3F8 --heap_size=0x200 --define=RAM -i${C2000WARE_ROOT} -i${PROJECT_BUILD_DIR}/syscfg -lc2000ware_libraries.cmd.genlibs " />
|
||||
<configuration name="CPU1_FLASH" compilerBuildOptions="--opt_level=off -I${C2000WARE_ROOT} -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} --define=_FLASH -v28 -ml -mt --cla_support=cla2 --float_support=fpu64 --tmu_support=tmu0 --define=DEBUG --define=CPU1 --gen_func_subsections=on --diag_warning=225 --diag_suppress=10063" linkerBuildOptions="--entry_point code_start --stack_size=0x3F8 --heap_size=0x200 --define=_FLASH -i${C2000WARE_ROOT} -i${PROJECT_BUILD_DIR}/syscfg -lc2000ware_libraries.cmd.genlibs " />
|
||||
|
||||
<pathVariable name="C2000WARE_DLIB_ROOT" path="../../../../../../driverlib/f2838x/driverlib/" scope="project" />
|
||||
<pathVariable name="C2000WARE_ROOT" path="../../../../../../" scope="project" />
|
||||
<pathVariable name="CLB_SYSCFG_ROOT" path="../../../../../../utilities/clb_tool/clb_syscfg/" scope="project" />
|
||||
<pathVariable name="SYSTEMC_INSTALL" path="../../../../../../utilities/clb_tool/clb_syscfg/systemc-2.3.3" scope="project" />
|
||||
<pathVariable name="CLB_SIM_COMPILER" path="C:/TDM-GCC-64/bin" scope="project" />
|
||||
<buildVariable name="GENERATE_DIAGRAM" value="0" scope="project" />
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/include/driverlib.h" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/include/device.h" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/source/device.c" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/targetConfigs/TMS320F28388D.ccxml" targetDirectory="targetConfigs" />
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/cmd/2838x_RAM_lnk_cpu1.cmd" targetDirectory="" applicableConfigurations="CPU1_RAM" />
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/cmd/2838x_FLASH_lnk_cpu1.cmd" targetDirectory="" applicableConfigurations="CPU1_FLASH" />
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/source/f2838x_codestartbranch.asm" targetDirectory="device" />
|
||||
<file action="link" path="../../../../../../driverlib/f2838x/driverlib/ccs/Debug/driverlib.lib" targetDirectory="" />
|
||||
<file action="copy" path="../../../../../../driverlib/f2838x/driverlib/" targetDirectory="device" excludeFromBuild="True" />
|
||||
<file action="copy" path="../adc_ex17_open_shorts_detection.c" targetDirectory="" />
|
||||
<file action="copy" path="../../empty_projects/c2000.syscfg" targetDirectory="" />
|
||||
</project>
|
||||
</projectSpec>
|
||||
@@ -0,0 +1,40 @@
|
||||
<projectSpec>
|
||||
<project
|
||||
name="adc_ex1_soc_software"
|
||||
device="TMS320F28388D"
|
||||
cgtVersion="22.6.1.LTS"
|
||||
products="sysconfig;C2000WARE"
|
||||
outputFormat="ELF"
|
||||
launchWizard="False"
|
||||
linkerCommandFile=""
|
||||
enableSysConfigTool="true"
|
||||
sysConfigBuildOptions="--product ${C2000WARE_ROOT}/.metadata/sdk.json --device F2838x --package 337bga --part F2838x_337bga"
|
||||
postBuildStep="
|
||||
echo "========= Build of the CLB simulation has moved to the CLB Tool. Click the '?' icon by the _Generate CLB Simulation File_ enable for more details (located in the Global Parameters of the Tile Design SysConfig module) ============="
|
||||
;if ${GENERATE_DIAGRAM} == 1 ${NODE_TOOL} "${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/dot_file_libraries/clbDotUtility.js" "${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/" "${BuildDirectory}/syscfg" "${BuildDirectory}/syscfg/clb.dot"
|
||||
;if ${GENERATE_DIAGRAM} == 1 mkdir "${BuildDirectory}/diagrams"
|
||||
;if ${GENERATE_DIAGRAM} == 1 ${NODE_TOOL} "${C2000WARE_ROOT}/driverlib/.meta/generate_diagrams.js" "${C2000WARE_ROOT}" "${BuildDirectory}/diagrams" "${BuildDirectory}/syscfg"
|
||||
"
|
||||
>
|
||||
<configuration name="CPU1_RAM" compilerBuildOptions= "--opt_level=off -I${C2000WARE_ROOT} -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} -v28 -ml -mt --cla_support=cla2 --define=RAM --float_support=fpu64 --tmu_support=tmu0 --define=DEBUG --define=CPU1 --gen_func_subsections=on --diag_warning=225 --diag_suppress=10063" linkerBuildOptions="--entry_point code_start --stack_size=0x3F8 --heap_size=0x200 --define=RAM -i${C2000WARE_ROOT} -i${PROJECT_BUILD_DIR}/syscfg -lc2000ware_libraries.cmd.genlibs " />
|
||||
<configuration name="CPU1_FLASH" compilerBuildOptions="--opt_level=off -I${C2000WARE_ROOT} -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} --define=_FLASH -v28 -ml -mt --cla_support=cla2 --float_support=fpu64 --tmu_support=tmu0 --define=DEBUG --define=CPU1 --gen_func_subsections=on --diag_warning=225 --diag_suppress=10063" linkerBuildOptions="--entry_point code_start --stack_size=0x3F8 --heap_size=0x200 --define=_FLASH -i${C2000WARE_ROOT} -i${PROJECT_BUILD_DIR}/syscfg -lc2000ware_libraries.cmd.genlibs " />
|
||||
|
||||
<pathVariable name="C2000WARE_DLIB_ROOT" path="../../../../../../driverlib/f2838x/driverlib/" scope="project" />
|
||||
<pathVariable name="C2000WARE_ROOT" path="../../../../../../" scope="project" />
|
||||
<pathVariable name="CLB_SYSCFG_ROOT" path="../../../../../../utilities/clb_tool/clb_syscfg/" scope="project" />
|
||||
<pathVariable name="SYSTEMC_INSTALL" path="../../../../../../utilities/clb_tool/clb_syscfg/systemc-2.3.3" scope="project" />
|
||||
<pathVariable name="CLB_SIM_COMPILER" path="C:/TDM-GCC-64/bin" scope="project" />
|
||||
<buildVariable name="GENERATE_DIAGRAM" value="0" scope="project" />
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/include/driverlib.h" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/include/device.h" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/source/device.c" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/targetConfigs/TMS320F28388D.ccxml" targetDirectory="targetConfigs" />
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/cmd/2838x_RAM_lnk_cpu1.cmd" targetDirectory="" applicableConfigurations="CPU1_RAM" />
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/cmd/2838x_FLASH_lnk_cpu1.cmd" targetDirectory="" applicableConfigurations="CPU1_FLASH" />
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/source/f2838x_codestartbranch.asm" targetDirectory="device" />
|
||||
<file action="link" path="../../../../../../driverlib/f2838x/driverlib/ccs/Debug/driverlib.lib" targetDirectory="" />
|
||||
<file action="copy" path="../../../../../../driverlib/f2838x/driverlib/" targetDirectory="device" excludeFromBuild="True" />
|
||||
<file action="copy" path="../adc_ex1_soc_software.c" targetDirectory="" />
|
||||
<file action="copy" path="../adc_ex1_soc_software.syscfg" targetDirectory="" />
|
||||
</project>
|
||||
</projectSpec>
|
||||
@@ -0,0 +1,40 @@
|
||||
<projectSpec>
|
||||
<project
|
||||
name="adc_ex2_soc_epwm"
|
||||
device="TMS320F28388D"
|
||||
cgtVersion="22.6.1.LTS"
|
||||
products="sysconfig;C2000WARE"
|
||||
outputFormat="ELF"
|
||||
launchWizard="False"
|
||||
linkerCommandFile=""
|
||||
enableSysConfigTool="true"
|
||||
sysConfigBuildOptions="--product ${C2000WARE_ROOT}/.metadata/sdk.json --device F2838x --package 337bga --part F2838x_337bga"
|
||||
postBuildStep="
|
||||
echo "========= Build of the CLB simulation has moved to the CLB Tool. Click the '?' icon by the _Generate CLB Simulation File_ enable for more details (located in the Global Parameters of the Tile Design SysConfig module) ============="
|
||||
;if ${GENERATE_DIAGRAM} == 1 ${NODE_TOOL} "${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/dot_file_libraries/clbDotUtility.js" "${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/" "${BuildDirectory}/syscfg" "${BuildDirectory}/syscfg/clb.dot"
|
||||
;if ${GENERATE_DIAGRAM} == 1 mkdir "${BuildDirectory}/diagrams"
|
||||
;if ${GENERATE_DIAGRAM} == 1 ${NODE_TOOL} "${C2000WARE_ROOT}/driverlib/.meta/generate_diagrams.js" "${C2000WARE_ROOT}" "${BuildDirectory}/diagrams" "${BuildDirectory}/syscfg"
|
||||
"
|
||||
>
|
||||
<configuration name="CPU1_RAM" compilerBuildOptions= "--opt_level=off -I${C2000WARE_ROOT} -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} -v28 -ml -mt --cla_support=cla2 --define=RAM --float_support=fpu64 --tmu_support=tmu0 --define=DEBUG --define=CPU1 --gen_func_subsections=on --diag_warning=225 --diag_suppress=10063" linkerBuildOptions="--entry_point code_start --stack_size=0x3F8 --heap_size=0x200 --define=RAM -i${C2000WARE_ROOT} -i${PROJECT_BUILD_DIR}/syscfg -lc2000ware_libraries.cmd.genlibs " />
|
||||
<configuration name="CPU1_FLASH" compilerBuildOptions="--opt_level=off -I${C2000WARE_ROOT} -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} --define=_FLASH -v28 -ml -mt --cla_support=cla2 --float_support=fpu64 --tmu_support=tmu0 --define=DEBUG --define=CPU1 --gen_func_subsections=on --diag_warning=225 --diag_suppress=10063" linkerBuildOptions="--entry_point code_start --stack_size=0x3F8 --heap_size=0x200 --define=_FLASH -i${C2000WARE_ROOT} -i${PROJECT_BUILD_DIR}/syscfg -lc2000ware_libraries.cmd.genlibs " />
|
||||
|
||||
<pathVariable name="C2000WARE_DLIB_ROOT" path="../../../../../../driverlib/f2838x/driverlib/" scope="project" />
|
||||
<pathVariable name="C2000WARE_ROOT" path="../../../../../../" scope="project" />
|
||||
<pathVariable name="CLB_SYSCFG_ROOT" path="../../../../../../utilities/clb_tool/clb_syscfg/" scope="project" />
|
||||
<pathVariable name="SYSTEMC_INSTALL" path="../../../../../../utilities/clb_tool/clb_syscfg/systemc-2.3.3" scope="project" />
|
||||
<pathVariable name="CLB_SIM_COMPILER" path="C:/TDM-GCC-64/bin" scope="project" />
|
||||
<buildVariable name="GENERATE_DIAGRAM" value="0" scope="project" />
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/include/driverlib.h" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/include/device.h" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/source/device.c" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/targetConfigs/TMS320F28388D.ccxml" targetDirectory="targetConfigs" />
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/cmd/2838x_RAM_lnk_cpu1.cmd" targetDirectory="" applicableConfigurations="CPU1_RAM" />
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/cmd/2838x_FLASH_lnk_cpu1.cmd" targetDirectory="" applicableConfigurations="CPU1_FLASH" />
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/source/f2838x_codestartbranch.asm" targetDirectory="device" />
|
||||
<file action="link" path="../../../../../../driverlib/f2838x/driverlib/ccs/Debug/driverlib.lib" targetDirectory="" />
|
||||
<file action="copy" path="../../../../../../driverlib/f2838x/driverlib/" targetDirectory="device" excludeFromBuild="True" />
|
||||
<file action="copy" path="../adc_ex2_soc_epwm.c" targetDirectory="" />
|
||||
<file action="copy" path="../adc_ex2_soc_epwm.syscfg" targetDirectory="" />
|
||||
</project>
|
||||
</projectSpec>
|
||||
@@ -0,0 +1,40 @@
|
||||
<projectSpec>
|
||||
<project
|
||||
name="adc_ex3_temp_sensor"
|
||||
device="TMS320F28388D"
|
||||
cgtVersion="22.6.1.LTS"
|
||||
products="sysconfig;C2000WARE"
|
||||
outputFormat="ELF"
|
||||
launchWizard="False"
|
||||
linkerCommandFile=""
|
||||
enableSysConfigTool="true"
|
||||
sysConfigBuildOptions="--product ${C2000WARE_ROOT}/.metadata/sdk.json --device F2838x --package 337bga --part F2838x_337bga"
|
||||
postBuildStep="
|
||||
echo "========= Build of the CLB simulation has moved to the CLB Tool. Click the '?' icon by the _Generate CLB Simulation File_ enable for more details (located in the Global Parameters of the Tile Design SysConfig module) ============="
|
||||
;if ${GENERATE_DIAGRAM} == 1 ${NODE_TOOL} "${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/dot_file_libraries/clbDotUtility.js" "${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/" "${BuildDirectory}/syscfg" "${BuildDirectory}/syscfg/clb.dot"
|
||||
;if ${GENERATE_DIAGRAM} == 1 mkdir "${BuildDirectory}/diagrams"
|
||||
;if ${GENERATE_DIAGRAM} == 1 ${NODE_TOOL} "${C2000WARE_ROOT}/driverlib/.meta/generate_diagrams.js" "${C2000WARE_ROOT}" "${BuildDirectory}/diagrams" "${BuildDirectory}/syscfg"
|
||||
"
|
||||
>
|
||||
<configuration name="CPU1_RAM" compilerBuildOptions= "--opt_level=off -I${C2000WARE_ROOT} -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} -v28 -ml -mt --cla_support=cla2 --define=RAM --float_support=fpu64 --tmu_support=tmu0 --define=DEBUG --define=CPU1 --gen_func_subsections=on --diag_warning=225 --diag_suppress=10063" linkerBuildOptions="--entry_point code_start --stack_size=0x3F8 --heap_size=0x200 --define=RAM -i${C2000WARE_ROOT} -i${PROJECT_BUILD_DIR}/syscfg -lc2000ware_libraries.cmd.genlibs " />
|
||||
<configuration name="CPU1_FLASH" compilerBuildOptions="--opt_level=off -I${C2000WARE_ROOT} -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} --define=_FLASH -v28 -ml -mt --cla_support=cla2 --float_support=fpu64 --tmu_support=tmu0 --define=DEBUG --define=CPU1 --gen_func_subsections=on --diag_warning=225 --diag_suppress=10063" linkerBuildOptions="--entry_point code_start --stack_size=0x3F8 --heap_size=0x200 --define=_FLASH -i${C2000WARE_ROOT} -i${PROJECT_BUILD_DIR}/syscfg -lc2000ware_libraries.cmd.genlibs " />
|
||||
|
||||
<pathVariable name="C2000WARE_DLIB_ROOT" path="../../../../../../driverlib/f2838x/driverlib/" scope="project" />
|
||||
<pathVariable name="C2000WARE_ROOT" path="../../../../../../" scope="project" />
|
||||
<pathVariable name="CLB_SYSCFG_ROOT" path="../../../../../../utilities/clb_tool/clb_syscfg/" scope="project" />
|
||||
<pathVariable name="SYSTEMC_INSTALL" path="../../../../../../utilities/clb_tool/clb_syscfg/systemc-2.3.3" scope="project" />
|
||||
<pathVariable name="CLB_SIM_COMPILER" path="C:/TDM-GCC-64/bin" scope="project" />
|
||||
<buildVariable name="GENERATE_DIAGRAM" value="0" scope="project" />
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/include/driverlib.h" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/include/device.h" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/source/device.c" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/targetConfigs/TMS320F28388D.ccxml" targetDirectory="targetConfigs" />
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/cmd/2838x_RAM_lnk_cpu1.cmd" targetDirectory="" applicableConfigurations="CPU1_RAM" />
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/cmd/2838x_FLASH_lnk_cpu1.cmd" targetDirectory="" applicableConfigurations="CPU1_FLASH" />
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/source/f2838x_codestartbranch.asm" targetDirectory="device" />
|
||||
<file action="link" path="../../../../../../driverlib/f2838x/driverlib/ccs/Debug/driverlib.lib" targetDirectory="" />
|
||||
<file action="copy" path="../../../../../../driverlib/f2838x/driverlib/" targetDirectory="device" excludeFromBuild="True" />
|
||||
<file action="copy" path="../adc_ex3_temp_sensor.c" targetDirectory="" />
|
||||
<file action="copy" path="../adc_ex3_temp_sensor.syscfg" targetDirectory="" />
|
||||
</project>
|
||||
</projectSpec>
|
||||
+40
@@ -0,0 +1,40 @@
|
||||
<projectSpec>
|
||||
<project
|
||||
name="adc_ex4_soc_software_sync"
|
||||
device="TMS320F28388D"
|
||||
cgtVersion="22.6.1.LTS"
|
||||
products="sysconfig;C2000WARE"
|
||||
outputFormat="ELF"
|
||||
launchWizard="False"
|
||||
linkerCommandFile=""
|
||||
enableSysConfigTool="true"
|
||||
sysConfigBuildOptions="--product ${C2000WARE_ROOT}/.metadata/sdk.json --device F2838x --package 337bga --part F2838x_337bga"
|
||||
postBuildStep="
|
||||
echo "========= Build of the CLB simulation has moved to the CLB Tool. Click the '?' icon by the _Generate CLB Simulation File_ enable for more details (located in the Global Parameters of the Tile Design SysConfig module) ============="
|
||||
;if ${GENERATE_DIAGRAM} == 1 ${NODE_TOOL} "${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/dot_file_libraries/clbDotUtility.js" "${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/" "${BuildDirectory}/syscfg" "${BuildDirectory}/syscfg/clb.dot"
|
||||
;if ${GENERATE_DIAGRAM} == 1 mkdir "${BuildDirectory}/diagrams"
|
||||
;if ${GENERATE_DIAGRAM} == 1 ${NODE_TOOL} "${C2000WARE_ROOT}/driverlib/.meta/generate_diagrams.js" "${C2000WARE_ROOT}" "${BuildDirectory}/diagrams" "${BuildDirectory}/syscfg"
|
||||
"
|
||||
>
|
||||
<configuration name="CPU1_RAM" compilerBuildOptions= "--opt_level=off -I${C2000WARE_ROOT} -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} -v28 -ml -mt --cla_support=cla2 --define=RAM --float_support=fpu64 --tmu_support=tmu0 --define=DEBUG --define=CPU1 --gen_func_subsections=on --diag_warning=225 --diag_suppress=10063" linkerBuildOptions="--entry_point code_start --stack_size=0x3F8 --heap_size=0x200 --define=RAM -i${C2000WARE_ROOT} -i${PROJECT_BUILD_DIR}/syscfg -lc2000ware_libraries.cmd.genlibs " />
|
||||
<configuration name="CPU1_FLASH" compilerBuildOptions="--opt_level=off -I${C2000WARE_ROOT} -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} --define=_FLASH -v28 -ml -mt --cla_support=cla2 --float_support=fpu64 --tmu_support=tmu0 --define=DEBUG --define=CPU1 --gen_func_subsections=on --diag_warning=225 --diag_suppress=10063" linkerBuildOptions="--entry_point code_start --stack_size=0x3F8 --heap_size=0x200 --define=_FLASH -i${C2000WARE_ROOT} -i${PROJECT_BUILD_DIR}/syscfg -lc2000ware_libraries.cmd.genlibs " />
|
||||
|
||||
<pathVariable name="C2000WARE_DLIB_ROOT" path="../../../../../../driverlib/f2838x/driverlib/" scope="project" />
|
||||
<pathVariable name="C2000WARE_ROOT" path="../../../../../../" scope="project" />
|
||||
<pathVariable name="CLB_SYSCFG_ROOT" path="../../../../../../utilities/clb_tool/clb_syscfg/" scope="project" />
|
||||
<pathVariable name="SYSTEMC_INSTALL" path="../../../../../../utilities/clb_tool/clb_syscfg/systemc-2.3.3" scope="project" />
|
||||
<pathVariable name="CLB_SIM_COMPILER" path="C:/TDM-GCC-64/bin" scope="project" />
|
||||
<buildVariable name="GENERATE_DIAGRAM" value="0" scope="project" />
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/include/driverlib.h" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/include/device.h" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/source/device.c" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/targetConfigs/TMS320F28388D.ccxml" targetDirectory="targetConfigs" />
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/cmd/2838x_RAM_lnk_cpu1.cmd" targetDirectory="" applicableConfigurations="CPU1_RAM" />
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/cmd/2838x_FLASH_lnk_cpu1.cmd" targetDirectory="" applicableConfigurations="CPU1_FLASH" />
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/source/f2838x_codestartbranch.asm" targetDirectory="device" />
|
||||
<file action="link" path="../../../../../../driverlib/f2838x/driverlib/ccs/Debug/driverlib.lib" targetDirectory="" />
|
||||
<file action="copy" path="../../../../../../driverlib/f2838x/driverlib/" targetDirectory="device" excludeFromBuild="True" />
|
||||
<file action="copy" path="../adc_ex4_soc_software_sync.c" targetDirectory="" />
|
||||
<file action="copy" path="../adc_ex4_soc_software_sync.syscfg" targetDirectory="" />
|
||||
</project>
|
||||
</projectSpec>
|
||||
@@ -0,0 +1,40 @@
|
||||
<projectSpec>
|
||||
<project
|
||||
name="adc_ex5_soc_continuous"
|
||||
device="TMS320F28388D"
|
||||
cgtVersion="22.6.1.LTS"
|
||||
products="sysconfig;C2000WARE"
|
||||
outputFormat="ELF"
|
||||
launchWizard="False"
|
||||
linkerCommandFile=""
|
||||
enableSysConfigTool="true"
|
||||
sysConfigBuildOptions="--product ${C2000WARE_ROOT}/.metadata/sdk.json --device F2838x --package 337bga --part F2838x_337bga"
|
||||
postBuildStep="
|
||||
echo "========= Build of the CLB simulation has moved to the CLB Tool. Click the '?' icon by the _Generate CLB Simulation File_ enable for more details (located in the Global Parameters of the Tile Design SysConfig module) ============="
|
||||
;if ${GENERATE_DIAGRAM} == 1 ${NODE_TOOL} "${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/dot_file_libraries/clbDotUtility.js" "${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/" "${BuildDirectory}/syscfg" "${BuildDirectory}/syscfg/clb.dot"
|
||||
;if ${GENERATE_DIAGRAM} == 1 mkdir "${BuildDirectory}/diagrams"
|
||||
;if ${GENERATE_DIAGRAM} == 1 ${NODE_TOOL} "${C2000WARE_ROOT}/driverlib/.meta/generate_diagrams.js" "${C2000WARE_ROOT}" "${BuildDirectory}/diagrams" "${BuildDirectory}/syscfg"
|
||||
"
|
||||
>
|
||||
<configuration name="CPU1_RAM" compilerBuildOptions= "--opt_level=off -I${C2000WARE_ROOT} -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} -v28 -ml -mt --cla_support=cla2 --define=RAM --float_support=fpu64 --tmu_support=tmu0 --define=DEBUG --define=CPU1 --gen_func_subsections=on --diag_warning=225 --diag_suppress=10063" linkerBuildOptions="--entry_point code_start --stack_size=0x3F8 --heap_size=0x200 --define=RAM -i${C2000WARE_ROOT} -i${PROJECT_BUILD_DIR}/syscfg -lc2000ware_libraries.cmd.genlibs " />
|
||||
<configuration name="CPU1_FLASH" compilerBuildOptions="--opt_level=off -I${C2000WARE_ROOT} -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} --define=_FLASH -v28 -ml -mt --cla_support=cla2 --float_support=fpu64 --tmu_support=tmu0 --define=DEBUG --define=CPU1 --gen_func_subsections=on --diag_warning=225 --diag_suppress=10063" linkerBuildOptions="--entry_point code_start --stack_size=0x3F8 --heap_size=0x200 --define=_FLASH -i${C2000WARE_ROOT} -i${PROJECT_BUILD_DIR}/syscfg -lc2000ware_libraries.cmd.genlibs " />
|
||||
|
||||
<pathVariable name="C2000WARE_DLIB_ROOT" path="../../../../../../driverlib/f2838x/driverlib/" scope="project" />
|
||||
<pathVariable name="C2000WARE_ROOT" path="../../../../../../" scope="project" />
|
||||
<pathVariable name="CLB_SYSCFG_ROOT" path="../../../../../../utilities/clb_tool/clb_syscfg/" scope="project" />
|
||||
<pathVariable name="SYSTEMC_INSTALL" path="../../../../../../utilities/clb_tool/clb_syscfg/systemc-2.3.3" scope="project" />
|
||||
<pathVariable name="CLB_SIM_COMPILER" path="C:/TDM-GCC-64/bin" scope="project" />
|
||||
<buildVariable name="GENERATE_DIAGRAM" value="0" scope="project" />
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/include/driverlib.h" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/include/device.h" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/source/device.c" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/targetConfigs/TMS320F28388D.ccxml" targetDirectory="targetConfigs" />
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/cmd/2838x_RAM_lnk_cpu1.cmd" targetDirectory="" applicableConfigurations="CPU1_RAM" />
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/cmd/2838x_FLASH_lnk_cpu1.cmd" targetDirectory="" applicableConfigurations="CPU1_FLASH" />
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/source/f2838x_codestartbranch.asm" targetDirectory="device" />
|
||||
<file action="link" path="../../../../../../driverlib/f2838x/driverlib/ccs/Debug/driverlib.lib" targetDirectory="" />
|
||||
<file action="copy" path="../../../../../../driverlib/f2838x/driverlib/" targetDirectory="device" excludeFromBuild="True" />
|
||||
<file action="copy" path="../adc_ex5_soc_continuous.c" targetDirectory="" />
|
||||
<file action="copy" path="../adc_ex5_soc_continuous.syscfg" targetDirectory="" />
|
||||
</project>
|
||||
</projectSpec>
|
||||
+40
@@ -0,0 +1,40 @@
|
||||
<projectSpec>
|
||||
<project
|
||||
name="adc_ex6_soc_continuous_dma"
|
||||
device="TMS320F28388D"
|
||||
cgtVersion="22.6.1.LTS"
|
||||
products="sysconfig;C2000WARE"
|
||||
outputFormat="ELF"
|
||||
launchWizard="False"
|
||||
linkerCommandFile=""
|
||||
enableSysConfigTool="true"
|
||||
sysConfigBuildOptions="--product ${C2000WARE_ROOT}/.metadata/sdk.json --device F2838x --package 337bga --part F2838x_337bga"
|
||||
postBuildStep="
|
||||
echo "========= Build of the CLB simulation has moved to the CLB Tool. Click the '?' icon by the _Generate CLB Simulation File_ enable for more details (located in the Global Parameters of the Tile Design SysConfig module) ============="
|
||||
;if ${GENERATE_DIAGRAM} == 1 ${NODE_TOOL} "${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/dot_file_libraries/clbDotUtility.js" "${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/" "${BuildDirectory}/syscfg" "${BuildDirectory}/syscfg/clb.dot"
|
||||
;if ${GENERATE_DIAGRAM} == 1 mkdir "${BuildDirectory}/diagrams"
|
||||
;if ${GENERATE_DIAGRAM} == 1 ${NODE_TOOL} "${C2000WARE_ROOT}/driverlib/.meta/generate_diagrams.js" "${C2000WARE_ROOT}" "${BuildDirectory}/diagrams" "${BuildDirectory}/syscfg"
|
||||
"
|
||||
>
|
||||
<configuration name="CPU1_RAM" compilerBuildOptions= "--opt_level=off -I${C2000WARE_ROOT} -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} -v28 -ml -mt --cla_support=cla2 --define=RAM --float_support=fpu64 --tmu_support=tmu0 --define=DEBUG --define=CPU1 --gen_func_subsections=on --diag_warning=225 --diag_suppress=10063" linkerBuildOptions="--entry_point code_start --stack_size=0x3F8 --heap_size=0x200 --define=RAM -i${C2000WARE_ROOT} -i${PROJECT_BUILD_DIR}/syscfg -lc2000ware_libraries.cmd.genlibs " />
|
||||
<configuration name="CPU1_FLASH" compilerBuildOptions="--opt_level=off -I${C2000WARE_ROOT} -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} --define=_FLASH -v28 -ml -mt --cla_support=cla2 --float_support=fpu64 --tmu_support=tmu0 --define=DEBUG --define=CPU1 --gen_func_subsections=on --diag_warning=225 --diag_suppress=10063" linkerBuildOptions="--entry_point code_start --stack_size=0x3F8 --heap_size=0x200 --define=_FLASH -i${C2000WARE_ROOT} -i${PROJECT_BUILD_DIR}/syscfg -lc2000ware_libraries.cmd.genlibs " />
|
||||
|
||||
<pathVariable name="C2000WARE_DLIB_ROOT" path="../../../../../../driverlib/f2838x/driverlib/" scope="project" />
|
||||
<pathVariable name="C2000WARE_ROOT" path="../../../../../../" scope="project" />
|
||||
<pathVariable name="CLB_SYSCFG_ROOT" path="../../../../../../utilities/clb_tool/clb_syscfg/" scope="project" />
|
||||
<pathVariable name="SYSTEMC_INSTALL" path="../../../../../../utilities/clb_tool/clb_syscfg/systemc-2.3.3" scope="project" />
|
||||
<pathVariable name="CLB_SIM_COMPILER" path="C:/TDM-GCC-64/bin" scope="project" />
|
||||
<buildVariable name="GENERATE_DIAGRAM" value="0" scope="project" />
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/include/driverlib.h" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/include/device.h" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/source/device.c" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/targetConfigs/TMS320F28388D.ccxml" targetDirectory="targetConfigs" />
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/cmd/2838x_RAM_lnk_cpu1.cmd" targetDirectory="" applicableConfigurations="CPU1_RAM" />
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/cmd/2838x_FLASH_lnk_cpu1.cmd" targetDirectory="" applicableConfigurations="CPU1_FLASH" />
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/source/f2838x_codestartbranch.asm" targetDirectory="device" />
|
||||
<file action="link" path="../../../../../../driverlib/f2838x/driverlib/ccs/Debug/driverlib.lib" targetDirectory="" />
|
||||
<file action="copy" path="../../../../../../driverlib/f2838x/driverlib/" targetDirectory="device" excludeFromBuild="True" />
|
||||
<file action="copy" path="../adc_ex6_soc_continuous_dma.c" targetDirectory="" />
|
||||
<file action="copy" path="../adc_ex6_soc_continuous_dma.syscfg" targetDirectory="" />
|
||||
</project>
|
||||
</projectSpec>
|
||||
@@ -0,0 +1,41 @@
|
||||
<projectSpec>
|
||||
<project
|
||||
name="adc_ex7_ppb_offset"
|
||||
device="TMS320F28388D"
|
||||
cgtVersion="22.6.1.LTS"
|
||||
products="sysconfig;C2000WARE"
|
||||
outputFormat="ELF"
|
||||
launchWizard="False"
|
||||
linkerCommandFile=""
|
||||
enableSysConfigTool="true"
|
||||
sysConfigBuildOptions="--product ${C2000WARE_ROOT}/.metadata/sdk.json --device F2838x --package 337bga --part F2838x_337bga"
|
||||
postBuildStep="
|
||||
echo "========= Build of the CLB simulation has moved to the CLB Tool. Click the '?' icon by the _Generate CLB Simulation File_ enable for more details (located in the Global Parameters of the Tile Design SysConfig module) ============="
|
||||
;if ${GENERATE_DIAGRAM} == 1 ${NODE_TOOL} "${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/dot_file_libraries/clbDotUtility.js" "${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/" "${BuildDirectory}/syscfg" "${BuildDirectory}/syscfg/clb.dot"
|
||||
;if ${GENERATE_DIAGRAM} == 1 mkdir "${BuildDirectory}/diagrams"
|
||||
;if ${GENERATE_DIAGRAM} == 1 ${NODE_TOOL} "${C2000WARE_ROOT}/driverlib/.meta/generate_diagrams.js" "${C2000WARE_ROOT}" "${BuildDirectory}/diagrams" "${BuildDirectory}/syscfg"
|
||||
"
|
||||
>
|
||||
<configuration name="CPU1_RAM" compilerBuildOptions= "--opt_level=off -I${C2000WARE_ROOT} -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} -v28 -ml -mt --cla_support=cla2 --define=RAM --float_support=fpu64 --tmu_support=tmu0 --define=DEBUG --define=CPU1 --gen_func_subsections=on --diag_warning=225 --diag_suppress=10063" linkerBuildOptions="--entry_point code_start --stack_size=0x3F8 --heap_size=0x200 --define=RAM -i${C2000WARE_ROOT} -i${PROJECT_BUILD_DIR}/syscfg -lc2000ware_libraries.cmd.genlibs " />
|
||||
<configuration name="CPU1_FLASH" compilerBuildOptions="--opt_level=off -I${C2000WARE_ROOT} -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} --define=_FLASH -v28 -ml -mt --cla_support=cla2 --float_support=fpu64 --tmu_support=tmu0 --define=DEBUG --define=CPU1 --gen_func_subsections=on --diag_warning=225 --diag_suppress=10063" linkerBuildOptions="--entry_point code_start --stack_size=0x3F8 --heap_size=0x200 --define=_FLASH -i${C2000WARE_ROOT} -i${PROJECT_BUILD_DIR}/syscfg -lc2000ware_libraries.cmd.genlibs " />
|
||||
|
||||
<pathVariable name="C2000WARE_DLIB_ROOT" path="../../../../../../driverlib/f2838x/driverlib/" scope="project" />
|
||||
<pathVariable name="C2000WARE_ROOT" path="../../../../../../" scope="project" />
|
||||
<pathVariable name="CLB_SYSCFG_ROOT" path="../../../../../../utilities/clb_tool/clb_syscfg/" scope="project" />
|
||||
<pathVariable name="SYSTEMC_INSTALL" path="../../../../../../utilities/clb_tool/clb_syscfg/systemc-2.3.3" scope="project" />
|
||||
<pathVariable name="CLB_SIM_COMPILER" path="C:/TDM-GCC-64/bin" scope="project" />
|
||||
<buildVariable name="GENERATE_DIAGRAM" value="0" scope="project" />
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/include/driverlib.h" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/include/device.h" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/source/device.c" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/targetConfigs/TMS320F28388D.ccxml" targetDirectory="targetConfigs" />
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/cmd/2838x_RAM_lnk_cpu1.cmd" targetDirectory="" applicableConfigurations="CPU1_RAM" />
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/cmd/2838x_FLASH_lnk_cpu1.cmd" targetDirectory="" applicableConfigurations="CPU1_FLASH" />
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/source/f2838x_codestartbranch.asm" targetDirectory="device" />
|
||||
<file action="link" path="../../../../../../driverlib/f2838x/driverlib/ccs/Debug/driverlib.lib" targetDirectory="" />
|
||||
<file action="copy" path="../../../../../../driverlib/f2838x/driverlib/" targetDirectory="device" excludeFromBuild="True" />
|
||||
<file action="copy" path="../adc_ex7_ppb_offset.c" targetDirectory="" />
|
||||
<file action="copy" path="../adc_ex7_ppb_offset.syscfg" targetDirectory="" />
|
||||
</project>
|
||||
</projectSpec>
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
<projectSpec>
|
||||
<project
|
||||
name="adc_ex8_ppb_limits"
|
||||
device="TMS320F28388D"
|
||||
cgtVersion="22.6.1.LTS"
|
||||
products="sysconfig;C2000WARE"
|
||||
outputFormat="ELF"
|
||||
launchWizard="False"
|
||||
linkerCommandFile=""
|
||||
enableSysConfigTool="true"
|
||||
sysConfigBuildOptions="--product ${C2000WARE_ROOT}/.metadata/sdk.json --device F2838x --package 337bga --part F2838x_337bga"
|
||||
postBuildStep="
|
||||
echo "========= Build of the CLB simulation has moved to the CLB Tool. Click the '?' icon by the _Generate CLB Simulation File_ enable for more details (located in the Global Parameters of the Tile Design SysConfig module) ============="
|
||||
;if ${GENERATE_DIAGRAM} == 1 ${NODE_TOOL} "${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/dot_file_libraries/clbDotUtility.js" "${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/" "${BuildDirectory}/syscfg" "${BuildDirectory}/syscfg/clb.dot"
|
||||
;if ${GENERATE_DIAGRAM} == 1 mkdir "${BuildDirectory}/diagrams"
|
||||
;if ${GENERATE_DIAGRAM} == 1 ${NODE_TOOL} "${C2000WARE_ROOT}/driverlib/.meta/generate_diagrams.js" "${C2000WARE_ROOT}" "${BuildDirectory}/diagrams" "${BuildDirectory}/syscfg"
|
||||
"
|
||||
>
|
||||
<configuration name="CPU1_RAM" compilerBuildOptions= "--opt_level=off -I${C2000WARE_ROOT} -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} -v28 -ml -mt --cla_support=cla2 --define=RAM --float_support=fpu64 --tmu_support=tmu0 --define=DEBUG --define=CPU1 --gen_func_subsections=on --diag_warning=225 --diag_suppress=10063" linkerBuildOptions="--entry_point code_start --stack_size=0x3F8 --heap_size=0x200 --define=RAM -i${C2000WARE_ROOT} -i${PROJECT_BUILD_DIR}/syscfg -lc2000ware_libraries.cmd.genlibs " />
|
||||
<configuration name="CPU1_FLASH" compilerBuildOptions="--opt_level=off -I${C2000WARE_ROOT} -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} --define=_FLASH -v28 -ml -mt --cla_support=cla2 --float_support=fpu64 --tmu_support=tmu0 --define=DEBUG --define=CPU1 --gen_func_subsections=on --diag_warning=225 --diag_suppress=10063" linkerBuildOptions="--entry_point code_start --stack_size=0x3F8 --heap_size=0x200 --define=_FLASH -i${C2000WARE_ROOT} -i${PROJECT_BUILD_DIR}/syscfg -lc2000ware_libraries.cmd.genlibs " />
|
||||
|
||||
<pathVariable name="C2000WARE_DLIB_ROOT" path="../../../../../../driverlib/f2838x/driverlib/" scope="project" />
|
||||
<pathVariable name="C2000WARE_ROOT" path="../../../../../../" scope="project" />
|
||||
<pathVariable name="CLB_SYSCFG_ROOT" path="../../../../../../utilities/clb_tool/clb_syscfg/" scope="project" />
|
||||
<pathVariable name="SYSTEMC_INSTALL" path="../../../../../../utilities/clb_tool/clb_syscfg/systemc-2.3.3" scope="project" />
|
||||
<pathVariable name="CLB_SIM_COMPILER" path="C:/TDM-GCC-64/bin" scope="project" />
|
||||
<buildVariable name="GENERATE_DIAGRAM" value="0" scope="project" />
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/include/driverlib.h" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/include/device.h" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/source/device.c" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/targetConfigs/TMS320F28388D.ccxml" targetDirectory="targetConfigs" />
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/cmd/2838x_RAM_lnk_cpu1.cmd" targetDirectory="" applicableConfigurations="CPU1_RAM" />
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/cmd/2838x_FLASH_lnk_cpu1.cmd" targetDirectory="" applicableConfigurations="CPU1_FLASH" />
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/source/f2838x_codestartbranch.asm" targetDirectory="device" />
|
||||
<file action="link" path="../../../../../../driverlib/f2838x/driverlib/ccs/Debug/driverlib.lib" targetDirectory="" />
|
||||
<file action="copy" path="../../../../../../driverlib/f2838x/driverlib/" targetDirectory="device" excludeFromBuild="True" />
|
||||
<file action="copy" path="../adc_ex8_ppb_limits.c" targetDirectory="" />
|
||||
<file action="copy" path="../adc_ex8_ppb_limits.syscfg" targetDirectory="" />
|
||||
</project>
|
||||
</projectSpec>
|
||||
@@ -0,0 +1,40 @@
|
||||
<projectSpec>
|
||||
<project
|
||||
name="adc_ex9_ppb_delay"
|
||||
device="TMS320F28388D"
|
||||
cgtVersion="22.6.1.LTS"
|
||||
products="sysconfig;C2000WARE"
|
||||
outputFormat="ELF"
|
||||
launchWizard="False"
|
||||
linkerCommandFile=""
|
||||
enableSysConfigTool="true"
|
||||
sysConfigBuildOptions="--product ${C2000WARE_ROOT}/.metadata/sdk.json --device F2838x --package 337bga --part F2838x_337bga"
|
||||
postBuildStep="
|
||||
echo "========= Build of the CLB simulation has moved to the CLB Tool. Click the '?' icon by the _Generate CLB Simulation File_ enable for more details (located in the Global Parameters of the Tile Design SysConfig module) ============="
|
||||
;if ${GENERATE_DIAGRAM} == 1 ${NODE_TOOL} "${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/dot_file_libraries/clbDotUtility.js" "${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/" "${BuildDirectory}/syscfg" "${BuildDirectory}/syscfg/clb.dot"
|
||||
;if ${GENERATE_DIAGRAM} == 1 mkdir "${BuildDirectory}/diagrams"
|
||||
;if ${GENERATE_DIAGRAM} == 1 ${NODE_TOOL} "${C2000WARE_ROOT}/driverlib/.meta/generate_diagrams.js" "${C2000WARE_ROOT}" "${BuildDirectory}/diagrams" "${BuildDirectory}/syscfg"
|
||||
"
|
||||
>
|
||||
<configuration name="CPU1_RAM" compilerBuildOptions= "--opt_level=off -I${C2000WARE_ROOT} -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} -v28 -ml -mt --cla_support=cla2 --define=RAM --float_support=fpu64 --tmu_support=tmu0 --define=DEBUG --define=CPU1 --gen_func_subsections=on --diag_warning=225 --diag_suppress=10063" linkerBuildOptions="--entry_point code_start --stack_size=0x3F8 --heap_size=0x200 --define=RAM -i${C2000WARE_ROOT} -i${PROJECT_BUILD_DIR}/syscfg -lc2000ware_libraries.cmd.genlibs " />
|
||||
<configuration name="CPU1_FLASH" compilerBuildOptions="--opt_level=off -I${C2000WARE_ROOT} -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT} --define=_FLASH -v28 -ml -mt --cla_support=cla2 --float_support=fpu64 --tmu_support=tmu0 --define=DEBUG --define=CPU1 --gen_func_subsections=on --diag_warning=225 --diag_suppress=10063" linkerBuildOptions="--entry_point code_start --stack_size=0x3F8 --heap_size=0x200 --define=_FLASH -i${C2000WARE_ROOT} -i${PROJECT_BUILD_DIR}/syscfg -lc2000ware_libraries.cmd.genlibs " />
|
||||
|
||||
<pathVariable name="C2000WARE_DLIB_ROOT" path="../../../../../../driverlib/f2838x/driverlib/" scope="project" />
|
||||
<pathVariable name="C2000WARE_ROOT" path="../../../../../../" scope="project" />
|
||||
<pathVariable name="CLB_SYSCFG_ROOT" path="../../../../../../utilities/clb_tool/clb_syscfg/" scope="project" />
|
||||
<pathVariable name="SYSTEMC_INSTALL" path="../../../../../../utilities/clb_tool/clb_syscfg/systemc-2.3.3" scope="project" />
|
||||
<pathVariable name="CLB_SIM_COMPILER" path="C:/TDM-GCC-64/bin" scope="project" />
|
||||
<buildVariable name="GENERATE_DIAGRAM" value="0" scope="project" />
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/include/driverlib.h" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/include/device.h" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/source/device.c" targetDirectory="device" />
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/targetConfigs/TMS320F28388D.ccxml" targetDirectory="targetConfigs" />
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/cmd/2838x_RAM_lnk_cpu1.cmd" targetDirectory="" applicableConfigurations="CPU1_RAM" />
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/cmd/2838x_FLASH_lnk_cpu1.cmd" targetDirectory="" applicableConfigurations="CPU1_FLASH" />
|
||||
<file action="copy" path="../../../../../../device_support/f2838x/common/source/f2838x_codestartbranch.asm" targetDirectory="device" />
|
||||
<file action="link" path="../../../../../../driverlib/f2838x/driverlib/ccs/Debug/driverlib.lib" targetDirectory="" />
|
||||
<file action="copy" path="../../../../../../driverlib/f2838x/driverlib/" targetDirectory="device" excludeFromBuild="True" />
|
||||
<file action="copy" path="../adc_ex9_ppb_delay.c" targetDirectory="" />
|
||||
<file action="copy" path="../adc_ex9_ppb_delay.syscfg" targetDirectory=""/>
|
||||
</project>
|
||||
</projectSpec>
|
||||
@@ -0,0 +1,239 @@
|
||||
//#############################################################################
|
||||
//
|
||||
// FILE: adc_ex10_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 ADCC. This example demonstrates multiple ADCs working together
|
||||
//! to process of a batch of conversions using the available parallelism
|
||||
//! across multiple ADCs.
|
||||
//!
|
||||
//! ADCA Interrupt ISRs are used to read results of both ADCA and ADCC.
|
||||
//!
|
||||
//! \b External \b Connections \n
|
||||
//! - A0, A1, A2 and C2, C3, C4 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 adcCResult0 - Digital representation of the voltage on pin C2
|
||||
//! - \b adcCResult1 - Digital representation of the voltage on pin C3
|
||||
//! - \b adcCResult2 - Digital representation of the voltage on pin C4
|
||||
//!
|
||||
//
|
||||
//#############################################################################
|
||||
//
|
||||
//
|
||||
//
|
||||
// C2000Ware v5.04.00.00
|
||||
//
|
||||
// Copyright (C) 2024 Texas Instruments Incorporated - http://www.ti.com
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions
|
||||
// are met:
|
||||
//
|
||||
// Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
//
|
||||
// Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
//
|
||||
// Neither the name of Texas Instruments Incorporated nor the names of
|
||||
// its contributors may be used to endorse or promote products derived
|
||||
// from this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
// $
|
||||
//#############################################################################
|
||||
//
|
||||
|
||||
//
|
||||
// Included Files
|
||||
//
|
||||
#include "driverlib.h"
|
||||
#include "device.h"
|
||||
#include "board.h"
|
||||
|
||||
//
|
||||
// Globals
|
||||
//
|
||||
uint16_t adcAResult0;
|
||||
uint16_t adcAResult1;
|
||||
uint16_t adcAResult2;
|
||||
uint16_t adcCResult0;
|
||||
uint16_t adcCResult1;
|
||||
uint16_t adcCResult2;
|
||||
|
||||
//
|
||||
// Function Prototypes
|
||||
//
|
||||
void initEPWM();
|
||||
__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();
|
||||
|
||||
//
|
||||
// Set up the ADCA and ADCC and initialize the ADC SOC.
|
||||
// ADC Resolution - 12-bit, signal mode - single ended
|
||||
// ADCA SOC0, SOC1, SOC2 are configured to convert A0,
|
||||
// A1 and A2 channels with EPWM1SOCA as SOC trigger.
|
||||
// ADCC SOC0, SOC1, SOC2 are configured to convert C2,
|
||||
// C3, C4 channels with EPWM1SOCA as trigger
|
||||
//
|
||||
Board_init();
|
||||
|
||||
//
|
||||
// Configure EPWM1 ADC SOCA trigger
|
||||
//
|
||||
initEPWM();
|
||||
|
||||
//
|
||||
// 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);
|
||||
}
|
||||
|
||||
//
|
||||
// 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);
|
||||
}
|
||||
|
||||
//
|
||||
// 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);
|
||||
adcCResult0 = ADC_readResult(ADCCRESULT_BASE, ADC_SOC_NUMBER0);
|
||||
adcCResult1 = ADC_readResult(ADCCRESULT_BASE, ADC_SOC_NUMBER1);
|
||||
adcCResult2 = ADC_readResult(ADCCRESULT_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,63 @@
|
||||
|
||||
/**
|
||||
* Import the modules used in this configuration.
|
||||
*/
|
||||
const adc = scripting.addModule("/driverlib/adc.js", {}, false);
|
||||
const adc1 = adc.addInstance();
|
||||
const adc2 = adc.addInstance();
|
||||
|
||||
/**
|
||||
* Write custom configuration values to the imported modules.
|
||||
*/
|
||||
adc1.$name = "myADC0";
|
||||
adc1.adcBase = "ADCA_BASE";
|
||||
|
||||
adc1.adcClockPrescaler = "ADC_CLK_DIV_4_0";
|
||||
|
||||
adc1.adcSignalMode = "ADC_MODE_SINGLE_ENDED";
|
||||
adc1.adcResolutionMode = "ADC_RESOLUTION_12BIT";
|
||||
|
||||
adc1.interruptPulseMode = "ADC_PULSE_END_OF_CONV";
|
||||
adc1.enabledSOCs = ["ADC_SOC_NUMBER0","ADC_SOC_NUMBER1","ADC_SOC_NUMBER2"];
|
||||
|
||||
adc1.soc0Trigger = "ADC_TRIGGER_EPWM1_SOCA";
|
||||
adc1.soc1Trigger = "ADC_TRIGGER_EPWM1_SOCA";
|
||||
adc1.soc2Trigger = "ADC_TRIGGER_EPWM1_SOCA";
|
||||
|
||||
adc1.soc0Channel = "ADC_CH_ADCIN0";
|
||||
adc1.soc1Channel = "ADC_CH_ADCIN1";
|
||||
adc1.soc2Channel = "ADC_CH_ADCIN2";
|
||||
|
||||
adc1.soc0SampleWindow = 15;
|
||||
adc1.soc1SampleWindow = 15;
|
||||
adc1.soc2SampleWindow = 15;
|
||||
|
||||
adc1.enabledInts = ["ADC_INT_NUMBER1"];
|
||||
adc1.enableInterrupt1 = true;
|
||||
adc1.interrupt1SOCSource = "ADC_SOC_NUMBER2";
|
||||
adc1.registerInterrupts = ["1"];
|
||||
adc1.adcInt1.enableInterrupt = true;
|
||||
adc1.adcInt1.interruptHandler = "adcA1ISR";
|
||||
|
||||
adc2.$name = "myADC1";
|
||||
adc2.adcBase = "ADCC_BASE";
|
||||
adc2.adcClockPrescaler = "ADC_CLK_DIV_4_0";
|
||||
adc2.interruptPulseMode = "ADC_PULSE_END_OF_CONV";
|
||||
|
||||
adc2.adcSignalMode = "ADC_MODE_SINGLE_ENDED";
|
||||
adc2.adcResolutionMode = "ADC_RESOLUTION_12BIT";
|
||||
|
||||
adc2.enabledSOCs = ["ADC_SOC_NUMBER0","ADC_SOC_NUMBER1","ADC_SOC_NUMBER2"];
|
||||
|
||||
adc2.soc0Trigger = "ADC_TRIGGER_EPWM1_SOCA";
|
||||
adc2.soc1Trigger = "ADC_TRIGGER_EPWM1_SOCA";
|
||||
adc2.soc2Trigger = "ADC_TRIGGER_EPWM1_SOCA";
|
||||
|
||||
adc2.soc0Channel = "ADC_CH_ADCIN2";
|
||||
adc2.soc1Channel = "ADC_CH_ADCIN3";
|
||||
adc2.soc2Channel = "ADC_CH_ADCIN4";
|
||||
|
||||
adc2.soc0SampleWindow = 15;
|
||||
adc2.soc1SampleWindow = 15;
|
||||
adc2.soc2SampleWindow = 15;
|
||||
|
||||
@@ -0,0 +1,278 @@
|
||||
//#############################################################################
|
||||
//
|
||||
// FILE: adc_ex11_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
|
||||
//!
|
||||
//
|
||||
//#############################################################################
|
||||
//
|
||||
//
|
||||
//
|
||||
// C2000Ware v5.04.00.00
|
||||
//
|
||||
// Copyright (C) 2024 Texas Instruments Incorporated - http://www.ti.com
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions
|
||||
// are met:
|
||||
//
|
||||
// Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
//
|
||||
// Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
//
|
||||
// Neither the name of Texas Instruments Incorporated nor the names of
|
||||
// its contributors may be used to endorse or promote products derived
|
||||
// from this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
// $
|
||||
//#############################################################################
|
||||
//
|
||||
|
||||
//
|
||||
// Included Files
|
||||
//
|
||||
#include "driverlib.h"
|
||||
#include "device.h"
|
||||
#include "board.h"
|
||||
|
||||
//
|
||||
// Globals
|
||||
//
|
||||
uint16_t adcAResult0;
|
||||
uint16_t adcAResult1;
|
||||
uint16_t adcAResult2;
|
||||
uint16_t adcAResult3;
|
||||
uint16_t adcAResult4;
|
||||
|
||||
|
||||
//
|
||||
// Function Prototypes
|
||||
//
|
||||
void initEPWM();
|
||||
__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();
|
||||
|
||||
//
|
||||
// Set up ADCs:
|
||||
// Signal Mode : single-ended
|
||||
// Conversion Resolution : 12-bit;
|
||||
//
|
||||
// Enable burst mode for SOC7-15 with burst size of 3 with
|
||||
// burst mode trigger as EPWM1 SOCA. Select the channels to be
|
||||
// converted and 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)
|
||||
//
|
||||
// Register and enable the interrupts:
|
||||
// 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
|
||||
//
|
||||
Board_init();
|
||||
|
||||
//
|
||||
// Initialize PWM
|
||||
//
|
||||
initEPWM();
|
||||
|
||||
//
|
||||
// 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);
|
||||
}
|
||||
|
||||
//
|
||||
// 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);
|
||||
}
|
||||
|
||||
//
|
||||
// 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);
|
||||
Interrupt_clearACKGroup(INTERRUPT_ACK_GROUP10);
|
||||
}
|
||||
|
||||
//
|
||||
// End of file
|
||||
//
|
||||
@@ -0,0 +1,75 @@
|
||||
|
||||
/**
|
||||
* Import the modules used in this configuration.
|
||||
*/
|
||||
const adc = scripting.addModule("/driverlib/adc.js", {}, false);
|
||||
const adc1 = adc.addInstance();
|
||||
|
||||
/**
|
||||
* Write custom configuration values to the imported modules.
|
||||
*/
|
||||
adc1.$name = "myADC0";
|
||||
adc1.adcBase = "ADCA_BASE";
|
||||
|
||||
adc1.adcClockPrescaler = "ADC_CLK_DIV_4_0";
|
||||
adc1.interruptPulseMode = "ADC_PULSE_END_OF_CONV";
|
||||
|
||||
adc1.adcSignalMode = "ADC_MODE_SINGLE_ENDED";
|
||||
adc1.adcResolutionMode = "ADC_RESOLUTION_12BIT";
|
||||
|
||||
adc1.enableBurstMode = true;
|
||||
adc1.burstTrigger = "ADC_TRIGGER_EPWM1_SOCA";
|
||||
adc1.burstSize = 2;
|
||||
adc1.socHighPriorityMode = "ADC_PRI_THRU_SOC6_HIPRI";
|
||||
|
||||
adc1.enabledSOCs = ["ADC_SOC_NUMBER10","ADC_SOC_NUMBER11","ADC_SOC_NUMBER12","ADC_SOC_NUMBER13","ADC_SOC_NUMBER14","ADC_SOC_NUMBER15","ADC_SOC_NUMBER7","ADC_SOC_NUMBER8","ADC_SOC_NUMBER9"];
|
||||
|
||||
adc1.soc7Channel = "ADC_CH_ADCIN0";
|
||||
adc1.soc8Channel = "ADC_CH_ADCIN1";
|
||||
adc1.soc9Channel = "ADC_CH_ADCIN2";
|
||||
adc1.soc10Channel = "ADC_CH_ADCIN0";
|
||||
adc1.soc11Channel = "ADC_CH_ADCIN1";
|
||||
adc1.soc12Channel = "ADC_CH_ADCIN3";
|
||||
adc1.soc13Channel = "ADC_CH_ADCIN0";
|
||||
adc1.soc14Channel = "ADC_CH_ADCIN1";
|
||||
adc1.soc15Channel = "ADC_CH_ADCIN4";
|
||||
|
||||
adc1.soc7SampleWindow = 15;
|
||||
adc1.soc8SampleWindow = 15;
|
||||
adc1.soc9SampleWindow = 15;
|
||||
adc1.soc10SampleWindow = 15;
|
||||
adc1.soc11SampleWindow = 15;
|
||||
adc1.soc12SampleWindow = 15;
|
||||
adc1.soc13SampleWindow = 15;
|
||||
adc1.soc14SampleWindow = 15;
|
||||
adc1.soc15SampleWindow = 15;
|
||||
|
||||
adc1.enabledInts = ["ADC_INT_NUMBER1","ADC_INT_NUMBER2","ADC_INT_NUMBER3"];
|
||||
|
||||
adc1.enableInterrupt1 = true;
|
||||
adc1.enableInterrupt2 = true;
|
||||
adc1.enableInterrupt3 = true;
|
||||
|
||||
adc1.interrupt1SOCSource = "ADC_SOC_NUMBER9";
|
||||
adc1.interrupt2SOCSource = "ADC_SOC_NUMBER12";
|
||||
adc1.interrupt3SOCSource = "ADC_SOC_NUMBER15";
|
||||
|
||||
adc1.registerInterrupts = ["1","2","3"];
|
||||
|
||||
adc1.adcInt1.enableInterrupt = true;
|
||||
adc1.adcInt1.interruptHandler = "adcABurstISR";
|
||||
adc1.adcInt2.enableInterrupt = true;
|
||||
adc1.adcInt2.interruptHandler = "adcABurstISR";
|
||||
adc1.adcInt3.enableInterrupt = true;
|
||||
adc1.adcInt3.interruptHandler = "adcABurstISR";
|
||||
|
||||
|
||||
scripting.suppress("SOC7 is configured for Round Robin\. With burst mode enabled, the burst mode trigger will override the selected trigger for this SOC",adc1,"soc7Trigger");
|
||||
scripting.suppress("SOC8 is configured for Round Robin\. With burst mode enabled, the burst mode trigger will override the selected trigger for this SOC",adc1,"soc8Trigger");
|
||||
scripting.suppress("SOC9 is configured for Round Robin\. With burst mode enabled, the burst mode trigger will override the selected trigger for this SOC",adc1,"soc9Trigger");
|
||||
scripting.suppress("SOC10 is configured for Round Robin\. With burst mode enabled, the burst mode trigger will override the selected trigger for this SOC",adc1,"soc10Trigger");
|
||||
scripting.suppress("SOC11 is configured for Round Robin\. With burst mode enabled, the burst mode trigger will override the selected trigger for this SOC",adc1,"soc11Trigger");
|
||||
scripting.suppress("SOC12 is configured for Round Robin\. With burst mode enabled, the burst mode trigger will override the selected trigger for this SOC",adc1,"soc12Trigger");
|
||||
scripting.suppress("SOC13 is configured for Round Robin\. With burst mode enabled, the burst mode trigger will override the selected trigger for this SOC",adc1,"soc13Trigger");
|
||||
scripting.suppress("SOC14 is configured for Round Robin\. With burst mode enabled, the burst mode trigger will override the selected trigger for this SOC",adc1,"soc14Trigger");
|
||||
scripting.suppress("SOC15 is configured for Round Robin\. With burst mode enabled, the burst mode trigger will override the selected trigger for this SOC",adc1,"soc15Trigger");
|
||||
@@ -0,0 +1,265 @@
|
||||
//#############################################################################
|
||||
//
|
||||
// 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 is an ADC oversampling example implemented with software. The
|
||||
//! ADC SOCs are configured in burst mode, triggered by the ePWM SOC A event
|
||||
//! trigger.
|
||||
//!
|
||||
//! \b External \b Connection \n
|
||||
//! - A2
|
||||
//!
|
||||
//! \b Watch \b Variables \n
|
||||
//! - \b lv_results - Array of digital values measured on pin A2 (oversampling
|
||||
//! is configured by Oversampling_Amount)
|
||||
//!
|
||||
//
|
||||
//#############################################################################
|
||||
//
|
||||
//
|
||||
//
|
||||
// C2000Ware v5.04.00.00
|
||||
//
|
||||
// Copyright (C) 2024 Texas Instruments Incorporated - http://www.ti.com
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions
|
||||
// are met:
|
||||
//
|
||||
// Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
//
|
||||
// Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
//
|
||||
// Neither the name of Texas Instruments Incorporated nor the names of
|
||||
// its contributors may be used to endorse or promote products derived
|
||||
// from this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
// $
|
||||
//#############################################################################
|
||||
|
||||
//
|
||||
// Included Files
|
||||
//
|
||||
#include "driverlib.h"
|
||||
#include "device.h"
|
||||
#include "board.h"
|
||||
|
||||
//
|
||||
// Macros and Enumerations
|
||||
//
|
||||
#define DO_TOGGLE 0
|
||||
typedef enum
|
||||
{
|
||||
Baseline = 0, //!< No oversampling
|
||||
X2_Oversampling = 1, //!< 2X oversampling
|
||||
X4_Oversampling = 2, //!< 4X oversampling
|
||||
X8_Oversampling = 3, //!< 8X oversampling
|
||||
X16_Oversampling = 4, //!< 16X oversampling
|
||||
} Oversampling_Amount;
|
||||
|
||||
//
|
||||
// Global Variables
|
||||
//
|
||||
uint16_t acc;
|
||||
uint16_t numBins = 8192;
|
||||
volatile uint16_t nloops = 0;
|
||||
volatile uint16_t *lv_results;
|
||||
Oversampling_Amount ovrsmplAmt = Baseline;
|
||||
|
||||
//
|
||||
// Functions
|
||||
//
|
||||
__interrupt void INT_myADC0_1_ISR(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:
|
||||
// Signal Mode : single-ended
|
||||
// Conversion Resolution : 12-bit;
|
||||
//
|
||||
// Burst mode configuration:
|
||||
// 1 burst of 16 conversions (SOC0 - SOC15) with equal priority
|
||||
//
|
||||
// Burst mode trigger is EPWM1 SOCA. Select the channels to be
|
||||
// converted and configure the S+H duration
|
||||
//
|
||||
Board_init();
|
||||
|
||||
//
|
||||
// Initialize memory address for results table
|
||||
//
|
||||
lv_results = (uint16_t*)0xC000;
|
||||
|
||||
//
|
||||
// Debug Timing of ePWM and SOC conversions
|
||||
//
|
||||
#if(DO_TOGGLE == 1)
|
||||
SysCtl_enableExtADCSOCSource(SYSCTL_ADCSOC_SRC_PWM1SOCA); //Routes ePWM SOCA trigger to external pin
|
||||
GPIO_setPinConfig(GPIO_8_ADCSOCAO);
|
||||
GPIO_setPadConfig(7, GPIO_PIN_TYPE_STD/*GPIO_PIN_TYPE_PULLUP*/);
|
||||
GPIO_setPinConfig(GPIO_7_GPIO7);
|
||||
GPIO_setDirectionMode(7, GPIO_DIR_MODE_OUT);
|
||||
GPIO_writePin(0,0);
|
||||
#endif
|
||||
|
||||
//
|
||||
// Enable Global Interrupt (INTM) and real time interrupt (DBGM)
|
||||
//
|
||||
EINT;
|
||||
ERTM;
|
||||
|
||||
while(1);
|
||||
}
|
||||
|
||||
//
|
||||
// INT_myADC0_1_ISR - ADC A Interrupt Burst Mode ISR
|
||||
// Interrupt performs oversampling calculation based on oversampling factor
|
||||
//
|
||||
__interrupt void INT_myADC0_1_ISR(void)
|
||||
{
|
||||
//
|
||||
// Clear the interrupt flag
|
||||
//
|
||||
ADC_clearInterruptStatus(myADC0_BASE, ADC_INT_NUMBER1);
|
||||
|
||||
//
|
||||
// Debug Timing of ePWM and SOC conversions
|
||||
//
|
||||
#if(DO_TOGGLE == 1)
|
||||
GPIO_togglePin(myGPIO0);
|
||||
#endif
|
||||
|
||||
//
|
||||
// Accumulate SOC results (store only 1 value per burst)
|
||||
//
|
||||
if(ovrsmplAmt == Baseline)
|
||||
{
|
||||
//
|
||||
// 1X Oversampling
|
||||
//
|
||||
lv_results[nloops++] = ADC_readResult(myADC0_RESULT_BASE, ADC_SOC_NUMBER0);
|
||||
}
|
||||
else if(ovrsmplAmt == X2_Oversampling)
|
||||
{
|
||||
//
|
||||
// 2X Oversampling
|
||||
//
|
||||
lv_results[nloops++] = (ADC_readResult(myADC0_RESULT_BASE, ADC_SOC_NUMBER0) + ADC_readResult(myADC0_RESULT_BASE, ADC_SOC_NUMBER1));
|
||||
}
|
||||
else if(ovrsmplAmt == X4_Oversampling)
|
||||
{
|
||||
//
|
||||
// 4X Oversampling
|
||||
//
|
||||
lv_results[nloops++] = (ADC_readResult(myADC0_RESULT_BASE, ADC_SOC_NUMBER0) + ADC_readResult(myADC0_RESULT_BASE, ADC_SOC_NUMBER1) +
|
||||
ADC_readResult(myADC0_RESULT_BASE, ADC_SOC_NUMBER2) + ADC_readResult(myADC0_RESULT_BASE, ADC_SOC_NUMBER3));
|
||||
}
|
||||
else if(ovrsmplAmt == X8_Oversampling)
|
||||
{
|
||||
//
|
||||
// 8X Oversampling
|
||||
//
|
||||
lv_results[nloops++] = (ADC_readResult(myADC0_RESULT_BASE, ADC_SOC_NUMBER0) + ADC_readResult(myADC0_RESULT_BASE, ADC_SOC_NUMBER1) +
|
||||
ADC_readResult(myADC0_RESULT_BASE, ADC_SOC_NUMBER2) + ADC_readResult(myADC0_RESULT_BASE, ADC_SOC_NUMBER3) +
|
||||
ADC_readResult(myADC0_RESULT_BASE, ADC_SOC_NUMBER4) + ADC_readResult(myADC0_RESULT_BASE, ADC_SOC_NUMBER5) +
|
||||
ADC_readResult(myADC0_RESULT_BASE, ADC_SOC_NUMBER6) + ADC_readResult(myADC0_RESULT_BASE, ADC_SOC_NUMBER7));
|
||||
}
|
||||
else if(ovrsmplAmt == X16_Oversampling)
|
||||
{
|
||||
//
|
||||
// 16X Oversampling
|
||||
//
|
||||
acc = (ADC_readResult(myADC0_RESULT_BASE, ADC_SOC_NUMBER0) + ADC_readResult(myADC0_RESULT_BASE, ADC_SOC_NUMBER1) +
|
||||
ADC_readResult(myADC0_RESULT_BASE, ADC_SOC_NUMBER2) + ADC_readResult(myADC0_RESULT_BASE, ADC_SOC_NUMBER3) +
|
||||
ADC_readResult(myADC0_RESULT_BASE, ADC_SOC_NUMBER4) + ADC_readResult(myADC0_RESULT_BASE, ADC_SOC_NUMBER5) +
|
||||
ADC_readResult(myADC0_RESULT_BASE, ADC_SOC_NUMBER6) + ADC_readResult(myADC0_RESULT_BASE, ADC_SOC_NUMBER7) +
|
||||
ADC_readResult(myADC0_RESULT_BASE, ADC_SOC_NUMBER8) + ADC_readResult(myADC0_RESULT_BASE, ADC_SOC_NUMBER9) +
|
||||
ADC_readResult(myADC0_RESULT_BASE, ADC_SOC_NUMBER10) + ADC_readResult(myADC0_RESULT_BASE, ADC_SOC_NUMBER11) +
|
||||
ADC_readResult(myADC0_RESULT_BASE, ADC_SOC_NUMBER12) + ADC_readResult(myADC0_RESULT_BASE, ADC_SOC_NUMBER13) +
|
||||
ADC_readResult(myADC0_RESULT_BASE, ADC_SOC_NUMBER14) + ADC_readResult(myADC0_RESULT_BASE, ADC_SOC_NUMBER15));
|
||||
lv_results[nloops] = acc;
|
||||
nloops++;
|
||||
}
|
||||
|
||||
//
|
||||
// Check if overflow has occurred
|
||||
//
|
||||
if(true == ADC_getInterruptOverflowStatus(myADC0_BASE, ADC_INT_NUMBER1))
|
||||
{
|
||||
ADC_clearInterruptOverflowStatus(myADC0_BASE, ADC_INT_NUMBER1);
|
||||
ADC_clearInterruptStatus(myADC0_BASE, ADC_INT_NUMBER1);
|
||||
}
|
||||
|
||||
//
|
||||
// Check if all results are stored
|
||||
//
|
||||
if(nloops >= numBins)
|
||||
{
|
||||
//
|
||||
// Disable ADC interrupt
|
||||
//
|
||||
ADC_disableInterrupt(myADC0_BASE, ADC_INT_NUMBER1);
|
||||
ESTOP0;
|
||||
}
|
||||
|
||||
//
|
||||
// Debug Timing of ePWM and SOC conversions
|
||||
//
|
||||
#if(DO_TOGGLE == 1)
|
||||
GPIO_togglePin(myGPIO0);
|
||||
#endif
|
||||
|
||||
//
|
||||
// Acknowledge the interrupt
|
||||
//
|
||||
Interrupt_clearACKGroup(INTERRUPT_ACK_GROUP1);
|
||||
}
|
||||
|
||||
//
|
||||
// End of file
|
||||
//
|
||||
@@ -0,0 +1,101 @@
|
||||
|
||||
/**
|
||||
* Import the modules used in this configuration.
|
||||
*/
|
||||
const adc = scripting.addModule("/driverlib/adc.js", {}, false);
|
||||
const adc1 = adc.addInstance();
|
||||
const epwm = scripting.addModule("/driverlib/epwm.js");
|
||||
const epwm1 = epwm.addInstance();
|
||||
const gpio = scripting.addModule("/driverlib/gpio.js", {}, false);
|
||||
const gpio1 = gpio.addInstance();
|
||||
const sync = scripting.addModule("/driverlib/sync.js");
|
||||
|
||||
/**
|
||||
* Write custom configuration values to the imported modules.
|
||||
*/
|
||||
adc1.$name = "myADC0";
|
||||
adc1.adcBase = "ADCA_BASE";
|
||||
|
||||
adc1.adcSignalMode = "ADC_MODE_SINGLE_ENDED";
|
||||
adc1.adcResolutionMode = "ADC_RESOLUTION_12BIT";
|
||||
|
||||
adc1.adcClockPrescaler = "ADC_CLK_DIV_4_0";
|
||||
|
||||
adc1.interruptPulseMode = "ADC_PULSE_END_OF_CONV";
|
||||
adc1.enabledSOCs = ["ADC_SOC_NUMBER0","ADC_SOC_NUMBER1","ADC_SOC_NUMBER2","ADC_SOC_NUMBER3","ADC_SOC_NUMBER4","ADC_SOC_NUMBER5","ADC_SOC_NUMBER6","ADC_SOC_NUMBER7","ADC_SOC_NUMBER8","ADC_SOC_NUMBER9","ADC_SOC_NUMBER10","ADC_SOC_NUMBER11","ADC_SOC_NUMBER12","ADC_SOC_NUMBER13","ADC_SOC_NUMBER14","ADC_SOC_NUMBER15"];
|
||||
|
||||
adc1.soc0Channel = "ADC_CH_ADCIN2";
|
||||
adc1.soc1Channel = "ADC_CH_ADCIN2";
|
||||
adc1.soc2Channel = "ADC_CH_ADCIN2";
|
||||
adc1.soc3Channel = "ADC_CH_ADCIN2";
|
||||
adc1.soc4Channel = "ADC_CH_ADCIN2";
|
||||
adc1.soc5Channel = "ADC_CH_ADCIN2";
|
||||
adc1.soc6Channel = "ADC_CH_ADCIN2";
|
||||
adc1.soc7Channel = "ADC_CH_ADCIN2";
|
||||
adc1.soc8Channel = "ADC_CH_ADCIN2";
|
||||
adc1.soc9Channel = "ADC_CH_ADCIN2";
|
||||
adc1.soc10Channel = "ADC_CH_ADCIN2";
|
||||
adc1.soc11Channel = "ADC_CH_ADCIN2";
|
||||
adc1.soc12Channel = "ADC_CH_ADCIN2";
|
||||
adc1.soc13Channel = "ADC_CH_ADCIN2";
|
||||
adc1.soc14Channel = "ADC_CH_ADCIN2";
|
||||
adc1.soc15Channel = "ADC_CH_ADCIN2";
|
||||
|
||||
adc1.soc0SampleWindow = 15;
|
||||
adc1.soc1SampleWindow = 15;
|
||||
adc1.soc2SampleWindow = 15;
|
||||
adc1.soc3SampleWindow = 15;
|
||||
adc1.soc4SampleWindow = 15;
|
||||
adc1.soc5SampleWindow = 15;
|
||||
adc1.soc6SampleWindow = 15;
|
||||
adc1.soc7SampleWindow = 15;
|
||||
adc1.soc8SampleWindow = 15;
|
||||
adc1.soc9SampleWindow = 15;
|
||||
adc1.soc10SampleWindow = 15;
|
||||
adc1.soc11SampleWindow = 15;
|
||||
adc1.soc12SampleWindow = 15;
|
||||
adc1.soc13SampleWindow = 15;
|
||||
adc1.soc14SampleWindow = 15;
|
||||
adc1.soc15SampleWindow = 15;
|
||||
|
||||
adc1.enabledInts = ["ADC_INT_NUMBER1"];
|
||||
adc1.enableInterrupt1 = true;
|
||||
adc1.interrupt1SOCSource = "ADC_SOC_NUMBER15";
|
||||
adc1.registerInterrupts = ["1"];
|
||||
adc1.enableBurstMode = true;
|
||||
adc1.burstTrigger = "ADC_TRIGGER_EPWM1_SOCA";
|
||||
adc1.adcInt1.enableInterrupt = true;
|
||||
|
||||
|
||||
scripting.suppress("SOC0 is configured for Round Robin\\. With burst mode enabled, the burst mode trigger will override the selected trigger for this SOC", adc1, "soc0Trigger");
|
||||
scripting.suppress("SOC1 is configured for Round Robin\\. With burst mode enabled, the burst mode trigger will override the selected trigger for this SOC", adc1, "soc1Trigger");
|
||||
scripting.suppress("SOC2 is configured for Round Robin\\. With burst mode enabled, the burst mode trigger will override the selected trigger for this SOC", adc1, "soc2Trigger");
|
||||
scripting.suppress("SOC3 is configured for Round Robin\\. With burst mode enabled, the burst mode trigger will override the selected trigger for this SOC", adc1, "soc3Trigger");
|
||||
scripting.suppress("SOC4 is configured for Round Robin\\. With burst mode enabled, the burst mode trigger will override the selected trigger for this SOC", adc1, "soc4Trigger");
|
||||
scripting.suppress("SOC5 is configured for Round Robin\\. With burst mode enabled, the burst mode trigger will override the selected trigger for this SOC", adc1, "soc5Trigger");
|
||||
scripting.suppress("SOC6 is configured for Round Robin\\. With burst mode enabled, the burst mode trigger will override the selected trigger for this SOC", adc1, "soc6Trigger");
|
||||
scripting.suppress("SOC7 is configured for Round Robin\\. With burst mode enabled, the burst mode trigger will override the selected trigger for this SOC", adc1, "soc7Trigger");
|
||||
scripting.suppress("SOC8 is configured for Round Robin\\. With burst mode enabled, the burst mode trigger will override the selected trigger for this SOC", adc1, "soc8Trigger");
|
||||
scripting.suppress("SOC9 is configured for Round Robin\\. With burst mode enabled, the burst mode trigger will override the selected trigger for this SOC", adc1, "soc9Trigger");
|
||||
scripting.suppress("SOC10 is configured for Round Robin\\. With burst mode enabled, the burst mode trigger will override the selected trigger for this SOC", adc1, "soc10Trigger");
|
||||
scripting.suppress("SOC11 is configured for Round Robin\\. With burst mode enabled, the burst mode trigger will override the selected trigger for this SOC", adc1, "soc11Trigger");
|
||||
scripting.suppress("SOC12 is configured for Round Robin\\. With burst mode enabled, the burst mode trigger will override the selected trigger for this SOC", adc1, "soc12Trigger");
|
||||
scripting.suppress("SOC13 is configured for Round Robin\\. With burst mode enabled, the burst mode trigger will override the selected trigger for this SOC", adc1, "soc13Trigger");
|
||||
scripting.suppress("SOC14 is configured for Round Robin\\. With burst mode enabled, the burst mode trigger will override the selected trigger for this SOC", adc1, "soc14Trigger");
|
||||
scripting.suppress("SOC15 is configured for Round Robin\\. With burst mode enabled, the burst mode trigger will override the selected trigger for this SOC", adc1, "soc15Trigger");
|
||||
|
||||
epwm.commentOutDefaultCode = true;
|
||||
epwm1.$name = "myEPWM0";
|
||||
epwm1.epwmEventTrigger_EPWM_SOC_A_triggerEnable = true;
|
||||
epwm1.epwmTimebase_hsClockDiv = "EPWM_HSCLOCK_DIVIDER_1";
|
||||
epwm1.epwmEventTrigger_EPWM_SOC_A_triggerEventPrescalar = "1";
|
||||
epwm1.epwmActionQualifier_EPWM_AQ_OUTPUT_A_ON_TIMEBASE_ZERO = "EPWM_AQ_OUTPUT_HIGH";
|
||||
epwm1.epwmActionQualifier_EPWM_AQ_OUTPUT_A_ON_TIMEBASE_UP_CMPA = "EPWM_AQ_OUTPUT_LOW";
|
||||
epwm1.epwmEventTrigger_EPWM_SOC_A_triggerSource = "EPWM_SOC_TBCTR_U_CMPA";
|
||||
epwm1.epwmTimebase_counterMode = "EPWM_COUNTER_MODE_UP";
|
||||
epwm1.epwmTimebase_period = 910;
|
||||
epwm1.epwmCounterCompare_cmpA = 909;
|
||||
|
||||
gpio1.$name = "myGPIO0";
|
||||
gpio1.direction = "GPIO_DIR_MODE_OUT";
|
||||
gpio1.gpioPin.$assign = "GPIO0";
|
||||
@@ -0,0 +1,237 @@
|
||||
//#############################################################################
|
||||
//
|
||||
// FILE: adc_ex13_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
|
||||
//!
|
||||
//
|
||||
//#############################################################################
|
||||
//
|
||||
//
|
||||
//
|
||||
// C2000Ware v5.04.00.00
|
||||
//
|
||||
// Copyright (C) 2024 Texas Instruments Incorporated - http://www.ti.com
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions
|
||||
// are met:
|
||||
//
|
||||
// Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
//
|
||||
// Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
//
|
||||
// Neither the name of Texas Instruments Incorporated nor the names of
|
||||
// its contributors may be used to endorse or promote products derived
|
||||
// from this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
// $
|
||||
//#############################################################################
|
||||
//
|
||||
|
||||
//
|
||||
// Included Files
|
||||
//
|
||||
#include "driverlib.h"
|
||||
#include "device.h"
|
||||
#include "board.h"
|
||||
|
||||
//
|
||||
// Globals
|
||||
//
|
||||
uint16_t adcAResult0;
|
||||
uint16_t adcAResult1;
|
||||
uint16_t adcAResult2;
|
||||
|
||||
//
|
||||
// Function Prototypes
|
||||
//
|
||||
void initEPWM();
|
||||
__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();
|
||||
|
||||
//
|
||||
// Set up ADCs:
|
||||
// Signal Mode : single-ended
|
||||
// Conversion Resolution : 12-bit;
|
||||
//
|
||||
// Configure SOC0-1 in round robin mode to sample A0 and A1 channel
|
||||
// respectively and SOC2-SOC5 oversamples channel A2 on EPWM1SOCA
|
||||
// trigger.
|
||||
//
|
||||
// Register and enable the interrupts:
|
||||
// SOC0 and SOC1 results are read after each PWM trigger for
|
||||
// channel 0 and 1 outputs while SOC2-SOC5 results will be
|
||||
// averaged together for oversampled channel A2 result
|
||||
//
|
||||
Board_init();
|
||||
|
||||
//
|
||||
// Initialize PWM
|
||||
//
|
||||
initEPWM();
|
||||
|
||||
//
|
||||
// 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);
|
||||
}
|
||||
|
||||
//
|
||||
// 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);
|
||||
}
|
||||
|
||||
//
|
||||
// adcA1ISR - 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,49 @@
|
||||
|
||||
/**
|
||||
* Import the modules used in this configuration.
|
||||
*/
|
||||
const adc = scripting.addModule("/driverlib/adc.js", {}, false);
|
||||
const adc1 = adc.addInstance();
|
||||
|
||||
/**
|
||||
* Write custom configuration values to the imported modules.
|
||||
*/
|
||||
adc1.$name = "myADC0";
|
||||
adc1.adcBase = "ADCA_BASE";
|
||||
|
||||
adc1.adcClockPrescaler = "ADC_CLK_DIV_4_0";
|
||||
adc1.interruptPulseMode = "ADC_PULSE_END_OF_CONV";
|
||||
|
||||
adc1.adcSignalMode = "ADC_MODE_SINGLE_ENDED";
|
||||
adc1.adcResolutionMode = "ADC_RESOLUTION_12BIT";
|
||||
|
||||
adc1.enabledSOCs = ["ADC_SOC_NUMBER0","ADC_SOC_NUMBER1","ADC_SOC_NUMBER2","ADC_SOC_NUMBER3","ADC_SOC_NUMBER4","ADC_SOC_NUMBER5"];
|
||||
|
||||
adc1.soc0Trigger = "ADC_TRIGGER_EPWM1_SOCA";
|
||||
adc1.soc1Trigger = "ADC_TRIGGER_EPWM1_SOCA";
|
||||
adc1.soc2Trigger = "ADC_TRIGGER_EPWM1_SOCA";
|
||||
adc1.soc3Trigger = "ADC_TRIGGER_EPWM1_SOCA";
|
||||
adc1.soc4Trigger = "ADC_TRIGGER_EPWM1_SOCA";
|
||||
adc1.soc5Trigger = "ADC_TRIGGER_EPWM1_SOCA";
|
||||
|
||||
adc1.soc0Channel = "ADC_CH_ADCIN0";
|
||||
adc1.soc1Channel = "ADC_CH_ADCIN1";
|
||||
adc1.soc2Channel = "ADC_CH_ADCIN2";
|
||||
adc1.soc3Channel = "ADC_CH_ADCIN2";
|
||||
adc1.soc4Channel = "ADC_CH_ADCIN2";
|
||||
adc1.soc5Channel = "ADC_CH_ADCIN2";
|
||||
|
||||
adc1.soc0SampleWindow = 15;
|
||||
adc1.soc1SampleWindow = 15;
|
||||
adc1.soc2SampleWindow = 15;
|
||||
adc1.soc3SampleWindow = 15;
|
||||
adc1.soc4SampleWindow = 15;
|
||||
adc1.soc5SampleWindow = 15;
|
||||
|
||||
adc1.enabledInts = ["ADC_INT_NUMBER1"];
|
||||
adc1.enableInterrupt1 = true;
|
||||
adc1.interrupt1SOCSource = "ADC_SOC_NUMBER5";
|
||||
adc1.registerInterrupts = ["1"];
|
||||
adc1.adcInt1.enableInterrupt = true;
|
||||
adc1.adcInt1.interruptHandler = "adcA1ISR";
|
||||
|
||||
@@ -0,0 +1,692 @@
|
||||
//###########################################################################
|
||||
//
|
||||
// FILE: adc_ex14_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
|
||||
//! - cycle-by-cycle
|
||||
//! - 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)
|
||||
//! - ePWM2(GPIO2 - GPIO3)
|
||||
//! - ePWM3(GPIO4 - GPIO5)
|
||||
//! -
|
||||
//!
|
||||
//! \b Watch \b Variables \n
|
||||
//! - adcA2Results - digital representation of the voltage on pin A2
|
||||
//!
|
||||
//
|
||||
//#############################################################################
|
||||
//
|
||||
//
|
||||
//
|
||||
// C2000Ware v5.04.00.00
|
||||
//
|
||||
// Copyright (C) 2024 Texas Instruments Incorporated - http://www.ti.com
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions
|
||||
// are met:
|
||||
//
|
||||
// Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
//
|
||||
// Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
//
|
||||
// Neither the name of Texas Instruments Incorporated nor the names of
|
||||
// its contributors may be used to endorse or promote products derived
|
||||
// from this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
// $
|
||||
//#############################################################################
|
||||
//
|
||||
|
||||
//
|
||||
// Included Files
|
||||
//
|
||||
#include "driverlib.h"
|
||||
#include "device.h"
|
||||
|
||||
//
|
||||
// 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 single-ended signaling
|
||||
// Or 16 for 16-bit conversion resolution, which supports single-ended or
|
||||
// differential signaling
|
||||
#define EX_ADC_SIGNALMODE "SINGLE-ENDED"
|
||||
//"SINGLE-ENDED" for ADC_MODE_SINGLE_ENDED:
|
||||
// Sample on single pin (VREFLO is the low reference)
|
||||
// Or "Differential" for 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
|
||||
// EPWM2 - frequency -> 2.5kHz, dutyA -> 20%, dutyB -> 50%, ePWM2B - 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 pwmSignal2 =
|
||||
{25000, 0.2f, 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 configureCBCTripSignal(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(EPWM2_BASE, &pwmSignal2);
|
||||
EPWM_configureSignal(EPWM3_BASE, &pwmSignal3);
|
||||
|
||||
//
|
||||
// Configure ADCEVTx as one-shot trip signal for ePWM1
|
||||
//
|
||||
configureOSHTripSignal(EPWM1_BASE);
|
||||
|
||||
//
|
||||
// Configure ADCEVTx as cycle-by-cycle trip signal for ePWM2
|
||||
//
|
||||
configureCBCTripSignal(EPWM2_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);
|
||||
}
|
||||
|
||||
//
|
||||
// configureCBCTripSignal - Configure ADCAEVT1 as cycle-by-cycle trip signal
|
||||
// for desired PWM instance
|
||||
//
|
||||
void configureCBCTripSignal(uint32_t epwmBase)
|
||||
{
|
||||
//
|
||||
// Configure trip 8 input to be triggered by ADCAEVT1
|
||||
//
|
||||
XBAR_setEPWMMuxConfig(XBAR_TRIP8, XBAR_EPWM_MUX00_ADCAEVT1);
|
||||
|
||||
//
|
||||
// Enable mux 0
|
||||
//
|
||||
XBAR_enableEPWMMux(XBAR_TRIP8, XBAR_MUX00);
|
||||
|
||||
//
|
||||
// Select Trip 8 input as input to DC module
|
||||
//
|
||||
EPWM_selectDigitalCompareTripInput(epwmBase, EPWM_DC_TRIP_TRIPIN8,
|
||||
EPWM_DC_TYPE_DCAH);
|
||||
|
||||
//
|
||||
// DCAEVT2 is generated when DCAH is high.
|
||||
//
|
||||
EPWM_setTripZoneDigitalCompareEventCondition(epwmBase, EPWM_TZ_DC_OUTPUT_A2,
|
||||
EPWM_TZ_EVENT_DCXH_HIGH);
|
||||
|
||||
//
|
||||
// DCAEVT2 uses the unfiltered version of DCAEVT2
|
||||
//
|
||||
EPWM_setDigitalCompareEventSource(epwmBase, EPWM_DC_MODULE_A,
|
||||
EPWM_DC_EVENT_2, EPWM_DC_EVENT_SOURCE_ORIG_SIGNAL);
|
||||
|
||||
//
|
||||
// DCAEVT2 is asynchronous
|
||||
//
|
||||
EPWM_setDigitalCompareEventSyncMode(epwmBase, EPWM_DC_MODULE_A,
|
||||
EPWM_DC_EVENT_2, EPWM_DC_EVENT_INPUT_NOT_SYNCED);
|
||||
|
||||
//
|
||||
// Enable Trip zone signals
|
||||
//
|
||||
EPWM_enableTripZoneSignals(epwmBase, EPWM_TZ_SIGNAL_DCAEVT2);
|
||||
|
||||
//
|
||||
// Configure CBC clear event
|
||||
//
|
||||
EPWM_selectCycleByCycleTripZoneClearEvent(epwmBase,
|
||||
EPWM_TZ_CBC_PULSE_CLR_CNTR_ZERO_PERIOD);
|
||||
|
||||
//
|
||||
// Action on DCAEVT2
|
||||
// Force the EPWMxA/EPWMxB LOW
|
||||
//
|
||||
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_DCAEVT2);
|
||||
|
||||
EPWM_clearCycleByCycleTripZoneFlag(epwmBase, EPWM_TZ_CBC_FLAG_DCAEVT2);
|
||||
|
||||
//
|
||||
// Enable TZ interrupt
|
||||
//
|
||||
EPWM_enableTripZoneInterrupt(epwmBase, EPWM_TZ_INTERRUPT_CBC);
|
||||
}
|
||||
|
||||
//
|
||||
// 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 ADCCLK 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)
|
||||
#if(EX_ADC_SIGNALMODE == "SINGLE-ENDED")
|
||||
ADC_setMode(adcBase, ADC_RESOLUTION_16BIT, ADC_MODE_SINGLE_ENDED);
|
||||
#elif(EX_ADC_SIGNALMODE == "DIFFERENTIAL")
|
||||
ADC_setMode(adcBase, ADC_RESOLUTION_16BIT, ADC_MODE_DIFFERENTIAL);
|
||||
#endif
|
||||
#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));
|
||||
|
||||
//
|
||||
// Configure CBCEN
|
||||
//
|
||||
EALLOW;
|
||||
HWREGH(ADCA_BASE + ADC_O_PPB1CONFIG) |= ADC_PPB2CONFIG_CBCEN;
|
||||
EDIS;
|
||||
}
|
||||
|
||||
//
|
||||
// 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(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);
|
||||
}
|
||||
|
||||
#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,3 @@
|
||||
/**
|
||||
* Blank
|
||||
*/
|
||||
@@ -0,0 +1,752 @@
|
||||
//###########################################################################
|
||||
//
|
||||
// FILE: adc_ex15_high_priority_soc.c
|
||||
//
|
||||
// TITLE: ADC High Priority SOC Example.
|
||||
//
|
||||
//! \addtogroup driver_example_list
|
||||
//! <h1> ADC High Priority SOC (adc_high_priority_soc)</h1>
|
||||
//!
|
||||
//! This example demonstrates configuration of ADC high priority SOCs in
|
||||
//! order to sample fastest control loop signals with high priority while
|
||||
//! low priority signals are sampled with default round robin priority.
|
||||
//!
|
||||
//! ADC PPB block is configured to capture delay between SOC trigger
|
||||
//! and actual start of the SOC sampling in order to quantify the jitters
|
||||
//! in sampling high priority signals due to low priority signals. The
|
||||
//! delay in processing an SOC is captured in ADCPPBxSTAMP.DLYSTAMP
|
||||
//! register field and the total delay in sampling an SOC is equal to
|
||||
//! (DLYSTAMP - 2) cycles. In an optimal design the high priority SOC
|
||||
//! is expected to have less delay between SOC trigger and actual start
|
||||
//! of the sample.
|
||||
//!
|
||||
//! In this example ADCA, ADCB and ADCD are configured to sample both
|
||||
//! high and low priority signals. SOC0-3 are configured as high priority
|
||||
//! SOCs while rest are configured with default round-robin priority. ADCA
|
||||
//! SOC0-3 are configured as high priority SOCs sampling channels A0-A3,
|
||||
//! ADCB SOC0-1 are configured as high priority SOCs sampling channels
|
||||
//! B0-B1 and ADCD SOC0-1 are configured as high priority SOCs sampling
|
||||
//! channels D0-D1. For sampling low priority signals SOC4-SOC5 are
|
||||
//! configured sampling channel 4 and channel 13 respectively for ADCA
|
||||
//! and channel 4 and 5 for ADCB and ADCD. For ADCA, channel 13 is
|
||||
//! connected to internal temperature sensor output and hence no signal
|
||||
//! needs to be connected to channel A13. High priority SOC results are
|
||||
//! read in ADCINT1 ISR while low priority SOC results are read in idle
|
||||
//! loop.
|
||||
//!
|
||||
//! This example has two modes of operation as follows. Desired mode
|
||||
//! can be selected by configuring the EX_ADC_LP_SOC_TRIGGER macro
|
||||
//! accordingly.
|
||||
//! Mode 0: ADCINT as round robin SOC trigger
|
||||
//! Mode 1: EPWM2 as round robin SOC trigger
|
||||
//!
|
||||
//! In mode 0, EPWM1 is configured as trigger for high priority SOCs while
|
||||
//! ADCINT1 is configured as low priority SOC trigger. ADCINT1 is configured
|
||||
//! to be triggered on completion of SOC1 conversion which in turn trigger
|
||||
//! low priority SOCs 4 and 5 and ADCINT2 is configured to be triggered on
|
||||
//! completion of SOC5. ADC result for high priority SOCs are read in ADCINT
|
||||
//! ISR while low priority SOC results are read in idle loop. ADCINT3 is
|
||||
//! configured to be triggered on completion of SOC3 and hence SOC2-SOC3
|
||||
//! results for ADCA are read post checking if the conversion is complete
|
||||
//! in ADCINT1 ISR.
|
||||
//!
|
||||
//! In mode 0, SOC0-SOC1 for all ADCs will experience minimal delay(0 and 1
|
||||
//! conversions) in processing due to the high priority configuration. For
|
||||
//! ADCA, SOC4-SOC5 are triggered when SOC2-SOC3 conversion is ongoing, hence
|
||||
//! SOC4-SOC5 will see some delay(2 and 3 conversions) in processing as
|
||||
//! expected. For ADCB and ADCD, SOC4-SOC5 will see minimal delay (0 and 1
|
||||
//! conversions) in processing as expected.
|
||||
//!
|
||||
//! In mode 1, EPWM1 is configured as trigger for high priority SOCs while
|
||||
//! EPWM2 is configured as low priority SOC trigger. ADCINT1 is configured
|
||||
//! to be triggered on completion of SOC3 conversion and ADC result for high
|
||||
//! priority SOCs are read in the ADCINT ISR. Low priority SOCs 4 and 5 are
|
||||
//! triggered through EPWM2 and ADCINT2 is configured to be triggered on
|
||||
//! completion of SOC5. The result for low priority SOCs are read in background
|
||||
//! loop. Since, SOC4-5 are triggered post SOC2-3 conversion(due to configured
|
||||
//! EPWM1 and EPWM2 trigger frequency and duty), SOC4-SOC5 will have minimal
|
||||
//! delay(0 and 1 conversions respectively) in SOC processing as expected.
|
||||
//!
|
||||
//! Optimization Level: Example is expected to run with opt level = O2.
|
||||
//!
|
||||
//! To view ADC results, put breakpoint at the statement where indexB is
|
||||
//! reset to zero in idle loop.
|
||||
//!
|
||||
//! \b External \b Connections \n
|
||||
//! - A0-A4, B0-B1, B4-B5, D0-D1 and D4-D5 pins should be connected to signals
|
||||
//! to be converted.
|
||||
//!
|
||||
//! - Observe ePWM1, ePWM2 signals on oscilloscope
|
||||
//!
|
||||
//! \b Watch \b Variables \n
|
||||
//! ADC Results:
|
||||
//! - adcA0Results - adcA4Results - ADC result of channels A0-A4
|
||||
//! - adcA13Results - ADC result of channels A13(Temp Sensor output)
|
||||
//! - adcB0Results - adcB1Results - ADC result of channels B0-B1
|
||||
//! - adcB4Results - ADC result of channel B4
|
||||
//! - adcB5Results - ADC result of channel B5
|
||||
//! - adcD0Results - adcD1Results - ADC result of channels D0-D1
|
||||
//! - adcD4Results - ADC result of channel D4
|
||||
//! - adcD5Results - ADC result of channel D5
|
||||
//!
|
||||
//! SOC conversion delays:
|
||||
//! - delaySocA0 - Delay in sampling ADCA SOC0
|
||||
//! - delaySocA3 - Delay in sampling ADCA SOC3
|
||||
//! - delaySocA4-delaySocA5 - Delay in sampling ADCA SOC4-SOC5
|
||||
//! - delaySocB0-delaySocB1 - Delay in sampling ADCB SOC0-SOC1
|
||||
//! - delaySocB4-delaySocB5 - Delay in sampling ADCB SOC4-SOC5
|
||||
//! - delaySocD0-delaySocD1 - Delay in sampling ADCD SOC0-SOC1
|
||||
//! - delaySocD4-delaySocD5 - Delay in sampling ADCD SOC4-SOC5
|
||||
//!
|
||||
//
|
||||
//###########################################################################
|
||||
//
|
||||
//
|
||||
//
|
||||
// C2000Ware v5.04.00.00
|
||||
//
|
||||
// Copyright (C) 2024 Texas Instruments Incorporated - http://www.ti.com
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions
|
||||
// are met:
|
||||
//
|
||||
// Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
//
|
||||
// Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
//
|
||||
// Neither the name of Texas Instruments Incorporated nor the names of
|
||||
// its contributors may be used to endorse or promote products derived
|
||||
// from this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
// $
|
||||
//###########################################################################
|
||||
|
||||
//
|
||||
// Included Files
|
||||
//
|
||||
#include "driverlib.h"
|
||||
#include "device.h"
|
||||
|
||||
//
|
||||
// Defines
|
||||
//
|
||||
|
||||
// Uncomment to enable profiling
|
||||
//#define ENABLE_PROFILING
|
||||
|
||||
//
|
||||
// Macro for defining ADC resolution
|
||||
//
|
||||
#define EX_ADC_RESOLUTION 12U
|
||||
|
||||
//
|
||||
// Macro to define acquisition window duration based on resolution.
|
||||
// This can vary as per application hardware. In this example, a
|
||||
// sampling window of 15 (75 ns at a 200MHz SYSCLK rate) will be used
|
||||
// for 12-bit resolution while a sampling window of 64 (320 ns at a
|
||||
// 200MHz SYSCLK rate) will be used for 16-bit resolution.
|
||||
//
|
||||
#define EX_ACQ_WIN_12_BIT 15U
|
||||
#define EX_ACQ_WIN_16_BIT 65U
|
||||
|
||||
//
|
||||
// Macro to define ADC result buffer size
|
||||
//
|
||||
#define RESULTS_BUFFER_SIZE 50U
|
||||
|
||||
//
|
||||
// Macro to define ADC Low Priority SOC trigger
|
||||
// if EX_ADC_LP_SOC_TRIGGER == 0U, low priority SOC trigger = ADCINT1
|
||||
// if EX_ADC_LP_SOC_TRIGGER == 1U, low priority SOC trigger = EPWM2
|
||||
//
|
||||
#define EX_ADC_LP_SOC_TRIGGER 0U
|
||||
|
||||
//
|
||||
// Globals
|
||||
//
|
||||
volatile uint16_t indexA = 0, indexB = 0; // Index into result buffer
|
||||
volatile uint16_t bufferFull; // Flag to indicate buffer is full
|
||||
|
||||
//
|
||||
// Globals for capturing SOC delay
|
||||
//
|
||||
volatile uint16_t delaySocA0 = 0, delaySocA3 = 0, delaySocA4 = 0, delaySocA5 = 0;
|
||||
volatile uint16_t delaySocB0 = 0, delaySocB1 = 0, delaySocB4 = 0, delaySocB5 = 0;
|
||||
volatile uint16_t delaySocD0 = 0, delaySocD1 = 0, delaySocD4 = 0, delaySocD5 = 0;
|
||||
|
||||
//
|
||||
// Globals for capturing ADC results
|
||||
//
|
||||
uint16_t adcA0Results[RESULTS_BUFFER_SIZE] = {0}; // ADC result buffer for Ch A0
|
||||
uint16_t adcB0Results[RESULTS_BUFFER_SIZE] = {0}; // ADC result buffer for Ch B0
|
||||
uint16_t adcD0Results[RESULTS_BUFFER_SIZE] = {0}; // ADC result buffer for Ch D0
|
||||
uint16_t adcA1Results[RESULTS_BUFFER_SIZE] = {0}; // ADC result buffer for Ch A1
|
||||
uint16_t adcB1Results[RESULTS_BUFFER_SIZE] = {0}; // ADC result buffer for Ch B1
|
||||
uint16_t adcD1Results[RESULTS_BUFFER_SIZE] = {0}; // ADC result buffer for Ch D1
|
||||
uint16_t adcA2Results[RESULTS_BUFFER_SIZE] = {0}; // ADC result buffer for Ch A2
|
||||
uint16_t adcA3Results[RESULTS_BUFFER_SIZE] = {0}; // ADC result buffer for Ch A3
|
||||
uint16_t adcA4Results[RESULTS_BUFFER_SIZE] = {0}; // ADC result buffer for Ch A4
|
||||
uint16_t adcB4Results[RESULTS_BUFFER_SIZE] = {0}; // ADC result buffer for Ch B4
|
||||
uint16_t adcD4Results[RESULTS_BUFFER_SIZE] = {0}; // ADC result buffer for Ch D4
|
||||
uint16_t adcA13Results[RESULTS_BUFFER_SIZE] = {0}; // ADC result buffer for Ch A13
|
||||
uint16_t adcB5Results[RESULTS_BUFFER_SIZE] = {0}; // ADC result buffer for Ch B5
|
||||
uint16_t adcD5Results[RESULTS_BUFFER_SIZE] = {0}; // ADC result buffer for Ch D5
|
||||
|
||||
//
|
||||
// Characteristics of PWM triggers
|
||||
// EPWM1 - frequency -> 400kHz, dutyA -> 50%, dutyB -> 50%, ePWM1B - inverted
|
||||
//
|
||||
EPWM_SignalParams pwmSignal1 =
|
||||
{400000, 0.5f, 0.5f, true, DEVICE_SYSCLK_FREQ, SYSCTL_EPWMCLK_DIV_2,
|
||||
EPWM_COUNTER_MODE_UP, EPWM_CLOCK_DIVIDER_1,
|
||||
EPWM_HSCLOCK_DIVIDER_1};
|
||||
|
||||
#if(EX_ADC_LP_SOC_TRIGGER == 1)
|
||||
//
|
||||
// EPWM2 - frequency -> 100kHz, dutyA -> 50%, dutyB -> 50%, ePWM2B - inverted
|
||||
//
|
||||
EPWM_SignalParams pwmSignal2 =
|
||||
{100000, 0.5f, 0.5f, true, DEVICE_SYSCLK_FREQ, SYSCTL_EPWMCLK_DIV_2,
|
||||
EPWM_COUNTER_MODE_UP, EPWM_CLOCK_DIVIDER_1,
|
||||
EPWM_HSCLOCK_DIVIDER_1};
|
||||
#endif
|
||||
|
||||
//
|
||||
// Functional Prototypes
|
||||
//
|
||||
|
||||
//
|
||||
// ADC configuration related APIs
|
||||
//
|
||||
void configureADC(uint32_t adcBase);
|
||||
void initADCSOC(uint32_t adcBase);
|
||||
void initADCPPB(void);
|
||||
|
||||
//
|
||||
// EPWM configuration related APIs
|
||||
//
|
||||
void initEPWMGPIO(void);
|
||||
|
||||
#ifdef ENABLE_PROFILING
|
||||
void setupProfileGpio(void);
|
||||
#endif
|
||||
|
||||
//
|
||||
// ADC ISR defined as high priority interrupt
|
||||
//
|
||||
__interrupt void adcA1ISR(void);
|
||||
#pragma CODE_SECTION(adcA1ISR, ".TI.ramfunc")
|
||||
#pragma INTERRUPT (adcA1ISR, HPI)
|
||||
|
||||
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);
|
||||
configureADC(ADCB_BASE);
|
||||
configureADC(ADCD_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_setTimeBaseCounterMode(EPWM1_BASE, EPWM_COUNTER_MODE_STOP_FREEZE);
|
||||
EPWM_disableADCTrigger(EPWM1_BASE, EPWM_SOC_A);
|
||||
|
||||
#if(EX_ADC_LP_SOC_TRIGGER == 1)
|
||||
EPWM_configureSignal(EPWM2_BASE, &pwmSignal2);
|
||||
EPWM_setTimeBaseCounterMode(EPWM2_BASE, EPWM_COUNTER_MODE_STOP_FREEZE);
|
||||
EPWM_disableADCTrigger(EPWM2_BASE, EPWM_SOC_A);
|
||||
#endif
|
||||
|
||||
//
|
||||
// Setup the ADC SOCs
|
||||
//
|
||||
initADCSOC(ADCA_BASE);
|
||||
initADCSOC(ADCB_BASE);
|
||||
initADCSOC(ADCD_BASE);
|
||||
|
||||
//
|
||||
// Configure ADC PPB for delay capture
|
||||
//
|
||||
initADCPPB();
|
||||
|
||||
//
|
||||
// Enable the temperature sensor and give it 500 us to power up
|
||||
//
|
||||
ASysCtl_enableTemperatureSensor();
|
||||
DEVICE_DELAY_US(500);
|
||||
|
||||
//
|
||||
// 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);
|
||||
EPWM_enableADCTrigger(EPWM1_BASE, EPWM_SOC_A);
|
||||
EPWM_setTimeBaseCounterMode(EPWM1_BASE, EPWM_COUNTER_MODE_UP);
|
||||
|
||||
#if(EX_ADC_LP_SOC_TRIGGER == 1)
|
||||
//
|
||||
// Configure the SOC to occur on the first up-count event
|
||||
//
|
||||
EPWM_setADCTriggerSource(EPWM2_BASE, EPWM_SOC_A, EPWM_SOC_TBCTR_U_CMPA);
|
||||
EPWM_setADCTriggerEventPrescale(EPWM2_BASE, EPWM_SOC_A, 1);
|
||||
EPWM_enableADCTrigger(EPWM2_BASE, EPWM_SOC_A);
|
||||
EPWM_setTimeBaseCounterMode(EPWM2_BASE, EPWM_COUNTER_MODE_UP);
|
||||
#endif
|
||||
|
||||
//
|
||||
// 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);
|
||||
|
||||
//
|
||||
// Loop indefinitely:
|
||||
//
|
||||
while(1)
|
||||
{
|
||||
//
|
||||
// Wait for ADCA to complete conversion of low priority SOCs,
|
||||
// then acknowledge flag
|
||||
//
|
||||
while(ADC_getInterruptStatus(ADCA_BASE, ADC_INT_NUMBER2) == false)
|
||||
{
|
||||
}
|
||||
|
||||
ADC_clearInterruptStatus(ADCA_BASE, ADC_INT_NUMBER2);
|
||||
ADC_clearInterruptStatus(ADCB_BASE, ADC_INT_NUMBER2);
|
||||
ADC_clearInterruptStatus(ADCD_BASE, ADC_INT_NUMBER2);
|
||||
|
||||
//
|
||||
// Capture delays for low priority SOCs
|
||||
//
|
||||
delaySocA4 = ADC_getPPBDelayTimeStamp(ADCA_BASE, ADC_PPB_NUMBER3);
|
||||
delaySocA5 = ADC_getPPBDelayTimeStamp(ADCA_BASE, ADC_PPB_NUMBER4);
|
||||
|
||||
delaySocB4 = ADC_getPPBDelayTimeStamp(ADCB_BASE, ADC_PPB_NUMBER3);
|
||||
delaySocB5 = ADC_getPPBDelayTimeStamp(ADCB_BASE, ADC_PPB_NUMBER4);
|
||||
|
||||
delaySocD4 = ADC_getPPBDelayTimeStamp(ADCD_BASE, ADC_PPB_NUMBER3);
|
||||
delaySocD5 = ADC_getPPBDelayTimeStamp(ADCD_BASE, ADC_PPB_NUMBER4);
|
||||
|
||||
//
|
||||
// Read low priority ADC signals in background loop
|
||||
//
|
||||
adcA4Results[indexB] = ADC_readResult(ADCARESULT_BASE, ADC_SOC_NUMBER4);
|
||||
adcB4Results[indexB] = ADC_readResult(ADCBRESULT_BASE, ADC_SOC_NUMBER4);
|
||||
adcD4Results[indexB] = ADC_readResult(ADCDRESULT_BASE, ADC_SOC_NUMBER4);
|
||||
|
||||
adcA13Results[indexB] = ADC_readResult(ADCARESULT_BASE, ADC_SOC_NUMBER5);
|
||||
adcB5Results[indexB] = ADC_readResult(ADCBRESULT_BASE, ADC_SOC_NUMBER5);
|
||||
adcD5Results[indexB++] = ADC_readResult(ADCDRESULT_BASE, ADC_SOC_NUMBER5);
|
||||
|
||||
if(indexB == RESULTS_BUFFER_SIZE)
|
||||
{
|
||||
//
|
||||
// Reset the index on buffer full condition. Put breakpoint on below
|
||||
// statement to view ADC results on graph window.
|
||||
//
|
||||
indexB = 0U;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// configureADC - Write ADC configurations and power up the desired ADC instance
|
||||
//
|
||||
void configureADC(uint32_t adcBase)
|
||||
{
|
||||
//
|
||||
// Set ADCCLK 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);
|
||||
}
|
||||
|
||||
//
|
||||
// initADCSOC - Function to configure ADC SOCs as per application requirement
|
||||
//
|
||||
void initADCSOC(uint32_t adcBase)
|
||||
{
|
||||
uint16_t i;
|
||||
|
||||
//
|
||||
// Set SOC priority- SOC0-SOC3 are high priority SOCs and SOC4-SOC15
|
||||
// would have round-robin priority
|
||||
//
|
||||
ADC_setSOCPriority(adcBase, ADC_PRI_THRU_SOC3_HIPRI);
|
||||
|
||||
//
|
||||
// Configure EPWM1 as SOC0-SOC1 trigger
|
||||
//
|
||||
for(i = 0; i < 2; i++)
|
||||
{
|
||||
ADC_setupSOC(adcBase, (ADC_SOCNumber)i,
|
||||
ADC_TRIGGER_EPWM1_SOCA,
|
||||
(ADC_Channel)i,
|
||||
((EX_ADC_RESOLUTION == ADC_RESOLUTION_16BIT) ?
|
||||
EX_ACQ_WIN_16_BIT : EX_ACQ_WIN_12_BIT));
|
||||
}
|
||||
|
||||
if(adcBase == ADCA_BASE)
|
||||
{
|
||||
//
|
||||
// Configure EPWM1 as SOC2-SOC3 trigger
|
||||
//
|
||||
for(i = 2; i < 4; i++)
|
||||
{
|
||||
ADC_setupSOC(adcBase, (ADC_SOCNumber)i,
|
||||
ADC_TRIGGER_EPWM1_SOCA,
|
||||
(ADC_Channel)i,
|
||||
((EX_ADC_RESOLUTION == ADC_RESOLUTION_16BIT) ?
|
||||
EX_ACQ_WIN_16_BIT : EX_ACQ_WIN_12_BIT));
|
||||
}
|
||||
}
|
||||
|
||||
#if(EX_ADC_LP_SOC_TRIGGER == 1)
|
||||
//
|
||||
// Configuration for EPWM trigger for low priority SOCs
|
||||
//
|
||||
|
||||
//
|
||||
// Configure EPWM2 as SOC4-SOC5 trigger. Configure SOC5 to sample
|
||||
// channel 13. For ADCA it is temperature sensor output
|
||||
//
|
||||
ADC_setupSOC(adcBase, ADC_SOC_NUMBER4, ADC_TRIGGER_EPWM2_SOCA,
|
||||
ADC_CH_ADCIN4, ((EX_ADC_RESOLUTION == ADC_RESOLUTION_16BIT) ?
|
||||
EX_ACQ_WIN_16_BIT : EX_ACQ_WIN_12_BIT));
|
||||
|
||||
if(adcBase == ADCA_BASE)
|
||||
{
|
||||
ADC_setupSOC(adcBase, ADC_SOC_NUMBER5, ADC_TRIGGER_EPWM2_SOCA,
|
||||
ADC_CH_ADCIN13, 140);
|
||||
}
|
||||
else
|
||||
{
|
||||
ADC_setupSOC(adcBase, ADC_SOC_NUMBER5, ADC_TRIGGER_EPWM2_SOCA,
|
||||
ADC_CH_ADCIN5, 140);
|
||||
|
||||
}
|
||||
|
||||
//
|
||||
// Set ADCA SOC3 to set the interrupt 1 flag.
|
||||
//
|
||||
ADC_setInterruptSource(adcBase, ADC_INT_NUMBER1, ADC_SOC_NUMBER3);
|
||||
|
||||
#elif(EX_ADC_LP_SOC_TRIGGER == 0)
|
||||
//
|
||||
// Configuration for ADCINT1 Trigger for low priority SOCs
|
||||
//
|
||||
|
||||
//
|
||||
// Configure SOC4-SOC5. Configure SOC5 to sample channel 13. For ADCA it
|
||||
// is temperature sensor output
|
||||
//
|
||||
ADC_setupSOC(adcBase, ADC_SOC_NUMBER4, ADC_TRIGGER_SW_ONLY,
|
||||
ADC_CH_ADCIN4, ((EX_ADC_RESOLUTION == ADC_RESOLUTION_16BIT) ?
|
||||
EX_ACQ_WIN_16_BIT : EX_ACQ_WIN_12_BIT));
|
||||
|
||||
if(adcBase == ADCA_BASE)
|
||||
{
|
||||
ADC_setupSOC(adcBase, ADC_SOC_NUMBER5, ADC_TRIGGER_SW_ONLY,
|
||||
ADC_CH_ADCIN13, 140);
|
||||
}
|
||||
else
|
||||
{
|
||||
ADC_setupSOC(adcBase, ADC_SOC_NUMBER5, ADC_TRIGGER_SW_ONLY,
|
||||
ADC_CH_ADCIN5, 140);
|
||||
}
|
||||
|
||||
//
|
||||
// Configure ADCINT1 as SOC4-SOC5 trigger
|
||||
//
|
||||
for(i = 4; i < 6; i++)
|
||||
{
|
||||
//
|
||||
// Set interrupt SOC trigger
|
||||
//
|
||||
ADC_setInterruptSOCTrigger(adcBase, (ADC_SOCNumber)i,
|
||||
ADC_INT_SOC_TRIGGER_ADCINT1);
|
||||
}
|
||||
|
||||
|
||||
if(adcBase == ADCA_BASE)
|
||||
{
|
||||
//
|
||||
// Set ADCA SOC3 to set the interrupt 3 flag. Enable the interrupt,
|
||||
// and make sure its flag is cleared.
|
||||
//
|
||||
ADC_setInterruptSource(adcBase, ADC_INT_NUMBER3, ADC_SOC_NUMBER3);
|
||||
ADC_enableInterrupt(adcBase, ADC_INT_NUMBER3);
|
||||
ADC_clearInterruptStatus(adcBase, ADC_INT_NUMBER3);
|
||||
}
|
||||
|
||||
//
|
||||
// Set ADCA SOC1 to set the interrupt 1 flag. Enable the interrupt,
|
||||
// continuous interrupt mode and make sure its flag is cleared.
|
||||
//
|
||||
ADC_setInterruptSource(adcBase, ADC_INT_NUMBER1, ADC_SOC_NUMBER1);
|
||||
|
||||
#endif
|
||||
|
||||
//
|
||||
// Enable the ADCINT1 interrupt, continuous interrupt mode
|
||||
// and make sure its flag is cleared.
|
||||
//
|
||||
ADC_enableContinuousMode(adcBase, ADC_INT_NUMBER1);
|
||||
ADC_enableInterrupt(adcBase, ADC_INT_NUMBER1);
|
||||
ADC_clearInterruptStatus(adcBase, ADC_INT_NUMBER1);
|
||||
|
||||
//
|
||||
// Set ADC SOC5 to set the interrupt 2 flag. Enable the interrupt
|
||||
// and make sure its flag is cleared.
|
||||
//
|
||||
ADC_setInterruptSource(adcBase, ADC_INT_NUMBER2, ADC_SOC_NUMBER5);
|
||||
ADC_enableInterrupt(adcBase, ADC_INT_NUMBER2);
|
||||
ADC_clearInterruptStatus(adcBase, ADC_INT_NUMBER2);
|
||||
}
|
||||
|
||||
//
|
||||
// initADCPPB - Function to configure ADC PPBs as per application requirement
|
||||
//
|
||||
void initADCPPB(void)
|
||||
{
|
||||
//
|
||||
// PPB configuration for ADCA
|
||||
//
|
||||
ADC_setupPPB(ADCA_BASE, ADC_PPB_NUMBER1, ADC_SOC_NUMBER0);
|
||||
ADC_setupPPB(ADCA_BASE, ADC_PPB_NUMBER2, ADC_SOC_NUMBER3);
|
||||
ADC_setupPPB(ADCA_BASE, ADC_PPB_NUMBER3, ADC_SOC_NUMBER4);
|
||||
ADC_setupPPB(ADCA_BASE, ADC_PPB_NUMBER4, ADC_SOC_NUMBER5);
|
||||
|
||||
//
|
||||
// PPB configuration for ADCB
|
||||
//
|
||||
ADC_setupPPB(ADCB_BASE, ADC_PPB_NUMBER1, ADC_SOC_NUMBER0);
|
||||
ADC_setupPPB(ADCB_BASE, ADC_PPB_NUMBER2, ADC_SOC_NUMBER1);
|
||||
ADC_setupPPB(ADCB_BASE, ADC_PPB_NUMBER3, ADC_SOC_NUMBER4);
|
||||
ADC_setupPPB(ADCB_BASE, ADC_PPB_NUMBER4, ADC_SOC_NUMBER5);
|
||||
|
||||
//
|
||||
// PPB configuration for ADCD
|
||||
//
|
||||
ADC_setupPPB(ADCD_BASE, ADC_PPB_NUMBER1, ADC_SOC_NUMBER0);
|
||||
ADC_setupPPB(ADCD_BASE, ADC_PPB_NUMBER2, ADC_SOC_NUMBER1);
|
||||
ADC_setupPPB(ADCD_BASE, ADC_PPB_NUMBER3, ADC_SOC_NUMBER4);
|
||||
ADC_setupPPB(ADCD_BASE, ADC_PPB_NUMBER4, ADC_SOC_NUMBER5);
|
||||
}
|
||||
|
||||
//
|
||||
// adcA1ISR - 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
|
||||
|
||||
//
|
||||
// Read SOC delays
|
||||
//
|
||||
delaySocA0 = ADC_getPPBDelayTimeStamp(ADCA_BASE, ADC_PPB_NUMBER1);
|
||||
delaySocB0 = ADC_getPPBDelayTimeStamp(ADCB_BASE, ADC_PPB_NUMBER1);
|
||||
delaySocB1 = ADC_getPPBDelayTimeStamp(ADCB_BASE, ADC_PPB_NUMBER2);
|
||||
delaySocD0 = ADC_getPPBDelayTimeStamp(ADCD_BASE, ADC_PPB_NUMBER1);
|
||||
delaySocD1 = ADC_getPPBDelayTimeStamp(ADCD_BASE, ADC_PPB_NUMBER2);
|
||||
|
||||
//
|
||||
// Add the latest ADC result of high priority signals to the buffer
|
||||
//
|
||||
adcA0Results[indexA] = ADC_readResult(ADCARESULT_BASE, ADC_SOC_NUMBER0);
|
||||
adcB0Results[indexA] = ADC_readResult(ADCBRESULT_BASE, ADC_SOC_NUMBER0);
|
||||
adcD0Results[indexA] = ADC_readResult(ADCDRESULT_BASE, ADC_SOC_NUMBER0);
|
||||
adcA1Results[indexA] = ADC_readResult(ADCARESULT_BASE, ADC_SOC_NUMBER1);
|
||||
adcB1Results[indexA] = ADC_readResult(ADCBRESULT_BASE, ADC_SOC_NUMBER1);
|
||||
adcD1Results[indexA] = ADC_readResult(ADCDRESULT_BASE, ADC_SOC_NUMBER1);
|
||||
|
||||
#if(EX_ADC_LP_SOC_TRIGGER == 0)
|
||||
//
|
||||
// Wait for ADCA to complete conversion of SOC2-SOC3, then acknowledge
|
||||
// flag
|
||||
//
|
||||
while(ADC_getInterruptStatus(ADCA_BASE, ADC_INT_NUMBER3) == false)
|
||||
{
|
||||
}
|
||||
|
||||
ADC_clearInterruptStatus(ADCA_BASE, ADC_INT_NUMBER3);
|
||||
#endif
|
||||
|
||||
//
|
||||
// Read ADCA SOC2-SOC3 results post checking the ADCINT3 flag
|
||||
//
|
||||
adcA2Results[indexA] = ADC_readResult(ADCARESULT_BASE, ADC_SOC_NUMBER2);
|
||||
adcA3Results[indexA++] = ADC_readResult(ADCARESULT_BASE, ADC_SOC_NUMBER3);
|
||||
|
||||
//
|
||||
// Read delay for ADCA SOC3
|
||||
//
|
||||
delaySocA3 = ADC_getPPBDelayTimeStamp(ADCA_BASE, ADC_PPB_NUMBER2);
|
||||
|
||||
if(RESULTS_BUFFER_SIZE <= indexA)
|
||||
{
|
||||
//
|
||||
// Reset the index when buffer is full.
|
||||
//
|
||||
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-ePWM2 GPIO
|
||||
//
|
||||
void initEPWMGPIO(void)
|
||||
{
|
||||
//
|
||||
// Disable pull up on GPIO0-1 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);
|
||||
|
||||
#if(EX_ADC_LP_SOC_TRIGGER == 1)
|
||||
//
|
||||
// Disable pull up on GPIO2-3 and configure them as PWMs
|
||||
//
|
||||
GPIO_setPadConfig(2, GPIO_PIN_TYPE_STD);
|
||||
GPIO_setPinConfig(GPIO_2_EPWM2A);
|
||||
|
||||
GPIO_setPadConfig(3, GPIO_PIN_TYPE_STD);
|
||||
GPIO_setPinConfig(GPIO_3_EPWM2B);
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef ENABLE_PROFILING
|
||||
//
|
||||
// setupProfileGpio - Configure profiling GPIO
|
||||
//
|
||||
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,3 @@
|
||||
/**
|
||||
* Blank
|
||||
*/
|
||||
@@ -0,0 +1,460 @@
|
||||
//#############################################################################
|
||||
//
|
||||
// FILE: adc_ex16_sw_interleaved_averaging.c
|
||||
//
|
||||
// TITLE: ADC Interleaved Averaging in Software
|
||||
//
|
||||
//! \addtogroup driver_example_list
|
||||
//! <h1>ADC Interleaved Averaging in Software</h1>
|
||||
//!
|
||||
//! This example demonstrates software interleaved averaging of ADC input
|
||||
//! channels. ADCA/B channel 0 and 1 are sampled one after another in order
|
||||
//! to achieve interleaved averaging. SOC0-15 of ADCA and ADCB are configured
|
||||
//! to sample channel 0 and 1 alternatively with channel 0 being sampled by
|
||||
//! even SOCs namely SOC0, 2, 4, 6, 8, 10, 12 & 14 and channel 1 being sampled
|
||||
//! by odd SOCs namely SOC1, 3, 5, 7, 9, 11, 13 & 15.
|
||||
//!
|
||||
//! Sampling is initially triggered through external GPIO signal through
|
||||
//! enabling ADCEXTSOC signal via input XBAR and thereafter through ADCINT1.
|
||||
//! GPIO33 is configured to trigger ADCA and B SOCs for the first time in order
|
||||
//! to ensure synchronous operation. GPIO33 needs to be connected to GPIO32
|
||||
//! which in turn is driven by software to trigger the respective ADC SOCs.
|
||||
//!
|
||||
//! ADCA Interrupt ISRs are used to read results of both ADCA and ADCB to
|
||||
//! demonstrate parallel operation of multiple ADCs. ADCINT2 is configured
|
||||
//! to be triggered after completion of SOC7 while ADCINT1 is configured to be
|
||||
//! triggered after completion of SOC15 conversion and respective SOC results
|
||||
//! of ADCA and ADCB are read in ADCAINT2 and ADCAINT1 ISRs. Read SOC0-SOC15
|
||||
//! ADC results are then averaged in ADCINT1 ISR to get the filtered ADC output.
|
||||
//!
|
||||
//! Early interrupt mode is configured to trigger the ADC interrupt just at the
|
||||
//! end of acquisition window in order to save cycles(~42 cycles) since ADCA
|
||||
//! result of SOC7 in ADCINT2 and SOC15 in ADCINT1 are read post around 60 and
|
||||
//! 65 cycles respectively. Also, Fast ISRs are configured in the example to
|
||||
//! save some cycles during compiler specific context save and restore.
|
||||
//!
|
||||
//! Optimization level: This example is expected to be run with opt level = 2
|
||||
//!
|
||||
//! Sampling rate related calculations:
|
||||
//! - ADC acquisition cycles programmed( S + H) = 15 SYSCLKS
|
||||
//! - Conversion time for 12-bit data = 10.5 ADCCLKS = N = 42 SYSCLKs
|
||||
//! - Time from 1st SOC trigger to interrupt trigger: 15 * 57 + 15 = 870 SYSCLKs
|
||||
//! - Next ADC trigger will come after 870 SYSCLKs
|
||||
//! - Approximate ISR trigger frequency = 1/(870 * 5ns) = 1/4350ns = 229 KSPS
|
||||
//! - Time taken in ADCINT1 ISR : 132 SYSCLKs (Fast ISR)(O2)
|
||||
//! - Time taken in ADCINT2 ISR : 76 SYSCLKs (Fast ISR)(O2)
|
||||
//!
|
||||
//! To view results in graph window, add breakpoint inside while(1) loop in
|
||||
//! main() where bufferFull flag is cleared and plot the watch variables.
|
||||
//!
|
||||
//! \b External \b Connections \n
|
||||
//! - A0, A1, B0 and B1 pins should be connected to signals to be converted
|
||||
//! - Connect GPIO32 to GPIO33 to trigger ADC channels for the first time
|
||||
//!
|
||||
//! \b Watch \b Variables \n
|
||||
//! - \b adcA0Results - A sequence of analog-to-digital conversion samples from
|
||||
//! pin A0.
|
||||
//! - \b adcA1Results - A sequence of analog-to-digital conversion samples from
|
||||
//! pin A1.
|
||||
//! - \b adcB0Results - A sequence of analog-to-digital conversion samples from
|
||||
//! pin B0.
|
||||
//! - \b adcB1Results - A sequence of analog-to-digital conversion samples from
|
||||
//! pin B1.
|
||||
//!
|
||||
//
|
||||
//#############################################################################
|
||||
//
|
||||
//
|
||||
//
|
||||
// C2000Ware v5.04.00.00
|
||||
//
|
||||
// Copyright (C) 2024 Texas Instruments Incorporated - http://www.ti.com
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions
|
||||
// are met:
|
||||
//
|
||||
// Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
//
|
||||
// Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
//
|
||||
// Neither the name of Texas Instruments Incorporated nor the names of
|
||||
// its contributors may be used to endorse or promote products derived
|
||||
// from this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
// $
|
||||
//#############################################################################
|
||||
|
||||
//
|
||||
// Included Files
|
||||
//
|
||||
#include "driverlib.h"
|
||||
#include "device.h"
|
||||
|
||||
//
|
||||
// Defines
|
||||
//
|
||||
#define RESULTS_BUFFER_SIZE 256U
|
||||
|
||||
//
|
||||
// Macros to define ADC resolution and input signal mode. Valid values of
|
||||
// resolution are 12 for 12-bit conversion resolution, which support input
|
||||
// modes ADC_MODE_SINGLE_ENDED & 16 for 16-bit conversion resolution, which
|
||||
// support ADC_MODE_SINGLE_ENDED & ADC_MODE_DIFFERENTIAL input signal modes.
|
||||
//
|
||||
#define EX_ADC_RESOLUTION (ADC_RESOLUTION_12BIT)
|
||||
#define EX_ADC_INPUT_MODE (ADC_MODE_SINGLE_ENDED)
|
||||
|
||||
//
|
||||
// Globals
|
||||
//
|
||||
uint16_t adcA0Results[RESULTS_BUFFER_SIZE]; // Buffer for ADCA channel 0
|
||||
uint16_t adcA1Results[RESULTS_BUFFER_SIZE]; // Buffer for ADCA channel 1
|
||||
uint16_t adcB0Results[RESULTS_BUFFER_SIZE]; // Buffer for ADCB channel 0
|
||||
uint16_t adcB1Results[RESULTS_BUFFER_SIZE]; // Buffer for ADCB channel 1
|
||||
volatile uint32_t sumACh0 = 0, sumACh1 = 0, averageACh0 = 0, averageACh1 = 0;
|
||||
volatile uint32_t sumBCh0 = 0, sumBCh1 = 0, averageBCh0 = 0, averageBCh1 = 0;
|
||||
volatile uint16_t indexA = 0, indexB = 0; // Index into result buffer
|
||||
volatile uint16_t bufferFull = 0; // Flag to indicate buffer is full
|
||||
volatile uint32_t countIdle = 0; // Idle counter
|
||||
|
||||
//
|
||||
// Function Prototypes
|
||||
//
|
||||
void configureADC(uint32_t adcBase);
|
||||
void initEPWM(uint32_t pwmBase);
|
||||
void initADCSOC(uint32_t adcBase);
|
||||
void initADCGPIOTrigger(void);
|
||||
|
||||
//
|
||||
// ISRs
|
||||
//
|
||||
__interrupt void adcA1ISR(void);
|
||||
#pragma CODE_SECTION(adcA1ISR, ".TI.ramfunc")
|
||||
#pragma INTERRUPT (adcA1ISR, HPI)
|
||||
__interrupt void adcA2ISR(void);
|
||||
#pragma CODE_SECTION(adcA2ISR, ".TI.ramfunc")
|
||||
#pragma INTERRUPT (adcA2ISR, HPI)
|
||||
|
||||
//
|
||||
// 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);
|
||||
Interrupt_register(INT_ADCA2, &adcA2ISR);
|
||||
|
||||
//
|
||||
// Set up the ADC and the ePWM and initialize the SOC
|
||||
//
|
||||
configureADC(ADCA_BASE);
|
||||
configureADC(ADCB_BASE);
|
||||
initADCSOC(ADCA_BASE);
|
||||
initADCSOC(ADCB_BASE);
|
||||
|
||||
//
|
||||
// Configure GPIO trigger for ADC
|
||||
//
|
||||
initADCGPIOTrigger();
|
||||
|
||||
//
|
||||
// Initialize results buffer
|
||||
//
|
||||
for(indexA = 0; indexA < RESULTS_BUFFER_SIZE; indexA++)
|
||||
{
|
||||
adcA0Results[indexA] = 0;
|
||||
adcA1Results[indexA] = 0;
|
||||
adcB0Results[indexA] = 0;
|
||||
adcB1Results[indexA] = 0;
|
||||
}
|
||||
|
||||
indexA = 0;
|
||||
indexB = 0;
|
||||
bufferFull = 0;
|
||||
|
||||
//
|
||||
// Enable ADC interrupt
|
||||
//
|
||||
Interrupt_enable(INT_ADCA1);
|
||||
Interrupt_enable(INT_ADCA2);
|
||||
|
||||
//
|
||||
// Enable Global Interrupt (INTM) and realtime interrupt (DBGM)
|
||||
//
|
||||
EINT;
|
||||
ERTM;
|
||||
|
||||
//
|
||||
// Trigger ADC once through setting GPIO32 connected to ADCEXTSOC
|
||||
// pin(GPIO33)
|
||||
//
|
||||
GPIO_setPortPins(GPIO_PORT_B, GPIO_GPBDIR_GPIO32);
|
||||
|
||||
//
|
||||
// Loop indefinitely
|
||||
//
|
||||
while(1)
|
||||
{
|
||||
countIdle = 0;
|
||||
indexA = 0;
|
||||
indexB = 0;
|
||||
|
||||
//
|
||||
// Wait while ADCINT1 causes ADC conversions which then cause interrupts.
|
||||
// When the results buffer is filled, the bufferFull flag will be set.
|
||||
//
|
||||
while(bufferFull == 0)
|
||||
{
|
||||
//
|
||||
// Incrementing idle counter to get the CPU bandwidth
|
||||
//
|
||||
countIdle++;
|
||||
}
|
||||
|
||||
//
|
||||
// Clear the buffer full flag. Add breakpoint at this statement to
|
||||
// view ADC results in graph view.
|
||||
//
|
||||
bufferFull = 0;
|
||||
|
||||
// //
|
||||
// // Software breakpoint to view results.
|
||||
// // Hit run again to get updated conversions.
|
||||
// // Uncomment to halt the execution once buffer is full.
|
||||
// //
|
||||
// ESTOP0;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// initADCGPIOTrigger - Configure ADCEXTSOC as ADC GPIO trigger
|
||||
//
|
||||
void initADCGPIOTrigger(void)
|
||||
{
|
||||
//
|
||||
// Load the output latch
|
||||
//
|
||||
GPIO_clearPortPins(GPIO_PORT_B, GPIO_GPBDIR_GPIO32);
|
||||
GPIO_setDirectionMode(32, GPIO_DIR_MODE_OUT); // output
|
||||
|
||||
GPIO_setDirectionMode(33, GPIO_DIR_MODE_IN); // input
|
||||
XBAR_setInputPin(INPUTXBAR_BASE, XBAR_INPUT5, 33);
|
||||
}
|
||||
|
||||
//
|
||||
// configureADC - Write ADC configurations and power up the selected ADC
|
||||
// instance
|
||||
//
|
||||
void configureADC(uint32_t adcBase)
|
||||
{
|
||||
//
|
||||
// Set ADCCLK divider to /4
|
||||
//
|
||||
ADC_setPrescaler(adcBase, ADC_CLK_DIV_4_0);
|
||||
|
||||
//
|
||||
// Set resolution and signal mode (see #defines above) and load
|
||||
// corresponding trims.
|
||||
//
|
||||
ADC_setMode(adcBase, EX_ADC_RESOLUTION, EX_ADC_INPUT_MODE);
|
||||
|
||||
//
|
||||
// Set pulse positions at the end of the acquisition window.
|
||||
//
|
||||
ADC_setInterruptPulseMode(adcBase, ADC_PULSE_END_OF_ACQ_WIN);
|
||||
|
||||
//
|
||||
// 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 selected ADC's SOC0 to be triggered by ePWM1.
|
||||
//
|
||||
void initADCSOC(uint32_t adcBase)
|
||||
{
|
||||
uint16_t i;
|
||||
|
||||
//
|
||||
// Configure SOCs of selected ADC
|
||||
// - 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.
|
||||
//
|
||||
|
||||
//
|
||||
// ADC channel for SOC0, SOC2, ...,SOC14 = ADCIN0
|
||||
// ADC channel for SOC1, SOC3, ...,SOC15 = ADCIN1
|
||||
// SOC Trigger = GPIO (for first time triggering)
|
||||
// ACQPS = 64 for 16-bit resolution & 15 for 12-bit resolution
|
||||
//
|
||||
for(i = 0; i < 16; i++)
|
||||
{
|
||||
ADC_setupSOC(adcBase, (ADC_SOCNumber)i,
|
||||
ADC_TRIGGER_GPIO,
|
||||
((i % 2 == 0) ? ADC_CH_ADCIN0 : ADC_CH_ADCIN1),
|
||||
((EX_ADC_RESOLUTION == ADC_RESOLUTION_16BIT) ? 64U : 15U));
|
||||
|
||||
//
|
||||
// Set SOC trigger
|
||||
//
|
||||
ADC_setInterruptSOCTrigger(adcBase, (ADC_SOCNumber)i,
|
||||
ADC_INT_SOC_TRIGGER_ADCINT1);
|
||||
}
|
||||
|
||||
//
|
||||
// Set ADCA SOC7 to set the interrupt 2 flag and SOC15 to set interrupt 1
|
||||
// flag. Enable the interrupt and make sure its flag is cleared.
|
||||
//
|
||||
if(adcBase == ADCA_BASE)
|
||||
{
|
||||
ADC_setInterruptSource(adcBase, ADC_INT_NUMBER2, ADC_SOC_NUMBER7);
|
||||
ADC_enableContinuousMode(adcBase, ADC_INT_NUMBER2);
|
||||
ADC_enableInterrupt(adcBase, ADC_INT_NUMBER2);
|
||||
ADC_clearInterruptStatus(adcBase, ADC_INT_NUMBER2);
|
||||
}
|
||||
|
||||
ADC_setInterruptSource(adcBase, ADC_INT_NUMBER1, ADC_SOC_NUMBER15);
|
||||
ADC_enableContinuousMode(adcBase, ADC_INT_NUMBER1);
|
||||
ADC_enableInterrupt(adcBase, ADC_INT_NUMBER1);
|
||||
ADC_clearInterruptStatus(adcBase, ADC_INT_NUMBER1);
|
||||
}
|
||||
|
||||
//
|
||||
// ADC A Interrupt 2 ISR
|
||||
//
|
||||
__interrupt void adcA2ISR(void)
|
||||
{
|
||||
//
|
||||
// Take sum of different channels
|
||||
//
|
||||
sumACh0 = ADC_readResult(ADCARESULT_BASE, ADC_SOC_NUMBER0) +
|
||||
ADC_readResult(ADCARESULT_BASE, ADC_SOC_NUMBER2) +
|
||||
ADC_readResult(ADCARESULT_BASE, ADC_SOC_NUMBER4) +
|
||||
ADC_readResult(ADCARESULT_BASE, ADC_SOC_NUMBER6);
|
||||
|
||||
sumBCh0 = ADC_readResult(ADCBRESULT_BASE, ADC_SOC_NUMBER0) +
|
||||
ADC_readResult(ADCBRESULT_BASE, ADC_SOC_NUMBER2) +
|
||||
ADC_readResult(ADCBRESULT_BASE, ADC_SOC_NUMBER4) +
|
||||
ADC_readResult(ADCBRESULT_BASE, ADC_SOC_NUMBER6);
|
||||
|
||||
sumACh1 = ADC_readResult(ADCARESULT_BASE, ADC_SOC_NUMBER1) +
|
||||
ADC_readResult(ADCARESULT_BASE, ADC_SOC_NUMBER3) +
|
||||
ADC_readResult(ADCARESULT_BASE, ADC_SOC_NUMBER5) +
|
||||
ADC_readResult(ADCARESULT_BASE, ADC_SOC_NUMBER7);
|
||||
|
||||
sumBCh1 = ADC_readResult(ADCBRESULT_BASE, ADC_SOC_NUMBER1) +
|
||||
ADC_readResult(ADCBRESULT_BASE, ADC_SOC_NUMBER3) +
|
||||
ADC_readResult(ADCBRESULT_BASE, ADC_SOC_NUMBER5) +
|
||||
ADC_readResult(ADCBRESULT_BASE, ADC_SOC_NUMBER7);
|
||||
|
||||
//
|
||||
// Acknowledge the interrupt
|
||||
//
|
||||
Interrupt_clearACKGroup(INTERRUPT_ACK_GROUP10);
|
||||
}
|
||||
|
||||
//
|
||||
// ADC A Interrupt 1 ISR
|
||||
//
|
||||
__interrupt void adcA1ISR(void)
|
||||
{
|
||||
//
|
||||
// Add the latest result to the buffer
|
||||
//
|
||||
sumACh0 += ADC_readResult(ADCARESULT_BASE, ADC_SOC_NUMBER8) +
|
||||
ADC_readResult(ADCARESULT_BASE, ADC_SOC_NUMBER10) +
|
||||
ADC_readResult(ADCARESULT_BASE, ADC_SOC_NUMBER12) +
|
||||
ADC_readResult(ADCARESULT_BASE, ADC_SOC_NUMBER14);
|
||||
|
||||
sumBCh0 += ADC_readResult(ADCBRESULT_BASE, ADC_SOC_NUMBER8) +
|
||||
ADC_readResult(ADCBRESULT_BASE, ADC_SOC_NUMBER10) +
|
||||
ADC_readResult(ADCBRESULT_BASE, ADC_SOC_NUMBER12) +
|
||||
ADC_readResult(ADCBRESULT_BASE, ADC_SOC_NUMBER14);
|
||||
|
||||
sumACh1 += ADC_readResult(ADCARESULT_BASE, ADC_SOC_NUMBER9) +
|
||||
ADC_readResult(ADCARESULT_BASE, ADC_SOC_NUMBER11) +
|
||||
ADC_readResult(ADCARESULT_BASE, ADC_SOC_NUMBER13) +
|
||||
ADC_readResult(ADCARESULT_BASE, ADC_SOC_NUMBER15);
|
||||
|
||||
sumBCh1 += ADC_readResult(ADCBRESULT_BASE, ADC_SOC_NUMBER9) +
|
||||
ADC_readResult(ADCBRESULT_BASE, ADC_SOC_NUMBER11) +
|
||||
ADC_readResult(ADCBRESULT_BASE, ADC_SOC_NUMBER13) +
|
||||
ADC_readResult(ADCBRESULT_BASE, ADC_SOC_NUMBER15);
|
||||
|
||||
//
|
||||
// Taking average of 8 channels
|
||||
//
|
||||
averageACh0 = sumACh0 >> 3;
|
||||
averageACh1 = sumACh1 >> 3;
|
||||
averageBCh0 = sumBCh0 >> 3;
|
||||
averageBCh1 = sumBCh1 >> 3;
|
||||
|
||||
adcA0Results[indexA] = averageACh0;
|
||||
adcA1Results[indexA++] = averageACh1;
|
||||
adcB0Results[indexB] = averageBCh0;
|
||||
adcB1Results[indexB++] = averageBCh1;
|
||||
|
||||
//
|
||||
// Set the bufferFull flag if the buffer is full
|
||||
//
|
||||
if(RESULTS_BUFFER_SIZE <= indexA)
|
||||
{
|
||||
bufferFull = 1;
|
||||
}
|
||||
|
||||
//
|
||||
// Acknowledge the interrupt
|
||||
//
|
||||
Interrupt_clearACKGroup(INTERRUPT_ACK_GROUP1);
|
||||
}
|
||||
|
||||
//
|
||||
// End of file
|
||||
//
|
||||
@@ -0,0 +1,3 @@
|
||||
/**
|
||||
* Blank
|
||||
*/
|
||||
@@ -0,0 +1,573 @@
|
||||
//###########################################################################
|
||||
//
|
||||
// FILE: adc_ex17_open_shorts_detection.c
|
||||
//
|
||||
// TITLE: ADC input pin fault check through Open/Shorts Detection Circuit
|
||||
//
|
||||
//! \addtogroup driver_example_list
|
||||
//! <h1> ADC Open Shorts Detection (adc_open_shorts_detection)</h1>
|
||||
//!
|
||||
//! This example demonstrates the ADC open/shorts detection(ADCOSDETECT) circuit
|
||||
//! configuration for detecting pin faults in the system. The example enables
|
||||
//! the open/shorts detection circuit along with mandatory ADC configurations
|
||||
//! and diagnoses ADCA A0 input pin state before starting normal ADC
|
||||
//! conversions.
|
||||
//!
|
||||
//! To enable the ADC OSDetect circuit:
|
||||
//! 1. Configure the ADC for conversion (E.g. channel, SOC, ACQPS, prescalar,
|
||||
//! trigger etc). The OSDetect functionality is available in 12-bit only,
|
||||
//! hence ADCA is configured in 12-bit mode in the example.
|
||||
//! 2. Set up the ADCOSDETECT register for the desired voltage divider
|
||||
//! connection. Refer device TRM for details on available OSDetect
|
||||
//! configurations.
|
||||
//! 3. Initiate a conversion and inspect the conversion result.
|
||||
//! \note Note: The results must be interpreted based on what is driving on
|
||||
//! the input side and what are the values of Rs and Cp. If the Vs signal can
|
||||
//! be disconnected from the input pin, the circuit can be used to detect
|
||||
//! open and shorted input pins.
|
||||
//!
|
||||
//! In the example, after configuring ADCA A0 channel in 12-bit mode along with
|
||||
//! other required ADC configurations, following algorithm is used to check the
|
||||
//! A0 pin status:
|
||||
//! Step 1: Configure full scale OSDETECT mode & capture ADC results(resultHi)
|
||||
//! Step 2: Configure zero scale OSDETECT mode & capture ADC results(resultLo)
|
||||
//! Step 3: Disable OSDETECT mode and capture ADC results(resultNormal)
|
||||
//! Step 4: Determine the state of the ADC pin
|
||||
//! a. If the pin is open, resultLo would be equal to Vreflo and resultHi
|
||||
//! would be equal to Vrefhi
|
||||
//! b. If the pin is shorted to Vrefhi, resultLo should be approximately
|
||||
//! equal to Vrefhi and resultHi should be equal to Vrefhi
|
||||
//! c. If the pin is shorted to Vreflo, resultLo should be equal to
|
||||
//! Vreflo and resultHi should be approximately equal to Vreflo
|
||||
//! d. If the pin is connected to a valid signal, resultLo should be
|
||||
//! greater than osdLoLimit but less than resultNormal while resultHi
|
||||
//! should be less than osdHiLimit but greater than resultNormal
|
||||
//!-----------------------------------------------------------------------------
|
||||
//! Input | Full-Scale output | Zero-scale Output | Pin Status
|
||||
//!-----------------------------------------------------------------------------
|
||||
//! Unknown| VREFHI | VREFLO | Open
|
||||
//! VREFHI | VREFHI | approx. VREFHI | Shorted to VREFHI
|
||||
//! VREFLO | approx. VREFLO | VREFLO | Shorted to VREFLO
|
||||
//! Vn | Vn < resultHi < VREFHI | VREFLO < resultLo < Vn | Good
|
||||
//!-----------------------------------------------------------------------------
|
||||
//! Step 5: osDetectStatusVal of value greater than 4 would mean that there is
|
||||
//! no pin fault.
|
||||
//! a. If osDetectStatusVal == 1, means pin A0 is OPEN
|
||||
//! b. If osDetectStatusVal == 2, means pin A0 is shorted to VREFLO
|
||||
//! c. If osDetectStatusVal == 4, means pin A0 is shorted to VREFHI
|
||||
//! d. If osDetectStatusVal == 8, means pin A0 is in GOOD/VALID state
|
||||
//! e. Any value of osDetectStatusVal > 4, means pin A0 is in VALID state
|
||||
//!
|
||||
//! Following points should be noted while configuring the ADC in OSDETECT mode.
|
||||
//! 1. The divider resistance tolerances can vary widely, hence this
|
||||
//! feature should not be used to check for conversion accuracy.
|
||||
//! 2. Consult the device data manual for implementation and availability of
|
||||
//! analog input channels.
|
||||
//! 3. Due to high drive impedance, a S+H duration much longer than
|
||||
//! the ADC minimum will be needed.
|
||||
//!
|
||||
//! \b External \b Connections \n
|
||||
//! - A0 pin should be connected to signals to convert
|
||||
//!
|
||||
//! \b Watch \b Variables \n
|
||||
//! - \b osDetectStatusVal \b: OS detection status of voltage on pin A0\n
|
||||
//! - \b adcAResult0 \b: a digital representation of the voltage on pin A0\n
|
||||
//!
|
||||
//
|
||||
//###########################################################################
|
||||
// $TI Release: $
|
||||
//
|
||||
//
|
||||
// C2000Ware v5.04.00.00
|
||||
//
|
||||
// Copyright (C) 2024 Texas Instruments Incorporated - http://www.ti.com
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions
|
||||
// are met:
|
||||
//
|
||||
// Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
//
|
||||
// Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
//
|
||||
// Neither the name of Texas Instruments Incorporated nor the names of
|
||||
// its contributors may be used to endorse or promote products derived
|
||||
// from this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
// $
|
||||
//###########################################################################
|
||||
|
||||
//
|
||||
// Included Files
|
||||
//
|
||||
#include "driverlib.h"
|
||||
#include "device.h"
|
||||
|
||||
//
|
||||
// Defines
|
||||
//
|
||||
#define EX_ENABLE_OS_DETECTION
|
||||
#define EX_ADC_RESOLUTION 12
|
||||
|
||||
//
|
||||
// Globals
|
||||
//
|
||||
uint16_t i = 0U;
|
||||
volatile uint16_t adcAResult0;
|
||||
volatile uint16_t resultHi;
|
||||
volatile uint16_t resultLo;
|
||||
volatile uint16_t resultNormal;
|
||||
|
||||
#ifdef EX_ENABLE_OS_DETECTION
|
||||
//
|
||||
// Application specific limits from Vreflo to Vrefhi.
|
||||
// This can change due to various factors like source
|
||||
// voltage offset etc.
|
||||
//
|
||||
uint16_t osdHiLimit = 3900; // upper limit
|
||||
uint16_t osdLoLimit = 15; // lower limit
|
||||
|
||||
//
|
||||
// Macros for open/shorts detection circuit status. If the osDetect status is
|
||||
// other than open, shorted to Vreflo and shorted to Vrefhi values (i.e > 4),
|
||||
// it can be considered as a valid signal
|
||||
//
|
||||
#define ADC_OSDETECT_STATUS_OPEN 1
|
||||
#define ADC_OSDETECT_STATUS_SHORTED_TO_VREFLO 2
|
||||
#define ADC_OSDETECT_STATUS_SHORTED_TO_VREFHI 4
|
||||
#define ADC_OSDETECT_STATUS_GOOD 8
|
||||
#define ADC_OSDETECT_STATUS_UNDETERMINED 16
|
||||
|
||||
uint16_t osDetectStatusVal = 0;
|
||||
#endif
|
||||
|
||||
//
|
||||
// Function Prototypes
|
||||
//
|
||||
void configureADC(uint32_t adcBase);
|
||||
void configureADCSOC(uint32_t adcBase, uint16_t channel);
|
||||
#ifdef EX_ENABLE_OS_DETECTION
|
||||
void configureADCTestMode(uint32_t adcBase, ADC_Channel channel);
|
||||
uint16_t performOSDetection(uint32_t adcBase, uint32_t adcResultBase,
|
||||
uint16_t channel);
|
||||
#endif
|
||||
|
||||
//
|
||||
// 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();
|
||||
|
||||
#ifdef EX_ENABLE_OS_DETECTION
|
||||
//
|
||||
// Configure ADC in test mode for checking pin status
|
||||
//
|
||||
configureADCTestMode(ADCA_BASE, ADC_CH_ADCIN0);
|
||||
|
||||
//
|
||||
// Perform open/shorts detection
|
||||
//
|
||||
for(i = 0U; i < 7U; i++)
|
||||
{
|
||||
osDetectStatusVal = osDetectStatusVal |
|
||||
performOSDetection(ADCA_BASE, ADCARESULT_BASE, 0U);
|
||||
|
||||
}
|
||||
|
||||
if(osDetectStatusVal > ADC_OSDETECT_STATUS_SHORTED_TO_VREFHI)
|
||||
{
|
||||
#endif
|
||||
//
|
||||
// Set up ADCs, initializing the SOCs to be triggered by software
|
||||
//
|
||||
configureADC(ADCA_BASE);
|
||||
configureADCSOC(ADCA_BASE, ADC_CH_ADCIN0);
|
||||
|
||||
//
|
||||
// Enable Global Interrupt (INTM) and realtime interrupt (DBGM)
|
||||
//
|
||||
EINT;
|
||||
ERTM;
|
||||
|
||||
//
|
||||
// Loop indefinitely
|
||||
//
|
||||
while(1)
|
||||
{
|
||||
|
||||
//
|
||||
// Convert, wait for completion, and store results
|
||||
//
|
||||
ADC_forceSOC(ADCA_BASE, ADC_SOC_NUMBER0);
|
||||
|
||||
//
|
||||
// Wait for ADCA to complete, then acknowledge flag
|
||||
//
|
||||
while(ADC_getInterruptStatus(ADCA_BASE, ADC_INT_NUMBER1) == false)
|
||||
{
|
||||
}
|
||||
ADC_clearInterruptStatus(ADCA_BASE, ADC_INT_NUMBER1);
|
||||
|
||||
//
|
||||
// Store results
|
||||
//
|
||||
adcAResult0 = ADC_readResult(ADCARESULT_BASE, ADC_SOC_NUMBER0);
|
||||
|
||||
//
|
||||
// Software breakpoint. At this point, conversion results are stored
|
||||
// in adcAResult0, adcAResult1, adcBResult0, and adcBResult1.
|
||||
//
|
||||
// Hit run again to get updated conversions.
|
||||
//
|
||||
ESTOP0;
|
||||
}
|
||||
#ifdef EX_ENABLE_OS_DETECTION
|
||||
}
|
||||
else
|
||||
{
|
||||
//
|
||||
// Selected ADC pin is either open or shorted to Vrefhi or Vreflo.
|
||||
// Loop indefinitely.
|
||||
//
|
||||
while(1)
|
||||
{
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef EX_ENABLE_OS_DETECTION
|
||||
//
|
||||
// performOSDetection - Function to perform open/shorts detection
|
||||
// for selected ADC channel
|
||||
//
|
||||
uint16_t performOSDetection(uint32_t adcBase, uint32_t adcResultBase,
|
||||
uint16_t channel)
|
||||
{
|
||||
uint16_t i;
|
||||
uint16_t status = ADC_OSDETECT_STATUS_UNDETERMINED;
|
||||
resultHi = 0, resultLo = 0, resultNormal = 0;
|
||||
|
||||
//
|
||||
// Step 1: Configure full scale OSDETECT mode and capture
|
||||
// ADC results
|
||||
//
|
||||
|
||||
//
|
||||
// Enable pull-up mode
|
||||
//
|
||||
ADC_configOSDetectMode(adcBase, ADC_OSDETECT_MODE_VDDA);
|
||||
|
||||
//
|
||||
// Force SOC0-SOC15
|
||||
//
|
||||
ADC_forceMultipleSOC(adcBase, 0xFFFF);
|
||||
|
||||
//
|
||||
// Wait for ADC to complete, then acknowledge flag
|
||||
//
|
||||
while(ADC_getInterruptStatus(adcBase, ADC_INT_NUMBER1) == false)
|
||||
{
|
||||
}
|
||||
ADC_clearInterruptStatus(adcBase, ADC_INT_NUMBER1);
|
||||
|
||||
//
|
||||
// Read ADC results
|
||||
//
|
||||
for(i = 0U; i < 16U; i++)
|
||||
{
|
||||
resultHi = resultHi + ADC_readResult(adcResultBase,
|
||||
(ADC_SOCNumber)i);
|
||||
}
|
||||
|
||||
resultHi = resultHi >> 4U;
|
||||
|
||||
//
|
||||
// Step 2: Configure zero scale OSDETECT mode and capture
|
||||
// ADC results
|
||||
//
|
||||
|
||||
//
|
||||
// Enable pull-down mode
|
||||
//
|
||||
ADC_configOSDetectMode(adcBase, ADC_OSDETECT_MODE_VSSA);
|
||||
|
||||
//
|
||||
// Force SOC0-SOC15
|
||||
//
|
||||
ADC_forceMultipleSOC(adcBase, 0xFFFFU);
|
||||
|
||||
//
|
||||
// Wait for ADC to complete, then acknowledge flag
|
||||
//
|
||||
while(ADC_getInterruptStatus(adcBase, ADC_INT_NUMBER1) == false)
|
||||
{
|
||||
}
|
||||
ADC_clearInterruptStatus(adcBase, ADC_INT_NUMBER1);
|
||||
|
||||
//
|
||||
// Read ADC results
|
||||
//
|
||||
for(i = 0U; i < 16U; i++)
|
||||
{
|
||||
resultLo = resultLo + ADC_readResult(adcResultBase, (ADC_SOCNumber)i);
|
||||
}
|
||||
|
||||
resultLo = resultLo >> 4U;
|
||||
|
||||
//
|
||||
// Step 3: Disable OSDETECT mode and capture
|
||||
// ADC results
|
||||
//
|
||||
|
||||
//
|
||||
// Disable OSDETECT mode
|
||||
//
|
||||
ADC_configOSDetectMode(adcBase, ADC_OSDETECT_MODE_DISABLED);
|
||||
|
||||
//
|
||||
// Force SOC0-SOC15
|
||||
//
|
||||
ADC_forceMultipleSOC(adcBase, 0xFFFFU);
|
||||
|
||||
//
|
||||
// Wait for ADC to complete, then acknowledge flag
|
||||
//
|
||||
while(ADC_getInterruptStatus(adcBase, ADC_INT_NUMBER1) == false)
|
||||
{
|
||||
}
|
||||
ADC_clearInterruptStatus(adcBase, ADC_INT_NUMBER1);
|
||||
|
||||
//
|
||||
// Read ADC results
|
||||
//
|
||||
for(i = 0U; i < 16U; i++)
|
||||
{
|
||||
resultNormal = resultNormal + ADC_readResult(adcResultBase,
|
||||
(ADC_SOCNumber)i);
|
||||
}
|
||||
|
||||
resultNormal = resultNormal >> 4U;
|
||||
|
||||
//
|
||||
// Step 4: Determine the state of the ADC pin
|
||||
//
|
||||
|
||||
//
|
||||
// If the pin is open, resultLo would be equal to Vreflo and
|
||||
// resultHi would be equal to Vrefhi
|
||||
//
|
||||
if((resultLo <= osdLoLimit) && (resultHi >= osdHiLimit))
|
||||
{
|
||||
status = ADC_OSDETECT_STATUS_OPEN;
|
||||
}
|
||||
|
||||
//
|
||||
// If the pin is shorted to Vrefhi, resultLo should be approximately
|
||||
// equal to Vrefhi and resultHi should be equal to Vrefhi
|
||||
//
|
||||
else if((resultLo > osdLoLimit) && (resultHi >= osdHiLimit) &&
|
||||
(resultNormal >= osdHiLimit))
|
||||
{
|
||||
status = ADC_OSDETECT_STATUS_SHORTED_TO_VREFHI;
|
||||
}
|
||||
|
||||
//
|
||||
// If the pin is shorted to Vreflo, resultLo should be equal to Vreflo
|
||||
// and resultHi should be approximately equal to Vreflo
|
||||
//
|
||||
else if((resultLo <= osdLoLimit) && (resultHi < osdHiLimit ) &&
|
||||
(resultNormal <= osdLoLimit ))
|
||||
{
|
||||
status = ADC_OSDETECT_STATUS_SHORTED_TO_VREFLO;
|
||||
}
|
||||
|
||||
//
|
||||
// If the pin is connected to a valid signal, resultLo should be greater
|
||||
// than osdLoLimit but less than resultNormal while resultHi should be
|
||||
// less than osdHiLimit but greater than resultNormal
|
||||
//
|
||||
else if((osdLoLimit < resultLo < resultNormal) &&
|
||||
(osdHiLimit < resultHi < resultNormal ))
|
||||
{
|
||||
status = ADC_OSDETECT_STATUS_GOOD;
|
||||
}
|
||||
|
||||
return(status);
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// configureADCTestMode - Function to configure selected ADC to enable testing
|
||||
// of Open/Shorts Detection
|
||||
//
|
||||
void configureADCTestMode(uint32_t adcBase, ADC_Channel channel)
|
||||
{
|
||||
uint16_t i;
|
||||
|
||||
//
|
||||
// Set ADCCLK divider to /4
|
||||
//
|
||||
ADC_setPrescaler(adcBase, ADC_CLK_DIV_4_0);
|
||||
|
||||
//
|
||||
// Set resolution to 12-bit and signal mode as single-ended
|
||||
//
|
||||
ADC_setMode(adcBase, ADC_RESOLUTION_12BIT, ADC_MODE_SINGLE_ENDED);
|
||||
|
||||
//
|
||||
// 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);
|
||||
|
||||
DEVICE_DELAY_US(1000);
|
||||
|
||||
//
|
||||
// Configure ADC SOCs to sample selected channel in test mode
|
||||
//
|
||||
for(i = 0; i < 16; i++)
|
||||
{
|
||||
ADC_setupSOC(adcBase, (ADC_SOCNumber)i, ADC_TRIGGER_SW_ONLY,
|
||||
channel, 64U);
|
||||
}
|
||||
|
||||
//
|
||||
// Set SOC15 to set the interrupt 1 flag. Enable the interrupt and make
|
||||
// sure its flag is cleared.
|
||||
//
|
||||
ADC_setInterruptSource(adcBase, ADC_INT_NUMBER1, ADC_SOC_NUMBER15);
|
||||
ADC_enableInterrupt(adcBase, ADC_INT_NUMBER1);
|
||||
ADC_clearInterruptStatus(adcBase, ADC_INT_NUMBER1);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
//
|
||||
// configureADC - Write ADC configurations and power up the desired ADC instance
|
||||
//
|
||||
void configureADC(uint32_t adcBase)
|
||||
{
|
||||
//
|
||||
// Set ADCCLK 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_SINGLE_ENDED);
|
||||
#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);
|
||||
}
|
||||
|
||||
//
|
||||
// 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
|
||||
// - 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)
|
||||
{
|
||||
acqps = 32;
|
||||
}
|
||||
else //resolution is 16-bit
|
||||
{
|
||||
acqps = 63;
|
||||
}
|
||||
|
||||
//
|
||||
// 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);
|
||||
}
|
||||
|
||||
//
|
||||
// End of File
|
||||
//
|
||||
|
||||
@@ -0,0 +1,164 @@
|
||||
//#############################################################################
|
||||
//
|
||||
// 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 ADCC based on a software
|
||||
//! trigger.
|
||||
//!
|
||||
//! The ADCC 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, C2, and C3 should be connected to signals to convert
|
||||
//!
|
||||
//! \b Watch \b Variables \n
|
||||
//! - \b myADC0Result0 - Digital representation of the voltage on pin A0
|
||||
//! - \b myADC0Result1 - Digital representation of the voltage on pin A1
|
||||
//! - \b myADC1Result0 - Digital representation of the voltage on pin C2
|
||||
//! - \b myADC1Result1 - Digital representation of the voltage on pin C3
|
||||
//!
|
||||
//
|
||||
//#############################################################################
|
||||
//
|
||||
//
|
||||
//
|
||||
// C2000Ware v5.04.00.00
|
||||
//
|
||||
// Copyright (C) 2024 Texas Instruments Incorporated - http://www.ti.com
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions
|
||||
// are met:
|
||||
//
|
||||
// Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
//
|
||||
// Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
//
|
||||
// Neither the name of Texas Instruments Incorporated nor the names of
|
||||
// its contributors may be used to endorse or promote products derived
|
||||
// from this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
// $
|
||||
//#############################################################################
|
||||
//
|
||||
|
||||
//
|
||||
// Included Files
|
||||
//
|
||||
#include "driverlib.h"
|
||||
#include "device.h"
|
||||
#include "board.h"
|
||||
|
||||
//
|
||||
// Globals
|
||||
//
|
||||
uint16_t myADC0Result0;
|
||||
uint16_t myADC0Result1;
|
||||
uint16_t myADC1Result0;
|
||||
uint16_t myADC1Result1;
|
||||
|
||||
//
|
||||
// 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
|
||||
// Signal Mode : single-ended
|
||||
// Conversion Resolution : 12-bit;
|
||||
//
|
||||
Board_init();
|
||||
|
||||
//
|
||||
// Enable Global Interrupt (INTM) and realtime interrupt (DBGM)
|
||||
//
|
||||
EINT;
|
||||
ERTM;
|
||||
|
||||
//
|
||||
// Loop indefinitely
|
||||
//
|
||||
while(1)
|
||||
{
|
||||
//
|
||||
// Convert, wait for completion, and store results
|
||||
//
|
||||
ADC_forceMultipleSOC(myADC0_BASE, (ADC_FORCE_SOC0 | ADC_FORCE_SOC1));
|
||||
|
||||
//
|
||||
// Wait for ADCA to complete, then acknowledge flag
|
||||
//
|
||||
while(ADC_getInterruptStatus(myADC0_BASE, ADC_INT_NUMBER1) == false)
|
||||
{
|
||||
}
|
||||
ADC_clearInterruptStatus(myADC0_BASE, ADC_INT_NUMBER1);
|
||||
|
||||
ADC_forceMultipleSOC(myADC1_BASE, (ADC_FORCE_SOC0 | ADC_FORCE_SOC1));
|
||||
//
|
||||
// Wait for ADCC to complete, then acknowledge flag
|
||||
//
|
||||
while(ADC_getInterruptStatus(myADC1_BASE, ADC_INT_NUMBER1) == false)
|
||||
{
|
||||
}
|
||||
ADC_clearInterruptStatus(myADC1_BASE, ADC_INT_NUMBER1);
|
||||
|
||||
//
|
||||
// Store results
|
||||
//
|
||||
myADC0Result0 = ADC_readResult(ADCARESULT_BASE, ADC_SOC_NUMBER0);
|
||||
myADC0Result1 = ADC_readResult(ADCARESULT_BASE, ADC_SOC_NUMBER1);
|
||||
myADC1Result0 = ADC_readResult(ADCCRESULT_BASE, ADC_SOC_NUMBER0);
|
||||
myADC1Result1 = ADC_readResult(ADCCRESULT_BASE, ADC_SOC_NUMBER1);
|
||||
|
||||
//
|
||||
// Software breakpoint. At this point, conversion results are stored in
|
||||
// myADC0Result0, myADC0Result1, myADC1Result0, and myADC1Result1.
|
||||
//
|
||||
// Hit run again to get updated conversions.
|
||||
//
|
||||
ESTOP0;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
|
||||
/**
|
||||
* Import the modules used in this configuration.
|
||||
*/
|
||||
const adc = scripting.addModule("/driverlib/adc.js", {}, false);
|
||||
const adc1 = adc.addInstance();
|
||||
const adc2 = adc.addInstance();
|
||||
|
||||
/**
|
||||
* Write custom configuration values to the imported modules.
|
||||
*/
|
||||
adc1.$name = "myADC0";
|
||||
adc1.adcClockPrescaler = "ADC_CLK_DIV_4_0";
|
||||
adc1.enabledSOCs = ["ADC_SOC_NUMBER0","ADC_SOC_NUMBER1"];
|
||||
adc1.soc1Channel = "ADC_CH_ADCIN1";
|
||||
adc1.soc0SampleWindow = 15;
|
||||
adc1.soc1SampleWindow = 15;
|
||||
adc1.enabledInts = ["ADC_INT_NUMBER1"];
|
||||
adc1.interruptPulseMode = "ADC_PULSE_END_OF_CONV";
|
||||
adc1.enableInterrupt1 = true;
|
||||
adc1.interrupt1SOCSource = "ADC_SOC_NUMBER1";
|
||||
adc1.adcSignalMode = "ADC_MODE_SINGLE_ENDED";
|
||||
adc1.adcResolutionMode = "ADC_RESOLUTION_12BIT";
|
||||
|
||||
adc2.$name = "myADC1";
|
||||
adc2.adcBase = "ADCC_BASE";
|
||||
adc2.adcClockPrescaler = "ADC_CLK_DIV_4_0";
|
||||
adc2.enabledSOCs = ["ADC_SOC_NUMBER0","ADC_SOC_NUMBER1"];
|
||||
adc2.soc0SampleWindow = 15;
|
||||
adc2.soc1SampleWindow = 15;
|
||||
adc2.soc1Channel = "ADC_CH_ADCIN3";
|
||||
adc2.soc0Channel = "ADC_CH_ADCIN2";
|
||||
adc2.enabledInts = ["ADC_INT_NUMBER1"];
|
||||
adc2.interruptPulseMode = "ADC_PULSE_END_OF_CONV";
|
||||
adc2.enableInterrupt1 = true;
|
||||
adc2.interrupt1SOCSource = "ADC_SOC_NUMBER1";
|
||||
adc2.adcSignalMode = "ADC_MODE_SINGLE_ENDED";
|
||||
adc2.adcResolutionMode = "ADC_RESOLUTION_12BIT";
|
||||
|
||||
@@ -0,0 +1,251 @@
|
||||
//#############################################################################
|
||||
//
|
||||
// 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 myADC0Results - 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.
|
||||
//!
|
||||
//
|
||||
//#############################################################################
|
||||
//
|
||||
//
|
||||
//
|
||||
// C2000Ware v5.04.00.00
|
||||
//
|
||||
// Copyright (C) 2024 Texas Instruments Incorporated - http://www.ti.com
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions
|
||||
// are met:
|
||||
//
|
||||
// Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
//
|
||||
// Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
//
|
||||
// Neither the name of Texas Instruments Incorporated nor the names of
|
||||
// its contributors may be used to endorse or promote products derived
|
||||
// from this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
// $
|
||||
//#############################################################################
|
||||
//
|
||||
|
||||
//
|
||||
// Included Files
|
||||
//
|
||||
#include "driverlib.h"
|
||||
#include "device.h"
|
||||
#include "board.h"
|
||||
|
||||
//
|
||||
// Defines
|
||||
//
|
||||
#define RESULTS_BUFFER_SIZE 256
|
||||
|
||||
//
|
||||
// Globals
|
||||
//
|
||||
uint16_t myADC0Results[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 initEPWM(void);
|
||||
|
||||
//
|
||||
// Main
|
||||
//
|
||||
void main(void)
|
||||
{
|
||||
//
|
||||
// Initialize device clock and peripherals
|
||||
//
|
||||
Device_init();
|
||||
|
||||
//
|
||||
// Disable pin locks and enable internal pullups.
|
||||
//
|
||||
Device_initGPIO();
|
||||
|
||||
//
|
||||
// Initialize PIE and clear PIE registers. Disables CPU interrupts.
|
||||
//
|
||||
Interrupt_initModule();
|
||||
|
||||
//
|
||||
// Initialize the PIE vector table with pointers to the shell Interrupt
|
||||
// Service Routines (ISR).
|
||||
//
|
||||
Interrupt_initVectorTable();
|
||||
|
||||
//
|
||||
// Board Initialization
|
||||
// - Set up the ADC and initialize the SOC
|
||||
// - Enable ADC interrupt
|
||||
// - Signal Mode : single-ended
|
||||
// - Conversion Resolution : 12-bit;
|
||||
//
|
||||
Board_init();
|
||||
|
||||
// Set up the ePWM
|
||||
initEPWM();
|
||||
|
||||
//
|
||||
// Initialize results buffer
|
||||
//
|
||||
for(index = 0; index < RESULTS_BUFFER_SIZE; index++)
|
||||
{
|
||||
myADC0Results[index] = 0;
|
||||
}
|
||||
|
||||
index = 0;
|
||||
bufferFull = 0;
|
||||
|
||||
//
|
||||
// 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
|
||||
// myADC0Results.
|
||||
//
|
||||
// Hit run again to get updated conversions.
|
||||
//
|
||||
ESTOP0;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// 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);
|
||||
}
|
||||
|
||||
//
|
||||
// adcA1ISR - ADC A Interrupt 1 ISR
|
||||
//
|
||||
__interrupt void adcA1ISR(void)
|
||||
{
|
||||
//
|
||||
// Add the latest result to the buffer
|
||||
//
|
||||
myADC0Results[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(myADC0_BASE, ADC_INT_NUMBER1);
|
||||
|
||||
//
|
||||
// Check if overflow has occurred
|
||||
//
|
||||
if(true == ADC_getInterruptOverflowStatus(myADC0_BASE, ADC_INT_NUMBER1))
|
||||
{
|
||||
ADC_clearInterruptOverflowStatus(myADC0_BASE, ADC_INT_NUMBER1);
|
||||
ADC_clearInterruptStatus(myADC0_BASE, ADC_INT_NUMBER1);
|
||||
}
|
||||
|
||||
//
|
||||
// Acknowledge the interrupt
|
||||
//
|
||||
Interrupt_clearACKGroup(INT_myADC0_1_INTERRUPT_ACK_GROUP);
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
|
||||
/**
|
||||
* Import the modules used in this configuration.
|
||||
*/
|
||||
const adc = scripting.addModule("/driverlib/adc.js", {}, false);
|
||||
const adc1 = adc.addInstance();
|
||||
|
||||
/**
|
||||
* Write custom configuration values to the imported modules.
|
||||
*/
|
||||
adc1.$name = "myADC0";
|
||||
adc1.adcClockPrescaler = "ADC_CLK_DIV_4_0";
|
||||
adc1.interruptPulseMode = "ADC_PULSE_END_OF_CONV";
|
||||
adc1.enabledSOCs = ["ADC_SOC_NUMBER0"];
|
||||
adc1.soc0Trigger = "ADC_TRIGGER_EPWM1_SOCA";
|
||||
adc1.soc0SampleWindow = 15;
|
||||
adc1.enabledInts = ["ADC_INT_NUMBER1"];
|
||||
adc1.enableInterrupt1 = true;
|
||||
adc1.registerInterrupts = ["1"];
|
||||
adc1.adcInt1.enableInterrupt = true;
|
||||
adc1.adcInt1.interruptHandler = "adcA1ISR";
|
||||
adc1.adcSignalMode = "ADC_MODE_SINGLE_ENDED";
|
||||
adc1.adcResolutionMode = "ADC_RESOLUTION_12BIT";
|
||||
|
||||
@@ -0,0 +1,213 @@
|
||||
//#############################################################################
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
//#############################################################################
|
||||
//
|
||||
//
|
||||
//
|
||||
// C2000Ware v5.04.00.00
|
||||
//
|
||||
// Copyright (C) 2024 Texas Instruments Incorporated - http://www.ti.com
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions
|
||||
// are met:
|
||||
//
|
||||
// Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
//
|
||||
// Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
//
|
||||
// Neither the name of Texas Instruments Incorporated nor the names of
|
||||
// its contributors may be used to endorse or promote products derived
|
||||
// from this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
// $
|
||||
//#############################################################################
|
||||
//
|
||||
|
||||
//
|
||||
// Included Files
|
||||
//
|
||||
#include "driverlib.h"
|
||||
#include "device.h"
|
||||
#include "board.h"
|
||||
|
||||
//
|
||||
// Globals
|
||||
//
|
||||
uint16_t sensorSample;
|
||||
int16_t sensorTemp;
|
||||
|
||||
//
|
||||
// Function Prototypes
|
||||
//
|
||||
void initEPWM(void);
|
||||
|
||||
//
|
||||
// Main
|
||||
//
|
||||
void main(void)
|
||||
{
|
||||
//
|
||||
// Initialize device clock and peripherals
|
||||
//
|
||||
Device_init();
|
||||
|
||||
//
|
||||
// Disable pin locks and enable internal pullups.
|
||||
//
|
||||
Device_initGPIO();
|
||||
|
||||
//
|
||||
// Initialize PIE and clear PIE registers. Disables CPU interrupts.
|
||||
//
|
||||
Interrupt_initModule();
|
||||
|
||||
//
|
||||
// Initialize the PIE vector table with pointers to the shell Interrupt
|
||||
// Service Routines (ISR).
|
||||
//
|
||||
Interrupt_initVectorTable();
|
||||
|
||||
//
|
||||
// Board Initialization
|
||||
// - Configure and power up ADCA.
|
||||
// - Configure ADC's SOC0 to be triggered by ePWM1.
|
||||
// - Enable the temperature sensor and give it 500 us to power up
|
||||
// - Enable ADC interrupt
|
||||
// - Signal Mode : single-ended
|
||||
// - Conversion Resolution : 12-bit;
|
||||
//
|
||||
Board_init();
|
||||
|
||||
//
|
||||
// Set up the ePWM
|
||||
//
|
||||
initEPWM();
|
||||
|
||||
//
|
||||
// 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)
|
||||
{
|
||||
;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// 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);
|
||||
}
|
||||
|
||||
//
|
||||
// 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(myADC0_BASE, ADC_INT_NUMBER1);
|
||||
|
||||
//
|
||||
// Check if overflow has occurred
|
||||
//
|
||||
if(true == ADC_getInterruptOverflowStatus(myADC0_BASE, ADC_INT_NUMBER1))
|
||||
{
|
||||
ADC_clearInterruptOverflowStatus(myADC0_BASE, ADC_INT_NUMBER1);
|
||||
ADC_clearInterruptStatus(myADC0_BASE, ADC_INT_NUMBER1);
|
||||
}
|
||||
|
||||
//
|
||||
// Acknowledge the interrupt
|
||||
//
|
||||
Interrupt_clearACKGroup(INT_myADC0_1_INTERRUPT_ACK_GROUP);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
|
||||
/**
|
||||
* Import the modules used in this configuration.
|
||||
*/
|
||||
const adc = scripting.addModule("/driverlib/adc.js", {}, false);
|
||||
const adc1 = adc.addInstance();
|
||||
const asysctl = scripting.addModule("/driverlib/asysctl.js");
|
||||
|
||||
/**
|
||||
* Write custom configuration values to the imported modules.
|
||||
*/
|
||||
adc1.$name = "myADC0";
|
||||
adc1.enabledSOCs = ["ADC_SOC_NUMBER0"];
|
||||
adc1.soc0Channel = "ADC_CH_ADCIN13";
|
||||
adc1.adcBase = "ADCA_BASE";
|
||||
adc1.adcClockPrescaler = "ADC_CLK_DIV_4_0";
|
||||
adc1.soc0Trigger = "ADC_TRIGGER_EPWM1_SOCA";
|
||||
adc1.interruptPulseMode = "ADC_PULSE_END_OF_CONV";
|
||||
adc1.enabledInts = ["ADC_INT_NUMBER1"];
|
||||
adc1.soc0SampleWindow = 140;
|
||||
adc1.enableInterrupt1 = true;
|
||||
adc1.registerInterrupts = ["1"];
|
||||
adc1.adcInt1.enableInterrupt = true;
|
||||
adc1.adcInt1.interruptHandler = "adcA1ISR";
|
||||
adc1.adcSignalMode = "ADC_MODE_SINGLE_ENDED";
|
||||
adc1.adcResolutionMode = "ADC_RESOLUTION_12BIT";
|
||||
|
||||
asysctl.enableTemperatureSensor = true;
|
||||
@@ -0,0 +1,169 @@
|
||||
//###########################################################################
|
||||
//
|
||||
// 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 ADCC 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, C2, C3 pins should be connected to signals to convert
|
||||
//!
|
||||
//! \b Watch \b Variables \n
|
||||
//! - \b myADC0Result0 \b: a digital representation of the voltage on pin A2\n
|
||||
//! - \b myADC0Result1 \b: a digital representation of the voltage on pin A3\n
|
||||
//! - \b myADC1Result0 \b: a digital representation of the voltage on pin C2\n
|
||||
//! - \b myADC1Result1 \b: a digital representation of the voltage on pin C3\n
|
||||
//!
|
||||
//
|
||||
//#############################################################################
|
||||
//
|
||||
//
|
||||
//
|
||||
// C2000Ware v5.04.00.00
|
||||
//
|
||||
// Copyright (C) 2024 Texas Instruments Incorporated - http://www.ti.com
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions
|
||||
// are met:
|
||||
//
|
||||
// Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
//
|
||||
// Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
//
|
||||
// Neither the name of Texas Instruments Incorporated nor the names of
|
||||
// its contributors may be used to endorse or promote products derived
|
||||
// from this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
// $
|
||||
//#############################################################################
|
||||
//
|
||||
|
||||
//
|
||||
// Included Files
|
||||
//
|
||||
#include "driverlib.h"
|
||||
#include "device.h"
|
||||
#include "board.h"
|
||||
|
||||
//
|
||||
// Globals
|
||||
//
|
||||
uint16_t myADC0Result0;
|
||||
uint16_t myADC0Result1;
|
||||
uint16_t myADC1Result0;
|
||||
uint16_t myADC1Result1;
|
||||
|
||||
void main(void)
|
||||
{
|
||||
//
|
||||
// Initialize device clock and peripherals
|
||||
//
|
||||
Device_init();
|
||||
|
||||
//
|
||||
// Disable pin locks and enable internal pullups.
|
||||
//
|
||||
Device_initGPIO();
|
||||
|
||||
//
|
||||
// Initialize PIE and clear PIE registers. Disables CPU interrupts.
|
||||
//
|
||||
Interrupt_initModule();
|
||||
|
||||
//
|
||||
// Initialize the PIE vector table with pointers to the shell Interrupt
|
||||
// Service Routines (ISR).
|
||||
//
|
||||
Interrupt_initVectorTable();
|
||||
|
||||
//
|
||||
// Board Initialization
|
||||
// - Write ADC configurations and power up the ADC for both ADC A and ADC C
|
||||
// - 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.
|
||||
// - Setup ADC acquisition window and compare values
|
||||
// - Signal Mode : single-ended
|
||||
// - Conversion Resolution : 12-bit;
|
||||
//
|
||||
Board_init();
|
||||
|
||||
//
|
||||
// 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(myADC0_BASE, ADC_INT_NUMBER1) == 0U);
|
||||
ADC_clearInterruptStatus(myADC0_BASE, ADC_INT_NUMBER1);
|
||||
|
||||
//
|
||||
// Store results
|
||||
//
|
||||
myADC0Result0 = ADC_readResult(ADCARESULT_BASE, ADC_SOC_NUMBER0);
|
||||
myADC0Result1 = ADC_readResult(ADCARESULT_BASE, ADC_SOC_NUMBER1);
|
||||
myADC1Result0 = ADC_readResult(ADCCRESULT_BASE, ADC_SOC_NUMBER0);
|
||||
myADC1Result1 = ADC_readResult(ADCCRESULT_BASE, ADC_SOC_NUMBER1);
|
||||
|
||||
//
|
||||
// At this point, conversion results are stored in
|
||||
// myADC0Result0, myADC0Result1, myADC1Result0, and myADC1Result1
|
||||
//
|
||||
|
||||
//
|
||||
// Software breakpoint, hit run again to get updated conversions
|
||||
//
|
||||
asm(" ESTOP0");
|
||||
|
||||
}
|
||||
while(1);
|
||||
}
|
||||
|
||||
//
|
||||
// End of file
|
||||
//
|
||||
@@ -0,0 +1,54 @@
|
||||
|
||||
/**
|
||||
* Import the modules used in this configuration.
|
||||
*/
|
||||
const adc = scripting.addModule("/driverlib/adc.js", {}, false);
|
||||
const adc1 = adc.addInstance();
|
||||
const adc2 = adc.addInstance();
|
||||
const gpio = scripting.addModule("/driverlib/gpio.js", {}, false);
|
||||
const gpio1 = gpio.addInstance();
|
||||
const inputxbar = scripting.addModule("/driverlib/inputxbar.js", {}, false);
|
||||
const inputxbar1 = inputxbar.addInstance();
|
||||
|
||||
/**
|
||||
* Write custom configuration values to the imported modules.
|
||||
*/
|
||||
adc1.$name = "myADC0";
|
||||
adc1.adcClockPrescaler = "ADC_CLK_DIV_4_0";
|
||||
adc1.interruptPulseMode = "ADC_PULSE_END_OF_CONV";
|
||||
adc1.enabledSOCs = ["ADC_SOC_NUMBER0","ADC_SOC_NUMBER1"];
|
||||
adc1.soc0Trigger = "ADC_TRIGGER_GPIO";
|
||||
adc1.soc1Trigger = "ADC_TRIGGER_GPIO";
|
||||
adc1.soc0Channel = "ADC_CH_ADCIN2";
|
||||
adc1.soc1Channel = "ADC_CH_ADCIN3";
|
||||
adc1.soc0SampleWindow = 15;
|
||||
adc1.soc1SampleWindow = 15;
|
||||
adc1.enabledInts = ["ADC_INT_NUMBER1"];
|
||||
adc1.enableInterrupt1 = true;
|
||||
adc1.interrupt1SOCSource = "ADC_SOC_NUMBER1";
|
||||
adc1.adcSignalMode = "ADC_MODE_SINGLE_ENDED";
|
||||
adc1.adcResolutionMode = "ADC_RESOLUTION_12BIT";
|
||||
|
||||
adc2.$name = "myADC1";
|
||||
adc2.adcBase = "ADCC_BASE";
|
||||
adc2.adcClockPrescaler = "ADC_CLK_DIV_4_0";
|
||||
adc2.interruptPulseMode = "ADC_PULSE_END_OF_CONV";
|
||||
adc2.enabledSOCs = ["ADC_SOC_NUMBER0","ADC_SOC_NUMBER1"];
|
||||
adc2.soc0Channel = "ADC_CH_ADCIN2";
|
||||
adc2.soc0Trigger = "ADC_TRIGGER_GPIO";
|
||||
adc2.soc1Channel = "ADC_CH_ADCIN3";
|
||||
adc2.soc1Trigger = "ADC_TRIGGER_GPIO";
|
||||
adc2.soc0SampleWindow = 15;
|
||||
adc2.soc1SampleWindow = 15;
|
||||
adc2.adcSignalMode = "ADC_MODE_SINGLE_ENDED";
|
||||
adc2.adcResolutionMode = "ADC_RESOLUTION_12BIT";
|
||||
|
||||
|
||||
gpio1.$name = "myGPIO0";
|
||||
gpio1.direction = "GPIO_DIR_MODE_OUT";
|
||||
gpio1.writeInitialValue = true;
|
||||
gpio1.gpioPin.$assign = "GPIO0";
|
||||
|
||||
inputxbar1.$name = "myINPUTXBAR0";
|
||||
inputxbar1.inputsUsed = ["inputxbar5Gpio"];
|
||||
inputxbar1.inputxbar5Gpio = "GPIO0";
|
||||
@@ -0,0 +1,251 @@
|
||||
//###########################################################################
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
//#############################################################################
|
||||
//
|
||||
//
|
||||
//
|
||||
// C2000Ware v5.04.00.00
|
||||
//
|
||||
// Copyright (C) 2024 Texas Instruments Incorporated - http://www.ti.com
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions
|
||||
// are met:
|
||||
//
|
||||
// Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
//
|
||||
// Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
//
|
||||
// Neither the name of Texas Instruments Incorporated nor the names of
|
||||
// its contributors may be used to endorse or promote products derived
|
||||
// from this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
// $
|
||||
//#############################################################################
|
||||
//
|
||||
|
||||
//
|
||||
// Included Files
|
||||
//
|
||||
#include "driverlib.h"
|
||||
#include "device.h"
|
||||
#include "board.h"
|
||||
|
||||
//
|
||||
// Defines
|
||||
//
|
||||
#define RESULTS_BUFFER_SIZE 256 //buffer for storing conversion results
|
||||
//(size must be multiple of 16)
|
||||
|
||||
//
|
||||
// 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();
|
||||
|
||||
//
|
||||
// Board Initialization
|
||||
// - Configure the ADC and power it up
|
||||
// - Setup the ADC for continuous conversions on channel 0
|
||||
// - Signal Mode : single-ended
|
||||
// - Conversion Resolution : 12-bit;
|
||||
//
|
||||
Board_init();
|
||||
|
||||
//
|
||||
// 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(myADC0_BASE, ADC_INT_NUMBER1);
|
||||
ADC_enableInterrupt(myADC0_BASE, ADC_INT_NUMBER2);
|
||||
ADC_enableInterrupt(myADC0_BASE, ADC_INT_NUMBER3);
|
||||
ADC_enableInterrupt(myADC0_BASE, ADC_INT_NUMBER4);
|
||||
|
||||
//
|
||||
// Clear all interrupts flags(INT1-4)
|
||||
//
|
||||
HWREGH(myADC0_BASE + ADC_O_INTFLGCLR) = 0x000F;
|
||||
|
||||
//
|
||||
// Initialize results index
|
||||
//
|
||||
resultsIndex = 0;
|
||||
|
||||
//
|
||||
// Software force start SOC0 to SOC7
|
||||
//
|
||||
HWREGH(myADC0_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(myADC0_BASE, ADC_INT_NUMBER3));
|
||||
|
||||
//
|
||||
// Clear the interrupt flag
|
||||
//
|
||||
ADC_clearInterruptStatus(myADC0_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(myADC0_BASE, ADC_INT_NUMBER4));
|
||||
|
||||
//
|
||||
// Clear the interrupt flag
|
||||
//
|
||||
ADC_clearInterruptStatus(myADC0_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(myADC0_BASE, ADC_INT_NUMBER1);
|
||||
ADC_disableInterrupt(myADC0_BASE, ADC_INT_NUMBER2);
|
||||
ADC_disableInterrupt(myADC0_BASE, ADC_INT_NUMBER3);
|
||||
ADC_disableInterrupt(myADC0_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
|
||||
}
|
||||
|
||||
//
|
||||
// End of file
|
||||
//
|
||||
@@ -0,0 +1,58 @@
|
||||
|
||||
/**
|
||||
* Import the modules used in this configuration.
|
||||
*/
|
||||
const adc = scripting.addModule("/driverlib/adc.js", {}, false);
|
||||
const adc1 = adc.addInstance();
|
||||
|
||||
/**
|
||||
* Write custom configuration values to the imported modules.
|
||||
*/
|
||||
adc1.$name = "myADC0";
|
||||
adc1.adcClockPrescaler = "ADC_CLK_DIV_4_0";
|
||||
adc1.interruptPulseMode = "ADC_PULSE_END_OF_CONV";
|
||||
adc1.soc0SampleWindow = 15;
|
||||
adc1.soc1SampleWindow = 15;
|
||||
adc1.soc2SampleWindow = 15;
|
||||
adc1.soc3SampleWindow = 15;
|
||||
adc1.soc4SampleWindow = 15;
|
||||
adc1.soc5SampleWindow = 15;
|
||||
adc1.soc6SampleWindow = 15;
|
||||
adc1.soc7SampleWindow = 15;
|
||||
adc1.soc8SampleWindow = 15;
|
||||
adc1.soc9SampleWindow = 15;
|
||||
adc1.soc10SampleWindow = 15;
|
||||
adc1.soc11SampleWindow = 15;
|
||||
adc1.soc12SampleWindow = 15;
|
||||
adc1.soc13SampleWindow = 15;
|
||||
adc1.soc14SampleWindow = 15;
|
||||
adc1.soc15SampleWindow = 15;
|
||||
adc1.enabledSOCs = ["ADC_SOC_NUMBER0","ADC_SOC_NUMBER1","ADC_SOC_NUMBER10","ADC_SOC_NUMBER11","ADC_SOC_NUMBER12","ADC_SOC_NUMBER13","ADC_SOC_NUMBER14","ADC_SOC_NUMBER15","ADC_SOC_NUMBER2","ADC_SOC_NUMBER3","ADC_SOC_NUMBER4","ADC_SOC_NUMBER5","ADC_SOC_NUMBER6","ADC_SOC_NUMBER7","ADC_SOC_NUMBER8","ADC_SOC_NUMBER9"];
|
||||
adc1.soc0InterruptTrigger = "ADC_INT_SOC_TRIGGER_ADCINT2";
|
||||
adc1.soc1InterruptTrigger = "ADC_INT_SOC_TRIGGER_ADCINT2";
|
||||
adc1.soc2InterruptTrigger = "ADC_INT_SOC_TRIGGER_ADCINT2";
|
||||
adc1.soc3InterruptTrigger = "ADC_INT_SOC_TRIGGER_ADCINT2";
|
||||
adc1.soc4InterruptTrigger = "ADC_INT_SOC_TRIGGER_ADCINT2";
|
||||
adc1.soc5InterruptTrigger = "ADC_INT_SOC_TRIGGER_ADCINT2";
|
||||
adc1.soc6InterruptTrigger = "ADC_INT_SOC_TRIGGER_ADCINT2";
|
||||
adc1.soc7InterruptTrigger = "ADC_INT_SOC_TRIGGER_ADCINT2";
|
||||
adc1.soc8InterruptTrigger = "ADC_INT_SOC_TRIGGER_ADCINT1";
|
||||
adc1.soc9InterruptTrigger = "ADC_INT_SOC_TRIGGER_ADCINT1";
|
||||
adc1.soc10InterruptTrigger = "ADC_INT_SOC_TRIGGER_ADCINT1";
|
||||
adc1.soc11InterruptTrigger = "ADC_INT_SOC_TRIGGER_ADCINT1";
|
||||
adc1.soc12InterruptTrigger = "ADC_INT_SOC_TRIGGER_ADCINT1";
|
||||
adc1.soc13InterruptTrigger = "ADC_INT_SOC_TRIGGER_ADCINT1";
|
||||
adc1.soc14InterruptTrigger = "ADC_INT_SOC_TRIGGER_ADCINT1";
|
||||
adc1.soc15InterruptTrigger = "ADC_INT_SOC_TRIGGER_ADCINT1";
|
||||
adc1.enabledInts = ["ADC_INT_NUMBER1","ADC_INT_NUMBER2","ADC_INT_NUMBER3","ADC_INT_NUMBER4"];
|
||||
adc1.enableInterrupt1ContinuousMode = true;
|
||||
adc1.enableInterrupt2ContinuousMode = true;
|
||||
adc1.enableInterrupt3ContinuousMode = true;
|
||||
adc1.enableInterrupt4ContinuousMode = true;
|
||||
adc1.interrupt1SOCSource = "ADC_SOC_NUMBER6";
|
||||
adc1.interrupt2SOCSource = "ADC_SOC_NUMBER14";
|
||||
adc1.interrupt3SOCSource = "ADC_SOC_NUMBER7";
|
||||
adc1.interrupt4SOCSource = "ADC_SOC_NUMBER15";
|
||||
adc1.adcSignalMode = "ADC_MODE_SINGLE_ENDED";
|
||||
adc1.adcResolutionMode = "ADC_RESOLUTION_12BIT";
|
||||
|
||||
@@ -0,0 +1,372 @@
|
||||
//###########################################################################
|
||||
//
|
||||
// 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 & C3 pins should be connected to signals to convert
|
||||
//!
|
||||
//! \b Watch \b Variables \n
|
||||
//! - \b myADC0DataBuffer \b: a digital representation of the voltage on pin A3\n
|
||||
//! - \b myADC1DataBuffer \b: a digital representation of the voltage on pin C3\n
|
||||
//!
|
||||
//
|
||||
//#############################################################################
|
||||
//
|
||||
//
|
||||
//
|
||||
// C2000Ware v5.04.00.00
|
||||
//
|
||||
// Copyright (C) 2024 Texas Instruments Incorporated - http://www.ti.com
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions
|
||||
// are met:
|
||||
//
|
||||
// Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
//
|
||||
// Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
//
|
||||
// Neither the name of Texas Instruments Incorporated nor the names of
|
||||
// its contributors may be used to endorse or promote products derived
|
||||
// from this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
// $
|
||||
//#############################################################################
|
||||
//
|
||||
|
||||
//
|
||||
// Included Files
|
||||
//
|
||||
#include "driverlib.h"
|
||||
#include "device.h"
|
||||
#include "board.h"
|
||||
|
||||
//
|
||||
// Function Prototypes
|
||||
//
|
||||
__interrupt void dmach1ISR(void);
|
||||
|
||||
void configureEPWM(uint32_t epwmBase);
|
||||
void initializeDMA(void);
|
||||
void configureDMAChannels(void);
|
||||
|
||||
//
|
||||
// Defines
|
||||
//
|
||||
#define RESULTS_BUFFER_SIZE 1024 //buffer for storing conversion results
|
||||
//(size must be multiple of 16)
|
||||
|
||||
//
|
||||
// Globals
|
||||
//
|
||||
#pragma DATA_SECTION(myADC0DataBuffer, "ramgs0");
|
||||
#pragma DATA_SECTION(myADC1DataBuffer, "ramgs0");
|
||||
uint16_t myADC0DataBuffer[RESULTS_BUFFER_SIZE];
|
||||
uint16_t myADC1DataBuffer[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();
|
||||
|
||||
//
|
||||
// Board Initializatrion
|
||||
// - Configure the ADCA & ADCC and power it up
|
||||
// - Setup the ADC for continuous conversions on channels A3 and C3
|
||||
// - Set up ISR for ADCA INT1 - occurs after first conversion
|
||||
// - Enable specific PIE & CPU interrupts: ADCA INT1 - Group 1, interrupt 1
|
||||
// - Signal Mode : single-ended
|
||||
// - Conversion Resolution : 12-bit;
|
||||
//
|
||||
Board_init();
|
||||
|
||||
//
|
||||
// Set up ISRs used by this example
|
||||
// ISR for DMA ch1 - occurs when DMA transfer is complete
|
||||
//
|
||||
Interrupt_register(INT_DMA_CH1, &dmach1ISR);
|
||||
|
||||
//
|
||||
// Enable specific PIE & CPU interrupts:
|
||||
// DMA interrupt - Group 7, interrupt 1
|
||||
//
|
||||
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);
|
||||
|
||||
//
|
||||
// Initialize the DMA & configure DMA channels 1 & 2
|
||||
//
|
||||
initializeDMA();
|
||||
configureDMAChannels();
|
||||
|
||||
//
|
||||
// Initialize results buffer
|
||||
//
|
||||
for(resultsIndex = 0; resultsIndex < RESULTS_BUFFER_SIZE; resultsIndex++)
|
||||
{
|
||||
myADC0DataBuffer[resultsIndex] = 0;
|
||||
myADC1DataBuffer[resultsIndex] = 0;
|
||||
}
|
||||
|
||||
//
|
||||
// Clearing all pending interrupt flags
|
||||
//
|
||||
DMA_clearTriggerFlag(DMA_CH1_BASE); // DMA channel 1
|
||||
DMA_clearTriggerFlag(DMA_CH2_BASE); // DMA channel 2
|
||||
HWREGH(myADC0_BASE + ADC_O_INTFLGCLR) = 0x3U; // ADCA
|
||||
HWREGH(myADC1_BASE + ADC_O_INTFLGCLR) = 0x3U; // ADCC
|
||||
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(myADC0_BASE, ADC_SOC_NUMBER0, // ADCA
|
||||
ADC_INT_SOC_TRIGGER_ADCINT2);
|
||||
ADC_setInterruptSOCTrigger(myADC1_BASE, ADC_SOC_NUMBER0, // ADCC
|
||||
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(INT_myADC0_1_INTERRUPT_ACK_GROUP);
|
||||
}
|
||||
|
||||
//
|
||||
// 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(myADC0_BASE, ADC_SOC_NUMBER0,
|
||||
ADC_INT_SOC_TRIGGER_NONE);
|
||||
ADC_setInterruptSOCTrigger(myADC1_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);
|
||||
|
||||
//
|
||||
// Enable initialization of the SOCA event counter. Since we are
|
||||
// disabling the ETSEL.SOCAEN bit, we need a way to reset the SOCACNT.
|
||||
// Hence, enable the counter initialize control.
|
||||
//
|
||||
EPWM_enableADCTriggerEventCountInit(epwmBase, EPWM_SOC_A);
|
||||
}
|
||||
|
||||
//
|
||||
// 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 *)&myADC0DataBuffer,
|
||||
(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 ADCC
|
||||
//
|
||||
DMA_configAddresses(DMA_CH2_BASE, (uint16_t *)&myADC1DataBuffer,
|
||||
(uint16_t *)ADCCRESULT_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,141 @@
|
||||
|
||||
/**
|
||||
* Import the modules used in this configuration.
|
||||
*/
|
||||
const adc = scripting.addModule("/driverlib/adc.js", {}, false);
|
||||
const adc1 = adc.addInstance();
|
||||
const adc2 = adc.addInstance();
|
||||
/**
|
||||
* Write custom configuration values to the imported modules.
|
||||
*/
|
||||
adc1.$name = "myADC0";
|
||||
adc1.registerInterrupts = ["1"];
|
||||
adc1.adcClockPrescaler = "ADC_CLK_DIV_4_0";
|
||||
adc1.interruptPulseMode = "ADC_PULSE_END_OF_CONV";
|
||||
adc1.enabledSOCs = ["ADC_SOC_NUMBER0","ADC_SOC_NUMBER1","ADC_SOC_NUMBER10","ADC_SOC_NUMBER11","ADC_SOC_NUMBER12","ADC_SOC_NUMBER13","ADC_SOC_NUMBER14","ADC_SOC_NUMBER15","ADC_SOC_NUMBER2","ADC_SOC_NUMBER3","ADC_SOC_NUMBER4","ADC_SOC_NUMBER5","ADC_SOC_NUMBER6","ADC_SOC_NUMBER7","ADC_SOC_NUMBER8","ADC_SOC_NUMBER9"];
|
||||
adc1.soc0SampleWindow = 15;
|
||||
adc1.soc1SampleWindow = 15;
|
||||
adc1.soc2SampleWindow = 15;
|
||||
adc1.soc3SampleWindow = 15;
|
||||
adc1.soc4SampleWindow = 15;
|
||||
adc1.soc5SampleWindow = 15;
|
||||
adc1.soc6SampleWindow = 15;
|
||||
adc1.soc7SampleWindow = 15;
|
||||
adc1.soc8SampleWindow = 15;
|
||||
adc1.soc9SampleWindow = 15;
|
||||
adc1.soc10SampleWindow = 15;
|
||||
adc1.soc11SampleWindow = 15;
|
||||
adc1.soc12SampleWindow = 15;
|
||||
adc1.soc13SampleWindow = 15;
|
||||
adc1.soc14SampleWindow = 15;
|
||||
adc1.soc15SampleWindow = 15;
|
||||
adc1.soc0Channel = "ADC_CH_ADCIN3";
|
||||
adc1.soc1Channel = "ADC_CH_ADCIN3";
|
||||
adc1.soc2Channel = "ADC_CH_ADCIN3";
|
||||
adc1.soc3Channel = "ADC_CH_ADCIN3";
|
||||
adc1.soc4Channel = "ADC_CH_ADCIN3";
|
||||
adc1.soc5Channel = "ADC_CH_ADCIN3";
|
||||
adc1.soc6Channel = "ADC_CH_ADCIN3";
|
||||
adc1.soc7Channel = "ADC_CH_ADCIN3";
|
||||
adc1.soc8Channel = "ADC_CH_ADCIN3";
|
||||
adc1.soc9Channel = "ADC_CH_ADCIN3";
|
||||
adc1.soc10Channel = "ADC_CH_ADCIN3";
|
||||
adc1.soc11Channel = "ADC_CH_ADCIN3";
|
||||
adc1.soc12Channel = "ADC_CH_ADCIN3";
|
||||
adc1.soc13Channel = "ADC_CH_ADCIN3";
|
||||
adc1.soc14Channel = "ADC_CH_ADCIN3";
|
||||
adc1.soc15Channel = "ADC_CH_ADCIN3";
|
||||
adc1.soc0Trigger = "ADC_TRIGGER_EPWM2_SOCA";
|
||||
adc1.soc0InterruptTrigger = "ADC_INT_SOC_TRIGGER_ADCINT1";
|
||||
adc1.soc1InterruptTrigger = "ADC_INT_SOC_TRIGGER_ADCINT1";
|
||||
adc1.soc2InterruptTrigger = "ADC_INT_SOC_TRIGGER_ADCINT1";
|
||||
adc1.soc3InterruptTrigger = "ADC_INT_SOC_TRIGGER_ADCINT1";
|
||||
adc1.soc4InterruptTrigger = "ADC_INT_SOC_TRIGGER_ADCINT1";
|
||||
adc1.soc5InterruptTrigger = "ADC_INT_SOC_TRIGGER_ADCINT1";
|
||||
adc1.soc6InterruptTrigger = "ADC_INT_SOC_TRIGGER_ADCINT1";
|
||||
adc1.soc7InterruptTrigger = "ADC_INT_SOC_TRIGGER_ADCINT1";
|
||||
adc1.soc8InterruptTrigger = "ADC_INT_SOC_TRIGGER_ADCINT1";
|
||||
adc1.soc9InterruptTrigger = "ADC_INT_SOC_TRIGGER_ADCINT1";
|
||||
adc1.soc10InterruptTrigger = "ADC_INT_SOC_TRIGGER_ADCINT1";
|
||||
adc1.soc11InterruptTrigger = "ADC_INT_SOC_TRIGGER_ADCINT1";
|
||||
adc1.soc12InterruptTrigger = "ADC_INT_SOC_TRIGGER_ADCINT1";
|
||||
adc1.soc13InterruptTrigger = "ADC_INT_SOC_TRIGGER_ADCINT1";
|
||||
adc1.soc14InterruptTrigger = "ADC_INT_SOC_TRIGGER_ADCINT1";
|
||||
adc1.soc15InterruptTrigger = "ADC_INT_SOC_TRIGGER_ADCINT1";
|
||||
adc1.enabledInts = ["ADC_INT_NUMBER1","ADC_INT_NUMBER2","ADC_INT_NUMBER3","ADC_INT_NUMBER4"];
|
||||
adc1.enableInterrupt1 = true;
|
||||
adc1.enableInterrupt2 = true;
|
||||
adc1.enableInterrupt1ContinuousMode = true;
|
||||
adc1.enableInterrupt2ContinuousMode = true;
|
||||
adc1.interrupt1SOCSource = "ADC_SOC_NUMBER0";
|
||||
adc1.interrupt2SOCSource = "ADC_SOC_NUMBER15";
|
||||
|
||||
adc1.adcInt1.enableInterrupt = true;
|
||||
adc1.adcInt1.interruptHandler = "adcA1ISR";
|
||||
adc1.adcSignalMode = "ADC_MODE_SINGLE_ENDED";
|
||||
adc1.adcResolutionMode = "ADC_RESOLUTION_12BIT";
|
||||
|
||||
adc2.$name = "myADC1";
|
||||
adc2.adcBase = "ADCC_BASE";
|
||||
adc2.adcClockPrescaler = "ADC_CLK_DIV_4_0";
|
||||
adc2.interruptPulseMode = "ADC_PULSE_END_OF_CONV";
|
||||
adc2.enabledSOCs = ["ADC_SOC_NUMBER0","ADC_SOC_NUMBER1","ADC_SOC_NUMBER10","ADC_SOC_NUMBER11","ADC_SOC_NUMBER12","ADC_SOC_NUMBER13","ADC_SOC_NUMBER14","ADC_SOC_NUMBER15","ADC_SOC_NUMBER2","ADC_SOC_NUMBER3","ADC_SOC_NUMBER4","ADC_SOC_NUMBER5","ADC_SOC_NUMBER6","ADC_SOC_NUMBER7","ADC_SOC_NUMBER8","ADC_SOC_NUMBER9"];
|
||||
adc2.soc0SampleWindow = 15;
|
||||
adc2.soc1SampleWindow = 15;
|
||||
adc2.soc2SampleWindow = 15;
|
||||
adc2.soc3SampleWindow = 15;
|
||||
adc2.soc4SampleWindow = 15;
|
||||
adc2.soc5SampleWindow = 15;
|
||||
adc2.soc6SampleWindow = 15;
|
||||
adc2.soc7SampleWindow = 15;
|
||||
adc2.soc8SampleWindow = 15;
|
||||
adc2.soc9SampleWindow = 15;
|
||||
adc2.soc10SampleWindow = 15;
|
||||
adc2.soc11SampleWindow = 15;
|
||||
adc2.soc12SampleWindow = 15;
|
||||
adc2.soc13SampleWindow = 15;
|
||||
adc2.soc14SampleWindow = 15;
|
||||
adc2.soc15SampleWindow = 15;
|
||||
adc2.soc0Channel = "ADC_CH_ADCIN3";
|
||||
adc2.soc1Channel = "ADC_CH_ADCIN3";
|
||||
adc2.soc2Channel = "ADC_CH_ADCIN3";
|
||||
adc2.soc3Channel = "ADC_CH_ADCIN3";
|
||||
adc2.soc4Channel = "ADC_CH_ADCIN3";
|
||||
adc2.soc5Channel = "ADC_CH_ADCIN3";
|
||||
adc2.soc6Channel = "ADC_CH_ADCIN3";
|
||||
adc2.soc7Channel = "ADC_CH_ADCIN3";
|
||||
adc2.soc8Channel = "ADC_CH_ADCIN3";
|
||||
adc2.soc9Channel = "ADC_CH_ADCIN3";
|
||||
adc2.soc10Channel = "ADC_CH_ADCIN3";
|
||||
adc2.soc11Channel = "ADC_CH_ADCIN3";
|
||||
adc2.soc12Channel = "ADC_CH_ADCIN3";
|
||||
adc2.soc13Channel = "ADC_CH_ADCIN3";
|
||||
adc2.soc14Channel = "ADC_CH_ADCIN3";
|
||||
adc2.soc15Channel = "ADC_CH_ADCIN3";
|
||||
adc2.soc0Trigger = "ADC_TRIGGER_EPWM2_SOCA";
|
||||
adc2.soc0InterruptTrigger = "ADC_INT_SOC_TRIGGER_ADCINT1";
|
||||
adc2.soc1InterruptTrigger = "ADC_INT_SOC_TRIGGER_ADCINT1";
|
||||
adc2.soc2InterruptTrigger = "ADC_INT_SOC_TRIGGER_ADCINT1";
|
||||
adc2.soc3InterruptTrigger = "ADC_INT_SOC_TRIGGER_ADCINT1";
|
||||
adc2.soc4InterruptTrigger = "ADC_INT_SOC_TRIGGER_ADCINT1";
|
||||
adc2.soc5InterruptTrigger = "ADC_INT_SOC_TRIGGER_ADCINT1";
|
||||
adc2.soc6InterruptTrigger = "ADC_INT_SOC_TRIGGER_ADCINT1";
|
||||
adc2.soc7InterruptTrigger = "ADC_INT_SOC_TRIGGER_ADCINT1";
|
||||
adc2.soc8InterruptTrigger = "ADC_INT_SOC_TRIGGER_ADCINT1";
|
||||
adc2.soc9InterruptTrigger = "ADC_INT_SOC_TRIGGER_ADCINT1";
|
||||
adc2.soc10InterruptTrigger = "ADC_INT_SOC_TRIGGER_ADCINT1";
|
||||
adc2.soc11InterruptTrigger = "ADC_INT_SOC_TRIGGER_ADCINT1";
|
||||
adc2.soc12InterruptTrigger = "ADC_INT_SOC_TRIGGER_ADCINT1";
|
||||
adc2.soc13InterruptTrigger = "ADC_INT_SOC_TRIGGER_ADCINT1";
|
||||
adc2.soc14InterruptTrigger = "ADC_INT_SOC_TRIGGER_ADCINT1";
|
||||
adc2.soc15InterruptTrigger = "ADC_INT_SOC_TRIGGER_ADCINT1";
|
||||
adc2.enabledInts = ["ADC_INT_NUMBER1","ADC_INT_NUMBER2","ADC_INT_NUMBER3","ADC_INT_NUMBER4"];
|
||||
adc2.enableInterrupt1 = true;
|
||||
adc2.enableInterrupt2 = true;
|
||||
adc2.interrupt1SOCSource = "ADC_SOC_NUMBER0";
|
||||
adc2.interrupt2SOCSource = "ADC_SOC_NUMBER15";
|
||||
adc2.enableInterrupt1ContinuousMode = true;
|
||||
adc2.enableInterrupt2ContinuousMode = true;
|
||||
adc2.adcSignalMode = "ADC_MODE_SINGLE_ENDED";
|
||||
adc2.adcResolutionMode = "ADC_RESOLUTION_12BIT";
|
||||
|
||||
@@ -0,0 +1,168 @@
|
||||
//###########################################################################
|
||||
//
|
||||
// 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, C2 pins should be connected to signals to convert
|
||||
//!
|
||||
//! \b Watch \b Variables \n
|
||||
//! - \b myADC0Result \b: a digital representation of the voltage on pin A2
|
||||
//! - \b myADC0PPBResult \b : a digital representation of the voltage
|
||||
//! on pin A2, minus 100 LSBs of automatically added offset
|
||||
//! - \b myADC1Result \b: a digital representation of the voltage on pin C2
|
||||
//! - \b myADC1PPBResult \b : a digital representation of the voltage
|
||||
//! on pin C2 plus 100 LSBs of automatically added offset
|
||||
//
|
||||
//#############################################################################
|
||||
//
|
||||
//
|
||||
//
|
||||
// C2000Ware v5.04.00.00
|
||||
//
|
||||
// Copyright (C) 2024 Texas Instruments Incorporated - http://www.ti.com
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions
|
||||
// are met:
|
||||
//
|
||||
// Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
//
|
||||
// Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
//
|
||||
// Neither the name of Texas Instruments Incorporated nor the names of
|
||||
// its contributors may be used to endorse or promote products derived
|
||||
// from this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
// $
|
||||
//#############################################################################
|
||||
//
|
||||
|
||||
//
|
||||
// Included Files
|
||||
//
|
||||
#include "driverlib.h"
|
||||
#include "device.h"
|
||||
#include "board.h"
|
||||
|
||||
//
|
||||
// Globals
|
||||
//
|
||||
uint16_t myADC0Result;
|
||||
uint16_t myADC0PPBResult;
|
||||
uint16_t myADC1Result;
|
||||
uint16_t myADC1PPBResult;
|
||||
|
||||
void main(void)
|
||||
{
|
||||
//
|
||||
// Initialize device clock and peripherals
|
||||
//
|
||||
Device_init();
|
||||
|
||||
//
|
||||
// Disable pin locks and enable internal pullups.
|
||||
//
|
||||
Device_initGPIO();
|
||||
|
||||
//
|
||||
// Initialize PIE and clear PIE registers. Disables CPU interrupts.
|
||||
//
|
||||
Interrupt_initModule();
|
||||
|
||||
//
|
||||
// Initialize the PIE vector table with pointers to the shell Interrupt
|
||||
// Service Routines (ISR).
|
||||
//
|
||||
Interrupt_initVectorTable();
|
||||
|
||||
//
|
||||
// Board Initialization
|
||||
// - Configure the ADCs and power them up
|
||||
// - Setup the ADCs for software conversions
|
||||
// - Setup PPB offset correction.
|
||||
// conversion on channel A will subtract 100.
|
||||
// conversion on channel C will add 100.
|
||||
// - Signal Mode : single-ended
|
||||
// - Conversion Resolution : 12-bit;
|
||||
//
|
||||
Board_init();
|
||||
|
||||
//
|
||||
// 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(myADC0_BASE, ADC_SOC_NUMBER0);
|
||||
ADC_forceSOC(myADC0_BASE, ADC_SOC_NUMBER1);
|
||||
|
||||
//
|
||||
// Wait for ADCA to complete, then acknowledge flag
|
||||
//
|
||||
while(ADC_getInterruptStatus(myADC0_BASE, ADC_INT_NUMBER1) == false);
|
||||
ADC_clearInterruptStatus(myADC0_BASE, ADC_INT_NUMBER1);
|
||||
|
||||
//
|
||||
// Start conversions immediately via software, ADCC
|
||||
//
|
||||
ADC_forceSOC(myADC1_BASE, ADC_SOC_NUMBER0);
|
||||
ADC_forceSOC(myADC1_BASE, ADC_SOC_NUMBER1);
|
||||
|
||||
//
|
||||
// Wait for ADCC to complete, then acknowledge flag
|
||||
//
|
||||
while(ADC_getInterruptStatus(myADC1_BASE, ADC_INT_NUMBER1) == false);
|
||||
ADC_clearInterruptStatus(myADC1_BASE, ADC_INT_NUMBER1);
|
||||
|
||||
//
|
||||
// Store results
|
||||
//
|
||||
myADC0Result = ADC_readResult(ADCARESULT_BASE, ADC_SOC_NUMBER0);
|
||||
myADC0PPBResult = ADC_readPPBResult(ADCARESULT_BASE, ADC_PPB_NUMBER1);
|
||||
myADC1Result = ADC_readResult(ADCCRESULT_BASE, ADC_SOC_NUMBER0);
|
||||
myADC1PPBResult = ADC_readPPBResult(ADCCRESULT_BASE, ADC_PPB_NUMBER1);
|
||||
|
||||
//
|
||||
// Software breakpoint, hit run again to get updated conversions
|
||||
//
|
||||
asm(" ESTOP0");
|
||||
}
|
||||
while(1);
|
||||
}
|
||||
|
||||
//
|
||||
// End of file
|
||||
//
|
||||
@@ -0,0 +1,46 @@
|
||||
|
||||
/**
|
||||
* Import the modules used in this configuration.
|
||||
*/
|
||||
const adc = scripting.addModule("/driverlib/adc.js", {}, false);
|
||||
const adc1 = adc.addInstance();
|
||||
const adc2 = adc.addInstance();
|
||||
|
||||
/**
|
||||
* Write custom configuration values to the imported modules.
|
||||
*/
|
||||
adc1.$name = "myADC0";
|
||||
adc1.adcClockPrescaler = "ADC_CLK_DIV_4_0";
|
||||
adc1.interruptPulseMode = "ADC_PULSE_END_OF_CONV";
|
||||
adc1.enabledSOCs = ["ADC_SOC_NUMBER0","ADC_SOC_NUMBER1"];
|
||||
adc1.soc0SampleWindow = 15;
|
||||
adc1.soc1SampleWindow = 15;
|
||||
adc1.soc0Channel = "ADC_CH_ADCIN2";
|
||||
adc1.soc1Channel = "ADC_CH_ADCIN2";
|
||||
adc1.enabledInts = ["ADC_INT_NUMBER1"];
|
||||
adc1.enableInterrupt1 = true;
|
||||
adc1.interrupt1SOCSource = "ADC_SOC_NUMBER1";
|
||||
adc1.enabledPPBs = ["ADC_PPB_NUMBER1"];
|
||||
adc1.ppb1SOCNumber = "ADC_SOC_NUMBER1";
|
||||
adc1.ppb1CalibrationOffset = 100;
|
||||
adc1.adcSignalMode = "ADC_MODE_SINGLE_ENDED";
|
||||
adc1.adcResolutionMode = "ADC_RESOLUTION_12BIT";
|
||||
|
||||
adc2.$name = "myADC1";
|
||||
adc2.adcBase = "ADCC_BASE";
|
||||
adc2.adcClockPrescaler = "ADC_CLK_DIV_4_0";
|
||||
adc2.interruptPulseMode = "ADC_PULSE_END_OF_CONV";
|
||||
adc2.enabledSOCs = ["ADC_SOC_NUMBER0","ADC_SOC_NUMBER1"];
|
||||
adc2.soc0SampleWindow = 15;
|
||||
adc2.soc1SampleWindow = 15;
|
||||
adc2.soc0Channel = "ADC_CH_ADCIN2";
|
||||
adc2.soc1Channel = "ADC_CH_ADCIN2";
|
||||
adc2.enabledInts = ["ADC_INT_NUMBER1"];
|
||||
adc2.enableInterrupt1 = true;
|
||||
adc2.interrupt1SOCSource = "ADC_SOC_NUMBER1";
|
||||
adc2.enabledPPBs = ["ADC_PPB_NUMBER1"];
|
||||
adc2.ppb1SOCNumber = "ADC_SOC_NUMBER1";
|
||||
adc2.ppb1CalibrationOffset = -100;
|
||||
adc2.adcSignalMode = "ADC_MODE_SINGLE_ENDED";
|
||||
adc2.adcResolutionMode = "ADC_RESOLUTION_12BIT";
|
||||
|
||||
@@ -0,0 +1,230 @@
|
||||
//###########################################################################
|
||||
//
|
||||
// FILE: adc_ex8_ppb_limits.c
|
||||
//
|
||||
// TITLE: ADC limits check using post-processing block.
|
||||
//
|
||||
//! \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
|
||||
//!
|
||||
//
|
||||
//#############################################################################
|
||||
//
|
||||
//
|
||||
//
|
||||
// C2000Ware v5.04.00.00
|
||||
//
|
||||
// Copyright (C) 2024 Texas Instruments Incorporated - http://www.ti.com
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions
|
||||
// are met:
|
||||
//
|
||||
// Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
//
|
||||
// Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
//
|
||||
// Neither the name of Texas Instruments Incorporated nor the names of
|
||||
// its contributors may be used to endorse or promote products derived
|
||||
// from this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
// $
|
||||
//#############################################################################
|
||||
//
|
||||
|
||||
//
|
||||
// Included Files
|
||||
//
|
||||
#include "driverlib.h"
|
||||
#include "device.h"
|
||||
#include "board.h"
|
||||
|
||||
//
|
||||
// Globals
|
||||
//
|
||||
uint32_t intStatus;
|
||||
//
|
||||
// Functional Prototypes
|
||||
//
|
||||
void configureEPWM(uint32_t epwmBase);
|
||||
|
||||
void main(void)
|
||||
{
|
||||
//
|
||||
// Initialize device clock and peripherals
|
||||
//
|
||||
Device_init();
|
||||
|
||||
//
|
||||
// Disable pin locks and enable internal pullups.
|
||||
//
|
||||
Device_initGPIO();
|
||||
|
||||
//
|
||||
// Initialize PIE and clear PIE registers. Disables CPU interrupts.
|
||||
//
|
||||
Interrupt_initModule();
|
||||
|
||||
//
|
||||
// Initialize the PIE vector table with pointers to the shell Interrupt
|
||||
// Service Routines (ISR).
|
||||
//
|
||||
Interrupt_initVectorTable();
|
||||
|
||||
//
|
||||
// Board Initialization
|
||||
// - Configure the ADC and power it up
|
||||
// - Setup the ADC for ePWM triggered conversions on channel 0
|
||||
// - Configure ADC post-processing limits
|
||||
// SOC0 will generate an interrupt if conversion is above or below limits
|
||||
// - Signal Mode : single-ended
|
||||
// - Conversion Resolution : 12-bit;
|
||||
//
|
||||
Board_init();
|
||||
|
||||
//
|
||||
// Configure the ePWM
|
||||
//
|
||||
configureEPWM(EPWM1_BASE);
|
||||
|
||||
//
|
||||
// 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);
|
||||
}
|
||||
|
||||
//
|
||||
// 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);
|
||||
}
|
||||
|
||||
//
|
||||
// adcAEvtISR - ISR for ADCA PPB
|
||||
//
|
||||
interrupt void adcAEvtISR(void)
|
||||
{
|
||||
//
|
||||
// Warning, you are outside of PPB limits
|
||||
//
|
||||
intStatus = ADC_getPPBEventStatus(myADC0_BASE, ADC_PPB_NUMBER1);
|
||||
if((intStatus & ADC_EVT_TRIPHI) != 0U)
|
||||
{
|
||||
//
|
||||
// Voltage exceeded high limit
|
||||
//
|
||||
asm(" ESTOP0");
|
||||
|
||||
//
|
||||
// Clear the trip flag and continue
|
||||
//
|
||||
ADC_clearPPBEventStatus(myADC0_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(myADC0_BASE, ADC_PPB_NUMBER1, ADC_EVT_TRIPLO);
|
||||
}
|
||||
Interrupt_clearACKGroup(INT_myADC0_EVT_INTERRUPT_ACK_GROUP);
|
||||
}
|
||||
|
||||
//
|
||||
// End of file
|
||||
//
|
||||
@@ -0,0 +1,28 @@
|
||||
|
||||
/**
|
||||
* Import the modules used in this configuration.
|
||||
*/
|
||||
const adc = scripting.addModule("/driverlib/adc.js", {}, false);
|
||||
const adc1 = adc.addInstance();
|
||||
|
||||
/**
|
||||
* Write custom configuration values to the imported modules.
|
||||
*/
|
||||
adc1.$name = "myADC0";
|
||||
adc1.adcClockPrescaler = "ADC_CLK_DIV_4_0";
|
||||
adc1.interruptPulseMode = "ADC_PULSE_END_OF_CONV";
|
||||
adc1.enabledSOCs = ["ADC_SOC_NUMBER0"];
|
||||
adc1.soc0Trigger = "ADC_TRIGGER_EPWM1_SOCA";
|
||||
adc1.soc0SampleWindow = 15;
|
||||
adc1.enabledInts = ["ADC_INT_NUMBER1"];
|
||||
adc1.enableInterrupt1 = true;
|
||||
adc1.enabledPPBs = ["ADC_PPB_NUMBER1"];
|
||||
adc1.ppb1HighTripLimit = 3000;
|
||||
adc1.ppb1LowTripLimit = 1000;
|
||||
adc1.ppb1EventInterruptEnable = ["ADC_EVT_TRIPHI","ADC_EVT_TRIPLO"];
|
||||
adc1.registerInterrupts = ["5"];
|
||||
adc1.adcIntEvent.enableInterrupt = true;
|
||||
adc1.adcIntEvent.interruptHandler = "adcAEvtISR";
|
||||
adc1.adcSignalMode = "ADC_MODE_SINGLE_ENDED";
|
||||
adc1.adcResolutionMode = "ADC_RESOLUTION_12BIT";
|
||||
|
||||
@@ -0,0 +1,326 @@
|
||||
//###########################################################################
|
||||
//
|
||||
// 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
|
||||
//!
|
||||
//
|
||||
//#############################################################################
|
||||
//
|
||||
//
|
||||
//
|
||||
// C2000Ware v5.04.00.00
|
||||
//
|
||||
// Copyright (C) 2024 Texas Instruments Incorporated - http://www.ti.com
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions
|
||||
// are met:
|
||||
//
|
||||
// Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
//
|
||||
// Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
//
|
||||
// Neither the name of Texas Instruments Incorporated nor the names of
|
||||
// its contributors may be used to endorse or promote products derived
|
||||
// from this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
// $
|
||||
//#############################################################################
|
||||
//
|
||||
|
||||
//
|
||||
// Included Files
|
||||
//
|
||||
#include "driverlib.h"
|
||||
#include "device.h"
|
||||
#include "board.h"
|
||||
|
||||
//
|
||||
// Defines
|
||||
//
|
||||
#define DELAY_BUFFER_SIZE 30
|
||||
|
||||
//
|
||||
// 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 configureEPWM(uint32_t epwmBase, uint16_t period);
|
||||
__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();
|
||||
|
||||
//
|
||||
// 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;
|
||||
}
|
||||
|
||||
//
|
||||
// Set up ADCs:
|
||||
// Signal Mode : single-ended
|
||||
// Conversion Resolution : 12-bit;
|
||||
// Configure ADC SOCs and PPB for delay capture
|
||||
// Register and enable the interrupts
|
||||
//
|
||||
Board_init();
|
||||
|
||||
//
|
||||
// Configure the ePWMs to have async. periods
|
||||
//
|
||||
configureEPWM(EPWM1_BASE, 2048);
|
||||
configureEPWM(EPWM2_BASE, 9999);
|
||||
|
||||
//
|
||||
// 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);
|
||||
|
||||
//
|
||||
// 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);
|
||||
}
|
||||
|
||||
//
|
||||
// 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);
|
||||
}
|
||||
|
||||
//
|
||||
// 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_NUMBER2);
|
||||
|
||||
//
|
||||
// Check if overflow has occurred
|
||||
//
|
||||
if(true == ADC_getInterruptOverflowStatus(ADCA_BASE, ADC_INT_NUMBER2))
|
||||
{
|
||||
ADC_clearInterruptOverflowStatus(ADCA_BASE, ADC_INT_NUMBER2);
|
||||
ADC_clearInterruptStatus(ADCA_BASE, ADC_INT_NUMBER2);
|
||||
}
|
||||
|
||||
//
|
||||
// Acknowledge the interrupt
|
||||
//
|
||||
Interrupt_clearACKGroup(INTERRUPT_ACK_GROUP10);
|
||||
}
|
||||
|
||||
//
|
||||
// End of file
|
||||
//
|
||||
@@ -0,0 +1,42 @@
|
||||
|
||||
/**
|
||||
* Import the modules used in this configuration.
|
||||
*/
|
||||
const adc = scripting.addModule("/driverlib/adc.js", {}, false);
|
||||
const adc1 = adc.addInstance();
|
||||
|
||||
/**
|
||||
* Write custom configuration values to the imported modules.
|
||||
*/
|
||||
adc1.$name = "myADC0";
|
||||
adc1.adcBase = "ADCA_BASE";
|
||||
|
||||
adc1.adcClockPrescaler = "ADC_CLK_DIV_4_0";
|
||||
adc1.interruptPulseMode = "ADC_PULSE_END_OF_CONV";
|
||||
|
||||
adc1.adcSignalMode = "ADC_MODE_SINGLE_ENDED";
|
||||
adc1.adcResolutionMode = "ADC_RESOLUTION_12BIT";
|
||||
|
||||
adc1.enabledSOCs = ["ADC_SOC_NUMBER0","ADC_SOC_NUMBER1"];
|
||||
|
||||
adc1.soc0Trigger = "ADC_TRIGGER_EPWM1_SOCA";
|
||||
adc1.soc1Trigger = "ADC_TRIGGER_EPWM2_SOCA";
|
||||
|
||||
adc1.soc0Channel = "ADC_CH_ADCIN0";
|
||||
adc1.soc1Channel = "ADC_CH_ADCIN2";
|
||||
|
||||
adc1.soc0SampleWindow = 15;
|
||||
adc1.soc1SampleWindow = 15;
|
||||
|
||||
adc1.enabledInts = ["ADC_INT_NUMBER1","ADC_INT_NUMBER2"];
|
||||
adc1.enableInterrupt1 = true;
|
||||
adc1.enableInterrupt2 = true;
|
||||
adc1.interrupt1SOCSource = "ADC_SOC_NUMBER0";
|
||||
adc1.interrupt2SOCSource = "ADC_SOC_NUMBER1";
|
||||
adc1.enabledPPBs = ["ADC_PPB_NUMBER1"];
|
||||
adc1.registerInterrupts = ["1","2"];
|
||||
adc1.adcInt1.enableInterrupt = true;
|
||||
adc1.adcInt1.interruptHandler = "adcA1ISR";
|
||||
adc1.adcInt2.interruptHandler = "adcA2ISR";
|
||||
adc1.adcInt2.enableInterrupt = true;
|
||||
|
||||
Reference in new issue
Block a user