Forráskód Böngészése

Updated Code for MCU -> Mutiplexer -> ADC

namrota ghosh 10 hónapja
szülő
commit
b1dd222be9

+ 39 - 39
charge_controller_v7/.cproject

@@ -15,25 +15,29 @@
             <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.1637705598" 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.1016184618">
-                            <option id="com.ti.ccstudio.buildDefinitions.core.OPT_TAGS.1571723819" superClass="com.ti.ccstudio.buildDefinitions.core.OPT_TAGS" valueType="stringList">
+                        <toolChain id="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.exe.DebugToolchain.1874229270" 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.1840046603">
+                            <option id="com.ti.ccstudio.buildDefinitions.core.OPT_TAGS.277352073" superClass="com.ti.ccstudio.buildDefinitions.core.OPT_TAGS" valueType="stringList">
                                 <listOptionValue value="DEVICE_CONFIGURATION_ID=Cortex M.MSPM0G3507"/>
                                 <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="RUNTIME_SUPPORT_LIBRARY="/>
-                                <listOptionValue value="OUTPUT_TYPE=executable"/>
+                                <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.1664574353" 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.1064616742" 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.629463878" 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.1210514165" 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.GENERATE_DWARF_DEBUG.2076963267" 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.ENDIAN_NESS__BIG_LITTLE.1270557865" 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.INCLUDE_PATH.182970579" superClass="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.compilerID.INCLUDE_PATH" valueType="includePath">
+                            <option id="com.ti.ccstudio.buildDefinitions.core.OPT_CODEGEN_VERSION.1547793914" 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.959432679" 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.273421561" 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.1432021582" 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.176788296" 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.1921641922" 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.380700039" 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.1311591585" 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.1751136976" 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.1001387270" 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.2024452914" 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}"/>
@@ -41,27 +45,26 @@
                                     <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.496609682" superClass="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.compilerID.DEFINE" valueType="definedSymbols">
+                                <option id="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.compilerID.DEFINE.510971352" 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.OPT_LEVEL.1723830578" 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.CMD_FILE.808039626" superClass="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.compilerID.CMD_FILE" valueType="stringList">
+                                <option id="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.compilerID.GENERATE_DWARF_DEBUG.1115098559" 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.190405872" superClass="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.compilerID.CMD_FILE" valueType="stringList">
                                     <listOptionValue value="device.opt"/>
                                 </option>
-                                <option id="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.compilerID.MCPU.1005915743" 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.MARCH.159831634" 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.MFLOAT_ABI.819878009" 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.SELECT_PROCESSOR_MODE__ARM_THUMB.1942285759" 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"/>
                             </tool>
-                            <tool id="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.exe.linkerDebug.1016184618" 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.OUTPUT_FILE.492385865" 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.MAP_FILE.2004353664" 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.XML_LINK_INFO.1404399280" 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.DISPLAY_ERROR_NUMBER.1843336219" 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.DIAG_WRAP.689832737" 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.REREAD_LIBS.672659646" 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.SEARCH_PATH.1973937298" superClass="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.linkerID.SEARCH_PATH" valueType="libPaths">
+                            <tool id="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.exe.linkerDebug.1840046603" 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.39638249" 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.799556693" 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.659509263" 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.1148428777" 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.1437152857" 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"/>
@@ -69,23 +72,20 @@
                                     <listOptionValue value="${PROJECT_BUILD_DIR}/syscfg"/>
                                     <listOptionValue value="${CG_TOOL_ROOT}/lib"/>
                                 </option>
