Update repo

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

No files matched your search

@@ -0,0 +1,40 @@
<projectSpec>
<project
name="buffdac_ex1_enable"
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 &quot;========= 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) =============&quot;
;if ${GENERATE_DIAGRAM} == 1 ${NODE_TOOL} &quot;${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/dot_file_libraries/clbDotUtility.js&quot; &quot;${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/&quot; &quot;${BuildDirectory}/syscfg&quot; &quot;${BuildDirectory}/syscfg/clb.dot&quot;
;if ${GENERATE_DIAGRAM} == 1 mkdir &quot;${BuildDirectory}/diagrams&quot;
;if ${GENERATE_DIAGRAM} == 1 ${NODE_TOOL} &quot;${C2000WARE_ROOT}/driverlib/.meta/generate_diagrams.js&quot; &quot;${C2000WARE_ROOT}&quot; &quot;${BuildDirectory}/diagrams&quot; &quot;${BuildDirectory}/syscfg&quot;
"
>
<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="../buffdac_ex1_enable.c" targetDirectory=""/>
<file action="copy" path="../buffdac_ex1_enable.syscfg" targetDirectory=""/>
</project>
</projectSpec>
@@ -0,0 +1,40 @@
<projectSpec>
<project
name="buffdac_ex2_random"
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 &quot;========= 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) =============&quot;
;if ${GENERATE_DIAGRAM} == 1 ${NODE_TOOL} &quot;${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/dot_file_libraries/clbDotUtility.js&quot; &quot;${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/&quot; &quot;${BuildDirectory}/syscfg&quot; &quot;${BuildDirectory}/syscfg/clb.dot&quot;
;if ${GENERATE_DIAGRAM} == 1 mkdir &quot;${BuildDirectory}/diagrams&quot;
;if ${GENERATE_DIAGRAM} == 1 ${NODE_TOOL} &quot;${C2000WARE_ROOT}/driverlib/.meta/generate_diagrams.js&quot; &quot;${C2000WARE_ROOT}&quot; &quot;${BuildDirectory}/diagrams&quot; &quot;${BuildDirectory}/syscfg&quot;
"
>
<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="../buffdac_ex2_random.c" targetDirectory=""/>
<file action="copy" path="../buffdac_ex2_random.syscfg" targetDirectory=""/>
</project>
</projectSpec>
@@ -0,0 +1,43 @@
<projectSpec>
<project
name="buffdac_ex3_waveform"
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 &quot;========= 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) =============&quot;
;if ${GENERATE_DIAGRAM} == 1 ${NODE_TOOL} &quot;${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/dot_file_libraries/clbDotUtility.js&quot; &quot;${C2000WARE_ROOT}/utilities/clb_tool/clb_syscfg/&quot; &quot;${BuildDirectory}/syscfg&quot; &quot;${BuildDirectory}/syscfg/clb.dot&quot;
;if ${GENERATE_DIAGRAM} == 1 mkdir &quot;${BuildDirectory}/diagrams&quot;
;if ${GENERATE_DIAGRAM} == 1 ${NODE_TOOL} &quot;${C2000WARE_ROOT}/driverlib/.meta/generate_diagrams.js&quot; &quot;${C2000WARE_ROOT}&quot; &quot;${BuildDirectory}/diagrams&quot; &quot;${BuildDirectory}/syscfg&quot;
"
>
<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="../buffdac_ex3_waveform.c" targetDirectory=""/>
<file action="copy" path="../buffdac_ex3_waveform.syscfg" targetDirectory=""/>
<file action="copy" path="../sgen.h" targetDirectory=""/>
<file action="copy" path="../sgti1c.asm" targetDirectory=""/>
<file action="copy" path="../SINTB360.asm" targetDirectory=""/>
</project>
</projectSpec>
@@ -0,0 +1,316 @@
;======================================================================
;
; File Name : sintb360.asm
;
; Originator : Digital Control Systems Group
; Texas Instruments
;
; Description : This file contains 256 entries of SIN values for Table
; Look-up used in the Signal Generator modules
;
; Date : 9/5/2001 (DD/MM/YYYY)
;===========================================================================
; #############################################################################
; $TI Release: F2838x Support Library v3.04.00.00 $
; $Copyright:
;// Copyright (C) 2021 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.
;// $
; #############################################################################
;Module definitions for external reference.
.def SINTAB_360
;===========================================================================
;-------------------------------------------------------
; Sine look-up table
; No. Entries : 256
; Angle Range : 360 deg
; Number format : Q15 with range -1 < N < +1
;-------------------------------------------------------
.sect "SINTBL"
;SINVAL ; Index Angle Sin(Angle)
SINTAB_360 .word 0 ; 0 0 0.0000
.word 804 ; 1 1.41 0.0245
.word 1608 ; 2 2.81 0.0491
.word 2410 ; 3 4.22 0.0736
.word 3212 ; 4 5.63 0.0980
.word 4011 ; 5 7.03 0.1224
.word 4808 ; 6 8.44 0.1467
.word 5602 ; 7 9.84 0.1710
.word 6393 ; 8 11.25 0.1951
.word 7179 ; 9 12.66 0.2191
.word 7962 ; 10 14.06 0.2430
.word 8739 ; 11 15.47 0.2667
.word 9512 ; 12 16.88 0.2903
.word 10278 ; 13 18.28 0.3137
.word 11039 ; 14 19.69 0.3369
.word 11793 ; 15 21.09 0.3599
.word 12539 ; 16 22.50 0.3827
.word 13279 ; 17 23.91 0.4052
.word 14010 ; 18 25.31 0.4276
.word 14732 ; 19 26.72 0.4496
.word 15446 ; 20 28.13 0.4714
.word 16151 ; 21 29.53 0.4929
.word 16846 ; 22 30.94 0.5141
.word 17530 ; 23 32.34 0.5350
.word 18204 ; 24 33.75 0.5556
.word 18868 ; 25 35.16 0.5758
.word 19519 ; 26 36.56 0.5957
.word 20159 ; 27 37.97 0.6152
.word 20787 ; 28 39.38 0.6344
.word 21403 ; 29 40.78 0.6532
.word 22005 ; 30 42.19 0.6716
.word 22594 ; 31 43.59 0.6895
.word 23170 ; 32 45.00 0.7071
.word 23731 ; 33 46.41 0.7242
.word 24279 ; 34 47.81 0.7410
.word 24811 ; 35 49.22 0.7572
.word 25329 ; 36 50.63 0.7730
.word 25832 ; 37 52.03 0.7883
.word 26319 ; 38 53.44 0.8032
.word 26790 ; 39 54.84 0.8176
.word 27245 ; 40 56.25 0.8315
.word 27683 ; 41 57.66 0.8449
.word 28105 ; 42 59.06 0.8577
.word 28510 ; 43 60.47 0.8701
.word 28898 ; 44 61.88 0.8819
.word 29268 ; 45 63.28 0.8932
.word 29621 ; 46 64.69 0.9040
.word 29956 ; 47 66.09 0.9142
.word 30273 ; 48 67.50 0.9239
.word 30571 ; 49 68.91 0.9330
.word 30852 ; 50 70.31 0.9415
.word 31113 ; 51 71.72 0.9495
.word 31356 ; 52 73.13 0.9569
.word 31580 ; 53 74.53 0.9638
.word 31785 ; 54 75.94 0.9700
.word 31971 ; 55 77.34 0.9757
.word 32137 ; 56 78.75 0.9808
.word 32285 ; 57 80.16 0.9853
.word 32412 ; 58 81.56 0.9892
.word 32521 ; 59 82.97 0.9925
.word 32609 ; 60 84.38 0.9952
.word 32678 ; 61 85.78 0.9973
.word 32728 ; 62 87.19 0.9988
.word 32757 ; 63 88.59 0.9997
.word 32767 ; 64 90.00 1.0000
.word 32757 ; 65 91.41 0.9997
.word 32728 ; 66 92.81 0.9988
.word 32678 ; 67 94.22 0.9973
.word 32609 ; 68 95.63 0.9952
.word 32521 ; 69 97.03 0.9925
.word 32412 ; 70 98.44 0.9892
.word 32285 ; 71 99.84 0.9853
.word 32137 ; 72 101.25 0.9808
.word 31971 ; 73 102.66 0.9757
.word 31785 ; 74 104.06 0.9700
.word 31580 ; 75 105.47 0.9638
.word 31356 ; 76 106.88 0.9569
.word 31113 ; 77 108.28 0.9495
.word 30852 ; 78 109.69 0.9415
.word 30571 ; 79 111.09 0.9330
.word 30273 ; 80 112.50 0.9239
.word 29956 ; 81 113.91 0.9142
.word 29621 ; 82 115.31 0.9040
.word 29268 ; 83 116.72 0.8932
.word 28898 ; 84 118.13 0.8819
.word 28510 ; 85 119.53 0.8701
.word 28105 ; 86 120.94 0.8577
.word 27683 ; 87 122.34 0.8449
.word 27245 ; 88 123.75 0.8315
.word 26790 ; 89 125.16 0.8176
.word 26319 ; 90 126.56 0.8032
.word 25832 ; 91 127.97 0.7883
.word 25329 ; 92 129.38 0.7730
.word 24811 ; 93 130.78 0.7572
.word 24279 ; 94 132.19 0.7410
.word 23731 ; 95 133.59 0.7242
.word 23170 ; 96 135.00 0.7071
.word 22594 ; 97 136.41 0.6895
.word 22005 ; 98 137.81 0.6716
.word 21403 ; 99 139.22 0.6532
.word 20787 ; 100 140.63 0.6344
.word 20159 ; 101 142.03 0.6152
.word 19519 ; 102 143.44 0.5957
.word 18868 ; 103 144.84 0.5758
.word 18204 ; 104 146.25 0.5556
.word 17530 ; 105 147.66 0.5350
.word 16846 ; 106 149.06 0.5141
.word 16151 ; 107 150.47 0.4929
.word 15446 ; 108 151.88 0.4714
.word 14732 ; 109 153.28 0.4496
.word 14010 ; 110 154.69 0.4276
.word 13279 ; 111 156.09 0.4052
.word 12539 ; 112 157.50 0.3827
.word 11793 ; 113 158.91 0.3599
.word 11039 ; 114 160.31 0.3369
.word 10278 ; 115 161.72 0.3137
.word 9512 ; 116 163.13 0.2903
.word 8739 ; 117 164.53 0.2667
.word 7962 ; 118 165.94 0.2430
.word 7179 ; 119 167.34 0.2191
.word 6393 ; 120 168.75 0.1951
.word 5602 ; 121 170.16 0.1710
.word 4808 ; 122 171.56 0.1467
.word 4011 ; 123 172.97 0.1224
.word 3212 ; 124 174.38 0.0980
.word 2410 ; 125 175.78 0.0736
.word 1608 ; 126 177.19 0.0491
.word 804 ; 127 178.59 0.0245
.word 0 ; 128 180.00 0.0000
.word 64731 ; 129 181.41 -0.0245
.word 63927 ; 130 182.81 -0.0491
.word 63125 ; 131 184.22 -0.0736
.word 62323 ; 132 185.63 -0.0980
.word 61524 ; 133 187.03 -0.1224
.word 60727 ; 134 188.44 -0.1467
.word 59933 ; 135 189.84 -0.1710
.word 59142 ; 136 191.25 -0.1951
.word 58356 ; 137 192.66 -0.2191
.word 57573 ; 138 194.06 -0.2430
.word 56796 ; 139 195.47 -0.2667
.word 56023 ; 140 196.88 -0.2903
.word 55257 ; 141 198.28 -0.3137
.word 54496 ; 142 199.69 -0.3369
.word 53742 ; 143 201.09 -0.3599
.word 52996 ; 144 202.50 -0.3827
.word 52256 ; 145 203.91 -0.4052
.word 51525 ; 146 205.31 -0.4276
.word 50803 ; 147 206.72 -0.4496
.word 50089 ; 148 208.13 -0.4714
.word 49384 ; 149 209.53 -0.4929
.word 48689 ; 150 210.94 -0.5141
.word 48005 ; 151 212.34 -0.5350
.word 47331 ; 152 213.75 -0.5556
.word 46667 ; 153 215.16 -0.5758
.word 46016 ; 154 216.56 -0.5957
.word 45376 ; 155 217.97 -0.6152
.word 44748 ; 156 219.38 -0.6344
.word 44132 ; 157 220.78 -0.6532
.word 43530 ; 158 222.19 -0.6716
.word 42941 ; 159 223.59 -0.6895
.word 42365 ; 160 225.00 -0.7071
.word 41804 ; 161 226.41 -0.7242
.word 41256 ; 162 227.81 -0.7410
.word 40724 ; 163 229.22 -0.7572
.word 40206 ; 164 230.63 -0.7730
.word 39703 ; 165 232.03 -0.7883
.word 39216 ; 166 233.44 -0.8032
.word 38745 ; 167 234.84 -0.8176
.word 38290 ; 168 236.25 -0.8315
.word 37852 ; 169 237.66 -0.8449
.word 37430 ; 170 239.06 -0.8577
.word 37025 ; 171 240.47 -0.8701
.word 36637 ; 172 241.88 -0.8819
.word 36267 ; 173 243.28 -0.8932
.word 35914 ; 174 244.69 -0.9040
.word 35579 ; 175 246.09 -0.9142
.word 35262 ; 176 247.50 -0.9239
.word 34964 ; 177 248.91 -0.9330
.word 34683 ; 178 250.31 -0.9415
.word 34422 ; 179 251.72 -0.9495
.word 34179 ; 180 253.13 -0.9569
.word 33955 ; 181 254.53 -0.9638
.word 33750 ; 182 255.94 -0.9700
.word 33564 ; 183 257.34 -0.9757
.word 33398 ; 184 258.75 -0.9808
.word 33250 ; 185 260.16 -0.9853
.word 33123 ; 186 261.56 -0.9892
.word 33014 ; 187 262.97 -0.9925
.word 32926 ; 188 264.38 -0.9952
.word 32857 ; 189 265.78 -0.9973
.word 32807 ; 190 267.19 -0.9988
.word 32778 ; 191 268.59 -0.9997
.word 32768 ; 192 270.00 -1.0000
.word 32778 ; 193 271.41 -0.9997
.word 32807 ; 194 272.81 -0.9988
.word 32857 ; 195 274.22 -0.9973
.word 32926 ; 196 275.63 -0.9952
.word 33014 ; 197 277.03 -0.9925
.word 33123 ; 198 278.44 -0.9892
.word 33250 ; 199 279.84 -0.9853
.word 33398 ; 200 281.25 -0.9808
.word 33564 ; 201 282.66 -0.9757
.word 33750 ; 202 284.06 -0.9700
.word 33955 ; 203 285.47 -0.9638
.word 34179 ; 204 286.88 -0.9569
.word 34422 ; 205 288.28 -0.9495
.word 34683 ; 206 289.69 -0.9415
.word 34964 ; 207 291.09 -0.9330
.word 35262 ; 208 292.50 -0.9239
.word 35579 ; 209 293.91 -0.9142
.word 35914 ; 210 295.31 -0.9040
.word 36267 ; 211 296.72 -0.8932
.word 36637 ; 212 298.13 -0.8819
.word 37025 ; 213 299.53 -0.8701
.word 37430 ; 214 300.94 -0.8577
.word 37852 ; 215 302.34 -0.8449
.word 38290 ; 216 303.75 -0.8315
.word 38745 ; 217 305.16 -0.8176
.word 39216 ; 218 306.56 -0.8032
.word 39703 ; 219 307.97 -0.7883
.word 40206 ; 220 309.38 -0.7730
.word 40724 ; 221 310.78 -0.7572
.word 41256 ; 222 312.19 -0.7410
.word 41804 ; 223 313.59 -0.7242
.word 42365 ; 224 315.00 -0.7071
.word 42941 ; 225 316.41 -0.6895
.word 43530 ; 226 317.81 -0.6716
.word 44132 ; 227 319.22 -0.6532
.word 44748 ; 228 320.63 -0.6344
.word 45376 ; 229 322.03 -0.6152
.word 46016 ; 230 323.44 -0.5957
.word 46667 ; 231 324.84 -0.5758
.word 47331 ; 232 326.25 -0.5556
.word 48005 ; 233 327.66 -0.5350
.word 48689 ; 234 329.06 -0.5141
.word 49384 ; 235 330.47 -0.4929
.word 50089 ; 236 331.88 -0.4714
.word 50803 ; 237 333.28 -0.4496
.word 51525 ; 238 334.69 -0.4276
.word 52256 ; 239 336.09 -0.4052
.word 52996 ; 240 337.50 -0.3827
.word 53742 ; 241 338.91 -0.3599
.word 54496 ; 242 340.31 -0.3369
.word 55257 ; 243 341.72 -0.3137
.word 56023 ; 244 343.13 -0.2903
.word 56796 ; 245 344.53 -0.2667
.word 57573 ; 246 345.94 -0.2430
.word 58356 ; 247 347.34 -0.2191
.word 59142 ; 248 348.75 -0.1951
.word 59933 ; 249 350.16 -0.1710
.word 60727 ; 250 351.56 -0.1467
.word 61524 ; 251 352.97 -0.1224
.word 62323 ; 252 354.38 -0.0980
.word 63125 ; 253 355.78 -0.0736
.word 63927 ; 254 357.19 -0.0491
.word 64731 ; 255 358.59 -0.0245
.word 65535 ; 256 360.00 0.0000
@@ -0,0 +1,112 @@
//#############################################################################
//
// FILE: buffdac_ex1_enable.c
//
// TITLE: Buffered DAC Enable Output Example
//
//! \addtogroup driver_example_list
//! <h1> Buffered DAC Enable </h1>
//!
//! This example generates a voltage on the buffered DAC output,
//! DACOUTA/ADCINA0 and uses the default DAC reference setting of
//! VDAC.
//!
//! \b External \b Connections \n
//! - When the DAC reference is set to VDAC, an external reference voltage
//! must be applied to the VDAC pin. This can be accomplished by connecting a
//! jumper wire from 3.3V to ADCINB0.
//!
//! \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
//
uint16_t dacVal = 2048;
//
// Main
//
void main(void)
{
//
// Initialize device clock and peripherals
//
Device_init();
//
// Initialize PIE and clear PIE registers. Disables CPU interrupts.
//
Interrupt_initModule();
//
// Initialize the PIE vector table with pointers to the shell Interrupt
// Service Routines (ISR).
//
Interrupt_initVectorTable();
//
// Board initialization
// Configure DAC - Setup the reference voltage and output value for the DAC
//
Board_init();
//
// Continuously set the DAC output value
//
while(1)
{
DAC_setShadowValue(myDAC0_BASE, dacVal);
DEVICE_DELAY_US(2);
}
}
//
// End of File
//
@@ -0,0 +1,13 @@
/**
* Import the modules used in this configuration.
*/
const dac = scripting.addModule("/driverlib/dac.js", {}, false);
const dac1 = dac.addInstance();
/**
* Write custom configuration values to the imported modules.
*/
dac1.$name = "myDAC0";
dac1.enableOutput = true;
@@ -0,0 +1,121 @@
//#############################################################################
//
// FILE: buffdac_ex2_random.c
//
// TITLE: Buffered DAC Random Output Example
//
//! \addtogroup driver_example_list
//! <h1> Buffered DAC Random </h1>
//!
//! This example generates random voltages on the buffered DAC output,
//! DACOUTA/ADCINA0 and uses the default DAC reference setting of
//! VDAC.
//!
//! \b External \b Connections \n
//! - When the DAC reference is set to VDAC, an external reference voltage
//! must be applied to the VDAC pin. This can accomplished by connecting a
//! jumper wire from 3.3V to ADCINB0.
//!
//! \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 <time.h>
#include <stdlib.h>
#include "driverlib.h"
#include "device.h"
#include "board.h"
//
// Globals
//
uint16_t lowLimit = 410;
uint16_t highLimit = 3686;
//
// Main
//
void main(void)
{
//
// Initialize device clock and peripherals
//
Device_init();
//
// Initialize PIE and clear PIE registers. Disables CPU interrupts.
//
Interrupt_initModule();
//
// Initialize the PIE vector table with pointers to the shell Interrupt
// Service Routines (ISR).
//
Interrupt_initVectorTable();
//
// Initialize a random time seed
//
srand(time(NULL));
//
// Configure the DAC module
// Configure DAC - Setup the reference voltage and output value for the DAC
//
Board_init();
//
// Continuously set the DAC output value based on random value
//
while(1)
{
DAC_setShadowValue(myDAC0_BASE, ((rand() % (highLimit - lowLimit)) +
lowLimit));
DEVICE_DELAY_US(1);
}
}
//
// End of File
//
@@ -0,0 +1,12 @@
/**
* Import the modules used in this configuration.
*/
const dac = scripting.addModule("/driverlib/dac.js", {}, false);
const dac1 = dac.addInstance();
/**
* Write custom configuration values to the imported modules.
*/
dac1.$name = "myDAC0";
dac1.enableOutput = true;
@@ -0,0 +1,522 @@
//###########################################################################
//
// FILE: buffdac_ex3_sine.c
//
// TITLE: Buffered DAC Sine Wave Output Example.
//
//! \addtogroup driver_example_list
//! <h1> Buffered DAC Sine (buffdac_sine) </h1>
//!
//! This example generates a sine wave on the buffered DAC output,
//! DACOUTA/ADCINA0 (HSEC Pin 9) and uses the default DAC reference setting
//! of VDAC.
//!
//! When the DAC reference is set to VDAC, an external reference voltage
//! must be applied to the VDAC pin. This can accomplished by connecting a
//! jumper wire from 3.3V to ADCINB0.
//!
//! Run the included .js file to add the watch variables.
//! This example uses the SGEN module. Documentation for the SGEN module can be
//! found in the SGEN library directory.
//!
//! The generated waveform can be adjusted with the following variables while
//! running:
//! - \b waveformGain \b : Adjust the magnitude of the waveform.
//! Range is from 0.0 to 1.0. The default value of 0.8003 centers the waveform
//! within the linear range of the DAC
//! - \b waveformOffset \b : Adjust the offset of the waveform.
//! Range is from -1.0 to 1.0. The default value of 0 centers the waveform
//! - \b outputFreq_hz \b : Adjust the output frequency of the waveform.
//! Range is from 0 to maxOutputFreq_hz
//! - \b maxOutputFreq_hz \b : Adjust the max output frequency of the waveform.
//! Range - See SGEN module documentation for how this affects other parameters
//!
//! The generated waveform can be adjusted with the following variables/macros
//! but require recompile:
//! - \b samplingFreq_hz \b : Adjust the rate at which the DAC is updated.
//! Range - See SGEN module documentation for how this affects other parameters
//! - \b SINEWAVE_TYPE \b : The type of sine generated.
//! Range - LOW_THD_SINE, HIGH_PRECISION_SINE
//!
//! The following variables give additional information about the generated
//! waveform:
//! See SGEN module documentation for details
//! - \b freqResolution_hz \b
//! - \b maxOutput_lsb \b : Maximum value written to the DAC.
//! - \b minOutput_lsb \b : Minimum value written to the DAC.
//! - \b pk_to_pk_lsb \b : Magnitude of generated waveform.
//! - \b cpuPeriod_us \b : Period of cpu.
//! - \b samplingPeriod_us \b : The rate at which the DAC is updated.
//! Note that samplingPeriod_us has to be greater than the DAC settling time.
//! - \b interruptCycles \b : Interrupt duration in cycles.
//! - \b interruptDuration_us \b : Interrupt duration in uS.
//! - \b sgen \b : The SGEN module instance.
//! - \b DataLog \b : Circular log of writes to the DAC.
//!
//
//#############################################################################
//
//
//
// 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 <time.h>
#include <stdlib.h>
#include "driverlib.h"
#include "device.h"
#include "sgen.h"
#include "board.h"
//
// Defines
//
#define DLOG_SIZE 1024
#define LOW_THD_SINE 0
#define HIGH_PRECISION_SINE 1
#define SINEWAVE_TYPE LOW_THD_SINE
//
// Globals
//
uint16_t cpuTimer0IntCount;
uint16_t cpuTimer1IntCount;
uint16_t cpuTimer2IntCount;
//
// Globals
//
uint16_t DataLog[DLOG_SIZE];
#pragma DATA_SECTION(DataLog, "DLOG");
uint32_t samplingFreq_hz = 200000;
uint32_t outputFreq_hz = 1000;
uint32_t maxOutputFreq_hz = 5000;
float waveformGain = 0.8003F; // Range 0.0 -> 1.0
float waveformOffset = 0; // Range -1.0 -> 1.0
uint16_t lowLimit = 410;
uint16_t highLimit = 3686;
#if SINEWAVE_TYPE==LOW_THD_SINE //initialize sine wave type
SGENTI_1 sgen = SGENTI_1_DEFAULTS;
#elif SINEWAVE_TYPE==HIGH_PRECISION_SINE
SGENHP_1 sgen = SGENHP_1_DEFAULTS;
#endif
uint16_t sgen_out = 0;
uint16_t ndx = 0;
float freqResolution_hz = 0;
float cpuPeriod_us = 0;
uint32_t interruptCycles = 0;
float interruptDuration_us = 0;
float samplingPeriod_us = 0;
uint16_t maxOutput_lsb = 0;
uint16_t minOutput_lsb = 0;
uint16_t pk_to_pk_lsb = 0;
//
// Function Prototypes
//
static inline void dlog(uint16_t value);
static inline void setFreq(void);
static inline void setGain(void);
static inline void setOffset(void);
static inline uint16_t getMax(void);
static inline uint16_t getMin(void);
void configureWaveform(void);
interrupt void cpu_timer0_isr(void);
void initCPUTimers(void);
void configCPUTimer(uint32_t, uint32_t);
//
// Main
//
void main(void)
{
//
// Initializes device clock and peripherals
//
Device_init();
//
// Initializes PIE and clears PIE registers. Disables CPU interrupts.
//
Interrupt_initModule();
//
// Initializes the PIE vector table with pointers to the shell Interrupt
// Service Routines (ISR).
//
Interrupt_initVectorTable();
//
// Map Cpu Timer0 interrupt function to the PIE vector table
//
Interrupt_register(INT_TIMER0, &cpu_timer0_isr);
//
// Initialize variables
//
cpuPeriod_us = (1000000.0F/DEVICE_SYSCLK_FREQ);
samplingPeriod_us = (1000000.0F/samplingFreq_hz);
//
// Initialize datalog
//
for(ndx=0; ndx<DLOG_SIZE; ndx++)
{
DataLog[ndx] = 0;
}
ndx = 0;
//
// Board initialization
// Configure DAC
//
Board_init();
//
// Configure Waveform
//
configureWaveform();
//
// Initialize Cpu Timers
//
initCPUTimers();
//
// Configure Cpu Timer0 to interrupt at specified sampling frequency
//
configCPUTimer(CPUTIMER0_BASE, samplingPeriod_us);
//
// Enable interrupt
//
Interrupt_enable(INT_TIMER0);
Interrupt_clearACKGroup(INTERRUPT_ACK_GROUP7);
//
// Start Cpu Timer0
//
CPUTimer_startTimer(CPUTIMER0_BASE);
//
// Enable Global Interrupt (INTM) and realtime interrupt (DBGM)
//
EINT;
ERTM;
while(1)
{
setFreq(); // Set Output Frequency and Max Output Frequency
setGain(); // Set Magnitude of Waveform
setOffset(); // Set Offset of Waveform
maxOutput_lsb = getMax();
minOutput_lsb = getMin();
pk_to_pk_lsb = maxOutput_lsb - minOutput_lsb;
}
}
//
// dlog - Circular DataLog. DataLog[0] contains the next index to
// be overwritten
//
static inline void dlog(uint16_t value)
{
DataLog[ndx] = value;
if(++ndx == DLOG_SIZE)
{
ndx = 0;
}
DataLog[0] = ndx;
}
//
// setFreq - Set the SINE frequency in SGEN
//
static inline void setFreq(void)
{
#if SINEWAVE_TYPE==LOW_THD_SINE
//
// Range(Q0) = 0x0000 -> 0x7FFF, step_max(Q0) =
// (Max_Freq_hz*0x10000)/Sampling_Freq_hz
//
sgen.step_max = (maxOutputFreq_hz*0x10000)/samplingFreq_hz;
//
// Range(Q15) = 0x0000 -> 0x7FFF, freq(Q15) =
// (Required_Freq_hz/Max_Freq_hz)*0x8000
//
sgen.freq = ((float)outputFreq_hz/maxOutputFreq_hz)*0x8000;
#elif SINEWAVE_TYPE==HIGH_PRECISION_SINE
//
// Range(Q0) = 0x00000000 -> 0x7FFFFFFF, step_max(Q0) =
// (Max_Freq_hz*0x100000000)/Sampling_Freq_hz
//
sgen.step_max = (maxOutputFreq_hz*0x100000000)/samplingFreq_hz;
//
// Range(Q31) = 0x00000000 -> 0x7FFFFFFF, freq(Q31) =
// (Required_Freq_hz/Max_Freq_hz)*0x80000000
//
sgen.freq = ((float)outputFreq_hz/maxOutputFreq_hz)*0x80000000;
#endif
freqResolution_hz = (float)maxOutputFreq_hz/sgen.step_max;
}
//
// setGain - Set the gain in SGEN
//
static inline void setGain(void)
{
sgen.gain = waveformGain * 0x7FFF; // Range(Q15) = 0x0000 -> 0x7FFF
}
//
// setOffset - Set the offset in SGEN
//
static inline void setOffset(void)
{
sgen.offset = waveformOffset * 0x7FFF; // Range(Q15) = 0x8000 -> 0x7FFF
}
//
// getMax - Get the max value in the data log
//
static inline uint16_t getMax(void)
{
uint16_t index = 0;
uint16_t tempMax = 0;
for(index=1; index<DLOG_SIZE; index++)
{
if(tempMax<DataLog[index])
{
tempMax = DataLog[index];
}
}
return tempMax;
}
//
// getMin - Get the min value in the data log
//
static inline uint16_t getMin(void)
{
uint16_t index = 0;
uint16_t tempMin = 0xFFFF;
for(index=1; index<DLOG_SIZE; index++)
{
if(tempMin>DataLog[index])
{
tempMin = DataLog[index];
}
}
return tempMin;
}
//
// configureWaveform - Configure the SINE waveform
//
void configureWaveform(void)
{
sgen.alpha = 0; // Range(16) = 0x0000 -> 0xFFFF
setFreq();
setGain();
setOffset();
}
//
// cpu_timer0_isr - Timer ISR that writes the sine value to DAC, log the sine
// value, compute the next sine value, and calculate interrupt
// duration
//
interrupt void cpu_timer0_isr(void)
{
//
// Start Cpu Timer1 to indicate begin of interrupt
//
CPUTimer_startTimer(CPUTIMER1_BASE);
//
// Write current sine value to buffered DAC
//
DAC_setShadowValue(myDAC0_BASE, sgen_out);
//
// Log current sine value
//
dlog(sgen_out);
//
// Compute next sine value
//
sgen.calc(&sgen);
//
// Scale next sine value
//
sgen_out = (sgen.out + 32768) >> 4;
//
// Acknowledge this interrupt to receive more interrupts from group 1
//
Interrupt_clearACKGroup(INTERRUPT_ACK_GROUP1);
//
// Stop Cpu Timer1 to indicate end of interrupt
//
CPUTimer_stopTimer(CPUTIMER1_BASE);
//
// Calculate interrupt duration in cycles
//
interruptCycles = 0xFFFFFFFFUL - CPUTimer_getTimerCount(CPUTIMER1_BASE);
//
// Calculate interrupt duration in micro seconds
//
interruptDuration_us = cpuPeriod_us * interruptCycles;
//
// Reload Cpu Timer1
//
CPUTimer_reloadTimerCounter(CPUTIMER1_BASE);
}
//
// initCPUTimers - This function initializes all three CPU timers
// to a known state.
//
void
initCPUTimers(void)
{
//
// Initialize timer period to maximum
//
CPUTimer_setPeriod(CPUTIMER0_BASE, 0xFFFFFFFF);
CPUTimer_setPeriod(CPUTIMER1_BASE, 0xFFFFFFFF);
CPUTimer_setPeriod(CPUTIMER2_BASE, 0xFFFFFFFF);
//
// Initialize pre-scale counter to divide by 1 (SYSCLKOUT)
//
CPUTimer_setPreScaler(CPUTIMER0_BASE, 0);
CPUTimer_setPreScaler(CPUTIMER1_BASE, 0);
CPUTimer_setPreScaler(CPUTIMER2_BASE, 0);
//
// Make sure timer is stopped
//
CPUTimer_stopTimer(CPUTIMER0_BASE);
CPUTimer_stopTimer(CPUTIMER1_BASE);
CPUTimer_stopTimer(CPUTIMER2_BASE);
//
// Reload all counter register with period value
//
CPUTimer_reloadTimerCounter(CPUTIMER0_BASE);
CPUTimer_reloadTimerCounter(CPUTIMER1_BASE);
CPUTimer_reloadTimerCounter(CPUTIMER2_BASE);
//
// Reset interrupt counter
//
cpuTimer0IntCount = 0;
cpuTimer1IntCount = 0;
cpuTimer2IntCount = 0;
}
//
// configCPUTimer - This function initializes the selected timer to the
// period specified by the "freq" and "period" variables. The "freq" is
// CPU frequency in Hz and the period in uSeconds. The timer is held in
// the stopped state after configuration.
//
void
configCPUTimer(uint32_t cpuTimer, uint32_t period)
{
uint32_t temp, freq = DEVICE_SYSCLK_FREQ;
//
// Initialize timer period:
//
temp = ((freq / 1000000) * period);
CPUTimer_setPeriod(cpuTimer, temp - 1);
//
// Set pre-scale counter to divide by 1 (SYSCLKOUT):
//
CPUTimer_setPreScaler(cpuTimer, 0);
//
// Initializes timer control register. The timer is stopped, reloaded,
// free run disabled, and interrupt enabled.
// Additionally, the free and soft bits are set
//
CPUTimer_stopTimer(cpuTimer);
CPUTimer_reloadTimerCounter(cpuTimer);
CPUTimer_setEmulationMode(cpuTimer,
CPUTIMER_EMULATIONMODE_STOPAFTERNEXTDECREMENT);
CPUTimer_enableInterrupt(cpuTimer);
//
// Resets interrupt counters for the three cpuTimers
//
if (cpuTimer == CPUTIMER0_BASE)
{
cpuTimer0IntCount = 0;
}
else if(cpuTimer == CPUTIMER1_BASE)
{
cpuTimer1IntCount = 0;
}
else if(cpuTimer == CPUTIMER2_BASE)
{
cpuTimer2IntCount = 0;
}
}
//
// End of File
//
@@ -0,0 +1,12 @@
/**
* Import the modules used in this configuration.
*/
const dac = scripting.addModule("/driverlib/dac.js", {}, false);
const dac1 = dac.addInstance();
/**
* Write custom configuration values to the imported modules.
*/
dac1.$name = "myDAC0";
dac1.enableOutput = true;
@@ -0,0 +1,397 @@
//######################################################################################
//
// File name : SGEN.H
//
// Originator : Advanced Embedded Control (AEC)
// Texas Instruments Inc.
//
// Description:
// Header file containing object definitions, prototype declaration and
// default object initializers for Signal Generator Modules
//
//#############################################################################
// $TI Release: F2838x Support Library v3.04.00.00 $
// $Copyright:
// Copyright (C) 2021 Texas Instruments Incorporated - http://www.ti.com/
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
//
// Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
//
// Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the
// distribution.
//
// Neither the name of Texas Instruments Incorporated nor the names of
// its contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// $
//#############################################################################
#ifndef __SGEN_H__
#define __SGEN_H__
#define NULL 0
typedef struct {
unsigned int freq;
unsigned int step_max;
unsigned int alpha;
int gain;
int offset;
int out;
void (*calc)(void *);
}SGENT_1;
#define SGENT_1_DEFAULTS { 5369,\
1000,\
0,\
0x7fff,\
0,\
0,\
(void (*)(void *))SGENT_1_calc}
typedef struct {
unsigned int freq;
unsigned int step_max;
unsigned int alpha;
int gain;
int offset;
int out;
void (*calc)(void *);
}SGENTI_1;
#define SGENTI_1_DEFAULTS { 5369,\
1000,\
0,\
0x7fff,\
0,\
0,\
(void (*)(void *))SGENTI_1_calc}
typedef struct {
unsigned int freq;
unsigned int step_max;
unsigned int alpha;
int gain;
int offset;
int out1;
unsigned int phase;
int out2;
void (*calc)(void *);
}SGENT_2;
#define SGENT_2_DEFAULTS { 5369,\
1000,\
0,\
0x7fff,\
0,\
0,\
0x4000,\
0,\
(void (*)(void *))SGENT_2_calc}
typedef struct {
unsigned int freq;
unsigned int step_max;
unsigned int alpha;
int gain;
int offset;
int out1;
unsigned int phase;
int out2;
void (*calc)(void *);
}SGENTI_2;
#define SGENTI_2_DEFAULTS { 5369,\
1000,\
0,\
0x7fff,\
0,\
0,\
0x4000,\
0,\
(void (*)(void *))SGENTI_2_calc}
typedef struct {
unsigned int freq;
unsigned int step_max;
unsigned int alpha;
int gain;
int offset;
int out1;
int out2;
int out3;
void (*calc)(void *);
}SGENT_3;
#define SGENT_3_DEFAULTS { 5369,\
1000,\
0,\
0x7fff,\
0,\
0,\
0,\
0,\
(void (*)(void *))SGENT_3_calc}
typedef struct {
unsigned int freq;
unsigned int step_max;
unsigned int alpha;
int gain;
int offset;
int out1;
int out2;
int out3;
void (*calc)(void *);
}SGENTI_3;
#define SGENTI_3_DEFAULTS { 5369,\
1000,\
0,\
0x7fff,\
0,\
0,\
0,\
0,\
(void (*)(void *))SGENTI_3_calc}
typedef struct {
unsigned int freq;
unsigned int step_max;
unsigned int alpha;
int gain;
int offset;
int out11;
int out12;
int out13;
unsigned int phase;
int out21;
int out22;
int out23;
void (*calc)(void *);
}SGENT_3D;
#define SGENT_3D_DEFAULTS { 5369,\
1000,\
0,\
0x7fff,\
0,\
0,\
0,\
0,\
0x4000,\
0,\
0,\
0,\
(void (*)(void *))SGENT_3D_calc}
typedef struct {
unsigned int freq;
unsigned int step_max;
unsigned int alpha;
int gain;
int offset;
int out11;
int out12;
int out13;
unsigned int phase;
int out21;
int out22;
int out23;
void (*calc)(void *);
}SGENTI_3D;
#define SGENTI_3D_DEFAULTS { 5369,\
1000,\
0,\
0x7fff,\
0,\
0,\
0,\
0,\
0x4000,\
0,\
0,\
0,\
(void (*)(void *))SGENTI_3D_calc}
typedef struct {
void (*calc)(void *);
unsigned long int freq;
unsigned long int step_max;
unsigned long int alpha;
int gain;
int offset;
int out;
}SGENHP_1;
#define SGENHP_1_DEFAULTS { (void (*) (void *))SGENHP_1_calc,\
0x14F8CF92,\
0x3E7FB26,\
0UL,\
0x7fff,\
0,\
0}
typedef struct {
unsigned long int freq;
unsigned long int step_max;
unsigned long int alpha;
int gain;
int offset;
int out1;
int out2;
unsigned long int phase;
void (*calc)(void *);
}SGENHP_2;
#define SGENHP_2_DEFAULTS { 0x14F8CF92,\
0x3E7FB26,\
0,\
0x7fff,\
0,\
0,\
0,\
0x40000000,\
(void (*)(void *))SGENHP_2_calc}
typedef struct { int freq;
unsigned int step_max;
unsigned int angle;
int gain;
int offset;
int out;
void (*calc)(void *);
}RMPGEN;
#define RMPGEN_DEFAULTS {5369,\
1000,\
0x0000,\
0x7FFF,\
0x0000,\
0,\
(void (*)(void *))RMPGEN_calc }
typedef struct { unsigned int skip_cntr;
unsigned int prescalar;
unsigned int freq;
unsigned int step_max;
unsigned long task;
unsigned int alpha;
int gain;
int offset;
int out;
void (*init)(void *);
void (*calc)(void *);
}TZDLGEN;
#define TZDLGEN_DEFAULTS { 0, \
1, \
5369, \
4000, \
0x0000UL, \
0x0000, \
0x7fff, \
0x0000, \
0x0000, \
(void (*)(void *))TZDLGEN_init,\
(void (*)(void *))TZDLGEN_calc}
typedef struct { int mode;
int trig;
unsigned int skip_cntr;
unsigned int prescalar;
unsigned int freq;
unsigned int step_max;
int t_rmpup;
int t_max;
int t_rmpdn;
int t_min;
unsigned long task;
unsigned int alpha;
int gain;
int offset;
int out;
void (*init)(void *);
void (*calc)(void *);
}PROFILE;
#define PROFILE_DEFAULTS {1, \
0, \
0, \
1, \
5369, \
4000, \
0, \
0, \
0, \
0, \
0x0000UL, \
0x0000, \
0x7fff, \
0x0000, \
0x0000, \
(void (*)(void *))PROFILE_init, \
(void (*)(void *))PROFILE_calc}
typedef SGENT_1 *SGENT_1_handle;
typedef SGENT_2 *SGENT_2_handle;
typedef SGENT_3 *SGENT_3_handle;
typedef SGENT_3D *SGENT_3D_handle;
typedef SGENTI_1 *SGENTI_1_handle;
typedef SGENTI_2 *SGENTI_2_handle;
typedef SGENTI_3 *SGENTI_3_handle;
typedef SGENTI_3D *SGENTI_3D_handle;
typedef SGENHP_1 *SGENHP_1_handle;
typedef SGENHP_2 *SGENHP_2_handle;
typedef RMPGEN *RMPGEN_handle;
typedef TZDLGEN *TZDLGEN_handle;
typedef PROFILE *PROFILE_handle;
void SGENT_1_calc(void *);
void SGENTI_1_calc(void *);
void SGENT_2_calc(void *);
void SGENTI_2_calc(void *);
void SGENT_3_calc(void *);
void SGENTI_3_calc(void *);
void SGENT_3D_calc(void *);
void SGENTI_3D_calc(void *);
void SGENHP_1_calc(void *);
void SGENHP_2_calc(void *);
void RMPGEN_calc(void *);
void TZDLGEN_init(void *);
void TZDLGEN_calc(void *);
void PROFILE_init(void *);
void PROFILE_calc(void *);
#endif
@@ -0,0 +1,100 @@
;======================================================================
;
; File Name : SGTI1C.ASM
;
; Originator : Advanced Embedded Control (AEC)
; Texas Instruments Inc.
;
; Description : This file contain source code for single channel
; SIN generator module(Using Table look-up and Linear Interpolation)
; * Table look-up and linear interpolation provides, low
; THD and high phase Resolution
;
; Routine Type : CcA
;
; Date : 28/12/2001 (DD/MM/YYYY)
;======================================================================
; Description:
; ___________________
; | |
; gain o---------->| |
; offset o---------->| SGENTI_1 |----->o OUT
; freq o---------->| |
; |___________________|
;
;======================================================================
; #############################################################################
; $TI Release: F2838x Support Library v3.04.00.00 $
; $Copyright:
;// Copyright (C) 2021 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.
;// $
; #############################################################################
; Module definition for external reference
.def SGENTI_1_calc
.ref SINTAB_360
SGENTI_1_calc:
SETC SXM,OVM ; XAR4->freq
MOVL XAR5,#SINTAB_360
; Obtain the step value in pro-rata with the freq input
MOV T,*XAR4++ ; XAR4->step_max, T=freq
MPY ACC,T,*XAR4++ ; XAR4->alpha, ACC=freq*step_max (Q15)
MOVH AL,ACC<<1
; Increment the angle "alpha" by step value
ADD AL,*XAR4 ; AL=(freq*step_max)+alpha (Q0)
MOV *XAR4,AL ; XAR4->alpha, alpha=alpha+step (Unsigned 8.8 format)
; Obtain the SIN of the angle "X=alpha" using Look-up Table and Linear Interpolation method
MOVB XAR0,#0
MOV T,#0
MOVB AR0,AL.MSB ; AR0=indice (alpha/2^8)
MOVB T,AL.LSB ; T=(X-X1) in Q8 format
MOV ACC,*+XAR5[AR0] ; ACC=Y1=*(SINTAB_360 + indice)
ADDB XAR0,#1
MOV PL,*+XAR5[AR0] ; PL=Y2
SUB PL,AL ; PL=Y2-Y1 in Q15
MPY P,T,PL ; P=Y2-Y1 in Q23
LSL ACC,8 ; ACC=Y1 in Q23
ADDL ACC,P ; Y=Y1+(Y2-Y1)*(X-X1)
MOVH T,ACC<<8 ; T=Y in Q15 format
; Scale the SIN output with the gain and add offset
MPY ACC,T,*+XAR4[1]
LSL ACC,#1 ; ACC=Y*gain (Q31)
ADD ACC,*+XAR4[2]<<16 ; ACC=Y*gain+offset
MOV *+XAR4[3],AH ; out=Y*gain+offset
CLRC OVM
LRETR