Explorar el Código

for new configured board MSPM0L1304

namrota ghosh hace 8 meses
padre
commit
0d7fef048b

+ 17 - 0
.ccsproject

@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<?ccsproject version="1.0"?>
+<projectOptions>
+	<ccsVariant value="50:Theia-based"/>
+	<ccsVersion value="51.5.0"/>
+	<deviceFamily value="TMS470"/>
+	<connection value="common/targetdb/connections/TIXDS110_Connection.xml"/>
+	<createSlaveProjects value=""/>
+	<ignoreDefaultDeviceSettings value="true"/>
+	<ignoreDefaultCCSSettings value="true"/>
+	<templateProperties value="id=i2c_controller_LP_MSPM0G3507_nortos_ticlang.projectspec.charge_controller_v7,buildProfile=release,isHybrid=true"/>
+	<activeTargetConfiguration value="targetConfigs/MSPM0L1304.ccxml"/>
+	<isTargetConfigurationManual value="false"/>
+	<sourceLookupPath value="${COM_TI_MSPM0_SDK_INSTALL_DIR}/source/ti/driverlib"/>
+	<origin value="/home/ngosh/ti/mspm0_sdk_2_03_00_07/examples/nortos/LP_MSPM0G3507/comm_modules/i2c_controller/ticlang/i2c_controller_LP_MSPM0G3507_nortos_ticlang.projectspec"/>
+	<filesToOpen value="i2c_controller.syscfg,README.md"/>
+</projectOptions>

+ 11 - 0
.clangd

@@ -0,0 +1,11 @@
+# This is an auto-generated file - do not add it to source-control
+
+CompileFlags:
+   CompilationDatabase: Debug/.clangd
+
+Diagnostics:
+   Suppress: '*'
+
+InlayHints:
+   Enabled: No
+

+ 189 - 0
.cproject