-                                <option id="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.linkerID.LIBRARY.518550382" 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.HEAP_SIZE.1870714999" 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.REREAD_LIBS.1613873861" 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.358579320" 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.142625368" 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.579183302" 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.1965667293" 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.757224353" name="Arm Objcopy Utility" superClass="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.objcopy"/>
-                            <tool id="com.ti.ccstudio.buildDefinitions.sysConfig.12016991" name="SysConfig" superClass="com.ti.ccstudio.buildDefinitions.sysConfig">
-                                <option id="com.ti.ccstudio.buildDefinitions.sysConfig.PRODUCTS.32951251" superClass="com.ti.ccstudio.buildDefinitions.sysConfig.PRODUCTS" valueType="stringList">
+                            <tool id="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.hex.1906934551" 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.1030212511" name="Arm Objcopy Utility" superClass="com.ti.ccstudio.buildDefinitions.TMS470_TICLANG_4.0.objcopy"/>
+                            <tool id="com.ti.ccstudio.buildDefinitions.sysConfig.1669516373" name="SysConfig" superClass="com.ti.ccstudio.buildDefinitions.sysConfig">
+                                <option id="com.ti.ccstudio.buildDefinitions.sysConfig.DIRECTORY_MODE.338947889" 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.953805556" superClass="com.ti.ccstudio.buildDefinitions.sysConfig.OUTPUT_DIR__MANUAL" value="." valueType="string"/>
+                                <option id="com.ti.ccstudio.buildDefinitions.sysConfig.PRODUCTS.1603468399" superClass="com.ti.ccstudio.buildDefinitions.sysConfig.PRODUCTS" valueType="stringList">
                                     <listOptionValue value="${COM_TI_MSPM0_SDK_SYSCONFIG_MANIFEST}"/>
                                     <listOptionValue value="${SYSCONFIG_TOOL_SYSCONFIG_MANIFEST}"/>
                                 </option>
-                                <option id="com.ti.ccstudio.buildDefinitions.sysConfig.OUTPUT_DIR__MANUAL.1482622122" superClass="com.ti.ccstudio.buildDefinitions.sysConfig.OUTPUT_DIR__MANUAL" value="." valueType="string"/>
-                                <option id="com.ti.ccstudio.buildDefinitions.sysConfig.DIRECTORY_MODE.2021565672" superClass="com.ti.ccstudio.buildDefinitions.sysConfig.DIRECTORY_MODE" value="com.ti.ccstudio.buildDefinitions.sysConfig.DIRECTORY_MODE.manual" valueType="enumerated"/>
                             </tool>
                         </toolChain>
                     </folderInfo>

BIN
charge_controller_v7/Debug/.clangd/.cache/clangd/index/i2c_comm_controller.c.203F8B33309E2B48.idx


BIN
charge_controller_v7/Debug/.clangd/.cache/clangd/index/i2c_comm_controller.h.8DD4C36B9014EBE6.idx


BIN
charge_controller_v7/Debug/.clangd/.cache/clangd/index/i2c_controller.c.D084D0AF1C0F98F4.idx


BIN
charge_controller_v7/Debug/.clangd/.cache/clangd/index/ti_msp_dl_config.c.CD2F9AD1B4C264FA.idx


BIN
charge_controller_v7/Debug/.clangd/.cache/clangd/index/ti_msp_dl_config.h.6C46FDF13D1C9C02.idx


A különbségek nem kerülnek megjelenítésre, a fájl túl nagy
+ 522 - 491
charge_controller_v7/Debug/charge_controller_v7.map


BIN
charge_controller_v7/Debug/charge_controller_v7.out


A különbségek nem kerülnek megjelenítésre, a fájl túl nagy
+ 748 - 501
charge_controller_v7/Debug/charge_controller_v7_linkInfo.xml


+ 8 - 8
charge_controller_v7/Debug/i2c_controller.d

@@ -1,7 +1,7 @@
 # FIXED
 
 i2c_controller.o: ../i2c_controller.c \
- ti_msp_dl_config.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_gpio.h \
  /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/msp/msp.h \
  /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/DeviceFamily.h \
  /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/msp/m0p/mspm0g350x.h \