@@ -0,0 +1,189 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<?fileVersion 4.0.0?><cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
+    <storageModule moduleId="org.eclipse.cdt.core.settings">
+        <cconfiguration id="com.ti.ccstudio.buildDefinitions.TMS470.Debug.1818366658">
+            <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="com.ti.ccstudio.buildDefinitions.TMS470.Debug.1818366658" moduleId="org.eclipse.cdt.core.settings" name="Debug">
+                <externalSettings/>
+                <extensions>
+                    <extension id="org.eclipse.cdt.core.GmakeErrorParser" point="com.ti.ccs.project.ErrorParser"/>
+                    <extension id="org.eclipse.cdt.core.GASErrorParser" point="com.ti.ccs.project.ErrorParser"/>
+                    <extension id="com.ti.ccs.errorparser.SysConfigErrorParser" point="com.ti.ccs.project.ErrorParser"/>
+                    <extension id="org.eclipse.cdt.core.GCCErrorParser" point="com.ti.ccs.project.ErrorParser"/>
+                    <extension id="com.ti.ccs.errorparser.CompilerErrorParser_TI" point="com.ti.ccs.project.ErrorParser"/>
+                </extensions>
+            </storageModule>
+            <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+                <configuration artifactExtension="out" artifactName="${ProjName}" buildProperties="" cleanCommand="${CG_CLEAN_CMD}" description="" id="com.ti.ccstudio.buildDefinitions.TMS470.Debug.1818366658" name="Debug" parent="com.ti.ccstudio.buildDefinitions.TMS470.Debug">
+                    <folderInfo id="com.ti.ccstudio.buildDefinitions.TMS470.Debug.1818366658." name="/" resourcePath="">
+                        <toolChain id="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.exe.DebugToolchain.35900164" name="TI Build Tools" superClass="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.exe.DebugToolchain" targetTool="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.exe.linkerDebug.882757169">
+                            <option id="com.ti.ccstudio.buildDefinitions.core.OPT_TAGS.1566241024" superClass="com.ti.ccstudio.buildDefinitions.core.OPT_TAGS" valueType="stringList">
+                                <listOptionValue value="DEVICE_CONFIGURATION_ID=Cortex M.MSPM0L1304"/>
+                                <listOptionValue value="DEVICE_CORE_ID="/>
+                                <listOptionValue value="DEVICE_ENDIANNESS=little"/>
+                                <listOptionValue value="OUTPUT_FORMAT=ELF"/>
+                                <listOptionValue value="RUNTIME_SUPPORT_LIBRARY="/>
+                                <listOptionValue value="CCS_MBS_VERSION=51.0.0"/>
+                                <listOptionValue value="PRODUCTS=MSPM0-SDK:2.4.0.06;sysconfig:1.22.0;"/>
+                                <listOptionValue value="PRODUCT_MACRO_IMPORTS={&quot;MSPM0-SDK&quot;:[&quot;${COM_TI_MSPM0_SDK_INCLUDE_PATH}&quot;,&quot;${COM_TI_MSPM0_SDK_LIBRARY_PATH}&quot;,&quot;${COM_TI_MSPM0_SDK_LIBRARIES}&quot;,&quot;${COM_TI_MSPM0_SDK_SYMBOLS}&quot;,&quot;${COM_TI_MSPM0_SDK_SYSCONFIG_MANIFEST}&quot;],&quot;sysconfig&quot;:[&quot;${SYSCONFIG_TOOL_INCLUDE_PATH}&quot;,&quot;${SYSCONFIG_TOOL_LIBRARY_PATH}&quot;,&quot;${SYSCONFIG_TOOL_LIBRARIES}&quot;,&quot;${SYSCONFIG_TOOL_SYMBOLS}&quot;,&quot;${SYSCONFIG_TOOL_SYSCONFIG_MANIFEST}&quot;]}"/>
+                                <listOptionValue value="OUTPUT_TYPE=executable"/>
+                            </option>
+                            <option id="com.ti.ccstudio.buildDefinitions.core.OPT_CODEGEN_VERSION.1154844752" superClass="com.ti.ccstudio.buildDefinitions.core.OPT_CODEGEN_VERSION" value="TICLANG_4.0.0.LTS" valueType="string"/>
+                            <targetPlatform id="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.exe.targetPlatformDebug.189192984" name="Platform" superClass="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.exe.targetPlatformDebug"/>
+                            <builder buildPath="${BuildDirectory}" id="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.exe.builderDebug.948599038" keepEnvironmentInBuildfile="false" name="GNU Make" parallelBuildOn="true" parallelizationNumber="optimal" superClass="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.exe.builderDebug"/>
+                            <tool id="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.exe.compilerDebug.165327511" name="Arm Compiler" superClass="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.exe.compilerDebug">
+                                <option id="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.compilerID.MARCH.46378732" superClass="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.compilerID.MARCH" value="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.compilerID.MARCH.thumbv6m" valueType="enumerated"/>
+                                <option id="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.compilerID.MCPU.479430438" superClass="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.compilerID.MCPU" value="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.compilerID.MCPU.cortex-m0plus" valueType="enumerated"/>
+                                <option id="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.compilerID.MFLOAT_ABI.799913972" superClass="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.compilerID.MFLOAT_ABI" value="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.compilerID.MFLOAT_ABI.soft" valueType="enumerated"/>
+                                <option id="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.compilerID.ENDIAN_NESS__BIG_LITTLE.1063807693" superClass="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.compilerID.ENDIAN_NESS__BIG_LITTLE" value="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.compilerID.ENDIAN_NESS__BIG_LITTLE.MLITTLE_ENDIAN" valueType="enumerated"/>
+                                <option id="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.compilerID.SELECT_PROCESSOR_MODE__ARM_THUMB.1439633488" superClass="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.compilerID.SELECT_PROCESSOR_MODE__ARM_THUMB" value="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.compilerID.SELECT_PROCESSOR_MODE__ARM_THUMB.MTHUMB" valueType="enumerated"/>
+                                <option id="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.compilerID.OPT_LEVEL.1065396778" superClass="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.compilerID.OPT_LEVEL" value="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.compilerID.OPT_LEVEL.0" valueType="enumerated"/>
+                                <option id="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.compilerID.INCLUDE_PATH.1273835144" superClass="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.compilerID.INCLUDE_PATH" valueType="includePath">
+                                    <listOptionValue value="${COM_TI_MSPM0_SDK_INCLUDE_PATH}"/>
+                                    <listOptionValue value="${SYSCONFIG_TOOL_INCLUDE_PATH}"/>
+                                    <listOptionValue value="${PROJECT_ROOT}"/>
+                                    <listOptionValue value="${PROJECT_ROOT}/${ConfigName}"/>
+                                    <listOptionValue value="${COM_TI_MSPM0_SDK_INSTALL_DIR}/source/third_party/CMSIS/Core/Include"/>
+                                    <listOptionValue value="${COM_TI_MSPM0_SDK_INSTALL_DIR}/source"/>
+                                </option>
+                                <option id="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.compilerID.DEFINE.2059102776" superClass="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.compilerID.DEFINE" valueType="definedSymbols">
+                                    <listOptionValue value="${COM_TI_MSPM0_SDK_SYMBOLS}"/>
+                                    <listOptionValue value="${SYSCONFIG_TOOL_SYMBOLS}"/>
+                                </option>
+                                <option id="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.compilerID.GENERATE_DWARF_DEBUG.734703729" superClass="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.compilerID.GENERATE_DWARF_DEBUG" value="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.compilerID.GENERATE_DWARF_DEBUG.GDWARF_3" valueType="enumerated"/>
+                                <option id="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.compilerID.CMD_FILE.975871040" superClass="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.compilerID.CMD_FILE" valueType="stringList">
+                                    <listOptionValue value="syscfg/device.opt"/>
+                                </option>
+                            </tool>
+                            <tool id="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.exe.linkerDebug.882757169" name="Arm Linker" superClass="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.exe.linkerDebug">
+                                <option id="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.linkerID.MAP_FILE.890617040" superClass="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.linkerID.MAP_FILE" value="${ProjName}.map" valueType="string"/>
+                                <option id="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.linkerID.OUTPUT_FILE.37322510" superClass="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.linkerID.OUTPUT_FILE" value="${ProjName}.out" valueType="string"/>
+                                <option id="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.linkerID.LIBRARY.1842090655" superClass="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.linkerID.LIBRARY" valueType="libs">
+                                    <listOptionValue value="${COM_TI_MSPM0_SDK_LIBRARIES}"/>
+                                    <listOptionValue value="${SYSCONFIG_TOOL_LIBRARIES}"/>
+                                    <listOptionValue value="device.cmd.genlibs"/>
+                                    <listOptionValue value="libc.a"/>
+                                </option>
+                                <option id="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.linkerID.SEARCH_PATH.1780716730" superClass="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.linkerID.SEARCH_PATH" valueType="libPaths">
+                                    <listOptionValue value="${COM_TI_MSPM0_SDK_LIBRARY_PATH}"/>
+                                    <listOptionValue value="${SYSCONFIG_TOOL_LIBRARY_PATH}"/>
+                                    <listOptionValue value="${COM_TI_MSPM0_SDK_INSTALL_DIR}/source"/>
+                                    <listOptionValue value="${PROJECT_BUILD_DIR}/syscfg"/>
+                                    <listOptionValue value="${CG_TOOL_ROOT}/lib"/>
+                                </option>
+                                <option id="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.linkerID.REREAD_LIBS.458526022" superClass="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.linkerID.REREAD_LIBS" value="false" valueType="boolean"/>
+                                <option id="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.linkerID.DIAG_WRAP.1785462721" superClass="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.linkerID.DIAG_WRAP" value="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.linkerID.DIAG_WRAP.off" valueType="enumerated"/>
+                                <option id="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.linkerID.DISPLAY_ERROR_NUMBER.175695452" superClass="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.linkerID.DISPLAY_ERROR_NUMBER" value="true" valueType="boolean"/>
+                                <option id="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.linkerID.XML_LINK_INFO.1359937870" superClass="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.linkerID.XML_LINK_INFO" value="${ProjName}_linkInfo.xml" valueType="string"/>
+                                <option id="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.linkerID.HEAP_SIZE.754278704" superClass="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.linkerID.HEAP_SIZE" value="0x100" valueType="string"/>
+                            </tool>
+                            <tool id="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.hex.760139285" name="Arm Hex Utility" superClass="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.hex"/>
+                            <tool id="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.objcopy.1014521351" name="Arm Objcopy Utility" superClass="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.objcopy"/>
+                            <tool id="com.ti.ccstudio.buildDefinitions.sysConfig.422844367" name="SysConfig" superClass="com.ti.ccstudio.buildDefinitions.sysConfig">
+                                <option id="com.ti.ccstudio.buildDefinitions.sysConfig.PRODUCTS.868047636" superClass="com.ti.ccstudio.buildDefinitions.sysConfig.PRODUCTS" valueType="stringList">
+                                    <listOptionValue value="${COM_TI_MSPM0_SDK_SYSCONFIG_MANIFEST}"/>
+                                    <listOptionValue value="${SYSCONFIG_TOOL_SYSCONFIG_MANIFEST}"/>
+                                </option>
+                            </tool>
+                        </toolChain>
+                    </folderInfo>
+                </configuration>
+            </storageModule>
+            <storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
+        </cconfiguration>
+        <cconfiguration id="com.ti.ccstudio.buildDefinitions.TMS470.Debug.1330295774">
+            <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="com.ti.ccstudio.buildDefinitions.TMS470.Debug.1330295774" moduleId="org.eclipse.cdt.core.settings" name="Debug">
+                <externalSettings/>
+                <extensions>
+                    <extension id="org.eclipse.cdt.core.GmakeErrorParser" point="com.ti.ccs.project.ErrorParser"/>
+                    <extension id="org.eclipse.cdt.core.GASErrorParser" point="com.ti.ccs.project.ErrorParser"/>
+                    <extension id="com.ti.ccs.errorparser.SysConfigErrorParser" point="com.ti.ccs.project.ErrorParser"/>
+                    <extension id="org.eclipse.cdt.core.GCCErrorParser" point="com.ti.ccs.project.ErrorParser"/>
+                    <extension id="com.ti.ccs.errorparser.CompilerErrorParser_TI" point="com.ti.ccs.project.ErrorParser"/>
+                </extensions>
+            </storageModule>
+            <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+                <configuration artifactExtension="out" artifactName="${ProjName}" buildProperties="" cleanCommand="${CG_CLEAN_CMD}" description="" id="com.ti.ccstudio.buildDefinitions.TMS470.Debug.1330295774" name="Debug" parent="com.ti.ccstudio.buildDefinitions.TMS470.Debug">
+                    <folderInfo id="com.ti.ccstudio.buildDefinitions.TMS470.Debug.1330295774." name="/" resourcePath="">
+                        <toolChain id="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.exe.DebugToolchain.992810816" name="TI Build Tools" superClass="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.exe.DebugToolchain" targetTool="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.exe.linkerDebug.1723638573">
+                            <option id="com.ti.ccstudio.buildDefinitions.core.OPT_TAGS.1534898856" superClass="com.ti.ccstudio.buildDefinitions.core.OPT_TAGS" valueType="stringList">
+                                <listOptionValue value="DEVICE_CONFIGURATION_ID=Cortex M.MSPM0L1304"/>
+                                <listOptionValue value="DEVICE_CORE_ID="/>
+                                <listOptionValue value="DEVICE_ENDIANNESS=little"/>
+                                <listOptionValue value="OUTPUT_FORMAT=ELF"/>
+                                <listOptionValue value="CCS_MBS_VERSION=51.0.0"/>
+                                <listOptionValue value="PRODUCTS=MSPM0-SDK:2.3.0.07;sysconfig:1.22.0;"/>
+                                <listOptionValue value="PRODUCT_MACRO_IMPORTS={&quot;MSPM0-SDK&quot;:[&quot;${COM_TI_MSPM0_SDK_INCLUDE_PATH}&quot;,&quot;${COM_TI_MSPM0_SDK_LIBRARY_PATH}&quot;,&quot;${COM_TI_MSPM0_SDK_LIBRARIES}&quot;,&quot;${COM_TI_MSPM0_SDK_SYMBOLS}&quot;,&quot;${COM_TI_MSPM0_SDK_SYSCONFIG_MANIFEST}&quot;],&quot;sysconfig&quot;:[&quot;${SYSCONFIG_TOOL_INCLUDE_PATH}&quot;,&quot;${SYSCONFIG_TOOL_LIBRARY_PATH}&quot;,&quot;${SYSCONFIG_TOOL_LIBRARIES}&quot;,&quot;${SYSCONFIG_TOOL_SYMBOLS}&quot;,&quot;${SYSCONFIG_TOOL_SYSCONFIG_MANIFEST}&quot;]}"/>
+                                <listOptionValue value="RUNTIME_SUPPORT_LIBRARY="/>
+                                <listOptionValue value="OUTPUT_TYPE=executable"/>
+                            </option>
+                            <option id="com.ti.ccstudio.buildDefinitions.core.OPT_CODEGEN_VERSION.957134305" superClass="com.ti.ccstudio.buildDefinitions.core.OPT_CODEGEN_VERSION" value="TICLANG_4.0.0.LTS" valueType="string"/>
+                            <targetPlatform id="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.exe.targetPlatformDebug.577332083" name="Platform" superClass="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.exe.targetPlatformDebug"/>
+                            <builder buildPath="${BuildDirectory}" id="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.exe.builderDebug.2099937134" name="GNU Make.Debug" parallelBuildOn="true" parallelizationNumber="optimal" superClass="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.exe.builderDebug"/>
+                            <tool id="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.exe.compilerDebug.1917036153" name="Arm Compiler" superClass="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.exe.compilerDebug">
+                                <option id="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.compilerID.MARCH.1130980006" superClass="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.compilerID.MARCH" value="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.compilerID.MARCH.thumbv6m" valueType="enumerated"/>
+                                <option id="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.compilerID.MCPU.128109878" superClass="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.compilerID.MCPU" value="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.compilerID.MCPU.cortex-m0plus" valueType="enumerated"/>
+                                <option id="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.compilerID.MFLOAT_ABI.1509533391" superClass="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.compilerID.MFLOAT_ABI" value="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.compilerID.MFLOAT_ABI.soft" valueType="enumerated"/>
+                                <option id="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.compilerID.ENDIAN_NESS__BIG_LITTLE.1853480779" superClass="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.compilerID.ENDIAN_NESS__BIG_LITTLE" value="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.compilerID.ENDIAN_NESS__BIG_LITTLE.MLITTLE_ENDIAN" valueType="enumerated"/>
+                                <option id="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.compilerID.SELECT_PROCESSOR_MODE__ARM_THUMB.929624114" superClass="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.compilerID.SELECT_PROCESSOR_MODE__ARM_THUMB" value="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.compilerID.SELECT_PROCESSOR_MODE__ARM_THUMB.MTHUMB" valueType="enumerated"/>
+                                <option id="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.compilerID.OPT_LEVEL.1846618491" superClass="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.compilerID.OPT_LEVEL" value="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.compilerID.OPT_LEVEL.0" valueType="enumerated"/>
+                                <option id="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.compilerID.INCLUDE_PATH.803507431" superClass="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.compilerID.INCLUDE_PATH" valueType="includePath">
+                                    <listOptionValue value="${COM_TI_MSPM0_SDK_INCLUDE_PATH}"/>
+                                    <listOptionValue value="${SYSCONFIG_TOOL_INCLUDE_PATH}"/>
+                                    <listOptionValue value="${PROJECT_ROOT}"/>
+                                    <listOptionValue value="${PROJECT_ROOT}/${ConfigName}"/>
+                                    <listOptionValue value="${COM_TI_MSPM0_SDK_INSTALL_DIR}/source/third_party/CMSIS/Core/Include"/>
+                                    <listOptionValue value="${COM_TI_MSPM0_SDK_INSTALL_DIR}/source"/>
+                                </option>
+                                <option id="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.compilerID.DEFINE.1653754570" superClass="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.compilerID.DEFINE" valueType="definedSymbols">
+                                    <listOptionValue value="${COM_TI_MSPM0_SDK_SYMBOLS}"/>
+                                    <listOptionValue value="${SYSCONFIG_TOOL_SYMBOLS}"/>
+                                </option>
+                                <option id="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.compilerID.GENERATE_DWARF_DEBUG.1428147386" superClass="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.compilerID.GENERATE_DWARF_DEBUG" value="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.compilerID.GENERATE_DWARF_DEBUG.GDWARF_3" valueType="enumerated"/>
+                                <option id="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.compilerID.CMD_FILE.2651665" superClass="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.compilerID.CMD_FILE" valueType="stringList">
+                                    <listOptionValue value="device.opt"/>
+                                </option>
+                            </tool>
+                            <tool id="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.exe.linkerDebug.1723638573" name="Arm Linker" superClass="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.exe.linkerDebug">
+                                <option id="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.linkerID.MAP_FILE.994431786" superClass="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.linkerID.MAP_FILE" value="${ProjName}.map" valueType="string"/>
+                                <option id="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.linkerID.OUTPUT_FILE.1664643903" superClass="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.linkerID.OUTPUT_FILE" value="${ProjName}.out" valueType="string"/>
+                                <option id="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.linkerID.HEAP_SIZE.435518710" superClass="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.linkerID.HEAP_SIZE" value="0x1000" valueType="string"/>
+                                <option id="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.linkerID.LIBRARY.2071185036" superClass="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.linkerID.LIBRARY" valueType="libs">
+                                    <listOptionValue value="${COM_TI_MSPM0_SDK_LIBRARIES}"/>
+                                    <listOptionValue value="${SYSCONFIG_TOOL_LIBRARIES}"/>
+                                    <listOptionValue value="device.cmd.genlibs"/>
+                                    <listOptionValue value="libc.a"/>
+                                </option>
+                                <option id="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.linkerID.SEARCH_PATH.1779569713" superClass="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.linkerID.SEARCH_PATH" valueType="libPaths">
+                                    <listOptionValue value="${COM_TI_MSPM0_SDK_LIBRARY_PATH}"/>
+                                    <listOptionValue value="${SYSCONFIG_TOOL_LIBRARY_PATH}"/>
+                                    <listOptionValue value="${COM_TI_MSPM0_SDK_INSTALL_DIR}/source"/>
+                                    <listOptionValue value="${PROJECT_ROOT}"/>
+                                    <listOptionValue value="${PROJECT_BUILD_DIR}/syscfg"/>
+                                    <listOptionValue value="${CG_TOOL_ROOT}/lib"/>
+                                </option>
+                                <option id="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.linkerID.REREAD_LIBS.149491947" superClass="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.linkerID.REREAD_LIBS" value="false" valueType="boolean"/>
+                                <option id="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.linkerID.DIAG_WRAP.1397069906" superClass="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.linkerID.DIAG_WRAP" value="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.linkerID.DIAG_WRAP.off" valueType="enumerated"/>
+                                <option id="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.linkerID.DISPLAY_ERROR_NUMBER.1061667235" superClass="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.linkerID.DISPLAY_ERROR_NUMBER" value="true" valueType="boolean"/>
+                                <option id="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.linkerID.XML_LINK_INFO.2112172605" superClass="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.linkerID.XML_LINK_INFO" value="${ProjName}_linkInfo.xml" valueType="string"/>
+                            </tool>
+                            <tool id="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.hex.1279295558" name="Arm Hex Utility" superClass="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.hex"/>
+                            <tool id="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.objcopy.316289981" name="Arm Objcopy Utility" superClass="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.objcopy"/>
+                            <tool id="com.ti.ccstudio.buildDefinitions.sysConfig.597247557" name="SysConfig" superClass="com.ti.ccstudio.buildDefinitions.sysConfig">
+                                <option id="com.ti.ccstudio.buildDefinitions.sysConfig.DIRECTORY_MODE.193937575" superClass="com.ti.ccstudio.buildDefinitions.sysConfig.DIRECTORY_MODE" value="com.ti.ccstudio.buildDefinitions.sysConfig.DIRECTORY_MODE.manual" valueType="enumerated"/>
+                                <option id="com.ti.ccstudio.buildDefinitions.sysConfig.OUTPUT_DIR__MANUAL.2094616860" superClass="com.ti.ccstudio.buildDefinitions.sysConfig.OUTPUT_DIR__MANUAL" value="." valueType="string"/>
+                                <option id="com.ti.ccstudio.buildDefinitions.sysConfig.PRODUCTS.1363909785" superClass="com.ti.ccstudio.buildDefinitions.sysConfig.PRODUCTS" valueType="stringList">
+                                    <listOptionValue value="${COM_TI_MSPM0_SDK_SYSCONFIG_MANIFEST}"/>
+                                    <listOptionValue value="${SYSCONFIG_TOOL_SYSCONFIG_MANIFEST}"/>
+                                </option>
+                            </tool>
+                        </toolChain>
+                    </folderInfo>
+                </configuration>
+            </storageModule>
+            <storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
+        </cconfiguration>
+    </storageModule>
+    <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+        <project id="charge_controller_v7.com.ti.ccstudio.buildDefinitions.TMS470.ProjectType.429570678" name="TMS470" projectType="com.ti.ccstudio.buildDefinitions.TMS470.ProjectType"/>
+    </storageModule>
+</cproject>

+ 99 - 0
.cproject_backup_1014

@@ -0,0 +1,99 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<?fileVersion 4.0.0?><cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
+    <storageModule moduleId="org.eclipse.cdt.core.settings">
+        <cconfiguration id="com.ti.ccstudio.buildDefinitions.TMS470.Debug.1330295774">
+            <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="com.ti.ccstudio.buildDefinitions.TMS470.Debug.1330295774" moduleId="org.eclipse.cdt.core.settings" name="Debug">
+                <externalSettings/>
+                <extensions>
+                    <extension id="org.eclipse.cdt.core.GmakeErrorParser" point="com.ti.ccs.project.ErrorParser"/>
+                    <extension id="org.eclipse.cdt.core.GASErrorParser" point="com.ti.ccs.project.ErrorParser"/>
+                    <extension id="com.ti.ccs.errorparser.SysConfigErrorParser" point="com.ti.ccs.project.ErrorParser"/>
+                    <extension id="org.eclipse.cdt.core.GCCErrorParser" point="com.ti.ccs.project.ErrorParser"/>
+                    <extension id="com.ti.ccs.errorparser.CompilerErrorParser_TI" point="com.ti.ccs.project.ErrorParser"/>
+                </extensions>
+            </storageModule>
+            <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+                <configuration artifactExtension="out" artifactName="${ProjName}" buildProperties="" cleanCommand="${CG_CLEAN_CMD}" description="" id="com.ti.ccstudio.buildDefinitions.TMS470.Debug.1330295774" name="Debug" parent="com.ti.ccstudio.buildDefinitions.TMS470.Debug">
+                    <folderInfo id="com.ti.ccstudio.buildDefinitions.TMS470.Debug.1330295774." name="/" resourcePath="">
+                        <toolChain id="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.exe.DebugToolchain.1602941685" name="TI Build Tools" superClass="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.exe.DebugToolchain" targetTool="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.exe.linkerDebug.983460605">
+                            <option id="com.ti.ccstudio.buildDefinitions.core.OPT_TAGS.89530102" superClass="com.ti.ccstudio.buildDefinitions.core.OPT_TAGS" valueType="stringList">
+                                <listOptionValue value="DEVICE_CONFIGURATION_ID=Cortex M.MSPM0L1304"/>
+                                <listOptionValue value="DEVICE_CORE_ID="/>
+                                <listOptionValue value="DEVICE_ENDIANNESS=little"/>
+                                <listOptionValue value="OUTPUT_FORMAT=ELF"/>
+                                <listOptionValue value="RUNTIME_SUPPORT_LIBRARY="/>
+                                <listOptionValue value="CCS_MBS_VERSION=51.0.0"/>
+                                <listOptionValue value="PRODUCTS=MSPM0-SDK:2.3.0.07;sysconfig:1.22.0;"/>
+                                <listOptionValue value="PRODUCT_MACRO_IMPORTS={&quot;MSPM0-SDK&quot;:[&quot;${COM_TI_MSPM0_SDK_INCLUDE_PATH}&quot;,&quot;${COM_TI_MSPM0_SDK_LIBRARY_PATH}&quot;,&quot;${COM_TI_MSPM0_SDK_LIBRARIES}&quot;,&quot;${COM_TI_MSPM0_SDK_SYMBOLS}&quot;,&quot;${COM_TI_MSPM0_SDK_SYSCONFIG_MANIFEST}&quot;],&quot;sysconfig&quot;:[&quot;${SYSCONFIG_TOOL_INCLUDE_PATH}&quot;,&quot;${SYSCONFIG_TOOL_LIBRARY_PATH}&quot;,&quot;${SYSCONFIG_TOOL_LIBRARIES}&quot;,&quot;${SYSCONFIG_TOOL_SYMBOLS}&quot;,&quot;${SYSCONFIG_TOOL_SYSCONFIG_MANIFEST}&quot;]}"/>
+                                <listOptionValue value="OUTPUT_TYPE=executable"/>
+                            </option>
+                            <option id="com.ti.ccstudio.buildDefinitions.core.OPT_CODEGEN_VERSION.2140235034" superClass="com.ti.ccstudio.buildDefinitions.core.OPT_CODEGEN_VERSION" value="TICLANG_4.0.0.LTS" valueType="string"/>
+                            <targetPlatform id="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.exe.targetPlatformDebug.527718494" name="Platform" superClass="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.exe.targetPlatformDebug"/>
+                            <builder buildPath="${BuildDirectory}" id="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.exe.builderDebug.27662060" name="GNU Make.Debug" parallelBuildOn="true" parallelizationNumber="optimal" superClass="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.exe.builderDebug"/>
+                            <tool id="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.exe.compilerDebug.120713194" name="Arm Compiler" superClass="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.exe.compilerDebug">
+                                <option id="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.compilerID.MARCH.862839101" superClass="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.compilerID.MARCH" value="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.compilerID.MARCH.thumbv6m" valueType="enumerated"/>
+                                <option id="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.compilerID.MCPU.2009046607" superClass="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.compilerID.MCPU" value="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.compilerID.MCPU.cortex-m0plus" valueType="enumerated"/>
+                                <option id="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.compilerID.MFLOAT_ABI.880128457" superClass="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.compilerID.MFLOAT_ABI" value="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.compilerID.MFLOAT_ABI.soft" valueType="enumerated"/>
+                                <option id="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.compilerID.ENDIAN_NESS__BIG_LITTLE.319692098" superClass="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.compilerID.ENDIAN_NESS__BIG_LITTLE" value="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.compilerID.ENDIAN_NESS__BIG_LITTLE.MLITTLE_ENDIAN" valueType="enumerated"/>
+                                <option id="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.compilerID.SELECT_PROCESSOR_MODE__ARM_THUMB.1598989832" superClass="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.compilerID.SELECT_PROCESSOR_MODE__ARM_THUMB" value="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.compilerID.SELECT_PROCESSOR_MODE__ARM_THUMB.MTHUMB" valueType="enumerated"/>
+                                <option id="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.compilerID.OPT_LEVEL.1870697664" superClass="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.compilerID.OPT_LEVEL" value="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.compilerID.OPT_LEVEL.0" valueType="enumerated"/>
+                                <option id="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.compilerID.INCLUDE_PATH.361966279" superClass="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.compilerID.INCLUDE_PATH" valueType="includePath">
+                                    <listOptionValue value="${COM_TI_MSPM0_SDK_INCLUDE_PATH}"/>
+                                    <listOptionValue value="${SYSCONFIG_TOOL_INCLUDE_PATH}"/>
+                                    <listOptionValue value="${PROJECT_ROOT}"/>
+                                    <listOptionValue value="${PROJECT_ROOT}/${ConfigName}"/>
+                                    <listOptionValue value="${COM_TI_MSPM0_SDK_INSTALL_DIR}/source/third_party/CMSIS/Core/Include"/>
+                                    <listOptionValue value="${COM_TI_MSPM0_SDK_INSTALL_DIR}/source"/>
+                                </option>
+                                <option id="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.compilerID.DEFINE.1590705097" superClass="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.compilerID.DEFINE" valueType="definedSymbols">
+                                    <listOptionValue value="${COM_TI_MSPM0_SDK_SYMBOLS}"/>
+                                    <listOptionValue value="${SYSCONFIG_TOOL_SYMBOLS}"/>
+                                </option>
+                                <option id="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.compilerID.GENERATE_DWARF_DEBUG.1127775775" superClass="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.compilerID.GENERATE_DWARF_DEBUG" value="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.compilerID.GENERATE_DWARF_DEBUG.GDWARF_3" valueType="enumerated"/>
+                                <option id="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.compilerID.CMD_FILE.1211997153" superClass="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.compilerID.CMD_FILE" valueType="stringList">
+                                    <listOptionValue value="device.opt"/>
+                                </option>
+                            </tool>
+                            <tool id="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.exe.linkerDebug.983460605" name="Arm Linker" superClass="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.exe.linkerDebug">
+                                <option id="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.linkerID.MAP_FILE.1597104819" superClass="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.linkerID.MAP_FILE" value="${ProjName}.map" valueType="string"/>
+                                <option id="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.linkerID.OUTPUT_FILE.206875142" superClass="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.linkerID.OUTPUT_FILE" value="${ProjName}.out" valueType="string"/>
+                                <option id="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.linkerID.LIBRARY.900488161" superClass="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.linkerID.LIBRARY" valueType="libs">
+                                    <listOptionValue value="${COM_TI_MSPM0_SDK_LIBRARIES}"/>
+                                    <listOptionValue value="${SYSCONFIG_TOOL_LIBRARIES}"/>
+                                    <listOptionValue value="device.cmd.genlibs"/>
+                                    <listOptionValue value="libc.a"/>
+                                </option>
+                                <option id="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.linkerID.SEARCH_PATH.76495531" superClass="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.linkerID.SEARCH_PATH" valueType="libPaths">
+                                    <listOptionValue value="${COM_TI_MSPM0_SDK_LIBRARY_PATH}"/>
+                                    <listOptionValue value="${SYSCONFIG_TOOL_LIBRARY_PATH}"/>
+                                    <listOptionValue value="${COM_TI_MSPM0_SDK_INSTALL_DIR}/source"/>
+                                    <listOptionValue value="${PROJECT_ROOT}"/>
+                                    <listOptionValue value="${PROJECT_BUILD_DIR}/syscfg"/>
+                                    <listOptionValue value="${CG_TOOL_ROOT}/lib"/>
+                                </option>
+                                <option id="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.linkerID.REREAD_LIBS.1090002428" superClass="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.linkerID.REREAD_LIBS" value="false" valueType="boolean"/>
+                                <option id="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.linkerID.DIAG_WRAP.280067588" superClass="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.linkerID.DIAG_WRAP" value="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.linkerID.DIAG_WRAP.off" valueType="enumerated"/>
+                                <option id="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.linkerID.DISPLAY_ERROR_NUMBER.935429977" superClass="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.linkerID.DISPLAY_ERROR_NUMBER" value="true" valueType="boolean"/>
+                                <option id="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.linkerID.XML_LINK_INFO.509514901" superClass="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.linkerID.XML_LINK_INFO" value="${ProjName}_linkInfo.xml" valueType="string"/>
+                            </tool>
+                            <tool id="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.hex.637068973" name="Arm Hex Utility" superClass="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.hex"/>
+                            <tool id="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.objcopy.1775696666" name="Arm Objcopy Utility" superClass="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.objcopy"/>
+                            <tool id="com.ti.ccstudio.buildDefinitions.sysConfig.1022348369" name="SysConfig" superClass="com.ti.ccstudio.buildDefinitions.sysConfig">
+                                <option id="com.ti.ccstudio.buildDefinitions.sysConfig.DIRECTORY_MODE.1505048443" superClass="com.ti.ccstudio.buildDefinitions.sysConfig.DIRECTORY_MODE" value="com.ti.ccstudio.buildDefinitions.sysConfig.DIRECTORY_MODE.manual" valueType="enumerated"/>
+                                <option id="com.ti.ccstudio.buildDefinitions.sysConfig.OUTPUT_DIR__MANUAL.1169004840" superClass="com.ti.ccstudio.buildDefinitions.sysConfig.OUTPUT_DIR__MANUAL" value="." valueType="string"/>
+                                <option id="com.ti.ccstudio.buildDefinitions.sysConfig.PRODUCTS.816208361" superClass="com.ti.ccstudio.buildDefinitions.sysConfig.PRODUCTS" valueType="stringList">
+                                    <listOptionValue value="${COM_TI_MSPM0_SDK_SYSCONFIG_MANIFEST}"/>
+                                    <listOptionValue value="${SYSCONFIG_TOOL_SYSCONFIG_MANIFEST}"/>
+                                </option>
+                            </tool>
+                        </toolChain>
+                    </folderInfo>
+                </configuration>
+            </storageModule>
+            <storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
+        </cconfiguration>
+    </storageModule>
+    <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+        <project id="charge_controller_v7.com.ti.ccstudio.buildDefinitions.TMS470.ProjectType.429570678" name="TMS470" projectType="com.ti.ccstudio.buildDefinitions.TMS470.ProjectType"/>
+    </storageModule>
+</cproject>