@@ -32,9 +32,11 @@ i2c_controller.o: ../i2c_controller.c \
  /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/msp/peripherals/m0p/hw_debugss.h \
  /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/msp/peripherals/m0p/hw_sysctl.h \
  /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/msp/peripherals/m0p/sysctl/hw_sysctl_mspm0g1x0x_g3x0x.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_common.h \
+ /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_i2c.h \
+ ti_msp_dl_config.h \
  /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/driverlib.h \
  /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_adc12.h \
- /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_common.h \
  /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/m0p/dl_factoryregion.h \
  /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/m0p/dl_core.h \
  /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_aes.h \
@@ -48,8 +50,6 @@ i2c_controller.o: ../i2c_controller.c \
  /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/m0p/dl_sysctl.h \
  /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/m0p/sysctl/dl_sysctl_mspm0g1x0x_g3x0x.h \
  /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_gpamp.h \
- /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_gpio.h \
- /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_i2c.h \
  /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_iwdt.h \
  /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_lfss.h \
  /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_keystorectl.h \
@@ -76,7 +76,7 @@ i2c_controller.o: ../i2c_controller.c \
  /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/m0p/dl_interrupt.h \
  /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/m0p/dl_systick.h \
  ../ti/comm_modules/i2c/controller/i2c_comm_controller.h
-ti_msp_dl_config.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_gpio.h:
 /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/msp/msp.h:
 /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/DeviceFamily.h:
 /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/msp/m0p/mspm0g350x.h:
@@ -107,9 +107,11 @@ ti_msp_dl_config.h:
 /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/msp/peripherals/m0p/hw_debugss.h:
 /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/msp/peripherals/m0p/hw_sysctl.h:
 /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/devices/msp/peripherals/m0p/sysctl/hw_sysctl_mspm0g1x0x_g3x0x.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_common.h:
+/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_i2c.h:
+ti_msp_dl_config.h:
 /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/driverlib.h:
 /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_adc12.h:
-/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_common.h:
 /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/m0p/dl_factoryregion.h:
 /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/m0p/dl_core.h:
 /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_aes.h:
@@ -123,8 +125,6 @@ ti_msp_dl_config.h:
 /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/m0p/dl_sysctl.h:
 /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/m0p/sysctl/dl_sysctl_mspm0g1x0x_g3x0x.h:
 /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_gpamp.h:
-/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_gpio.h:
-/home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_i2c.h:
 /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_iwdt.h:
 /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_lfss.h:
 /home/ngosh/ti/mspm0_sdk_2_03_00_07/source/ti/driverlib/dl_keystorectl.h:

BIN
charge_controller_v7/Debug/i2c_controller.o


BIN
charge_controller_v7/Debug/ti/comm_modules/i2c/controller/i2c_comm_controller.o


+ 48 - 0
charge_controller_v7/Debug/ti_msp_dl_config.c

@@ -51,6 +51,7 @@ SYSCONFIG_WEAK void SYSCFG_DL_init(void)
     /* Module-Specific Initializations*/
     SYSCFG_DL_SYSCTL_init();
     SYSCFG_DL_I2C_controller_init();
+    SYSCFG_DL_I2C_target_init();
     SYSCFG_DL_CRC_init();
 }
 
@@ -59,11 +60,13 @@ SYSCONFIG_WEAK void SYSCFG_DL_initPower(void)
     DL_GPIO_reset(GPIOA);
     DL_GPIO_reset(GPIOB);
     DL_I2C_reset(I2C_controller_INST);
+    DL_I2C_reset(I2C_target_INST);
     DL_CRC_reset(CRC);
 
     DL_GPIO_enablePower(GPIOA);
     DL_GPIO_enablePower(GPIOB);
     DL_I2C_enablePower(I2C_controller_INST);
+    DL_I2C_enablePower(I2C_target_INST);
     DL_CRC_enablePower(CRC);
     delay_cycles(POWER_STARTUP_DELAY);
 }
@@ -82,6 +85,17 @@ SYSCONFIG_WEAK void SYSCFG_DL_GPIO_init(void)
 		 DL_GPIO_HYSTERESIS_DISABLE, DL_GPIO_WAKEUP_DISABLE);
     DL_GPIO_enableHiZ(GPIO_I2C_controller_IOMUX_SDA);
     DL_GPIO_enableHiZ(GPIO_I2C_controller_IOMUX_SCL);
+    
+	DL_GPIO_initPeripheralInputFunctionFeatures(
+		 GPIO_I2C_target_IOMUX_SDA, GPIO_I2C_target_IOMUX_SDA_FUNC,
+		 DL_GPIO_INVERSION_DISABLE, DL_GPIO_RESISTOR_NONE,
+		 DL_GPIO_HYSTERESIS_DISABLE, DL_GPIO_WAKEUP_DISABLE);
+	DL_GPIO_initPeripheralInputFunctionFeatures(
+		 GPIO_I2C_target_IOMUX_SCL, GPIO_I2C_target_IOMUX_SCL_FUNC,
+		 DL_GPIO_INVERSION_DISABLE, DL_GPIO_RESISTOR_NONE,
+		 DL_GPIO_HYSTERESIS_DISABLE, DL_GPIO_WAKEUP_DISABLE);
+    DL_GPIO_enableHiZ(GPIO_I2C_target_IOMUX_SDA);
+    DL_GPIO_enableHiZ(GPIO_I2C_target_IOMUX_SCL);
 
 }
 
@@ -134,6 +148,40 @@ SYSCONFIG_WEAK void SYSCFG_DL_I2C_controller_init(void) {
     DL_I2C_enableController(I2C_controller_INST);
 
 
+}
+static const DL_I2C_ClockConfig gI2C_targetClockConfig = {
+    .clockSel = DL_I2C_CLOCK_BUSCLK,
+    .divideRatio = DL_I2C_CLOCK_DIVIDE_1,
+};
+
+SYSCONFIG_WEAK void SYSCFG_DL_I2C_target_init(void) {
+
+    DL_I2C_setClockConfig(I2C_target_INST,
+        (DL_I2C_ClockConfig *) &gI2C_targetClockConfig);
+    DL_I2C_setAnalogGlitchFilterPulseWidth(I2C_target_INST,
+        DL_I2C_ANALOG_GLITCH_FILTER_WIDTH_50NS);
+    DL_I2C_enableAnalogGlitchFilter(I2C_target_INST);
+
+    /* Configure Target Mode */
+    DL_I2C_setTargetOwnAddress(I2C_target_INST, I2C_target_TARGET_OWN_ADDR);
+    DL_I2C_setTargetTXFIFOThreshold(I2C_target_INST, DL_I2C_TX_FIFO_LEVEL_EMPTY);
+    DL_I2C_setTargetRXFIFOThreshold(I2C_target_INST, DL_I2C_RX_FIFO_LEVEL_BYTES_1);
+
+    DL_I2C_enableTargetClockStretching(I2C_target_INST);
+
+    /* Workaround for errata I2C_ERR_04 */
+    DL_I2C_disableTargetWakeup(I2C_target_INST);
+    /* Configure Interrupts */
+    DL_I2C_enableInterrupt(I2C_target_INST,
+                           DL_I2C_INTERRUPT_TARGET_RXFIFO_TRIGGER |
+                           DL_I2C_INTERRUPT_TARGET_START |
+                           DL_I2C_INTERRUPT_TARGET_STOP);
+
+
+    /* Enable module */
+    DL_I2C_enableTarget(I2C_target_INST);
+
+
 }
 
 SYSCONFIG_WEAK void SYSCFG_DL_CRC_init(void)

+ 15 - 0
charge_controller_v7/Debug/ti_msp_dl_config.h