+ 3 - 0
.gitignore

@@ -0,0 +1,3 @@
+
+*.idx
+Debug/*

+ 20 - 0
.project

@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>charge_controller_target</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>com.ti.ccstudio.core.ccsNature</nature>
+		<nature>org.eclipse.cdt.core.cnature</nature>
+		<nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
+		<nature>org.eclipse.cdt.core.ccnature</nature>
+	</natures>
+</projectDescription>

+ 3 - 0
.settings/org.eclipse.cdt.codan.core.prefs

@@ -0,0 +1,3 @@
+eclipse.preferences.version=1
+inEditor=false
+onBuild=false

+ 42 - 0
.settings/org.eclipse.core.resources.prefs

@@ -0,0 +1,42 @@
+eclipse.preferences.version=1
+encoding//Debug/Debug_/Debug_/subdir_rules.mk=UTF-8
+encoding//Debug/Debug_/Debug_/subdir_vars.mk=UTF-8
+encoding//Debug/Debug_/Debug_/ti/comm_modules/i2c/controller/subdir_rules.mk=UTF-8
+encoding//Debug/Debug_/Debug_/ti/comm_modules/i2c/controller/subdir_vars.mk=UTF-8
+encoding//Debug/Debug_/src/battery_data/subdir_rules.mk=UTF-8
+encoding//Debug/Debug_/src/battery_data/subdir_vars.mk=UTF-8
+encoding//Debug/Debug_/src/i2c_comm/subdir_rules.mk=UTF-8
+encoding//Debug/Debug_/src/i2c_comm/subdir_vars.mk=UTF-8
+encoding//Debug/Debug_/src/interfaces/subdir_rules.mk=UTF-8
+encoding//Debug/Debug_/src/interfaces/subdir_vars.mk=UTF-8
+encoding//Debug/Debug_/src/peripherals/adc/subdir_rules.mk=UTF-8
+encoding//Debug/Debug_/src/peripherals/adc/subdir_vars.mk=UTF-8
+encoding//Debug/Debug_/src/peripherals/dac/subdir_rules.mk=UTF-8
+encoding//Debug/Debug_/src/peripherals/dac/subdir_vars.mk=UTF-8
+encoding//Debug/Debug_/src/subdir_rules.mk=UTF-8
+encoding//Debug/Debug_/src/subdir_vars.mk=UTF-8
+encoding//Debug/Debug_/subdir_rules.mk=UTF-8
+encoding//Debug/Debug_/subdir_vars.mk=UTF-8
+encoding//Debug/Debug_/ti/comm_modules/i2c/controller/subdir_rules.mk=UTF-8
+encoding//Debug/Debug_/ti/comm_modules/i2c/controller/subdir_vars.mk=UTF-8
+encoding//Debug/makefile=UTF-8
+encoding//Debug/objects.mk=UTF-8
+encoding//Debug/sources.mk=UTF-8
+encoding//Debug/src/battery_data/subdir_rules.mk=UTF-8
+encoding//Debug/src/battery_data/subdir_vars.mk=UTF-8
+encoding//Debug/src/i2c_comm/subdir_rules.mk=UTF-8
+encoding//Debug/src/i2c_comm/subdir_vars.mk=UTF-8
+encoding//Debug/src/interfaces/subdir_rules.mk=UTF-8
+encoding//Debug/src/interfaces/subdir_vars.mk=UTF-8
+encoding//Debug/src/peripherals/adc/subdir_rules.mk=UTF-8
+encoding//Debug/src/peripherals/adc/subdir_vars.mk=UTF-8
+encoding//Debug/src/peripherals/dac/subdir_rules.mk=UTF-8
+encoding//Debug/src/peripherals/dac/subdir_vars.mk=UTF-8
+encoding//Debug/src/subdir_rules.mk=UTF-8
+encoding//Debug/src/subdir_vars.mk=UTF-8
+encoding//Debug/subdir_rules.mk=UTF-8
+encoding//Debug/subdir_vars.mk=UTF-8
+encoding//Debug/ti/comm_modules/i2c/controller/subdir_rules.mk=UTF-8
+encoding//Debug/ti/comm_modules/i2c/controller/subdir_vars.mk=UTF-8
+encoding//Debug/ti_/comm_modules/i2c/controller/subdir_rules.mk=UTF-8
+encoding//Debug/ti_/comm_modules/i2c/controller/subdir_vars.mk=UTF-8

+ 16 - 0
.theia/launch.json

@@ -53,6 +53,13 @@
             "projectInfo": {
                 "name": "charge_controller_target",
                 "resourceId": "/charge_controller_target/i2c_controller.c"
+            },
+            "debuggerSettings": {
+                "targetConfigs/MSPM0L1304.ccxml": {
+                    "Texas Instruments XDS110 USB Debug Probe/CORTEX_M0P": {
+                        "data": "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\" ?>\n<PropertyValues/>\n"
+                    }
+                }
             }
         },
         {
@@ -72,6 +79,15 @@
                 "name": "charge_controller_target",
                 "resourceId": "/charge_controller_target/src/i2c_controller.c"
             }
+        },
+        {
+            "name": "charge_controller_target (3)",
+            "type": "ccs-debug",
+            "request": "launch",
+            "projectInfo": {
+                "name": "charge_controller_target",
+                "resourceId": "/charge_controller_target/src/target_main.c"
+            }
         }
     ]
 }

+ 60 - 0
controller_target.syscfg

@@ -0,0 +1,60 @@
+/**
+ * These arguments were used when this file was generated. They will be automatically applied on subsequent loads
+ * via the GUI or CLI. Run CLI with '--help' for additional information on how to override these arguments.
+ * @cliArgs --device "MSPM0L130X" --part "Default" --package "SOT-16(DYY)" --product "mspm0_sdk@2.04.00.06"
+ * @v2CliArgs --device "MSPM0L1304" --package "SOT-16(DYY)" --product "mspm0_sdk@2.04.00.06"
+ * @versions {"tool":"1.22.0+3893"}
+ */
+
+/**
+ * Import the modules used in this configuration.
+ */
+const I2C           = scripting.addModule("/ti/driverlib/I2C", {}, false);
+const I2C1          = I2C.addInstance();
+const I2C2          = I2C.addInstance();
+const SYSCTL        = scripting.addModule("/ti/driverlib/SYSCTL");
+const ProjectConfig = scripting.addModule("/ti/project_config/ProjectConfig");
+
+/**
+ * Write custom configuration values to the imported modules.
+ */
+I2C1.$name                             = "I2C_target";
+I2C1.basicEnableTarget                 = true;
+I2C1.basicTargetAddress                = 0x48;
+I2C1.peripheral.$assign                = "I2C0";
+I2C1.peripheral.sdaPin.$assign         = "PA0";
+I2C1.peripheral.sclPin.$assign         = "PA1/NRST";
+I2C1.sdaPinConfig.$name                = "ti_driverlib_gpio_GPIOPinGeneric0";
+I2C1.sdaPinConfig.hideOutputInversion  = scripting.forceWrite(false);
+I2C1.sdaPinConfig.onlyInternalResistor = scripting.forceWrite(false);
+I2C1.sdaPinConfig.passedPeripheralType = scripting.forceWrite("Digital");
+I2C1.sdaPinConfig.enableConfig         = true;
+I2C1.sclPinConfig.$name                = "ti_driverlib_gpio_GPIOPinGeneric1";
+I2C1.sclPinConfig.hideOutputInversion  = scripting.forceWrite(false);
+I2C1.sclPinConfig.onlyInternalResistor = scripting.forceWrite(false);
+I2C1.sclPinConfig.passedPeripheralType = scripting.forceWrite("Digital");
+I2C1.sclPinConfig.enableConfig         = true;
+
+const Board                       = scripting.addModule("/ti/driverlib/Board", {}, false);
+Board.peripheral.$assign          = "DEBUGSS";
+Board.peripheral.swclkPin.$assign = "PA20";
+Board.peripheral.swdioPin.$assign = "PA19";
+
+I2C2.$name                             = "I2C_controller";
+I2C2.basicEnableController             = true;
+I2C2.peripheral.$assign                = "I2C1";
+I2C2.peripheral.sdaPin.$assign         = "PA18";
+I2C2.peripheral.sclPin.$assign         = "PA17/OPA1.IN0-";
+I2C2.sdaPinConfig.$name                = "ti_driverlib_gpio_GPIOPinGeneric2";
+I2C2.sdaPinConfig.hideOutputInversion  = scripting.forceWrite(false);
+I2C2.sdaPinConfig.onlyInternalResistor = scripting.forceWrite(false);
+I2C2.sdaPinConfig.passedPeripheralType = scripting.forceWrite("Digital");
+I2C2.sclPinConfig.$name                = "ti_driverlib_gpio_GPIOPinGeneric3";
+I2C2.sclPinConfig.hideOutputInversion  = scripting.forceWrite(false);
+I2C2.sclPinConfig.onlyInternalResistor = scripting.forceWrite(false);
+I2C2.sclPinConfig.passedPeripheralType = scripting.forceWrite("Digital");
+
+SYSCTL.disableNRSTPin     = true;
+SYSCTL.peripheral.$assign = "SYSCTL";
+
+ProjectConfig.migrationCondition = true;

+ 2 - 3
src/i2c_comm/mcu_slave.c

@@ -4,7 +4,7 @@ References: https://stackoverflow.com/questions/246127/why-is-volatile-needed-in
 */
 
 #include "src/battery_data/battery.h"
-#include "src/peripherals/dac/dac.h"
+//#include "src/peripherals/dac/dac.h"
 #include "src/interfaces/mcu_slave_interface.h"
 #include "ti/driverlib/dl_i2c.h"
 #include "ti_msp_dl_config.h"