@@ -93,6 +93,20 @@ extern "C" {
 #define GPIO_I2C_controller_IOMUX_SCL                            (IOMUX_PINCM15)
 #define GPIO_I2C_controller_IOMUX_SCL_FUNC               IOMUX_PINCM15_PF_I2C1_SCL
 
+/* Defines for I2C_target */
+#define I2C_target_INST                                                     I2C0
+#define I2C_target_INST_IRQHandler                               I2C0_IRQHandler
+#define I2C_target_INST_INT_IRQN                                   I2C0_INT_IRQn
+#define I2C_target_TARGET_OWN_ADDR                                          0x48
+#define GPIO_I2C_target_SDA_PORT                                           GPIOA
+#define GPIO_I2C_target_SDA_PIN                                    DL_GPIO_PIN_0
+#define GPIO_I2C_target_IOMUX_SDA                                 (IOMUX_PINCM1)
+#define GPIO_I2C_target_IOMUX_SDA_FUNC                  IOMUX_PINCM1_PF_I2C0_SDA
+#define GPIO_I2C_target_SCL_PORT                                           GPIOA
+#define GPIO_I2C_target_SCL_PIN                                    DL_GPIO_PIN_1
+#define GPIO_I2C_target_IOMUX_SCL                                 (IOMUX_PINCM2)
+#define GPIO_I2C_target_IOMUX_SCL_FUNC                  IOMUX_PINCM2_PF_I2C0_SCL
+
 
 /* Defines for CRC */
 #define CRC_SEED                                                        (0xFFFF)
@@ -104,6 +118,7 @@ void SYSCFG_DL_initPower(void);
 void SYSCFG_DL_GPIO_init(void);
 void SYSCFG_DL_SYSCTL_init(void);
 void SYSCFG_DL_I2C_controller_init(void);
+void SYSCFG_DL_I2C_target_init(void);
 void SYSCFG_DL_CRC_init(void);
 
 

BIN
charge_controller_v7/Debug/ti_msp_dl_config.o


+ 111 - 9
charge_controller_v7/i2c_controller.c

@@ -31,6 +31,8 @@
  */
 
 
+#include "ti/driverlib/dl_gpio.h"
+#include "ti/driverlib/dl_i2c.h"
 #include "ti_msp_dl_config.h"
 #include "ti/comm_modules/i2c/controller/i2c_comm_controller.h"
 #include<stdint.h>
@@ -38,24 +40,109 @@
 
 I2C_Instance gI2C;
 
+/*Multiplexer Address*/
+#define MULTIPLEXER_I2C_ADDR (0x70)
+
+/*Multiplexer channel*/
+#define ADC_I2C_CHANNEL (0x01)
+
 volatile I2C_CommandInfo gCommand;
 
 I2C_ResponseInfo gResponse;
 
 volatile bool gSendCommand = true;
 
+/*Buffers to store ADC Data*/
+
 /* Data to send to target */
 uint8_t gTxData[MAX_DATA_SIZE] = {0xAA,0xBB,0xCC,0xDD,0xEE,0xFF, \
                                   0x00,0x11,0x22,0x33,0x44,0x55, \
                                   0x66,0x77,0x88,0x99,0x12,0x23, \
                                   0x34,0x45,0x56,0x67,0x78,0x89};
 
+
+
+/*
+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.
+*/
+
+/*Function for Multiplexer*/
+
+void Multiplexer_SelectChannel(uint8_t channel)
+{
+    uint8_t data = channel;
+    printf("Scanning I2C Bus...\n");
+
+    // Ensure bus is idle before starting communication
+    while (DL_I2C_getControllerStatus(I2C_controller_INST) & DL_I2C_CONTROLLER_STATUS_BUSY_BUS);
+
+    // Attempt to send START and the device address
+    DL_I2C_startControllerTransfer(I2C_controller_INST, MULTIPLEXER_I2C_ADDR, DL_I2C_CONTROLLER_DIRECTION_TX, 1);
+
+    // Wait for a response from the multiplexer
+    while (DL_I2C_getControllerStatus(I2C_controller_INST) & DL_I2C_CONTROLLER_STATUS_BUSY_BUS);
+
+    // Send the channel selection byte
+    DL_I2C_fillControllerTXFIFO(I2C_controller_INST, &data, 1);
+
+    // **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);
+
+    // Verify if the multiplexer accepted the command
+    printf("Checking the Multiplexer Configuration.\n");
+
+    uint8_t response;
+    DL_I2C_startControllerTransfer(I2C_controller_INST, MULTIPLEXER_I2C_ADDR, DL_I2C_CONTROLLER_DIRECTION_RX, 1);
+
+    while (DL_I2C_getControllerStatus(I2C_controller_INST) & DL_I2C_CONTROLLER_STATUS_BUSY_BUS);
+   
+    response = DL_I2C_receiveControllerData(I2C_controller_INST);
+
+    if(response != channel){
+        printf("ERROR: Multiplexer did not set the correct channel!\n");
+    } else {
+        printf("Multiplexer Active Channel: 0x%X\n", channel);
+    }
+}
+
+
 int main(void)
 {
     SYSCFG_DL_init();
 
-    printf("System Configuration Enabled\n");
+    printf("............System Configuration Enabled...............\n");
+
+    
+    /* Multiplexer Section */
+    printf("Selecting Multiplexer Channel...\n");
 
+    Multiplexer_SelectChannel(ADC_I2C_CHANNEL);
+    
     NVIC_EnableIRQ(I2C_controller_INST_INT_IRQN);
 
     I2C_init(&gI2C);
@@ -67,43 +154,49 @@ int main(void)
     CommandInfo_Obj.commandType = READ_COMMAND;
     CommandInfo_Obj.addr = 0x20207C00;
     CommandInfo_Obj.dataArray = &gTxData[0];
-    CommandInfo_Obj.dataSize = 0;
+    CommandInfo_Obj.dataSize = 8;
     CommandInfo_Obj.crcEnable = false;
 
     gCommand = CommandInfo_Obj;
 
     while(1)
     {
-        if(gSendCommand)
+        if(gSendCommand == true)
         {
-            /* Frames a command packet and sends it to Target through I2C Write Command */
+            //Add a delay to allow conversion time (~1ms)
+            delay_cycles(50000);  // Adjust if needed
+
+            //Frames a command packet and sends it to Target through I2C Write Command
             I2C_sendCommand(&gI2C, (I2C_CommandInfo *) &gCommand);
-            printf("Sending data to I2C address: 0x%X\n", gCommand.targetAddr);
+            printf("Requesting ADC Data from I2C address: 0x%X\n", gCommand.targetAddr);
             gI2C.status = I2C_STATUS_RX_STARTED;
             gI2C.rxMsg.ptr = 0;
-            gI2C.dataLen = 4;
-            /* Issues I2C Read Command to get the response from Target */
+            gI2C.dataLen = gCommand.dataSize;
+            // Issues I2C Read Command to get the response from Target 
             I2C_getResponse(&gI2C,gCommand.targetAddr);
-            printf("Reading data to I2C address: 0x%X\n", gCommand.targetAddr);
             gSendCommand = false;
         }
+
     }
 }
 
+/*Interrupt for MCU -> ADC*/
 void I2C_controller_INST_IRQHandler(void)
-{   printf("I2C Interrupt Triggered!\n");
+{   printf("I2C Interrupt Triggered to ADC!\n");
     switch (DL_I2C_getPendingInterrupt(I2C_controller_INST)) 
     {
         case DL_I2C_IIDX_CONTROLLER_RX_DONE:
             gI2C.rxMsg.len = gI2C.rxMsg.ptr;
             I2C_decodeResponse(&gI2C,&gResponse);
             gI2C.status = I2C_STATUS_RX_COMPLETE;
+            printf("I2C RX COMPLETE!\n");
             break;
 
         case DL_I2C_IIDX_CONTROLLER_TX_DONE:
             DL_I2C_disableInterrupt(
                 I2C_controller_INST, DL_I2C_INTERRUPT_CONTROLLER_TXFIFO_TRIGGER);
             gI2C.status = I2C_STATUS_TX_COMPLETE;
+            printf("I2C TX COMPLETE!\n");
             break;
 
         case DL_I2C_IIDX_CONTROLLER_RXFIFO_TRIGGER:
@@ -113,7 +206,14 @@ void I2C_controller_INST_IRQHandler(void)
                 if (gI2C.rxMsg.ptr < MAX_BUFFER_SIZE) {
                     gI2C.rxMsg.buffer[gI2C.rxMsg.ptr++] =
                         DL_I2C_receiveControllerData(I2C_controller_INST);
+                        if(gI2C.rxMsg.ptr>0){
+                            printf("Received Byte[%d]: 0x%02X\n", gI2C.rxMsg.ptr, gI2C.rxMsg.buffer[gI2C.rxMsg.ptr - 1]);
+
+                        }
+                        
+                    
                 } else {
+                    printf("ERROR: RX Buffer Overflow! ptr=%d MAX_BUFFER_SIZE=%d\n", gI2C.rxMsg.ptr, MAX_BUFFER_SIZE);
                     /* Ignore and remove from FIFO if the buffer is full */
                     DL_I2C_receiveControllerData(I2C_controller_INST);
                 }
@@ -140,3 +240,5 @@ void I2C_controller_INST_IRQHandler(void)
             break;
     }
 }
+
+

+ 22 - 0
charge_controller_v7/i2c_controller.syscfg

@@ -13,6 +13,7 @@ const Board = scripting.addModule("/ti/driverlib/Board");
 const CRC   = scripting.addModule("/ti/driverlib/CRC");
 const I2C   = scripting.addModule("/ti/driverlib/I2C", {}, false);
 const I2C1  = I2C.addInstance();
+const I2C2  = I2C.addInstance();
 
 /**
  * Write custom configuration values to the imported modules.
@@ -26,6 +27,7 @@ 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         = "PB3";
 I2C1.peripheral.sclPin.$assign         = "PB2";
 I2C1.sdaPinConfig.$name                = "ti_driverlib_gpio_GPIOPinGeneric0";
@@ -41,6 +43,26 @@ I2C1.sclPinConfig.passedPeripheralType = scripting.forceWrite("Digital");
 I2C1.sclPinConfig.enableConfig         = true;
 I2C1.sclPinConfig.internalResistor     = "PULL_UP";
 
+I2C2.$name                             = "I2C_target";
+I2C2.basicEnableTarget                 = true;
+I2C2.basicTargetAddress                = 0x48;
+I2C2.enableDMAEvent1                   = false;
+I2C2.enableDMAEvent2                   = false;
+I2C2.intTarget                         = ["RXFIFO_TRIGGER","START","STOP"];
+I2C2.peripheral.$assign                = "I2C0";
+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;

+ 21 - 5
charge_controller_v7/ti/comm_modules/i2c/controller/i2c_comm_controller.c

@@ -259,17 +259,26 @@ static void I2C_sendBuffer(I2C_Instance *I2C_handle,uint8_t targetAddr)
     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)) {
-        printf("Wait till the bus is idle");
+            (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) &
@@ -298,12 +307,19 @@ The total expected length of the response is calculated as:
 */
 void I2C_getResponse(I2C_Instance* I2C_handle,uint32_t targetAddr)
 {   
-    printf("Receiving data from I2C address\n");
-
+    
     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) 

+ 3 - 0
charge_controller_v7/ti/comm_modules/i2c/controller/i2c_comm_controller.h

@@ -106,6 +106,9 @@ extern "C" {
 /*! @brief Default Target Address */
 #define DEF_TARGET_ADDR             (0x68)
 
+
+
+
 /*! @brief Buffer Info structure */
 typedef struct
 {

Nem az összes módosított fájl került megjelenítésre, mert túl sok fájl változott