@@ -89,8 +89,7 @@ void mcu_i2c_handle(I2C_Regs *i2c) {
                     // channels, how to handle that?-> ans: with slot_id, since each slots
                     // will be connected to each channels of the same DAC, address is same
                     // channels change
-                    DL_GPIO_setPins(GPIO_Battery_Charging_PORT, GPIO_Battery_Charging_PIN_PB4_PIN);
-                    DAC_SingleWrite(current);
+                    //DAC_SingleWrite(current);
                 } else if (current < 0) {
                     // Calibrate discharge current for PWM
                     // TODO: PWM function develop

+ 0 - 103
src/i2c_controller.syscfg

@@ -1,103 +0,0 @@
-/**
- * These arguments were used when this file was generated. They will be automatically applied on subsequent loads
- * via the GUI or CLI. Run CLI with '--help' for additional information on how to override these arguments.
- * @cliArgs --device "MSPM0G350X" --part "Default" --package "LQFP-64(PM)" --product "mspm0_sdk@2.03.00.08"
- * @v2CliArgs --device "MSPM0G3507" --package "LQFP-64(PM)" --product "mspm0_sdk@2.03.00.08"
- * @versions {"tool":"1.22.0+3893"}
- */
-
-/**
- * Import the modules used in this configuration.
- */
-const Board = scripting.addModule("/ti/driverlib/Board");
-const CRC   = scripting.addModule("/ti/driverlib/CRC");
-const GPIO  = scripting.addModule("/ti/driverlib/GPIO", {}, false);
-const GPIO1 = GPIO.addInstance();
-const GPIO2 = GPIO.addInstance();
-const GPIO3 = GPIO.addInstance();
-const I2C   = scripting.addModule("/ti/driverlib/I2C", {}, false);
-const I2C1  = I2C.addInstance();
-const I2C2  = I2C.addInstance();
-
-/**
- * Write custom configuration values to the imported modules.
- */
-
-CRC.polynomial = "16_POLYNOMIAL";
-CRC.seed       = 0xFFFF;
-
-GPIO1.$name                         = "GPIO_Battery_Charging";
-GPIO1.port                          = "PORTB";
-GPIO1.associatedPins.create(2);
-GPIO1.associatedPins[0].$name       = "PIN_PB0";
-GPIO1.associatedPins[0].pin.$assign = "PB0";
-GPIO1.associatedPins[1].$name       = "PIN_PB4";
-GPIO1.associatedPins[1].pin.$assign = "PB4";
-
-GPIO2.$name                         = "GPIO_Battery_Discharging";
-GPIO2.port                          = "PORTB";
-GPIO2.associatedPins.create(2);
-GPIO2.associatedPins[0].$name       = "PIN_PB8";
-GPIO2.associatedPins[0].pin.$assign = "PB8";
-GPIO2.associatedPins[1].$name       = "PIN_PB12";
-GPIO2.associatedPins[1].pin.$assign = "PB12";
-
-GPIO3.$name                         = "LDAC_PIN";
-GPIO3.port                          = "PORTA";
-GPIO3.associatedPins[0].$name       = "PIN_PA8";
-GPIO3.associatedPins[0].pin.$assign = "PA8";
-
-I2C1.basicEnableController             = true;
-I2C1.advControllerTXFIFOTRIG           = "BYTES_1";
-I2C1.advAnalogGlitchFilter             = "DISABLED";
-I2C1.intController                     = ["ARBITRATION_LOST","NACK","RXFIFO_TRIGGER","RX_DONE","TX_DONE"];
-I2C1.$name                             = "I2C_controller";
-I2C1.basicTargetAddress                = 0x48;
-I2C1.peripheral.sdaPin.$assign         = "PA16";
-I2C1.peripheral.sclPin.$assign         = "PA15";
-I2C1.sdaPinConfig.$name                = "ti_driverlib_gpio_GPIOPinGeneric0";
-I2C1.sdaPinConfig.hideOutputInversion  = scripting.forceWrite(false);
-I2C1.sdaPinConfig.onlyInternalResistor = scripting.forceWrite(false);
-I2C1.sdaPinConfig.passedPeripheralType = scripting.forceWrite("Digital");
-I2C1.sdaPinConfig.enableConfig         = true;
-I2C1.sdaPinConfig.internalResistor     = "PULL_UP";
-I2C1.sclPinConfig.$name                = "ti_driverlib_gpio_GPIOPinGeneric1";
-I2C1.sclPinConfig.hideOutputInversion  = scripting.forceWrite(false);
-I2C1.sclPinConfig.onlyInternalResistor = scripting.forceWrite(false);
-I2C1.sclPinConfig.passedPeripheralType = scripting.forceWrite("Digital");
-I2C1.sclPinConfig.enableConfig         = true;
-I2C1.sclPinConfig.internalResistor     = "PULL_UP";
-
-I2C2.$name                             = "I2C_target";
-I2C2.basicEnableTarget                 = true;
-I2C2.enableDMAEvent1                   = false;
-I2C2.enableDMAEvent2                   = false;
-I2C2.basicTargetAddress                = 0x48;
-I2C2.intTarget                         = ["RXFIFO_TRIGGER","START","STOP","TXFIFO_TRIGGER"];
-I2C2.peripheral.sdaPin.$assign         = "PA0";
-I2C2.peripheral.sclPin.$assign         = "PA1";
-I2C2.sdaPinConfig.$name                = "ti_driverlib_gpio_GPIOPinGeneric2";
-I2C2.sdaPinConfig.hideOutputInversion  = scripting.forceWrite(false);
-I2C2.sdaPinConfig.onlyInternalResistor = scripting.forceWrite(false);
-I2C2.sdaPinConfig.passedPeripheralType = scripting.forceWrite("Digital");
-I2C2.sdaPinConfig.enableConfig         = true;
-I2C2.sclPinConfig.$name                = "ti_driverlib_gpio_GPIOPinGeneric3";
-I2C2.sclPinConfig.hideOutputInversion  = scripting.forceWrite(false);
-I2C2.sclPinConfig.onlyInternalResistor = scripting.forceWrite(false);
-I2C2.sclPinConfig.passedPeripheralType = scripting.forceWrite("Digital");
-I2C2.sclPinConfig.enableConfig         = true;
-
-const SYSCTL                 = scripting.addModule("/ti/driverlib/SYSCTL", {}, false);
-SYSCTL.forceDefaultClkConfig = true;
-SYSCTL.clockTreeEn           = true;
-
-/**
- * Pinmux solution for unlocked pins/peripherals. This ensures that minor changes to the automatic solver in a future
- * version of the tool will not impact the pinmux you originally saw.  These lines can be completely deleted in order to
- * re-solve from scratch.
- */
-Board.peripheral.$suggestSolution          = "DEBUGSS";
-Board.peripheral.swclkPin.$suggestSolution = "PA20";
-Board.peripheral.swdioPin.$suggestSolution = "PA19";
-I2C1.peripheral.$suggestSolution           = "I2C1";
-I2C2.peripheral.$suggestSolution           = "I2C0";

+ 37 - 0
src/interfaces/i2c_peripherals_scan.c

@@ -0,0 +1,37 @@
+#include "ti/driverlib/dl_i2c.h"
+#include "ti_msp_dl_config.h"
+#include <stdio.h>
+#include <stdint.h>
+
+
+/*
+Scans all the addresses of the peripherals:
+*/
+void I2C_scanBus(I2C_Regs *i2c) {
+    printf("Scanning I2C Bus...\n");
+
+    // **Step 1: Reset I2C Controller if Busy**
+    if (DL_I2C_getControllerStatus(i2c) & DL_I2C_CONTROLLER_STATUS_BUSY_BUS) {
+        printf("I2C Bus Busy! Resetting I2C Controller...\n");
+        DL_I2C_disableController(i2c);  // Disable I2C
+        delay_cycles(20000);
+        DL_I2C_enableController(i2c);   // Re-enable I2C
+        delay_cycles(20000);
+    }
+
+    // **Step 2: Scan I2C Bus**
+    for (uint8_t addr = 0x08; addr < 0x78; addr++) {  // Valid I2C Address Range
+        DL_I2C_startControllerTransfer(i2c, addr, DL_I2C_CONTROLLER_DIRECTION_RX, 1);
+        delay_cycles(5000);
+        
+        if (!(DL_I2C_getControllerStatus(i2c) & DL_I2C_CONTROLLER_STATUS_ERROR)) {
+            printf("Device found at: 0x%02X\n", addr);
+        }else {
+            // Clear the error by resetting the I2C controller
+            DL_I2C_disableController(i2c);
+            DL_I2C_enableController(i2c);
+        }
+    }
+
+    //printf("I2C Scan Complete!\n");
+}

+ 6 - 0
src/interfaces/i2c_peripherals_scan.h

@@ -0,0 +1,6 @@
+#ifndef I2C_PERIPHERALS_SCAN_H_
+#define I2C_PERIPHERALS_SCAN_H_
+
+void I2C_scanBus(I2C_Regs *i2c);
+
+#endif

+ 1 - 1
src/peripherals/adc/adc.c

@@ -1,4 +1,4 @@
-#include "src/battery.h"
+#include "src/battery_data/battery.h"
 #include "src/interfaces/i2c_controller_interface.h"
 #include "ti/driverlib/dl_i2c.h"
 #include "ti/driverlib/m0p/dl_core.h"

+ 3 - 8
src/peripherals/adc/adc.h

@@ -2,8 +2,7 @@
 #ifndef ADC_H_
 #include "ti/driverlib/dl_i2c.h"
 #include "ti_msp_dl_config.h"
-#include "src/battery.h"
-
+#include "src/battery_data/battery.h"
 
 //Maximum packet sizes
 /*#define I2C_TX_MAX_PACKET_SIZE (16)
@@ -35,11 +34,7 @@ typedef enum{
 } ADC_PARAMS;*/
 
 
-//void ADC_SetConfigurationBytes(ADC_PARAMS params);
-//bool ADC_CheckReadyBit(uint8_t slot_id, ADC_PARAMS params);
-//int16_t ADC_ReadData(uint8_t slot_id, ADC_PARAMS params);
-//void Battery_UpdateVoltage(ADC_PARAMS params);
-//void Battery_UpdateCurrent(ADC_PARAMS params);
+
 void updateADCReading_multichannel(uint8_t slot, uint8_t channel); //belongs to battery module
-//void Battery_ReadState(uint8_t slot_id); //belongs to battery module
+
 #endif

+ 0 - 156
src/peripherals/dac/dac.c

@@ -1,156 +0,0 @@
-#include "src/peripherals/dac/dac.h"
-#include "src/interfaces/i2c_controller_interface.h"
-#include "ti/driverlib/dl_i2c.h"
-#include "ti_msp_dl_config.h"
-#include <stdint.h>
-#include <stdio.h>
-
-// The device updates all DAC analog output(vout) at the same time
-
-void DAC_UpdateOutput() {
-  uint8_t general_call_command = 0x08; // General Call Update Command
-  while (DL_I2C_getControllerStatus(I2C_controller_INST) &
-         DL_I2C_CONTROLLER_STATUS_BUSY_BUS)
-    ;
-
-  // Start I2C transaction
-  DL_I2C_startControllerTransfer(I2C_controller_INST, 0x00,
-                                 DL_I2C_CONTROLLER_DIRECTION_TX, 1);
-
-  while (DL_I2C_getControllerStatus(I2C_controller_INST) &
-         DL_I2C_CONTROLLER_STATUS_BUSY_BUS)
-    ;
-
-  DL_I2C_fillControllerTXFIFO(I2C_controller_INST, &general_call_command, 1);
-
-  //printf("DAC Outputs Updated via General Call Software Update!\n");
-}
-
-/**Function for FAST write command, sending values over I2c to every channel of
- * DAC**/
-bool DAC_fastWrite(uint16_t channel_a_value) {
-
-  /*DAC has a 12 bit resolution that ranges from 0 to 4095.
-  0x00: sets the Power Mode to NORMAL for Channel A
-  (channel_a_value >> 8): shifts the value to 8 places right and gives upper 4
-  bits VoutA channel, rest channels are powered down Each Vout pins is driven by
-  its own output buffer with a gain of 1 or 2.
-
-  */
-
-  uint8_t output_buffer[8];
-
-  output_buffer[0] = 0x01;
-  output_buffer[1] = 0x00;
-
-  // Normal Mode: PD0 and PD1 is 00
-  output_buffer[2] = (0x00) | ((channel_a_value >> 8) & 0x0F);
-  output_buffer[3] = channel_a_value & 0xFF;
-
-  output_buffer[4] = 0x01;
-  output_buffer[5] = 0x00;
-
-  output_buffer[6] = 0x01;
-  output_buffer[7] = 0x00;
-
-  if (!DL_I2C_CONTROLLER_STATUS_ADDR_ACK) {
-    printf("DAC Address Failure");
-    return false;
-  }
-
-  i2c_hal.write(DAC_TARGET_BASE_ADDRESS, (uint8_t *)&output_buffer, 8);
-  //printf("Output Buffer[2]: 0x%02X, Output Buffer[3]: 0x%02X\n",
-  //      output_buffer[2], output_buffer[3]);
-  //printf("DAC Fast write Successful!\n");
-  DAC_UpdateOutput();
-  return true;
-}
-
-/*
-LDAC pin is set to HIGH or LOW
-LDAC "HIGH": until the end of the positive pulse of the 8th clock of the 2nd
-byte LDAC "LOW": negative pulse of the 8th clock of the 2nd byte and stays low
-until the rising edge of the 9th clock of the 3rd byte LDAC pin resumes normal
-function after STOP bit Device address of 0x60 till 0x67, default is 0x60
-*/
-
-/*void ldac_pin_init() {
-  // Default set to HIGH
-  DL_GPIO_setPins(LDAC_PIN_PORT, LDAC_PIN_PIN_PA8_PIN);
-}
-
-void set_ldac(bool level) {
-  if (level) {
-    // Set LDAC Pins HIGH
-    DL_GPIO_setPins(LDAC_PIN_PORT, LDAC_PIN_PIN_PA8_PIN);
-  } else {
-    // Set LDAC Pins LOW
-    DL_GPIO_clearPins(LDAC_PIN_PORT, LDAC_PIN_PIN_PA8_PIN);
-  }
-}*/
-
-/*General Call Read Address: Command to read I2C address bits of the device*/
-uint8_t DAC_ReadCurrentAddress() {
-  uint8_t current_address = 0;
-  // General call address bits
-  uint8_t command = 0xC3;
-  while (DL_I2C_getControllerStatus(I2C_controller_INST) &
-         DL_I2C_CONTROLLER_STATUS_BUSY_BUS)
-    ;
-
-  // Send General Call Read Address Command
-  DL_I2C_startControllerTransfer(I2C_controller_INST, I2C_GENERAL_CALL_ADDR,
-                                 DL_I2C_CONTROLLER_DIRECTION_TX, 1);
-  DL_I2C_fillControllerTXFIFO(I2C_controller_INST, &command, 1);
-
-  while (DL_I2C_getControllerStatus(I2C_controller_INST) &
-         DL_I2C_CONTROLLER_STATUS_BUSY_BUS)
-    ;
-
-  // Read the response (Current DAC I2C address)
-  DL_I2C_startControllerTransfer(I2C_controller_INST, I2C_GENERAL_CALL_ADDR,
-                                 DL_I2C_CONTROLLER_DIRECTION_RX, 1);
-  current_address = DL_I2C_receiveControllerData(I2C_controller_INST);
-
-  // Debug
-  //printf("Current DAC I2C Address: 0x%02X\n", current_address);
-  return current_address;
-}
-
-/*
-Single Write for DAC: writes the input data to a selected single DAC input
-register and also to its EEPROM. DAC1: Channel Selection Bits
-    - 00 Channel A
-    - 01 Channel B
-    - 10 Channel C
-    - 11 Channel D
-
-UDAC: DAC latch bit
-    - 0: Upload
-    - 1: Do not upload
-*/
-bool DAC_SingleWrite(uint16_t channel_value) {
-  if(channel_value > 4095){
-    printf("DAC Error: channel_value out of range. Must be between 0 and 4095\n");
-    return false;
-  }
-  uint8_t data_length = 3;
-  uint8_t output_buffer_SingleWrite[data_length];
-  //C2 C1 C0 W1 W0: 01011 | DAC1 DAC0: 00| UDAC:0
-  output_buffer_SingleWrite[0] = 0x5A; //0x58 for Channel 0
-  output_buffer_SingleWrite[1] = (0x10) | ((channel_value >> 8) & 0x0F);
-  output_buffer_SingleWrite[2] = (channel_value & 0xFF);
-
-  // Write data to DAC
-  if (!i2c_hal.write(DAC_TARGET_BASE_ADDRESS, output_buffer_SingleWrite, data_length)) {
-        printf("I2C DAC Write Error: Failed to write to DAC.\n");
-        return false;
-    }
-
-  DAC_UpdateOutput();
-
-  //printf("Output_Buffer_1: 0x%02X, Output_Buffer_2: 0x%02X\n", output_buffer_SingleWrite[1], output_buffer_SingleWrite[2]);
-
-  return true;
-
-}

+ 0 - 16
src/peripherals/dac/dac.h

@@ -1,16 +0,0 @@
-#ifndef DAC_H_
-#include "ti/driverlib/dl_i2c.h"
-#include "ti_msp_dl_config.h"
-#include <stdbool.h>
-
-#define DAC_TARGET_BASE_ADDRESS (0x60)
-//#define CHANNEL_A_VALUE (800) // in mAmps
-#define I2C_GENERAL_CALL_ADDR  0x00
-#define DAC_VREF_MV 2048
-
-bool DAC_fastWrite(uint16_t channel_a_value);
-void DAC_UpdateOutput();
-uint8_t DAC_ReadCurrentAddress();
-bool DAC_SingleWrite(uint16_t channel_value);
-
-#endif

+ 0 - 132
src/peripherals/mux/multiplexer.c

@@ -1,132 +0,0 @@
-#include "src/peripherals/mux/multiplexer.h"
-#include "ti/driverlib/dl_i2c.h"
-#include "ti_msp_dl_config.h"
-#include <stdio.h>
-#include <stdint.h>
-
-/*
-Multiplexer TCA9548A:
-Address:0x70
-The TCA9548A is example of a single-register device, which is controlled via I2C commands. Since it has 1 bit to enable or disable a channel, there is only 1 register
-needed, and the controller merely writes the register data after the target address, skipping the register number.
-ADC connected to channel 0
-Both SDA and SL lines of the multiplexer is connected to VIN through pull-up resistors
-The following is the general procedure for a controller to access a target device:
-1. If a controller wants to send data to a target:
-    • Controller-transmitter sends a START condition and addresses the target-receiver.
-    • Controller-transmitter sends data to target-receiver.
-    • Controller-transmitter terminates the transfer with a STOP condition.
-2. If a controller wants to receive or read data from a target:
-    • Controller-receiver sends a START condition and addresses the target-transmitter.
-    • Controller-receiver sends the requested register to read to target-transmitter.
-    • Controller-receiver receives data from the target-transmitter.
-    • Controller-receiver terminates the transfer with a STOP condition.
-The TCA9548A is example of a single-register device, which is controlled via I2C commands. Since it has 1 bit to enable or disable a channel, 
-there is only 1 register needed, and the controller merely writes the register data after the target address, skipping the register number.
-*/
-
-/*
-Scans all the addresses of the peripherals:
-*/
-void I2C_scanBus() {
-    printf("Scanning I2C Bus...\n");
-
-    // **Step 1: Reset I2C Controller if Busy**
-    if (DL_I2C_getControllerStatus(I2C_controller_INST) & DL_I2C_CONTROLLER_STATUS_BUSY_BUS) {
-        printf("I2C Bus Busy! Resetting I2C Controller...\n");
-        DL_I2C_disableController(I2C_controller_INST);  // Disable I2C
-        delay_cycles(20000);
-        DL_I2C_enableController(I2C_controller_INST);   // Re-enable I2C
-        delay_cycles(20000);
-    }
-
-    // **Step 2: Scan I2C Bus**
-    for (uint8_t addr = 0x08; addr < 0x78; addr++) {  // Valid I2C Address Range
-        DL_I2C_startControllerTransfer(I2C_controller_INST, addr, DL_I2C_CONTROLLER_DIRECTION_RX, 1);
-        delay_cycles(5000);
-        
-        if (!(DL_I2C_getControllerStatus(I2C_controller_INST) & DL_I2C_CONTROLLER_STATUS_ERROR)) {
-            printf("Device found at: 0x%02X\n", addr);
-        }else {
-            // Clear the error by resetting the I2C controller
-            DL_I2C_disableController(I2C_controller_INST);
-            DL_I2C_enableController(I2C_controller_INST);
-        }
-    }
-
-    //printf("I2C Scan Complete!\n");
-}
-
-/*Function for Multiplexer*/
-
-void Multiplexer_SelectChannel(uint8_t channel)
-{
-    if (channel > 7) {
-        printf("ERROR: Invalid Multiplexer Channel! Must be 0-7.\n");
-        return;
-    }
-    uint8_t data = (channel);
-    //printf("Selecting Multiplexer I2C Channel: 0x%02X\n", data);
-
-    // Ensure bus is idle before starting communication
-    while (DL_I2C_getControllerStatus(I2C_controller_INST) & DL_I2C_CONTROLLER_STATUS_BUSY_BUS);
-
-    // SEND Command to Multiplexer
-    DL_I2C_startControllerTransfer(I2C_controller_INST, MULTIPLEXER_I2C_ADDR, DL_I2C_CONTROLLER_DIRECTION_TX, 1);
-    DL_I2C_fillControllerTXFIFO(I2C_controller_INST, &data, 1);
-
-    // **Ensure STOP condition is sent**
-    while (DL_I2C_getControllerStatus(I2C_controller_INST) & DL_I2C_CONTROLLER_STATUS_BUSY_BUS);
-
-    // **Slightly Increase Delay for Multiplexer to Process Command**
-    delay_cycles(30000); 
-
-    // Verify Multiplexer Response:
-    //uint8_t response= 0x00;
-    DL_I2C_startControllerTransfer(I2C_controller_INST, MULTIPLEXER_I2C_ADDR, DL_I2C_CONTROLLER_DIRECTION_RX, 1);
-
-    // Wait for a response from the multiplexer
-    while (DL_I2C_getControllerStatus(I2C_controller_INST) & DL_I2C_CONTROLLER_STATUS_BUSY_BUS);
-    //uint8_t response = DL_I2C_receiveControllerData(I2C_controller_INST);
-
-    // **Debug: Print Expected vs. Received Response**
-    //printf("Multiplexer Response: 0x%02X (Expected: 0x%02X)\n", response, data);
-    
-    
-    // **CHECK FOR ADDRESS ACKNOWLEDGMENT**
-    //(if (!(DL_I2C_getControllerStatus(I2C_controller_INST) & DL_I2C_CONTROLLER_STATUS_ERROR)) {
-    //    printf("Multiplexer detected at 0x70.\n");
-    //    return;
-    //} else{
-    //    printf("ERROR: Multiplexer (0x70) detected.\n");
-    //}
-
-    // Wait for transaction completion
-    //while (DL_I2C_getControllerStatus(I2C_controller_INST) & DL_I2C_CONTROLLER_STATUS_BUSY_BUS);
-
-    //if(response != data){
-    //    printf("ERROR: Multiplexer did not set the correct channel!\n");
-        // **Retry Mechanism: Attempt to Set the Channel Again**
-    //    delay_cycles(10000);
-    //    Multiplexer_SelectChannel(channel);
-    //} else {
-    //    printf("Multiplexer Active Channel: 0x%X\n", data);
-    //    return;
-    //}
-}
-
-void Reset_I2C_Bus() {
-    printf("I2C Bus is stuck! Resetting...\n");
-    
-    // Disable I2C Controller
-    DL_I2C_disableController(I2C_controller_INST);
-    delay_cycles(50000);
-
-    // Re-enable I2C Controller
-    DL_I2C_enableController(I2C_controller_INST);
-    delay_cycles(50000);
-
-    // Check if bus is free now
-    uint32_t status = DL_I2C_getControllerStatus(I2C_controller_INST);
-    printf("I2C Bus Status After Reset: 0x%08X\n", status);
-}

+ 0 - 12
src/peripherals/mux/multiplexer.h

@@ -1,12 +0,0 @@
-#ifndef MULTIPLEXER_H_
-#define MULTIPLEXER_H_
-
-#include <stdint.h>
-
-#define MULTIPLEXER_I2C_ADDR           (0x70)
-//For Channel 0 Hex Value is 0x01
-#define I2C_CHANNEL                    (0x01)
-
-void Multiplexer_SelectChannel(uint8_t channel);
-void I2C_scanBus();
-#endif

+ 3 - 6
src/target_main.c

@@ -9,14 +9,12 @@
 //adc peripheral
 #include "src/peripherals/adc/adc.h"
 #include "src/peripherals/adc/adc_interface.h"
-// mux peripheral
-#include "src/peripherals/mux/multiplexer.h"
 #define DELAY_CYCLE  (1000000)
 //i2c:
 #include "ti/comm_modules/i2c/controller/i2c_comm_controller.h"
 //battery:
 #include "src/battery_data/battery.h"
-
+#include "src/interfaces/i2c_peripherals_scan.h"
 I2C_Instance gI2C;
 I2C_ResponseInfo gResponse;
 
@@ -158,10 +156,9 @@ int main(void){
     // Reset_I2C_Bus();
     NVIC_EnableIRQ(I2C_target_INST_INT_IRQN);
     NVIC_EnableIRQ(I2C_controller_INST_INT_IRQN);
-    // Multiplexer
-    Multiplexer_SelectChannel(I2C_CHANNEL);
+    printf("*******Scanning the peripherals********\n");
     //I2C Scanning
-    I2C_scanBus();
+    I2C_scanBus(I2C_controller_INST);
     I2C_init(&gI2C);
 
     while(1){

+ 1 - 1
targetConfigs/MSPM0G3507.ccxml → targetConfigs/MSPM0L1304.ccxml

@@ -15,7 +15,7 @@
                 <choice Name="SWD Mode - Aux COM port is target TDO pin" value="nothing"/>
             </property>
             <platform XML_version="1.2" id="platform_0">
-                <instance XML_version="1.2" desc="MSPM0G3507" href="devices/MSPM0G3507.xml" id="MSPM0G3507" xml="MSPM0G3507.xml" xmlpath="devices"/>
+                <instance XML_version="1.2" desc="MSPM0L1304" href="devices/MSPM0L1304.xml" id="MSPM0L1304" xml="MSPM0L1304.xml" xmlpath="devices"/>
             </platform>
         </connection>
     </configuration>

+ 9 - 0
targetConfigs/readme.txt

@@ -0,0 +1,9 @@
+The 'targetConfigs' folder contains target-configuration (.ccxml) files, automatically generated based
+on the device and connection settings specified in your project on the Properties > General page.
+
+Please note that in automatic target-configuration management, changes to the project's device and/or
+connection settings will either modify an existing or generate a new target-configuration file. Thus,
+if you manually edit these auto-generated files, you may need to re-apply your changes. Alternatively,
+you may create your own target-configuration file for this project and manage it manually. You can
+always switch back to automatic target-configuration management by checking the "Manage the project's
+target-configuration automatically" checkbox on the project's Properties > General page.

+ 381 - 0
ti/comm_modules/i2c/controller/i2c_comm_controller.c

@@ -0,0 +1,381 @@
+/*
+ * Copyright (c) 2024, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "i2c_comm_controller.h"
+#include <stdio.h>
+#include<stdint.h>
+
+#define LEFT_SHIFT_8(x)     ((x) << 8)
+#define RIGHT_SHIFT_8(x)    ((x) >> 8)
+
+
+/* Function Declarations */
+/**
+ * @brief     Calculates CRC 16 for an array of 8-bit data
+ * @param[in] ptr   Pointer to the data to compute CRC
+ * @param[in] size  size of the array of data in bytes
+ * @return    Returns the CRC value
+ */
+static uint16_t CRC_calc16(uint8_t* ptr,uint8_t size);
+
+/**
+ * @brief     Prepares I2C Tx FIFO and issues I2C write command
+ * @param[in] I2C_handle     Pointer to I2C_Instance
+ * @param[in] targetAddr     I2C Target Address
+ */
+static void I2C_sendBuffer(I2C_Instance *I2C_handle,uint8_t targetAddr);
+
+
+/* Helper Functions */
+/**
+ * @brief     32 bit to 8 bit
+ * @param[in] b  pointer to unsigned 8 bit output
+ * @param[in] u32  unsigned 32 bit input
+ */
+static void u8From32(uint8_t *b, uint32_t u32)
+{
+    b[0] = (uint8_t)u32;
+    b[1] = (uint8_t)(u32 = RIGHT_SHIFT_8(u32));
+    b[2] = (uint8_t)(u32 = RIGHT_SHIFT_8(u32));
+    b[3] = (uint8_t)(u32 = RIGHT_SHIFT_8(u32));
+}
+
+/**
+ * @brief     16 bit to 8 bit
+ * @param[in] b  pointer to unsigned 8 bit output
+ * @param[in] u16  unsigned 16 bit input
+ */
+static void u8From16(uint8_t *b, uint16_t u16)
+{
+    b[0] = (uint8_t)u16;
+    b[1] = (uint8_t)(u16 = RIGHT_SHIFT_8(u16));
+}
+
+/**
+ * @brief     8 bit to 32 bit
+ * @param[in] b  pointer to unsigned 8 bit output
+ * @return    32 bit result
+ */
+static uint32_t u32(uint8_t *b)
+{
+  uint32_t u;
+  u = b[3];
+  u = LEFT_SHIFT_8(u) + b[2];
+  u = LEFT_SHIFT_8(u) + b[1];
+  u = LEFT_SHIFT_8(u) + b[0];
+  return u;
+}
+
+/**
+ * @brief     8 bit to 16 bit
+ * @param[in] b  pointer to unsigned 8 bit output
+ * @return    16 bit result
+ */
+static uint16_t u16(uint8_t *b)
+{
+  uint16_t u;
+  u = b[1];
+  u = LEFT_SHIFT_8(u) + b[0];
+  return u;
+}
+
+#ifdef CONFIG_MSPM0G351X
+static uint16_t CRC_calc16(uint8_t* ptr,uint8_t size)
+{
+    uint8_t remainder = (size & 1);
+    uint16_t size16 = size>>1;
+
+    uint16_t checkSum = DL_CRCP_calculateBlock16(CRCP0,CRCP_SEED,
+                                                    (uint16_t*)ptr,size16);
+
+    if(remainder)
+    {
+        DL_CRCP_feedData8(CRCP0,ptr[size - 1]);
+        checkSum = ((uint16_t) DL_CRCP_getResult16(CRCP0));
+    }
+
+    return checkSum;
+}
+
+#else
+static uint16_t CRC_calc16(uint8_t* ptr,uint8_t size)
+{
+    uint8_t remainder = (size & 1);
+    uint16_t size16 = size>>1;
+
+    uint16_t checkSum = DL_CRC_calculateBlock16(CRC,CRC_SEED,
+                                                    (uint16_t*)ptr,size16);
+
+    if(remainder)
+    {
+        DL_CRC_feedData8(CRC,ptr[size - 1]);
+        checkSum = ((uint16_t) DL_CRC_getResult16(CRC));
+    }
+
+    return checkSum;
+}
+
+#endif
+
+/**
+ * @brief     Resets pointer and length of the buffer
+ * @param[in] frame  Pointer to BufferInfo (Rx,Tx)
+ */
+__STATIC_INLINE void I2C_clearBuffer(BufferInfo *frame)
+{
+    frame->ptr = 0;
+    frame->len = 0;
+}
+/*Initialize the I2C instance structure:
+* Clears the Receive and Tramnsmit Buffer
+* Resets data length to 0
+* Disables CRC
+* Sets the initial I2C status to IDLE
+* Resets Error Status
+*/
+void I2C_init(I2C_Instance *I2C_handle)
+{
+    I2C_clearBuffer(&I2C_handle->rxMsg);
+    I2C_clearBuffer(&I2C_handle->txMsg);
+ 
+    I2C_handle->dataLen = 0;
+    I2C_handle->isCrc = false;
+    I2C_handle->status = I2C_STATUS_IDLE;
+    I2C_handle->error = ERROR_TYPE_NONE;
+}
+
+/*
+Send I2C command:
+* Resets the transmit buffer to 0: Prepares for new data
+* (command->commandType): Specifies whether the command is READ or WRITE
+* (command->crcEnable ? CRC_MASK : (0x00)): Adds a CRC FLag if enabled
+* ((command->dataSize - 1) & LEN_MASK) : encodes the data size in control byte
+* I2C_handle->txMsg.ptr += 4 -> moves the pointer forward 4 bytes (since address is 32 bits)
+* READ operation expects dataSize
+* Loops through the command array and stores it to the buffer.
+* I2C_handle->txMsg.len = I2C_handle->txMsg.ptr -> final length of the TX message
+*/
+void I2C_sendCommand(I2C_Instance *I2C_handle,I2C_CommandInfo *command)
+{  
+    /* Prepare TX Buffer */
+    I2C_handle->txMsg.ptr = 0;
+
+    /* Control Byte */
+    I2C_handle->txMsg.buffer[I2C_handle->txMsg.ptr++] = (command->commandType) | (command->crcEnable ? CRC_MASK : (0x00)) | ((command->dataSize - 1) & LEN_MASK) ;
+
+    u8From32(&I2C_handle->txMsg.buffer[I2C_handle->txMsg.ptr],command->addr);
+    I2C_handle->txMsg.ptr += 4;
+
+    /* For Read Command */
+    I2C_handle->dataLen = command->dataSize;
+    
+    /* For Write Command */
+    if(command->commandType == WRITE_COMMAND)
+    {
+        I2C_handle->dataLen = 1;
+        
+        for(int i = 0 ; i < command->dataSize ; i++)
+        {
+            I2C_handle->txMsg.buffer[I2C_handle->txMsg.ptr++] = command->dataArray[i];
+        }
+    }
+
+    /* CRC */
+    I2C_handle->isCrc = false;
+    if(command->crcEnable)
+    {
+        I2C_handle->isCrc = true;
+        uint16_t Crc = CRC_calc16((&I2C_handle->txMsg.buffer[0]),I2C_handle->txMsg.ptr);
+        u8From16(&I2C_handle->txMsg.buffer[I2C_handle->txMsg.ptr],Crc);
+        I2C_handle->txMsg.ptr += 2;
+    }
+
+
+    I2C_handle->txMsg.len = I2C_handle->txMsg.ptr;
+
+    I2C_sendBuffer(I2C_handle, command->targetAddr);
+
+    /* Wait until I2C Controller is idle */
+    while (!(
+        DL_I2C_getControllerStatus(I2C_controller_INST) & DL_I2C_CONTROLLER_STATUS_IDLE))
+        ;
+}
+
+
+static void I2C_sendBuffer(I2C_Instance *I2C_handle,uint8_t targetAddr)
+{
+    I2C_handle->txMsg.ptr = 0;
+
+    I2C_handle->txMsg.ptr = DL_I2C_fillControllerTXFIFO(I2C_controller_INST, &I2C_handle->txMsg.buffer[0], I2C_handle->txMsg.len);
+
+    /* Enable TXFIFO trigger interrupt if there are more bytes to send */
+    if (I2C_handle->txMsg.ptr < I2C_handle->txMsg.len) 
+    {
+        DL_I2C_enableInterrupt(
+            I2C_controller_INST, DL_I2C_INTERRUPT_CONTROLLER_TXFIFO_TRIGGER);
+    } else
+    {
+        DL_I2C_disableInterrupt(
+            I2C_controller_INST, DL_I2C_INTERRUPT_CONTROLLER_TXFIFO_TRIGGER);
+    }
+
+
+    I2C_handle->status = I2C_STATUS_TX_STARTED;
+
+    /* Wait until I2C Controller is idle */
+    while (!(
+        DL_I2C_getControllerStatus(I2C_controller_INST) & DL_I2C_CONTROLLER_STATUS_IDLE))
+        ;
+
+    DL_I2C_startControllerTransfer(
+        I2C_controller_INST, targetAddr, DL_I2C_CONTROLLER_DIRECTION_TX, I2C_handle->txMsg.len);
+
+
+    // added to avoid infinite wait...
+    /* Wait until the Controller sends all bytes */
+    int timeout = 100000;
+    while ((I2C_handle->status != I2C_STATUS_TX_COMPLETE) &&
+            (I2C_handle->status != I2C_STATUS_ERROR)  && (--timeout)) {
+        printf("Wait till the bus is idle.\n");
+        __WFE();
+    }
+    /* Handle timeout error */
+    if (timeout == 0) {
+        printf("ERROR: Timeout waiting for I2C transmission to complete!\n");
+        I2C_handle->status = I2C_STATUS_ERROR;
+    }
+
+    /* Wait until I2C bus is Idle */
+    while (DL_I2C_getControllerStatus(I2C_controller_INST) &
+            DL_I2C_CONTROLLER_STATUS_BUSY_BUS)
+            ;
+        
+
+    /* Trap if there was an error */
+    if (DL_I2C_getControllerStatus(I2C_controller_INST) &
+        DL_I2C_CONTROLLER_STATUS_ERROR) {
+        //Testing for error trap:
+        uint32_t status = DL_I2C_getControllerStatus(I2C_controller_INST);
+        printf("I2C ERROR: Controller status = 0x%X\n", status);
+        __BKPT(0);
+    }
+}
+
+/*
+This function returns and receives the data from the I2C peripheral.
+The total expected length of the response is calculated as:
+* CTRL_SIZE: The control byte size
+* I2C_handle->dataLen: The data length that is expected in response
+* (I2C_handle->isCrc ? CRC_SIZE : 0) : if the CRC checking is enabled, add the CRC_Size to the expected length
+* Calls DL_I2C_startControllerTransfer to start an I2C read transaction.
+    * I2C_controller_INST: Reference to the the I2C controller instance
+    * targetAddr: I2C address of the device
+    * DL_I2C_CONTROLLER_DIRECTION_RX: indicates this is a READ operation
+    * expectedLen: The no. of bytes expected in the response
+* Waits until data reception is complete
+* Retries if a NACK error occurs
+* Wait for the bus to become idle.
+*/
+void I2C_getResponse(I2C_Instance* I2C_handle,uint32_t targetAddr)
+{   
+    
+    uint32_t expectedLen = CTRL_SIZE + I2C_handle->dataLen + (I2C_handle->isCrc ? CRC_SIZE : 0);
+
+    DL_I2C_startControllerTransfer(
+        I2C_controller_INST, targetAddr, DL_I2C_CONTROLLER_DIRECTION_RX, expectedLen);
+    
+    if (DL_I2C_getControllerStatus(I2C_controller_INST) & DL_I2C_CONTROLLER_STATUS_ERROR){
+        printf("ERROR: ADC(0x%X) not responding.\n", targetAddr);
+        return;
+    }else{
+        printf("ADC(0x%X) acknowledged.\n",targetAddr);
+    }
+
+
+    /* Wait for all bytes to be received in interrupt */
+    while (I2C_handle->status != I2C_STATUS_RX_COMPLETE) 
+    {
+        /* Resend the Read Command if it is N'ACKed */
+        if(I2C_handle->status == I2C_STATUS_ERROR)
+        {
+            I2C_handle->status = I2C_STATUS_RX_STARTED;
+            delay_cycles(10000);
+            DL_I2C_startControllerTransfer(
+                I2C_controller_INST, targetAddr, DL_I2C_CONTROLLER_DIRECTION_RX, expectedLen);
+        }
+    }
+
+    /* Wait until I2C bus is Idle */
+    while (DL_I2C_getControllerStatus(I2C_controller_INST) &
+            DL_I2C_CONTROLLER_STATUS_BUSY_BUS)
+        ;
+}
+
+void I2C_decodeResponse(I2C_Instance *I2C_handle,I2C_ResponseInfo *response)
+{
+    response->received = true;
+
+    /* Length stored in frame is 1 less than actual length */
+    response->dataSize = ( I2C_handle->rxMsg.buffer[CTRL_IDX] & LEN_MASK ) + 1;
+
+    response->status = ERROR_TYPE_NONE;
+
+    if(I2C_handle->rxMsg.buffer[CTRL_IDX] & ERROR_MASK)
+    {
+        /* Store error code sent by target */
+        response->status = (ErrorType) I2C_handle->rxMsg.buffer[RESP_DATA_IDX];
+    }
+
+    response->frame.ctrl = I2C_handle->rxMsg.buffer[CTRL_IDX];
+
+    for(int i = 0; i < MAX_DATA_SIZE; i++)
+    {
+        if(i < response->dataSize)
+        {
+            response->frame.data[i] = I2C_handle->rxMsg.buffer[RESP_DATA_IDX + i];
+        }
+        /* Resetting extra space to zero*/
+        else
+        {
+            response->frame.data[i] = 0;
+        }
+    }
+
+    if(I2C_handle->isCrc)
+    {
+        response->frame.crc = u16(&I2C_handle->rxMsg.buffer[I2C_handle->rxMsg.len - CRC_SIZE]);
+    }
+}
+
+
+
+

+ 255 - 0
ti/comm_modules/i2c/controller/i2c_comm_controller.h

@@ -0,0 +1,255 @@
+/*
+ * Copyright (c) 2024, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * 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.
+ */
+/*!****************************************************************************
+ *  @file       i2c_comm_controller.h
+ *  @brief      I2C communication Module
+ *
+ * 
+ *  @anchor i2c_comm_controller
+ *  # Overview
+ *
+ *  APIs for I2C communication module
+ *
+ *  <hr>
+ ******************************************************************************/
+
+#ifndef I2C_COMM_CONTROLLER_H_
+#define I2C_COMM_CONTROLLER_H_
+
+#include "ti_msp_dl_config.h"
+#include <stdbool.h>
+
+#define CRC_SEED 0xFFFF
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* FRAME STRUCTURE */
+
+/* Control Byte */
+/*! @brief Control index */
+#define CTRL_IDX                     (0)
+/*! @brief Control size */
+#define CTRL_SIZE                    (1)
+/*! @brief Control mask */
+#define CMD_MASK                     (0x80)
+/*! @brief CRC mask */
+#define CRC_MASK                     (0x40)
+/*! @brief Length mask */
+#define LEN_MASK                     (0x3F)
+/*! @brief Write command */
+#define WRITE_CMD                    (0x80)
+/*! @brief Read command */
+#define READ_CMD                     (0x00)
+/*! @brief Error Mask */
+#define ERROR_MASK                   (0x80)  
+
+/* Address  */
+/*! @brief Address index */
+#define ADDR_IDX                    (CTRL_IDX + CTRL_SIZE)
+/*! @brief Address size */
+#define ADDR_SIZE                   (4)
+/*! @brief Address range start */
+#define ADDR_RANGE_START            (0x20100000)
+/*! @brief Address range end */
+#define ADDR_RANGE_END              (0x20307FFF)
+
+/* Data */
+/*! @brief Command Data index */
+#define DATA_IDX                    (ADDR_IDX + ADDR_SIZE)
+/*! @brief Response Data index */
+#define RESP_DATA_IDX               (CTRL_IDX + CTRL_SIZE)
+/*! @brief Maximum data size */
+#define MAX_DATA_SIZE               (64)
+
+/* OFFSET is from the end of frame */
+/* CRC */
+/*! @brief CRC offset */
+#define CRC_OFFSET                  (0)
+/*! @brief CRC size */
+#define CRC_SIZE                    (2)
+
+/*! @brief Maximum buffer size */
+#define MAX_BUFFER_SIZE             (CTRL_SIZE + ADDR_SIZE + MAX_DATA_SIZE + CRC_SIZE)
+/*! @brief Maximum response size */
+#define MAX_RESP_SIZE               (CTRL_SIZE + MAX_DATA_SIZE + CRC_SIZE)
+
+/*! I2C Target Addr configured in the example */
+/*! @brief Default Target Address */
+//#define DEF_TARGET_ADDR_ADC             (0x68)
+//#define DEF_TARGET_ADDR_DAC             (0x60)
+
+
+
+/*! @brief Buffer Info structure */
+typedef struct
+{
+    /*! Buffer array */
+    _Alignas(uint32_t) uint8_t buffer[MAX_BUFFER_SIZE];
+    /*! Pointer */
+    uint8_t ptr;
+    /*! Length */
+    uint8_t len;
+} BufferInfo;
+
+/*! @brief Frame Info structure*/
+typedef struct
+{
+    /*! CRC */
+    uint16_t crc;
+    /*! Control Byte */
+    uint8_t ctrl;
+    /*! Data */
+    uint8_t data[MAX_DATA_SIZE];
+} FrameInfo;
+
+/*! @brief I2C status */
+typedef enum
+{
+    /*! I2C IDLE state */
+    I2C_STATUS_IDLE = 0,
+    /*! I2C Tx Started state */
+    I2C_STATUS_TX_STARTED,
+    /*! I2C Tx in Progress state */
+    I2C_STATUS_TX_INPROGRESS,
+    /*! I2C Tx Complete state */
+    I2C_STATUS_TX_COMPLETE,
+    /*! I2C Rx Started state */
+    I2C_STATUS_RX_STARTED,
+    /*! I2C Rx in Progress state */
+    I2C_STATUS_RX_INPROGRESS,
+    /*! I2C Rx Complete state */
+    I2C_STATUS_RX_COMPLETE,
+    /*! I2C Error state */
+    I2C_STATUS_ERROR,
+} I2C_Status;
+
+typedef enum
+{
+    /*! No error */
+    ERROR_TYPE_NONE         = 0x00,
+    /*! Mismatch CRC error */
+    ERROR_TYPE_MISMATCH_CRC = 0xE1,
+    /*! Error in Address range */
+    ERROR_TYPE_ADDR_RANGE   = 0xE2,
+} ErrorType;
+
+/*! @brief I2C instance */
+typedef struct
+{
+    /*! Transmit message */
+    BufferInfo txMsg;
+    /*! Receive message */
+    BufferInfo rxMsg;
+
+    /*! Data length */
+    uint8_t dataLen;
+    /*! CRC enabled */
+    _Bool isCrc;
+
+    /*! I2C status */
+    I2C_Status status;
+    /*! I2C error type */
+    ErrorType error;
+} I2C_Instance;
+
+/*! @brief I2C Command types */
+typedef enum 
+{
+    /*! I2C Read Command */
+    READ_COMMAND = 0x00,
+    /*! I2C Write Command */
+    WRITE_COMMAND = 0x80,
+} CommandType;
+
+/*! @brief I2C Command Info */
+typedef struct
+{
+    /*! Target Address */
+    uint32_t targetAddr;
+    /*! I2C Command Type */
+    CommandType commandType;
+    /*! Address */
+    uint32_t addr;
+    /*! Pointer to array of Data */
+    uint8_t* dataArray;
+    /*! Data Size */
+    uint8_t dataSize;
+    /*! CRC Enable*/
+    bool crcEnable;
+} I2C_CommandInfo;
+
+/*! @brief I2C Response Info */
+typedef struct
+{
+    /*! Response Frame Info */
+    FrameInfo frame;
+    /*! Response data size */
+    uint8_t dataSize;
+    /*! Response error status */
+    ErrorType status;
+    /*! Response received */
+    bool received; 
+} I2C_ResponseInfo;
+
+/**
+ * @brief     Initializes I2C_Instance Handle
+ * @param[in] I2C_handle    Pointer to I2C_Instance
+ */
+void I2C_init(I2C_Instance *I2C_handle);
+
+/**
+ * @brief     Prepares I2C Command frame and stores in TX Buffer to transmit
+ * @param[in] I2C_handle     Pointer to I2C_Instance
+ * @param[in] command        Pointer to I2C_CommandInfo
+ */
+void I2C_sendCommand(I2C_Instance *I2C_handle,I2C_CommandInfo *command);
+
+/**
+ * @brief     Sends I2C Read command to get the response from target
+ * @param[in] I2C_handle     Pointer to I2C_Instance
+ * @param[in] targetAddr     I2C Target Address
+ */
+void I2C_getResponse(I2C_Instance* I2C_handle,uint32_t targetAddr);
+
+/**
+ * @brief     Decodes the received data in Rx Buffer for response
+ * @param[in] I2C_handle     Pointer to I2C_Instance
+ * @param[in] response       Pointer to I2C_ResponseInfo
+ */
+void I2C_decodeResponse(I2C_Instance *I2C_handle,I2C_ResponseInfo *response);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* I2C_COMM_CONTROLLER_H_ */