forked from achamaikin/CCSModuleSW30Web
Compare commits
18
Commits
92c33b2f46
..
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b98207da4c | ||
|
|
940e3f4a3d | ||
|
|
fdc83c5b9f | ||
|
|
52d4685673 | ||
|
|
af8bbd5275 | ||
|
|
96826da0e0 | ||
|
|
49a4fd8ee1 | ||
|
|
86b0bfc0fc | ||
|
|
a583e12132 | ||
|
|
ecf8e3d2f0 | ||
|
|
622644a6a1 | ||
|
|
ac1ce30121 | ||
|
|
3037ae2368 | ||
|
|
414d2cba60 | ||
|
|
c8f91af7da | ||
|
|
e8b3ed90cd | ||
|
|
28d63c7270 | ||
|
|
c59d150b23 |
@@ -0,0 +1,187 @@
|
||||
<?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.st.stm32cube.ide.mcu.gnu.managedbuild.config.exe.debug.1370229639">
|
||||
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="com.st.stm32cube.ide.mcu.gnu.managedbuild.config.exe.debug.1370229639" moduleId="org.eclipse.cdt.core.settings" name="Debug">
|
||||
<externalSettings/>
|
||||
<extensions>
|
||||
<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
|
||||
<extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
</extensions>
|
||||
</storageModule>
|
||||
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
|
||||
<configuration artifactExtension="elf" artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe,org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.debug" cleanCommand="rm -rf" description="" id="com.st.stm32cube.ide.mcu.gnu.managedbuild.config.exe.debug.1370229639" name="Debug" parent="com.st.stm32cube.ide.mcu.gnu.managedbuild.config.exe.debug">
|
||||
<folderInfo id="com.st.stm32cube.ide.mcu.gnu.managedbuild.config.exe.debug.1370229639." name="/" resourcePath="">
|
||||
<toolChain id="com.st.stm32cube.ide.mcu.gnu.managedbuild.toolchain.exe.debug.1017099221" name="MCU ARM GCC" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.toolchain.exe.debug">
|
||||
<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.target_mcu.1244048691" name="MCU" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.target_mcu" useByScannerDiscovery="true" value="STM32F107VCTx" valueType="string"/>
|
||||
<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.target_cpuid.1379215735" name="CPU" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.target_cpuid" useByScannerDiscovery="false" value="0" valueType="string"/>
|
||||
<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.target_coreid.960532971" name="Core" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.target_coreid" useByScannerDiscovery="false" value="0" valueType="string"/>
|
||||
<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.target_board.1990552137" name="Board" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.target_board" useByScannerDiscovery="false" value="genericBoard" valueType="string"/>
|
||||
<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.defaults.1586976077" name="Defaults" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.defaults" useByScannerDiscovery="false" value="com.st.stm32cube.ide.common.services.build.inputs.revA.1.0.6 || Debug || true || Executable || com.st.stm32cube.ide.mcu.gnu.managedbuild.option.toolchain.value.workspace || STM32F107VCTx || 0 || 0 || arm-none-eabi- || ${gnu_tools_for_stm32_compiler_path} || ../Core/Inc | ../Drivers/STM32F1xx_HAL_Driver/Inc | ../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy | ../Drivers/CMSIS/Device/ST/STM32F1xx/Include | ../Drivers/CMSIS/Include || || || USE_HAL_DRIVER | STM32F107xC || || Drivers | Core/Startup | Core || || || ${workspace_loc:/${ProjName}/STM32F107VCTX_FLASH.ld} || true || NonSecure || || secure_nsclib.o || || None || || || " valueType="string"/>
|
||||
<option id="com.st.stm32cube.ide.mcu.debug.option.cpuclock.82282192" name="Cpu clock frequence" superClass="com.st.stm32cube.ide.mcu.debug.option.cpuclock" useByScannerDiscovery="false" value="72" valueType="string"/>
|
||||
<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.nanoprintffloat.808472221" name="Use float with printf from newlib-nano (-u _printf_float)" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.nanoprintffloat" useByScannerDiscovery="false" value="true" valueType="boolean"/>
|
||||
<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.converthex.400501462" name="Convert to Intel Hex file (-O ihex)" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.converthex" useByScannerDiscovery="false" value="true" valueType="boolean"/>
|
||||
<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.convertsrec.519949918" name="Convert to Motorola S-record file (-O srec)" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.convertsrec" useByScannerDiscovery="false" value="true" valueType="boolean"/>
|
||||
<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.convertbinary.1730912092" name="Convert to binary file (-O binary)" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.convertbinary" useByScannerDiscovery="false" value="true" valueType="boolean"/>
|
||||
<targetPlatform archList="all" binaryParser="org.eclipse.cdt.core.ELF" id="com.st.stm32cube.ide.mcu.gnu.managedbuild.targetplatform.1026339783" isAbstract="false" osList="all" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.targetplatform"/>
|
||||
<builder buildPath="${workspace_loc:/GbTModuleSW}/Debug" id="com.st.stm32cube.ide.mcu.gnu.managedbuild.builder.653659782" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" parallelBuildOn="true" parallelizationNumber="optimal" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.builder"/>
|
||||
<tool id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.assembler.1272315080" name="MCU GCC Assembler" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.assembler">
|
||||
<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.assembler.option.debuglevel.370357426" name="Debug level" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.assembler.option.debuglevel" value="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.assembler.option.debuglevel.value.g3" valueType="enumerated"/>
|
||||
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.assembler.option.definedsymbols.1924718806" name="Define symbols (-D)" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.assembler.option.definedsymbols" valueType="definedSymbols">
|
||||
<listOptionValue builtIn="false" value="DEBUG"/>
|
||||
</option>
|
||||
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.assembler.option.includepaths.340226531" name="Include paths (-I)" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.assembler.option.includepaths" useByScannerDiscovery="false" valueType="includePath">
|
||||
<listOptionValue builtIn="false" value="/Users/colorbass/STM32CubeIDE/workspace_1.12.0/lib_EDCAN"/>
|
||||
</option>
|
||||
<inputType id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.assembler.input.602034741" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.assembler.input"/>
|
||||
</tool>
|
||||
<tool id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.129443933" name="MCU GCC Compiler" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler">
|
||||
<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.option.debuglevel.150601486" name="Debug level" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.option.debuglevel" useByScannerDiscovery="false" value="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.option.debuglevel.value.g3" valueType="enumerated"/>
|
||||
<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.option.optimization.level.2041244846" name="Optimization level" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.option.optimization.level" useByScannerDiscovery="false" value="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.option.optimization.level.value.o0" valueType="enumerated"/>
|
||||
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.option.definedsymbols.504560065" name="Define symbols (-D)" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.option.definedsymbols" useByScannerDiscovery="false" valueType="definedSymbols">
|
||||
<listOptionValue builtIn="false" value="DEBUG"/>
|
||||
<listOptionValue builtIn="false" value="USE_HAL_DRIVER"/>
|
||||
<listOptionValue builtIn="false" value="STM32F107xC"/>
|
||||
</option>
|
||||
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.option.includepaths.452593111" name="Include paths (-I)" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.option.includepaths" useByScannerDiscovery="false" valueType="includePath">
|
||||
<listOptionValue builtIn="false" value="../Core/Inc"/>
|
||||
<listOptionValue builtIn="false" value="../Drivers/STM32F1xx_HAL_Driver/Inc"/>
|
||||
<listOptionValue builtIn="false" value="../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy"/>
|
||||
<listOptionValue builtIn="false" value="../Drivers/CMSIS/Device/ST/STM32F1xx/Include"/>
|
||||
<listOptionValue builtIn="false" value="../Drivers/CMSIS/Include"/>
|
||||
</option>
|
||||
<inputType id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.input.c.1408123272" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.input.c"/>
|
||||
</tool>
|
||||
<tool id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.cpp.compiler.2070441151" name="MCU G++ Compiler" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.cpp.compiler">
|
||||
<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.cpp.compiler.option.debuglevel.1543951018" name="Debug level" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.cpp.compiler.option.debuglevel" useByScannerDiscovery="false" value="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.cpp.compiler.option.debuglevel.value.g3" valueType="enumerated"/>
|
||||
<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.cpp.compiler.option.optimization.level.2049580629" name="Optimization level" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.cpp.compiler.option.optimization.level" useByScannerDiscovery="false"/>
|
||||
</tool>
|
||||
<tool id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.linker.2102490823" name="MCU GCC Linker" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.linker">
|
||||
<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.linker.option.script.272103658" name="Linker Script (-T)" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.linker.option.script" value="${workspace_loc:/${ProjName}/STM32F107VCTX_FLASH.ld}" valueType="string"/>
|
||||
<inputType id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.linker.input.266162782" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.linker.input">
|
||||
<additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
|
||||
<additionalInput kind="additionalinput" paths="$(LIBS)"/>
|
||||
</inputType>
|
||||
</tool>
|
||||
<tool id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.cpp.linker.502005820" name="MCU G++ Linker" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.cpp.linker"/>
|
||||
<tool id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.archiver.1392625179" name="MCU GCC Archiver" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.archiver"/>
|
||||
<tool id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.size.771001125" name="MCU Size" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.size"/>
|
||||
<tool id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.objdump.listfile.1682381984" name="MCU Output Converter list file" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.objdump.listfile"/>
|
||||
<tool id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.objcopy.hex.467663480" name="MCU Output Converter Hex" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.objcopy.hex"/>
|
||||
<tool id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.objcopy.binary.1608796910" name="MCU Output Converter Binary" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.objcopy.binary"/>
|
||||
<tool id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.objcopy.verilog.1767624081" name="MCU Output Converter Verilog" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.objcopy.verilog"/>
|
||||
<tool id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.objcopy.srec.139156618" name="MCU Output Converter Motorola S-rec" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.objcopy.srec"/>
|
||||
<tool id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.objcopy.symbolsrec.1422585447" name="MCU Output Converter Motorola S-rec with symbols" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.objcopy.symbolsrec"/>
|
||||
</toolChain>
|
||||
</folderInfo>
|
||||
<sourceEntries>
|
||||
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="Core"/>
|
||||
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="Drivers"/>
|
||||
</sourceEntries>
|
||||
</configuration>
|
||||
</storageModule>
|
||||
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
|
||||
</cconfiguration>
|
||||
<cconfiguration id="com.st.stm32cube.ide.mcu.gnu.managedbuild.config.exe.release.1286135127">
|
||||
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="com.st.stm32cube.ide.mcu.gnu.managedbuild.config.exe.release.1286135127" moduleId="org.eclipse.cdt.core.settings" name="Release">
|
||||
<externalSettings/>
|
||||
<extensions>
|
||||
<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
|
||||
<extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
</extensions>
|
||||
</storageModule>
|
||||
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
|
||||
<configuration artifactExtension="elf" artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe,org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.release" cleanCommand="rm -rf" description="" id="com.st.stm32cube.ide.mcu.gnu.managedbuild.config.exe.release.1286135127" name="Release" parent="com.st.stm32cube.ide.mcu.gnu.managedbuild.config.exe.release">
|
||||
<folderInfo id="com.st.stm32cube.ide.mcu.gnu.managedbuild.config.exe.release.1286135127." name="/" resourcePath="">
|
||||
<toolChain id="com.st.stm32cube.ide.mcu.gnu.managedbuild.toolchain.exe.release.368317543" name="MCU ARM GCC" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.toolchain.exe.release">
|
||||
<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.target_mcu.1083778044" name="MCU" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.target_mcu" useByScannerDiscovery="true" value="STM32F107VCTx" valueType="string"/>
|
||||
<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.target_cpuid.1672048738" name="CPU" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.target_cpuid" useByScannerDiscovery="false" value="0" valueType="string"/>
|
||||
<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.target_coreid.716214807" name="Core" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.target_coreid" useByScannerDiscovery="false" value="0" valueType="string"/>
|
||||
<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.target_board.1611406059" name="Board" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.target_board" useByScannerDiscovery="false" value="genericBoard" valueType="string"/>
|
||||
<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.defaults.2026840843" name="Defaults" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.defaults" useByScannerDiscovery="false" value="com.st.stm32cube.ide.common.services.build.inputs.revA.1.0.6 || Release || false || Executable || com.st.stm32cube.ide.mcu.gnu.managedbuild.option.toolchain.value.workspace || STM32F107VCTx || 0 || 0 || arm-none-eabi- || ${gnu_tools_for_stm32_compiler_path} || ../Core/Inc | ../Drivers/STM32F1xx_HAL_Driver/Inc | ../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy | ../Drivers/CMSIS/Device/ST/STM32F1xx/Include | ../Drivers/CMSIS/Include || || || USE_HAL_DRIVER | STM32F107xC || || Drivers | Core/Startup | Core || || || ${workspace_loc:/${ProjName}/STM32F107VCTX_FLASH.ld} || true || NonSecure || || secure_nsclib.o || || None || || || " valueType="string"/>
|
||||
<option id="com.st.stm32cube.ide.mcu.debug.option.cpuclock.1744697906" name="Cpu clock frequence" superClass="com.st.stm32cube.ide.mcu.debug.option.cpuclock" useByScannerDiscovery="false" value="72" valueType="string"/>
|
||||
<targetPlatform archList="all" binaryParser="org.eclipse.cdt.core.ELF" id="com.st.stm32cube.ide.mcu.gnu.managedbuild.targetplatform.1433680358" isAbstract="false" osList="all" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.targetplatform"/>
|
||||
<builder buildPath="${workspace_loc:/GbTModuleSW}/Release" id="com.st.stm32cube.ide.mcu.gnu.managedbuild.builder.1316679712" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" parallelBuildOn="true" parallelizationNumber="optimal" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.builder"/>
|
||||
<tool id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.assembler.1810954687" name="MCU GCC Assembler" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.assembler">
|
||||
<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.assembler.option.debuglevel.1184417617" name="Debug level" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.assembler.option.debuglevel" value="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.assembler.option.debuglevel.value.g0" valueType="enumerated"/>
|
||||
<inputType id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.assembler.input.679037772" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.assembler.input"/>
|
||||
</tool>
|
||||
<tool id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.2023937975" name="MCU GCC Compiler" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler">
|
||||
<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.option.debuglevel.2061465690" name="Debug level" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.option.debuglevel" useByScannerDiscovery="false" value="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.option.debuglevel.value.g0" valueType="enumerated"/>
|
||||
<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.option.optimization.level.463973701" name="Optimization level" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.option.optimization.level" useByScannerDiscovery="false" value="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.option.optimization.level.value.os" valueType="enumerated"/>
|
||||
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.option.definedsymbols.1124370999" name="Define symbols (-D)" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.option.definedsymbols" useByScannerDiscovery="false" valueType="definedSymbols">
|
||||
<listOptionValue builtIn="false" value="USE_HAL_DRIVER"/>
|
||||
<listOptionValue builtIn="false" value="STM32F107xC"/>
|
||||
</option>
|
||||
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.option.includepaths.2130633236" name="Include paths (-I)" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.option.includepaths" useByScannerDiscovery="false" valueType="includePath">
|
||||
<listOptionValue builtIn="false" value="../Core/Inc"/>
|
||||
<listOptionValue builtIn="false" value="../Drivers/STM32F1xx_HAL_Driver/Inc"/>
|
||||
<listOptionValue builtIn="false" value="../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy"/>
|
||||
<listOptionValue builtIn="false" value="../Drivers/CMSIS/Device/ST/STM32F1xx/Include"/>
|
||||
<listOptionValue builtIn="false" value="../Drivers/CMSIS/Include"/>
|
||||
</option>
|
||||
<inputType id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.input.c.139233432" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.input.c"/>
|
||||
</tool>
|
||||
<tool id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.cpp.compiler.77997183" name="MCU G++ Compiler" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.cpp.compiler">
|
||||
<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.cpp.compiler.option.debuglevel.954735929" name="Debug level" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.cpp.compiler.option.debuglevel" useByScannerDiscovery="false" value="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.cpp.compiler.option.debuglevel.value.g0" valueType="enumerated"/>
|
||||
<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.cpp.compiler.option.optimization.level.1509118949" name="Optimization level" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.cpp.compiler.option.optimization.level" useByScannerDiscovery="false" value="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.cpp.compiler.option.optimization.level.value.os" valueType="enumerated"/>
|
||||
</tool>
|
||||
<tool id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.linker.455795129" name="MCU GCC Linker" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.linker">
|
||||
<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.linker.option.script.135018481" name="Linker Script (-T)" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.linker.option.script" value="${workspace_loc:/${ProjName}/STM32F107VCTX_FLASH.ld}" valueType="string"/>
|
||||
<inputType id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.linker.input.850565080" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.linker.input">
|
||||
<additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
|
||||
<additionalInput kind="additionalinput" paths="$(LIBS)"/>
|
||||
</inputType>
|
||||
</tool>
|
||||
<tool id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.cpp.linker.1304115760" name="MCU G++ Linker" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.cpp.linker"/>
|
||||
<tool id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.archiver.2125898682" name="MCU GCC Archiver" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.archiver"/>
|
||||
<tool id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.size.862607409" name="MCU Size" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.size"/>
|
||||
<tool id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.objdump.listfile.268643843" name="MCU Output Converter list file" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.objdump.listfile"/>
|
||||
<tool id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.objcopy.hex.2012318786" name="MCU Output Converter Hex" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.objcopy.hex"/>
|
||||
<tool id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.objcopy.binary.25627582" name="MCU Output Converter Binary" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.objcopy.binary"/>
|
||||
<tool id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.objcopy.verilog.1856490045" name="MCU Output Converter Verilog" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.objcopy.verilog"/>
|
||||
<tool id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.objcopy.srec.573281510" name="MCU Output Converter Motorola S-rec" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.objcopy.srec"/>
|
||||
<tool id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.objcopy.symbolsrec.336799426" name="MCU Output Converter Motorola S-rec with symbols" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.objcopy.symbolsrec"/>
|
||||
</toolChain>
|
||||
</folderInfo>
|
||||
<sourceEntries>
|
||||
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="Core"/>
|
||||
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="Drivers"/>
|
||||
</sourceEntries>
|
||||
</configuration>
|
||||
</storageModule>
|
||||
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
|
||||
</cconfiguration>
|
||||
</storageModule>
|
||||
<storageModule moduleId="org.eclipse.cdt.core.pathentry"/>
|
||||
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
|
||||
<project id="GbTModuleSW.null.359723610" name="GbTModuleSW"/>
|
||||
</storageModule>
|
||||
<storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
|
||||
<storageModule moduleId="org.eclipse.cdt.make.core.buildtargets"/>
|
||||
<storageModule moduleId="scannerConfiguration">
|
||||
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
|
||||
<scannerConfigBuildInfo instanceId="com.st.stm32cube.ide.mcu.gnu.managedbuild.config.exe.release.1286135127;com.st.stm32cube.ide.mcu.gnu.managedbuild.config.exe.release.1286135127.;com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.2023937975;com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.input.c.139233432">
|
||||
<autodiscovery enabled="false" problemReportingEnabled="true" selectedProfileId=""/>
|
||||
</scannerConfigBuildInfo>
|
||||
<scannerConfigBuildInfo instanceId="com.st.stm32cube.ide.mcu.gnu.managedbuild.config.exe.debug.1370229639;com.st.stm32cube.ide.mcu.gnu.managedbuild.config.exe.debug.1370229639.;com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.129443933;com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.c.compiler.input.c.1408123272">
|
||||
<autodiscovery enabled="false" problemReportingEnabled="true" selectedProfileId=""/>
|
||||
</scannerConfigBuildInfo>
|
||||
</storageModule>
|
||||
<storageModule moduleId="refreshScope" versionNumber="2">
|
||||
<configuration configurationName="Debug">
|
||||
<resource resourceType="PROJECT" workspacePath="/GbTModuleSW"/>
|
||||
</configuration>
|
||||
<configuration configurationName="Release">
|
||||
<resource resourceType="PROJECT" workspacePath="/GbTModuleSW"/>
|
||||
</configuration>
|
||||
</storageModule>
|
||||
</cproject>
|
||||
+83
-112
@@ -1,129 +1,100 @@
|
||||
# ---> C
|
||||
# Prerequisites
|
||||
*.d
|
||||
# =============================================================================
|
||||
# STM32 / ARM GCC / STM32CubeIDE — standardized firmware .gitignore
|
||||
# Track: sources + final firmware images (*.elf *.bin *.hex *.srec)
|
||||
# Ignore: build intermediates, IDE noise, logs, captures, backups
|
||||
#
|
||||
# NOTE: Only root /Debug /Release /Build are build dirs.
|
||||
# Do NOT use **/Debug — on Windows (core.ignorecase) that also matches
|
||||
# source folders like Libs/**/DEBUG/.
|
||||
# =============================================================================
|
||||
|
||||
# Object files
|
||||
# -----------------------------------------------------------------------------
|
||||
# Build dirs (project root only): ignore all, then re-include firmware images
|
||||
# -----------------------------------------------------------------------------
|
||||
/Debug/*
|
||||
!/Debug/
|
||||
/Release/*
|
||||
!/Release/
|
||||
/Build/*
|
||||
!/Build/
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Object / dependency / analysis outputs (any path)
|
||||
# -----------------------------------------------------------------------------
|
||||
*.o
|
||||
*.ko
|
||||
*.obj
|
||||
*.elf
|
||||
|
||||
# Linker output
|
||||
*.ilk
|
||||
*.map
|
||||
*.exp
|
||||
|
||||
# Precompiled Headers
|
||||
*.gch
|
||||
*.pch
|
||||
|
||||
# Libraries
|
||||
*.lib
|
||||
*.a
|
||||
*.la
|
||||
*.lo
|
||||
|
||||
# Shared objects (inc. Windows DLLs)
|
||||
*.dll
|
||||
*.so
|
||||
*.so.*
|
||||
*.dylib
|
||||
|
||||
# Executables
|
||||
*.exe
|
||||
*.out
|
||||
*.app
|
||||
*.i*86
|
||||
*.x86_64
|
||||
*.hex
|
||||
|
||||
# Debug files
|
||||
*.dSYM/
|
||||
*.d
|
||||
*.su
|
||||
*.idb
|
||||
*.pdb
|
||||
*.cyclo
|
||||
|
||||
# Kernel Module Compile Results
|
||||
*.mod*
|
||||
*.cmd
|
||||
.tmp_versions/
|
||||
modules.order
|
||||
Module.symvers
|
||||
Mkfile.old
|
||||
dkms.conf
|
||||
|
||||
# ---> CMake
|
||||
CMakeLists.txt.user
|
||||
CMakeCache.txt
|
||||
CMakeFiles
|
||||
CMakeScripts
|
||||
Testing
|
||||
# -----------------------------------------------------------------------------
|
||||
# Generated make fragments (CubeIDE)
|
||||
# -----------------------------------------------------------------------------
|
||||
*.mk
|
||||
makefile
|
||||
Makefile
|
||||
cmake_install.cmake
|
||||
install_manifest.txt
|
||||
compile_commands.json
|
||||
CTestTestfile.cmake
|
||||
_deps
|
||||
objects.list
|
||||
objects.mk
|
||||
sources.mk
|
||||
subdir.mk
|
||||
|
||||
# ---> Eclipse
|
||||
.metadata
|
||||
bin/
|
||||
tmp/
|
||||
*.tmp
|
||||
# -----------------------------------------------------------------------------
|
||||
# Linker listings (not needed in repo)
|
||||
# -----------------------------------------------------------------------------
|
||||
*.map
|
||||
*.list
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Backups / temp
|
||||
# -----------------------------------------------------------------------------
|
||||
**/Backup/
|
||||
*.bak
|
||||
*.tmp
|
||||
*.swp
|
||||
*~.nib
|
||||
local.properties
|
||||
*.swo
|
||||
*~
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# IDE / tooling (local machine)
|
||||
# -----------------------------------------------------------------------------
|
||||
.settings/
|
||||
.loadpath
|
||||
.recommenders
|
||||
|
||||
# External tool builders
|
||||
.mxproject
|
||||
.externalToolBuilders/
|
||||
|
||||
# Locally stored "Eclipse launch configurations"
|
||||
.metadata/
|
||||
.idea/
|
||||
*.launch
|
||||
*.code-workspace
|
||||
|
||||
# PyDev specific (Python IDE for Eclipse)
|
||||
*.pydevproject
|
||||
# -----------------------------------------------------------------------------
|
||||
# Logs / analyzer captures
|
||||
# -----------------------------------------------------------------------------
|
||||
log.txt
|
||||
log*.txt
|
||||
*.log
|
||||
*.asc
|
||||
|
||||
# CDT-specific (C/C++ Development Tooling)
|
||||
.cproject
|
||||
# -----------------------------------------------------------------------------
|
||||
# OS junk
|
||||
# -----------------------------------------------------------------------------
|
||||
.DS_Store
|
||||
Thumbs.db
|
||||
|
||||
# CDT- autotools
|
||||
.autotools
|
||||
# =============================================================================
|
||||
# Keep final firmware images under root build dirs
|
||||
# =============================================================================
|
||||
!/Debug/*.elf
|
||||
!/Debug/*.bin
|
||||
!/Debug/*.hex
|
||||
!/Debug/*.srec
|
||||
!/Release/*.elf
|
||||
!/Release/*.bin
|
||||
!/Release/*.hex
|
||||
!/Release/*.srec
|
||||
!/Build/*.elf
|
||||
!/Build/*.bin
|
||||
!/Build/*.hex
|
||||
!/Build/*.srec
|
||||
|
||||
# Java annotation processor (APT)
|
||||
.factorypath
|
||||
|
||||
# PDT-specific (PHP Development Tools)
|
||||
.buildpath
|
||||
|
||||
# sbteclipse plugin
|
||||
.target
|
||||
|
||||
# Tern plugin
|
||||
.tern-project
|
||||
|
||||
# TeXlipse plugin
|
||||
.texlipse
|
||||
|
||||
# STS (Spring Tool Suite)
|
||||
.springBeans
|
||||
|
||||
# Code Recommenders
|
||||
.recommenders/
|
||||
|
||||
# Annotation Processing
|
||||
.apt_generated/
|
||||
.apt_generated_test/
|
||||
|
||||
# Scala IDE specific (Scala & Java development for Eclipse)
|
||||
.cache-main
|
||||
.scala_dependencies
|
||||
.worksheet
|
||||
|
||||
# Uncomment this line if you wish to ignore the project description file.
|
||||
# Typically, this file would be tracked if it contains build/dependency configurations:
|
||||
#.project
|
||||
# IDE local
|
||||
.vscode/
|
||||
|
||||
|
||||
-41
File diff suppressed because one or more lines are too long
Vendored
-6
@@ -1,6 +0,0 @@
|
||||
{
|
||||
"files.associations": {
|
||||
"charger_config.h": "c",
|
||||
"charger_gbt.h": "c"
|
||||
}
|
||||
}
|
||||
+97
-45
@@ -6,7 +6,7 @@ ADC1.Channel-3\#ChannelRegularConversion=ADC_CHANNEL_9
|
||||
ADC1.Channel-4\#ChannelRegularConversion=ADC_CHANNEL_TEMPSENSOR
|
||||
ADC1.Channel-5\#ChannelRegularConversion=ADC_CHANNEL_VREFINT
|
||||
ADC1.ExternalTrigConv=ADC_EXTERNALTRIGCONV_T3_TRGO
|
||||
ADC1.IPParameters=Rank-0\#ChannelRegularConversion,Channel-0\#ChannelRegularConversion,SamplingTime-0\#ChannelRegularConversion,NbrOfConversionFlag,master,Rank-1\#ChannelRegularConversion,Channel-1\#ChannelRegularConversion,SamplingTime-1\#ChannelRegularConversion,Rank-2\#ChannelRegularConversion,Channel-2\#ChannelRegularConversion,SamplingTime-2\#ChannelRegularConversion,Rank-3\#ChannelRegularConversion,Channel-3\#ChannelRegularConversion,SamplingTime-3\#ChannelRegularConversion,Rank-4\#ChannelRegularConversion,Channel-4\#ChannelRegularConversion,SamplingTime-4\#ChannelRegularConversion,Rank-5\#ChannelRegularConversion,Channel-5\#ChannelRegularConversion,SamplingTime-5\#ChannelRegularConversion,NbrOfConversion,ExternalTrigConv
|
||||
ADC1.IPParameters=Rank-0\#ChannelRegularConversion,Channel-0\#ChannelRegularConversion,SamplingTime-0\#ChannelRegularConversion,NbrOfConversionFlag,Rank-1\#ChannelRegularConversion,Channel-1\#ChannelRegularConversion,SamplingTime-1\#ChannelRegularConversion,Rank-2\#ChannelRegularConversion,Channel-2\#ChannelRegularConversion,SamplingTime-2\#ChannelRegularConversion,Rank-3\#ChannelRegularConversion,Channel-3\#ChannelRegularConversion,SamplingTime-3\#ChannelRegularConversion,Rank-4\#ChannelRegularConversion,Channel-4\#ChannelRegularConversion,SamplingTime-4\#ChannelRegularConversion,Rank-5\#ChannelRegularConversion,Channel-5\#ChannelRegularConversion,SamplingTime-5\#ChannelRegularConversion,NbrOfConversion,ExternalTrigConv,master
|
||||
ADC1.NbrOfConversion=6
|
||||
ADC1.NbrOfConversionFlag=1
|
||||
ADC1.Rank-0\#ChannelRegularConversion=1
|
||||
@@ -54,10 +54,50 @@ Dma.ADC1.0.MemInc=DMA_MINC_ENABLE
|
||||
Dma.ADC1.0.Mode=DMA_CIRCULAR
|
||||
Dma.ADC1.0.PeriphDataAlignment=DMA_PDATAALIGN_HALFWORD
|
||||
Dma.ADC1.0.PeriphInc=DMA_PINC_DISABLE
|
||||
Dma.ADC1.0.Priority=DMA_PRIORITY_HIGH
|
||||
Dma.ADC1.0.Priority=DMA_PRIORITY_MEDIUM
|
||||
Dma.ADC1.0.RequestParameters=Instance,Direction,PeriphInc,MemInc,PeriphDataAlignment,MemDataAlignment,Mode,Priority
|
||||
Dma.Request0=ADC1
|
||||
Dma.RequestsNb=1
|
||||
Dma.Request1=USART2_RX
|
||||
Dma.Request2=USART2_TX
|
||||
Dma.Request3=USART3_RX
|
||||
Dma.Request4=USART3_TX
|
||||
Dma.RequestsNb=5
|
||||
Dma.USART2_RX.1.Direction=DMA_PERIPH_TO_MEMORY
|
||||
Dma.USART2_RX.1.Instance=DMA1_Channel6
|
||||
Dma.USART2_RX.1.MemDataAlignment=DMA_MDATAALIGN_BYTE
|
||||
Dma.USART2_RX.1.MemInc=DMA_MINC_ENABLE
|
||||
Dma.USART2_RX.1.Mode=DMA_NORMAL
|
||||
Dma.USART2_RX.1.PeriphDataAlignment=DMA_PDATAALIGN_BYTE
|
||||
Dma.USART2_RX.1.PeriphInc=DMA_PINC_DISABLE
|
||||
Dma.USART2_RX.1.Priority=DMA_PRIORITY_VERY_HIGH
|
||||
Dma.USART2_RX.1.RequestParameters=Instance,Direction,PeriphInc,MemInc,PeriphDataAlignment,MemDataAlignment,Mode,Priority
|
||||
Dma.USART2_TX.2.Direction=DMA_MEMORY_TO_PERIPH
|
||||
Dma.USART2_TX.2.Instance=DMA1_Channel7
|
||||
Dma.USART2_TX.2.MemDataAlignment=DMA_MDATAALIGN_BYTE
|
||||
Dma.USART2_TX.2.MemInc=DMA_MINC_ENABLE
|
||||
Dma.USART2_TX.2.Mode=DMA_NORMAL
|
||||
Dma.USART2_TX.2.PeriphDataAlignment=DMA_PDATAALIGN_BYTE
|
||||
Dma.USART2_TX.2.PeriphInc=DMA_PINC_DISABLE
|
||||
Dma.USART2_TX.2.Priority=DMA_PRIORITY_HIGH
|
||||
Dma.USART2_TX.2.RequestParameters=Instance,Direction,PeriphInc,MemInc,PeriphDataAlignment,MemDataAlignment,Mode,Priority
|
||||
Dma.USART3_RX.3.Direction=DMA_PERIPH_TO_MEMORY
|
||||
Dma.USART3_RX.3.Instance=DMA1_Channel3
|
||||
Dma.USART3_RX.3.MemDataAlignment=DMA_MDATAALIGN_BYTE
|
||||
Dma.USART3_RX.3.MemInc=DMA_MINC_ENABLE
|
||||
Dma.USART3_RX.3.Mode=DMA_NORMAL
|
||||
Dma.USART3_RX.3.PeriphDataAlignment=DMA_PDATAALIGN_BYTE
|
||||
Dma.USART3_RX.3.PeriphInc=DMA_PINC_DISABLE
|
||||
Dma.USART3_RX.3.Priority=DMA_PRIORITY_VERY_HIGH
|
||||
Dma.USART3_RX.3.RequestParameters=Instance,Direction,PeriphInc,MemInc,PeriphDataAlignment,MemDataAlignment,Mode,Priority
|
||||
Dma.USART3_TX.4.Direction=DMA_MEMORY_TO_PERIPH
|
||||
Dma.USART3_TX.4.Instance=DMA1_Channel2
|
||||
Dma.USART3_TX.4.MemDataAlignment=DMA_MDATAALIGN_BYTE
|
||||
Dma.USART3_TX.4.MemInc=DMA_MINC_ENABLE
|
||||
Dma.USART3_TX.4.Mode=DMA_NORMAL
|
||||
Dma.USART3_TX.4.PeriphDataAlignment=DMA_PDATAALIGN_BYTE
|
||||
Dma.USART3_TX.4.PeriphInc=DMA_PINC_DISABLE
|
||||
Dma.USART3_TX.4.Priority=DMA_PRIORITY_HIGH
|
||||
Dma.USART3_TX.4.RequestParameters=Instance,Direction,PeriphInc,MemInc,PeriphDataAlignment,MemDataAlignment,Mode,Priority
|
||||
File.Version=6
|
||||
GPIO.groupedBy=Group By Peripherals
|
||||
KeepUserPlacement=false
|
||||
@@ -103,57 +143,62 @@ Mcu.Pin25=PB11
|
||||
Mcu.Pin26=PD13
|
||||
Mcu.Pin27=PD14
|
||||
Mcu.Pin28=PD15
|
||||
Mcu.Pin29=PA9
|
||||
Mcu.Pin29=PC9
|
||||
Mcu.Pin3=OSC_OUT
|
||||
Mcu.Pin30=PA10
|
||||
Mcu.Pin31=PA13
|
||||
Mcu.Pin32=PA14
|
||||
Mcu.Pin33=PA15
|
||||
Mcu.Pin34=PC10
|
||||
Mcu.Pin35=PC11
|
||||
Mcu.Pin36=PC12
|
||||
Mcu.Pin37=PD0
|
||||
Mcu.Pin38=PD1
|
||||
Mcu.Pin39=PD2
|
||||
Mcu.Pin30=PA9
|
||||
Mcu.Pin31=PA10
|
||||
Mcu.Pin32=PA13
|
||||
Mcu.Pin33=PA14
|
||||
Mcu.Pin34=PA15
|
||||
Mcu.Pin35=PC10
|
||||
Mcu.Pin36=PC11
|
||||
Mcu.Pin37=PC12
|
||||
Mcu.Pin38=PD0
|
||||
Mcu.Pin39=PD1
|
||||
Mcu.Pin4=PC2
|
||||
Mcu.Pin40=PD3
|
||||
Mcu.Pin41=PD4
|
||||
Mcu.Pin42=PD5
|
||||
Mcu.Pin43=PD6
|
||||
Mcu.Pin44=PD7
|
||||
Mcu.Pin45=PB3
|
||||
Mcu.Pin46=PB4
|
||||
Mcu.Pin47=PB5
|
||||
Mcu.Pin48=PB6
|
||||
Mcu.Pin49=PB7
|
||||
Mcu.Pin40=PD2
|
||||
Mcu.Pin41=PD3
|
||||
Mcu.Pin42=PD4
|
||||
Mcu.Pin43=PD5
|
||||
Mcu.Pin44=PD6
|
||||
Mcu.Pin45=PD7
|
||||
Mcu.Pin46=PB3
|
||||
Mcu.Pin47=PB4
|
||||
Mcu.Pin48=PB5
|
||||
Mcu.Pin49=PB6
|
||||
Mcu.Pin5=PC3
|
||||
Mcu.Pin50=PB8
|
||||
Mcu.Pin51=PB9
|
||||
Mcu.Pin52=PE1
|
||||
Mcu.Pin53=VP_ADC1_TempSens_Input
|
||||
Mcu.Pin54=VP_ADC1_Vref_Input
|
||||
Mcu.Pin55=VP_CRC_VS_CRC
|
||||
Mcu.Pin56=VP_RTC_VS_RTC_Activate
|
||||
Mcu.Pin57=VP_SYS_VS_Systick
|
||||
Mcu.Pin58=VP_TIM3_VS_ClockSourceINT
|
||||
Mcu.Pin59=VP_TIM3_VS_no_output1
|
||||
Mcu.Pin50=PB7
|
||||
Mcu.Pin51=PB8
|
||||
Mcu.Pin52=PB9
|
||||
Mcu.Pin53=PE1
|
||||
Mcu.Pin54=VP_ADC1_TempSens_Input
|
||||
Mcu.Pin55=VP_ADC1_Vref_Input
|
||||
Mcu.Pin56=VP_CRC_VS_CRC
|
||||
Mcu.Pin57=VP_RTC_VS_RTC_Activate
|
||||
Mcu.Pin58=VP_SYS_VS_Systick
|
||||
Mcu.Pin59=VP_TIM3_VS_ClockSourceINT
|
||||
Mcu.Pin6=PA1
|
||||
Mcu.Pin60=VP_TIM4_VS_ClockSourceINT
|
||||
Mcu.Pin60=VP_TIM3_VS_no_output1
|
||||
Mcu.Pin61=VP_TIM4_VS_ClockSourceINT
|
||||
Mcu.Pin7=PA2
|
||||
Mcu.Pin8=PA3
|
||||
Mcu.Pin9=PA4
|
||||
Mcu.PinsNb=61
|
||||
Mcu.PinsNb=62
|
||||
Mcu.ThirdPartyNb=0
|
||||
Mcu.UserConstants=
|
||||
Mcu.UserName=STM32F107VCTx
|
||||
MxCube.Version=6.15.0
|
||||
MxDb.Version=DB.6.0.150
|
||||
NVIC.ADC1_2_IRQn=true\:0\:0\:false\:false\:true\:true\:true\:true
|
||||
NVIC.ADC1_2_IRQn=true\:7\:0\:true\:false\:true\:true\:true\:true
|
||||
NVIC.BusFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false
|
||||
NVIC.CAN1_RX0_IRQn=true\:0\:0\:false\:false\:true\:true\:true\:true
|
||||
NVIC.CAN2_RX1_IRQn=true\:0\:0\:false\:false\:true\:true\:true\:true
|
||||
NVIC.CAN1_RX0_IRQn=true\:3\:0\:true\:false\:true\:true\:true\:true
|
||||
NVIC.CAN2_RX1_IRQn=true\:3\:0\:true\:false\:true\:true\:true\:true
|
||||
NVIC.CAN2_TX_IRQn=true\:0\:0\:false\:false\:true\:true\:true\:true
|
||||
NVIC.DMA1_Channel1_IRQn=true\:0\:0\:false\:false\:true\:false\:true\:true
|
||||
NVIC.DMA1_Channel1_IRQn=true\:1\:0\:true\:false\:true\:false\:true\:true
|
||||
NVIC.DMA1_Channel2_IRQn=true\:4\:0\:true\:false\:true\:false\:true\:true
|
||||
NVIC.DMA1_Channel3_IRQn=true\:1\:0\:true\:false\:true\:false\:true\:true
|
||||
NVIC.DMA1_Channel6_IRQn=true\:1\:0\:true\:false\:true\:false\:true\:true
|
||||
NVIC.DMA1_Channel7_IRQn=true\:4\:0\:true\:false\:true\:false\:true\:true
|
||||
NVIC.DebugMonitor_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false
|
||||
NVIC.ForceEnableDMAVector=true
|
||||
NVIC.HardFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false
|
||||
@@ -163,11 +208,11 @@ NVIC.PendSV_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false
|
||||
NVIC.PriorityGroup=NVIC_PRIORITYGROUP_4
|
||||
NVIC.SVCall_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false
|
||||
NVIC.SysTick_IRQn=true\:15\:0\:false\:false\:true\:false\:true\:false
|
||||
NVIC.TIM3_IRQn=true\:0\:0\:false\:false\:true\:true\:true\:true
|
||||
NVIC.UART5_IRQn=true\:0\:0\:false\:false\:true\:true\:true\:true
|
||||
NVIC.USART1_IRQn=true\:0\:0\:false\:false\:true\:true\:true\:true
|
||||
NVIC.USART2_IRQn=true\:0\:0\:false\:false\:true\:true\:true\:true
|
||||
NVIC.USART3_IRQn=true\:0\:0\:false\:false\:true\:true\:true\:true
|
||||
NVIC.TIM3_IRQn=true\:6\:0\:true\:false\:true\:true\:true\:true
|
||||
NVIC.UART5_IRQn=true\:5\:0\:true\:false\:true\:true\:true\:true
|
||||
NVIC.USART1_IRQn=true\:5\:0\:true\:false\:true\:true\:true\:true
|
||||
NVIC.USART2_IRQn=true\:2\:0\:true\:false\:true\:true\:true\:true
|
||||
NVIC.USART3_IRQn=true\:2\:0\:true\:false\:true\:true\:true\:true
|
||||
NVIC.UsageFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false
|
||||
OSC_IN.Mode=HSE-External-Oscillator
|
||||
OSC_IN.Signal=RCC_OSC_IN
|
||||
@@ -262,6 +307,8 @@ PC10.Signal=USART3_TX
|
||||
PC11.Locked=true
|
||||
PC11.Mode=Asynchronous
|
||||
PC11.Signal=USART3_RX
|
||||
PC12.GPIOParameters=GPIO_Label
|
||||
PC12.GPIO_Label=HEATER
|
||||
PC12.Mode=Asynchronous
|
||||
PC12.Signal=UART5_TX
|
||||
PC14-OSC32_IN.Mode=LSE-External-Oscillator
|
||||
@@ -285,6 +332,11 @@ PC5.GPIOParameters=GPIO_Label
|
||||
PC5.GPIO_Label=LOCK_B
|
||||
PC5.Locked=true
|
||||
PC5.Signal=GPIO_Output
|
||||
PC9.GPIOParameters=GPIO_Speed,GPIO_Label
|
||||
PC9.GPIO_Label=LED_DATA
|
||||
PC9.GPIO_Speed=GPIO_SPEED_FREQ_HIGH
|
||||
PC9.Locked=true
|
||||
PC9.Signal=GPIO_Output
|
||||
PD0.Locked=true
|
||||
PD0.Mode=CAN_Activate
|
||||
PD0.Signal=CAN1_RX
|
||||
|
||||
@@ -1,133 +0,0 @@
|
||||
# Журнал изменений (сессия чата): `fork/CCSModuleSW30Web`
|
||||
|
||||
Документ фиксирует доработки проекта **CCSModuleSW30Web** в ветке/каталоге форка
|
||||
`/Users/colorbass/STM32CubeIDE/workspace_1.12.0/fork/CCSModuleSW30Web`, обсуждавшиеся и вносившиеся в рамках описанной сессии (UART, ADC/DMA, CP, отладка IRQ, оптимизация `-Ofast` для кода из прерываний).
|
||||
|
||||
---
|
||||
|
||||
## 1. UART и протокол
|
||||
|
||||
### 1.1. UART3 (Everest / `serial.c`)
|
||||
|
||||
- Таймаут «нет связи с хостом»:** `EVEREST_TIMEOUT_MS` = **5000** мс.
|
||||
- Жёсткий реинициал при отсутствии RX:** `UART3_REINIT_TIMEOUT_MS` = **1500** мс (с защитой от слишком частых реинициалов через `uart3_last_reinit_tick`).
|
||||
- Расширено логирование путей сброса/ошибок приёма и ошибок HAL для диагностики «таймаут без остановки UART3».
|
||||
- Колбэки и вспомогательные функции, вызываемые из контекста прерывания, помечены **`ISR_FAST`** (см. раздел 6):
|
||||
`CCS_RxEventCallback`, `HAL_UART_ErrorCallback`, `uart3_log_hal_error`, `uart3_arm_rx_or_log`, цепочка разбора пакета (`process_received_packet`, `crc16_ibm`, `expected_payload_len`, `apply_command`).
|
||||
|
||||
### 1.2. UART2 / `serial_control.c`
|
||||
|
||||
- Отдельная логика **`SC_UART2_Watchdog()`**, вызывается из **`SC_Task()`** (не из IRQ).
|
||||
- Константы:
|
||||
- **`SC_UART2_REINIT_TIMEOUT_MS`** = **500** мс — порог для жёсткого реинициала при отсутствии пакетов;
|
||||
- **`SC_UART2_PACKET_TIMEOUT_MS`** = **5000** мс — таймаут коммуникации.
|
||||
- Сценарий **новый пакет при `BUSY_TX`**: при необходимости **`Abort_IT`**, сброс направления RS-485, затем повторная инициализация UART и приём `ReceiveToIdle_IT` (защита от обрыва TX из-за агрессивного watchdog).
|
||||
- Отдельная ветка **жёсткого реинициала при `BUSY_TX`** с логом `USART2 BUSY_TX: hard reinit` (отслеживание `sc_uart2_last_busy_tx_reinit_packet_tick`).
|
||||
- HAL-колбэки **`HAL_UARTEx_RxEventCallback`**, **`HAL_UART_TxCpltCallback`** помечены **`ISR_FAST`**.
|
||||
|
||||
### 1.3. `SC_SendPacket` и стек CRC/кодирования
|
||||
|
||||
- Для единообразной оптимизации пути «IRQ → ответ» на функции **`calculate_crc32`**, **`encode_packet`**, **`parse_packet`**, **`process_received_packet`** и публичную **`SC_SendPacket`** добавлен **`ISR_FAST`**.
|
||||
- В **`Core/Inc/serial_control.h`**: подключение **`isr_opt.h`**, прототип **`ISR_FAST void SC_SendPacket(...)`** (согласованность с определением в `.c`).
|
||||
|
||||
**Замечание:** `SC_SendPacket` вызывается и из основного потока; для GCC вся функция компилируется с `-Ofast`. При необходимости строгого разделения можно вынести отдельную версию «только из IRQ».
|
||||
|
||||
---
|
||||
|
||||
## 2. Отладочные линии DBG в `stm32f1xx_it.c`
|
||||
|
||||
На время входа/выхода из выбранных обработчиков прерываний поднимается/опускается соответствующий GPIO — удобно для осциллографа (длительность IRQ).
|
||||
|
||||
| Линия | Обработчик |
|
||||
|--------|------------|
|
||||
| **DBG1** | `UART5_IRQHandler` |
|
||||
| **DBG2** | `USART2_IRQHandler` |
|
||||
| **DBG3** | `USART3_IRQHandler` |
|
||||
| **DBG4** | `DMA1_Channel1_IRQHandler`, `ADC1_2_IRQHandler`, `TIM3_IRQHandler` |
|
||||
| **DBG5** | `CAN1_RX0_IRQHandler`, `CAN2_TX_IRQHandler`, `CAN2_RX1_IRQHandler` |
|
||||
| — | `USART1_IRQHandler` — без обёртки DBG (по согласованию) |
|
||||
|
||||
В **`DMA1_Channel1_IRQHandler`** вызывается **`HAL_DMA_IRQHandler(&hdma_adc1)`** для цепочки ADC+DMA.
|
||||
|
||||
Для всего файла **`stm32f1xx_it.c`** под GCC добавлено:
|
||||
|
||||
```c
|
||||
#pragma GCC optimize("Ofast")
|
||||
```
|
||||
|
||||
(в блоке `USER CODE BEGIN Includes`).
|
||||
|
||||
---
|
||||
|
||||
## 3. ADC: DMA, глобальные данные, колбэк
|
||||
|
||||
- Файлы **`adc.c` / `adc.h`**: структура **`ADC_ScanData_t`**, глобально **`volatile ADC_ScanData_t adc_data`** с полями сырых каналов (`in3_raw`, `cp_raw`, `ntc1_raw`, `ntc2_raw`, `temp_sensor_raw`, `vrefint_raw` и т.д. по фактическому объявлению в заголовке).
|
||||
- **`HAL_ADC_ConvCpltCallback`**: копирование из буфера DMA в **`adc_data`**, помечен **`ISR_FAST`**.
|
||||
- Публичная **`ADC_ScanStart()`** — запуск сканирования (после калибровки вызывается из инициализации платы).
|
||||
- **`board.c`**: после **`HAL_ADCEx_Calibration_Start`** вызывается **`ADC_ScanStart()`**; **`CONN_ReadTemp`** читает **`adc_data.ntc1_raw` / `ntc2_raw`** вместо блокирующего опроса ADC.
|
||||
|
||||
**Диагностика (из обсуждения):** если не вызываются **`HAL_ADC_ConvCpltCallback`** / **`HAL_DMA_IRQHandler`**, проверять: срабатывание триггера ADC (например, **TIM3 TRGO**), работу TIM3, порядок инициализации DMA/NVIC, срабатывание **`DMA1_Channel1_IRQHandler`**.
|
||||
|
||||
---
|
||||
|
||||
## 4. CP (`cp.c` / `cp.h`)
|
||||
|
||||
- Измерение опоры на **`adc_data.cp_raw`** (и при необходимости **`vrefint_raw`** по текущей реализации в коде).
|
||||
- Логика классификации/порогов приведена к варианту, согласованному с основным **CCSModuleSW30Web** (не форк).
|
||||
- Сэмпл по таймеру: уход от тяжёлой работы в IRQ OC — использование **`HAL_TIM_OC_Start`** без прерывания по сравнению, обновление напряжения в **`CP_GetVoltage()`** / основном цикле (**`CP_Loop`** опирается на **`CP_GetState()`** и т.п. по фактическому коду).
|
||||
|
||||
---
|
||||
|
||||
## 5. Отладочный UART (`debug.c`)
|
||||
|
||||
При **`#ifndef USE_WEB_INTERFACE`** (или эквивалентной ветке сборки в файле): колбэк **`HAL_UARTEx_RxEventCallback`** и **`debug_rx_interrupt`** помечены **`ISR_FAST`**.
|
||||
|
||||
---
|
||||
|
||||
## 6. Оптимизация `-Ofast` для кода из прерываний
|
||||
|
||||
### 6.1. Макрос `ISR_FAST`
|
||||
|
||||
Файл **`Core/Inc/isr_opt.h`**:
|
||||
|
||||
- **GCC:** `#define ISR_FAST __attribute__((optimize("Ofast")))`
|
||||
- **Иное:** пустой макрос.
|
||||
|
||||
### 6.2. Где используется (по состоянию репозитория)
|
||||
|
||||
| Файл | Элементы с `ISR_FAST` / pragma |
|
||||
|------|--------------------------------|
|
||||
| `stm32f1xx_it.c` | `#pragma GCC optimize("Ofast")` на весь файл (GCC) |
|
||||
| `adc.c` | `HAL_ADC_ConvCpltCallback` |
|
||||
| `serial.c` | `CCS_RxEventCallback`, `HAL_UART_ErrorCallback`, `uart3_log_hal_error`, `uart3_arm_rx_or_log`, `process_received_packet`, `crc16_ibm`, `expected_payload_len`, `apply_command` |
|
||||
| `serial_control.c` | `HAL_UARTEx_RxEventCallback`, `HAL_UART_TxCpltCallback`, `calculate_crc32`, `encode_packet`, `parse_packet`, `process_received_packet`, `SC_SendPacket` |
|
||||
| `serial_control.h` | прототип `SC_SendPacket` + `#include "isr_opt.h"` |
|
||||
| `psu_control.c` | `HAL_CAN_RxFifo1MsgPendingCallback` |
|
||||
| `debug.c` | см. раздел 5 |
|
||||
|
||||
---
|
||||
|
||||
## 7. Ограничения и переносимость
|
||||
|
||||
- **`ISR_FAST`** и pragma в **`stm32f1xx_it.c`** рассчитаны на **GCC** (STM32CubeIDE по умолчанию). Для **IAR / ARM Compiler 6** потребуется отдельная стратегия (прагмы/ключи проекта).
|
||||
- **`-Ofast`** допускает агрессивные преобразования с плавающей точкой и перестановки, влияющие на строго воспроизводимую арифметику; для критичных вычислений вне IRQ при необходимости ограничивайте область оптимизации.
|
||||
|
||||
---
|
||||
|
||||
## 8. Затронутые пути (краткий список)
|
||||
|
||||
- `Core/Inc/isr_opt.h` — новый/центральный заголовок оптимизации IRQ.
|
||||
- `Core/Inc/serial_control.h` — `isr_opt.h`, `ISR_FAST` у `SC_SendPacket`.
|
||||
- `Core/Src/stm32f1xx_it.c` — DBG, DMA ADC, pragma `Ofast`.
|
||||
- `Core/Src/adc.c`, `Core/Inc/adc.h` — DMA, `adc_data`, `ADC_ScanStart`, колбэк.
|
||||
- `Core/Src/board.c` — калибровка, старт скана, температура из `adc_data`.
|
||||
- `Core/Src/cp.c`, `Core/Inc/cp.h` — CP и ADC.
|
||||
- `Core/Src/serial.c` — UART3, таймауты, логи, `ISR_FAST`.
|
||||
- `Core/Src/serial_control.c` — UART2, watchdog, `ISR_FAST`.
|
||||
- `Core/Src/psu_control.c` — CAN RX callback.
|
||||
- `Core/Src/debug.c` — отладочный UART под условием сборки.
|
||||
- `Core/Src/dma.c`, `gpio.c`, `main.h` — по необходимости для DMA1 Ch1 и DBG-пинов.
|
||||
|
||||
---
|
||||
|
||||
*Документ сгенерирован для фиксации контекста сессии; при дальнейших правках кода имеет смысл обновлять соответствующие разделы вручную.*
|
||||
Vendored
BIN
Binary file not shown.
Vendored
BIN
Binary file not shown.
+1
-17
@@ -1,21 +1,5 @@
|
||||
/* USER CODE BEGIN Header */
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file adc.h
|
||||
* @brief This file contains all the function prototypes for
|
||||
* the adc.c file
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* Copyright (c) 2024 STMicroelectronics.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This software is licensed under terms that can be found in the LICENSE file
|
||||
* in the root directory of this software component.
|
||||
* If no LICENSE file comes with this software, it is provided AS-IS.
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
/* USER CODE END Header */
|
||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||
#ifndef __ADC_H__
|
||||
|
||||
+5
-14
@@ -1,14 +1,6 @@
|
||||
/*
|
||||
* board.h
|
||||
*
|
||||
* Created on: Apr 15, 2024
|
||||
* Author: colorbass
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#ifndef SRC_BOARD_H_
|
||||
#define SRC_BOARD_H_
|
||||
|
||||
void GBT_Lock(uint8_t state);
|
||||
#include <stdint.h>
|
||||
|
||||
typedef enum{
|
||||
RELAY_AUX0 = 0,
|
||||
@@ -24,6 +16,7 @@ typedef enum{
|
||||
} relay_t;
|
||||
|
||||
void RELAY_Write(relay_t num, uint8_t state);
|
||||
uint8_t RELAY_Read(relay_t num);
|
||||
void Init_Peripheral();
|
||||
uint8_t GBT_LockGetState();
|
||||
void GBT_Lock(uint8_t state);
|
||||
@@ -55,10 +48,8 @@ typedef struct __attribute__((packed)) {
|
||||
uint8_t stationType; // Байт 4: тип станции
|
||||
uint8_t boardVersion; // Байт 5: версия платы
|
||||
uint8_t addrEdcan; // Байт 6: адрес EDCAN
|
||||
uint8_t reserved[57]; // Байты 7-63: зарезервированы
|
||||
uint8_t maxPower; // Байт 7: максимальная мощность станции (5кВт/bit)
|
||||
uint8_t reserved[56]; // Байты 8-63: зарезервированы
|
||||
} InfoBlock_t;
|
||||
|
||||
extern InfoBlock_t *InfoBlock;
|
||||
|
||||
|
||||
#endif /* SRC_BOARD_H_ */
|
||||
|
||||
Executable → Regular
+1
-17
@@ -1,21 +1,5 @@
|
||||
/* USER CODE BEGIN Header */
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file can.h
|
||||
* @brief This file contains all the function prototypes for
|
||||
* the can.c file
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* Copyright (c) 2024 STMicroelectronics.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This software is licensed under terms that can be found in the LICENSE file
|
||||
* in the root directory of this software component.
|
||||
* If no LICENSE file comes with this software, it is provided AS-IS.
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
/* USER CODE END Header */
|
||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||
#ifndef __CAN_H__
|
||||
|
||||
@@ -5,9 +5,28 @@
|
||||
#define PSU_MIN_VOLTAGE 150 //1V/bit
|
||||
#define PSU_MAX_CURRENT 133 //1A/bit
|
||||
#define PSU_MIN_CURRENT 1 //1A/bit
|
||||
#define PSU_MAX_POWER 30000 //1W/bit
|
||||
#define PSU_MAX_POWER 40000 //1W/bit
|
||||
|
||||
#define PSU_NUM 1
|
||||
|
||||
#define GBT_CH_VER_MAJOR 1
|
||||
#define GBT_CH_VER_MINOR 0
|
||||
/* Dynamic LV clamp (CS60 hv_limit): active only on overload at low bus voltage. */
|
||||
#define PSU_LV_CLAMP_V 499u
|
||||
#define PSU_HV_LIMIT_ON_THRESHOLD 480u
|
||||
#define PSU_HV_LIMIT_OFF_THRESHOLD 495u
|
||||
#define PSU_HV_SWITCH_DELAY_MS 1000u
|
||||
#define PSU_HV_LOAD_CURRENT 300u /* 30.0 A, MeasuredCurrent is 0.1 A/bit */
|
||||
#define PSU_HV_LIMIT_MAX_COUNT 3u
|
||||
|
||||
/* Fast discharge: PSU off/on cycle on step-down setpoint (unloaded bus). */
|
||||
#define PSD_ENABLE 1u
|
||||
#define PSD_MAX_CMD_CURRENT_0P1A 20u /* 2.0 A */
|
||||
#define PSD_MAX_MEASURED_CURRENT_0P1A 30u /* 3.0 A */
|
||||
#define PSD_MEASURED_LATCH_MS 500u
|
||||
#define PSD_MIN_VOLTAGE_STEP_V 50u
|
||||
#define PSD_DISCHARGE_MARGIN_V 15u
|
||||
#define PSD_DEBOUNCE_MS 2000u
|
||||
#define PSD_MAX_PER_SESSION 4u
|
||||
#define PSD_OFF_TIMEOUT_MS 10000u /* как PSU_WAIT_ACK_OFF */
|
||||
#define PSD_ON_TIMEOUT_MS 10000u
|
||||
#define PSD_ON_RETRY_MS 500u /* повтор SET+ON в ON_WAIT */
|
||||
#define PSD_PRECHARGE_TOLERANCE_V 40u /* ~±10% for 350 V precharge window */
|
||||
|
||||
@@ -1,12 +1,4 @@
|
||||
/*
|
||||
* charger_control.h
|
||||
*
|
||||
* Created on: Jul 29, 2024
|
||||
* Author: colorbass
|
||||
*/
|
||||
|
||||
#ifndef INC_CHARGER_CONTROL_H_
|
||||
#define INC_CHARGER_CONTROL_H_
|
||||
#pragma once
|
||||
|
||||
#include "main.h"
|
||||
|
||||
@@ -55,6 +47,7 @@ typedef enum __attribute__((packed)){
|
||||
CONN_ERR_HOTPLUG = 8, // Коннектор неожиданно отключился
|
||||
CONN_ERR_EV_COMM = 9, // Ошибка протокола связи с электромобилем
|
||||
CONN_ERR_PSU_FAULT = 10, // Ошибка PSU
|
||||
CONN_ERR_FIRE_ALARM = 11, // Пожарная тревога (до перезагрузки)
|
||||
|
||||
}CONN_Error_t;
|
||||
|
||||
@@ -75,6 +68,10 @@ typedef struct{
|
||||
uint16_t WantedCurrent; //0.1A/bit
|
||||
CONN_Error_t chargingError; // 0 if okay
|
||||
uint8_t EvConnected;
|
||||
uint32_t ChargingTime; // seconds of active charging in current session
|
||||
uint8_t hv_limit; // Limits PSU voltage to LV range when set
|
||||
uint32_t hv_tick; // Timer for delayed HV limit switching
|
||||
uint8_t hv_limit_count; // Anti-chatter counter for LV limit switching
|
||||
|
||||
} ChargingConnector_t;
|
||||
|
||||
@@ -83,16 +80,7 @@ typedef struct{
|
||||
|
||||
extern ChargingConnector_t CONN;
|
||||
|
||||
//информация о зарядке
|
||||
|
||||
//база данных с хранением инфы
|
||||
//главный блок хранит в себе инфу о конфиге возможно во флеше
|
||||
//либо в charger_config.h
|
||||
//OCPP - универсальный блок типа
|
||||
|
||||
void CONN_Init();
|
||||
void CONN_Loop();
|
||||
|
||||
void CONN_PrintChargingTotal();
|
||||
|
||||
#endif /* INC_CHARGER_CONTROL_H_ */
|
||||
void CONN_GetElapsedForMonitoring(uint16_t *min, uint8_t *sec);
|
||||
|
||||
+1
-12
@@ -1,12 +1,4 @@
|
||||
/*
|
||||
* connector.h
|
||||
*
|
||||
* Created on: Jul 31, 2024
|
||||
* Author: colorbass
|
||||
*/
|
||||
|
||||
#ifndef INC_CONNECTOR_H_
|
||||
#define INC_CONNECTOR_H_
|
||||
#pragma once
|
||||
|
||||
#include "main.h"
|
||||
#include "charger_control.h"
|
||||
@@ -15,7 +7,4 @@
|
||||
extern CONN_State_t connectorState;
|
||||
|
||||
void CONN_Init();
|
||||
void CONN_Task();
|
||||
void CONN_SetState(CONN_State_t state);
|
||||
|
||||
#endif /* INC_CONNECTOR_H_ */
|
||||
|
||||
+5
-4
@@ -1,5 +1,4 @@
|
||||
#ifndef __CP_H
|
||||
#define __CP_H
|
||||
#pragma once
|
||||
|
||||
#include "main.h"
|
||||
#include <stdint.h>
|
||||
@@ -16,12 +15,14 @@ typedef enum {
|
||||
EV_STATE_ACQUIRING = 6,
|
||||
} CP_State_t;
|
||||
|
||||
extern CP_State_t cp_state_buffer;
|
||||
|
||||
void CP_Init(void);
|
||||
void CP_SetDuty(uint8_t percentage);
|
||||
uint8_t CP_GetDuty(void);
|
||||
int32_t CP_GetVoltage(void);
|
||||
CP_State_t CP_GetState(void);
|
||||
CP_State_t CP_GetFilteredState(void);
|
||||
void CP_FilterState(void);
|
||||
void CP_Loop(void);
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
+1
-17
@@ -1,21 +1,5 @@
|
||||
/* USER CODE BEGIN Header */
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file crc.h
|
||||
* @brief This file contains all the function prototypes for
|
||||
* the crc.c file
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* Copyright (c) 2025 STMicroelectronics.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This software is licensed under terms that can be found in the LICENSE file
|
||||
* in the root directory of this software component.
|
||||
* If no LICENSE file comes with this software, it is provided AS-IS.
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
/* USER CODE END Header */
|
||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||
#ifndef __CRC_H__
|
||||
|
||||
+1
-11
@@ -1,12 +1,4 @@
|
||||
/*
|
||||
* debug.h
|
||||
*
|
||||
* Created on: Apr 16, 2024
|
||||
* Author: colorbass
|
||||
*/
|
||||
|
||||
#ifndef SRC_DEBUG_H_
|
||||
#define SRC_DEBUG_H_
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdarg.h>
|
||||
@@ -30,5 +22,3 @@ void debug_buffer_send(void);
|
||||
|
||||
// Кастомный printf с приоритетом лога
|
||||
int log_printf(LogLevel_t level, const char *format, ...);
|
||||
|
||||
#endif /* SRC_DEBUG_H_ */
|
||||
|
||||
+1
-17
@@ -1,21 +1,5 @@
|
||||
/* USER CODE BEGIN Header */
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file dma.h
|
||||
* @brief This file contains all the function prototypes for
|
||||
* the dma.c file
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* Copyright (c) 2026 STMicroelectronics.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This software is licensed under terms that can be found in the LICENSE file
|
||||
* in the root directory of this software component.
|
||||
* If no LICENSE file comes with this software, it is provided AS-IS.
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
/* USER CODE END Header */
|
||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||
#ifndef __DMA_H__
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
#ifndef INC_FIRE_ALARM_H_
|
||||
#define INC_FIRE_ALARM_H_
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
uint8_t FireAlarm_IsLatched(void);
|
||||
void FireAlarm_Activate(void);
|
||||
|
||||
#endif /* INC_FIRE_ALARM_H_ */
|
||||
Executable → Regular
+1
-17
@@ -1,21 +1,5 @@
|
||||
/* USER CODE BEGIN Header */
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file gpio.h
|
||||
* @brief This file contains all the function prototypes for
|
||||
* the gpio.c file
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* Copyright (c) 2024 STMicroelectronics.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This software is licensed under terms that can be found in the LICENSE file
|
||||
* in the root directory of this software component.
|
||||
* If no LICENSE file comes with this software, it is provided AS-IS.
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
/* USER CODE END Header */
|
||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||
#ifndef __GPIO_H__
|
||||
|
||||
+1
-4
@@ -1,5 +1,4 @@
|
||||
#ifndef ISR_OPT_H
|
||||
#define ISR_OPT_H
|
||||
#pragma once
|
||||
|
||||
/* GCC: быстрые функции, вызываемые из IRQ / из HAL из IRQ-контекста */
|
||||
#if defined(__GNUC__)
|
||||
@@ -7,5 +6,3 @@
|
||||
#else
|
||||
#define ISR_FAST
|
||||
#endif
|
||||
|
||||
#endif /* ISR_OPT_H */
|
||||
|
||||
+8
-18
@@ -1,21 +1,5 @@
|
||||
/* USER CODE BEGIN Header */
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file : main.h
|
||||
* @brief : Header for main.c file.
|
||||
* This file contains the common defines of the application.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* Copyright (c) 2024 STMicroelectronics.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This software is licensed under terms that can be found in the LICENSE file
|
||||
* in the root directory of this software component.
|
||||
* If no LICENSE file comes with this software, it is provided AS-IS.
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
/* USER CODE END Header */
|
||||
|
||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||
@@ -43,7 +27,7 @@ extern "C" {
|
||||
/* USER CODE BEGIN EC */
|
||||
#define FW_VERSION_MAJOR 1
|
||||
#define FW_VERSION_MINOR 0
|
||||
#define FW_VERSION_PATCH 15
|
||||
#define FW_VERSION_PATCH 31
|
||||
/* USER CODE END EC */
|
||||
|
||||
/* Exported macro ------------------------------------------------------------*/
|
||||
@@ -55,6 +39,8 @@ extern "C" {
|
||||
void Error_Handler(void);
|
||||
|
||||
/* USER CODE BEGIN EFP */
|
||||
uint8_t ED_TraceWarning(uint8_t flag, uint8_t id);
|
||||
void ED_Delay(uint32_t Delay);
|
||||
|
||||
/* USER CODE END EFP */
|
||||
|
||||
@@ -101,8 +87,12 @@ void Error_Handler(void);
|
||||
#define DBG5_GPIO_Port GPIOB
|
||||
#define DBG4_Pin GPIO_PIN_11
|
||||
#define DBG4_GPIO_Port GPIOB
|
||||
#define LED_DATA_Pin GPIO_PIN_9
|
||||
#define LED_DATA_GPIO_Port GPIOC
|
||||
#define RELAY_CC_Pin GPIO_PIN_15
|
||||
#define RELAY_CC_GPIO_Port GPIOA
|
||||
#define HEATER_Pin GPIO_PIN_12
|
||||
#define HEATER_GPIO_Port GPIOC
|
||||
#define RELAY_DC_Pin GPIO_PIN_3
|
||||
#define RELAY_DC_GPIO_Port GPIOD
|
||||
#define USART2_DIR_Pin GPIO_PIN_4
|
||||
|
||||
+1
-13
@@ -1,25 +1,15 @@
|
||||
/*
|
||||
* psu_struct.h
|
||||
*
|
||||
* Created on: Jul 24, 2024
|
||||
* Author: colorbass
|
||||
*/
|
||||
|
||||
#ifndef INC_METER_H_
|
||||
#define INC_METER_H_
|
||||
#pragma once
|
||||
|
||||
#include "main.h"
|
||||
#include "charger_config.h"
|
||||
|
||||
|
||||
typedef struct {
|
||||
uint32_t meterLastTick; // Время последнего пакета Alive
|
||||
uint8_t online;
|
||||
uint32_t lastTick; // Время последнего вызова для каждого коннектора
|
||||
uint64_t EnergyPSU_Ws; // Энергия для каждого коннектора (расчет по силовым модулям)
|
||||
uint32_t AbsoluteEnergy; // Абсолютная энергия каждого счетчика (ватт*час)
|
||||
uint32_t EnergyOffset; // смещение энергии по счетчикам (если 0, значит не успели захватить Offset) (ватт*час)
|
||||
uint32_t EnergyOffset1; // смещение энергии по счетчикам относительно PSU
|
||||
|
||||
uint8_t enable; //если 0, то счетчик обнуляется
|
||||
}METER_t;
|
||||
@@ -27,5 +17,3 @@ typedef struct {
|
||||
extern METER_t METER;
|
||||
|
||||
void METER_CalculateEnergy();
|
||||
|
||||
#endif /* INC_METER_H_ */
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include "power_setpoint_policy.h"
|
||||
|
||||
typedef enum {
|
||||
PSD_TRY_IDLE = 0,
|
||||
PSD_TRY_APPLIED_NORMAL,
|
||||
PSD_TRY_START_FAST_DISCHARGE,
|
||||
} PowerSetpointTryResult_t;
|
||||
|
||||
void PowerSetpoint_Init(void);
|
||||
void PowerSetpoint_OnCommand(uint16_t voltage_V, uint16_t current_0p1A);
|
||||
void PowerSetpoint_UpdateDeliveryLatch(void);
|
||||
uint8_t PowerSetpoint_HasPending(void);
|
||||
uint8_t PowerSetpoint_IsBusy(void);
|
||||
PowerSetpointTryResult_t PowerSetpoint_TryApply(void);
|
||||
void PowerSetpoint_GetFastDischargeTarget(PowerSetpoint_t *target);
|
||||
void PowerSetpoint_OnFastDischargeComplete(void);
|
||||
void PowerSetpoint_OnFastDischargeAbort(void);
|
||||
@@ -0,0 +1,35 @@
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include "charger_config.h"
|
||||
|
||||
typedef struct {
|
||||
uint16_t voltage_V;
|
||||
uint16_t current_0p1A;
|
||||
} PowerSetpoint_t;
|
||||
|
||||
typedef enum {
|
||||
POWER_SETPOINT_NORMAL,
|
||||
POWER_SETPOINT_FAST_DISCHARGE,
|
||||
} PowerSetpointAction_t;
|
||||
|
||||
typedef struct {
|
||||
uint8_t dc_contactor_closed;
|
||||
uint8_t psu_hv_enabled;
|
||||
uint16_t measured_voltage_V;
|
||||
uint16_t measured_current_0p1A;
|
||||
uint8_t power_delivery_active;
|
||||
uint8_t enable_output;
|
||||
uint8_t psu_state_connected;
|
||||
uint8_t psu_cont_fault;
|
||||
uint8_t psu_fault;
|
||||
uint8_t fast_discharge_count;
|
||||
uint32_t last_fast_discharge_ms;
|
||||
uint32_t now_ms;
|
||||
} PowerPathContext_t;
|
||||
|
||||
PowerSetpointAction_t PowerSetpoint_Decide(
|
||||
const PowerSetpoint_t *applied,
|
||||
const PowerSetpoint_t *next,
|
||||
const PowerPathContext_t *ctx);
|
||||
+8
-16
@@ -1,20 +1,12 @@
|
||||
/*
|
||||
* ccs_control.h
|
||||
*
|
||||
* Created on: 19 авг. 2024 г.
|
||||
* Author: colorbass
|
||||
*/
|
||||
|
||||
#ifndef INC_PSU_CONTROL_H_
|
||||
#define INC_PSU_CONTROL_H_
|
||||
#pragma once
|
||||
|
||||
#include "main.h"
|
||||
#include "charger_config.h"
|
||||
|
||||
void PSU_Init();
|
||||
void PSU_Enable(uint8_t addr, uint8_t enable);
|
||||
void PSU_Loop();
|
||||
void CONT_Loop();
|
||||
void PSU_SetVoltageCurrent(uint8_t addr, uint16_t voltage, uint16_t current);
|
||||
void PSU_ReadWrite(void);
|
||||
|
||||
// --- Состояние силового модуля (DC30, один PSU) ---
|
||||
|
||||
@@ -25,6 +17,11 @@ typedef enum{
|
||||
PSU_WAIT_ACK_ON, // ждём подтверждение включения модуля (напряжение выше порога)
|
||||
PSU_CONT_WAIT_ACK_ON, // включаем DC-контактор и ждём подтверждение
|
||||
PSU_CONNECTED, // модуль включён, DC-контактор замкнут
|
||||
PSU_FAST_DISCHARGE_OFF,
|
||||
PSU_FAST_DISCHARGE_WAIT, /* ждём подтверждение выключения (как PSU_WAIT_ACK_OFF) */
|
||||
PSU_FAST_DISCHARGE_SET, /* задать целевое U/I при выключенном модуле */
|
||||
PSU_FAST_DISCHARGE_ON, /* команда включения после set */
|
||||
PSU_FAST_DISCHARGE_ON_WAIT, /* ждём подтверждение включения (как PSU_WAIT_ACK_ON) */
|
||||
PSU_CURRENT_DROP, // снижение тока перед отключением
|
||||
PSU_WAIT_ACK_OFF, // ждём подтверждение выключения модуля (напряжение ниже порога)
|
||||
PSU_CONT_WAIT_ACK_OFF, // выключаем DC-контактор и ждём подтверждение
|
||||
@@ -87,7 +84,6 @@ typedef struct {
|
||||
|
||||
// Дополнительные параметры для одного модуля DC30
|
||||
uint32_t power_limit; // лимит мощности [кВт]
|
||||
uint8_t hv_mode; // HV-режим (ограничение напряжения)
|
||||
|
||||
uint32_t tempAmbient; // температура окружающего воздуха (из PSU_04)
|
||||
union { uint8_t raw; PSU_Status0_t bits; } status0; // modularForm0
|
||||
@@ -190,7 +186,3 @@ extern PSU_1B_t PSU_1B;
|
||||
extern PSU_1C_t PSU_1C;
|
||||
|
||||
#pragma pack(pop)
|
||||
|
||||
|
||||
|
||||
#endif /* INC_PSU_CONTROL_H_ */
|
||||
|
||||
@@ -1,14 +1,7 @@
|
||||
/*
|
||||
* rgb_handler.h
|
||||
*
|
||||
* Created on: Jul 25, 2024
|
||||
* Author: colorbass
|
||||
*/
|
||||
|
||||
#ifndef INC_RGB_CONTROLLER_H_
|
||||
#define INC_RGB_CONTROLLER_H_
|
||||
#pragma once
|
||||
|
||||
#include "main.h"
|
||||
#include "serial_control.h"
|
||||
|
||||
#pragma pack(push, 1)
|
||||
|
||||
@@ -48,6 +41,7 @@ typedef struct{
|
||||
void LED_Task();
|
||||
void LED_Write();
|
||||
void LED_Init();
|
||||
|
||||
|
||||
#endif /* INC_RGB_CONTROLLER_H_ */
|
||||
void LED_SetColor(const RGB_Cycle_t *color);
|
||||
void RGB_SetColor(RGB_t *color);
|
||||
void WS2812_SetColor(RGB_t *color);
|
||||
uint8_t LED_ApplyLightingConfig(const LightingConfigPacket_t *config);
|
||||
|
||||
Executable → Regular
+1
-17
@@ -1,21 +1,5 @@
|
||||
/* USER CODE BEGIN Header */
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file rtc.h
|
||||
* @brief This file contains all the function prototypes for
|
||||
* the rtc.c file
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* Copyright (c) 2024 STMicroelectronics.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This software is licensed under terms that can be found in the LICENSE file
|
||||
* in the root directory of this software component.
|
||||
* If no LICENSE file comes with this software, it is provided AS-IS.
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
/* USER CODE END Header */
|
||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||
#ifndef __RTC_H__
|
||||
|
||||
+8
-10
@@ -1,5 +1,4 @@
|
||||
#ifndef __SERIAL_H
|
||||
#define __SERIAL_H
|
||||
#pragma once
|
||||
|
||||
#include "main.h"
|
||||
#include "charger_control.h"
|
||||
@@ -11,14 +10,16 @@ void CCS_Init(void);
|
||||
void CCS_SendEmergencyStop(void);
|
||||
void CCS_SendStart(void);
|
||||
void CCS_RxEventCallback(UART_HandleTypeDef *huart, uint16_t size);
|
||||
void CCS_TxCpltCallback(UART_HandleTypeDef *huart);
|
||||
void HAL_UART_ErrorCallback(UART_HandleTypeDef *huart);
|
||||
|
||||
typedef enum {
|
||||
CCS_DISABLED = 0,
|
||||
CCS_UNPLUGGED = 1,
|
||||
CCS_AUTH_REQUIRED = 2,
|
||||
CCS_CONNECTED = 3,
|
||||
CCS_REPLUGGING = 4,
|
||||
CCS_UNKNOWN = 0,
|
||||
CCS_DISABLED = 1,
|
||||
CCS_UNPLUGGED = 2,
|
||||
CCS_AUTH_REQUIRED = 3,
|
||||
CCS_CONNECTED = 4,
|
||||
CCS_REPLUGGING = 5,
|
||||
} CCS_ConnectorState_t;
|
||||
|
||||
typedef enum {
|
||||
@@ -123,6 +124,3 @@ extern CCS_MaxLoad_t CCS_MaxLoad;
|
||||
extern CCS_EvInfo_t CCS_EvInfo;
|
||||
extern CONN_State_t CCS_EvseState;
|
||||
extern uint8_t REPLUG;
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -1,13 +1,10 @@
|
||||
#ifndef SERIALCONTROL_H
|
||||
#define SERIALCONTROL_H
|
||||
#pragma once
|
||||
|
||||
#include "main.h"
|
||||
#include <string.h>
|
||||
#include "charger_control.h"
|
||||
#include "isr_opt.h"
|
||||
|
||||
#define USE_WEB_INTERFACE
|
||||
|
||||
// Команды от ПК к устройству
|
||||
// Пакет статуса изоляции от отдельного блока по одностороннему UART
|
||||
#define CMD_ISOLATION_STATUS 0x01
|
||||
@@ -25,9 +22,12 @@
|
||||
|
||||
// Сервисные команды
|
||||
#define CMD_SET_CONFIG 0xB0
|
||||
#define CMD_SET_LIGHTING 0xB1
|
||||
|
||||
// Перезагрузка для входа в бутлоадер
|
||||
#define CMD_DEVICE_RESET 0xB5
|
||||
// Пожарная тревога (внешний триггер)
|
||||
#define CMD_FIRE_ALARM 0xB7
|
||||
|
||||
// Коды ответов
|
||||
#define RESP_SUCCESS 0x12
|
||||
@@ -148,6 +148,27 @@ typedef struct __attribute__((packed)) {
|
||||
|
||||
} ConfigBlock_t;
|
||||
|
||||
typedef struct __attribute__((packed)) {
|
||||
uint8_t r;
|
||||
uint8_t g;
|
||||
uint8_t b;
|
||||
uint8_t brightness;
|
||||
uint8_t effect;
|
||||
uint8_t speed;
|
||||
uint8_t fadeTo;
|
||||
} LightingRolePacket_t;
|
||||
|
||||
typedef struct __attribute__((packed)) {
|
||||
uint8_t mode;
|
||||
uint8_t flags;
|
||||
uint8_t previewSec;
|
||||
uint8_t reserved;
|
||||
LightingRolePacket_t roles[5];
|
||||
} LightingConfigPacket_t;
|
||||
|
||||
_Static_assert(sizeof(LightingRolePacket_t) == 7, "Lighting role packet must be 7 bytes");
|
||||
_Static_assert(sizeof(LightingConfigPacket_t) == 39, "Lighting config packet must be 39 bytes");
|
||||
|
||||
// Предварительное объявление структуры протокола
|
||||
typedef struct SerialControl_t SerialControl_t;
|
||||
|
||||
@@ -170,6 +191,7 @@ struct SerialControl_t {
|
||||
void SC_Init();
|
||||
void SC_Task();
|
||||
ISR_FAST void SC_SendPacket(const uint8_t* payload, uint16_t payload_len, uint8_t response_code);
|
||||
void SC_RecoverUartDma(UART_HandleTypeDef *huart);
|
||||
|
||||
// Внешняя функция обработки команд (определена в serial_handler.c)
|
||||
extern void SC_CommandHandler(ReceivedCommand_t* cmd);
|
||||
@@ -179,5 +201,3 @@ extern StatusPacket_t statusPacket;
|
||||
extern InfoPacket_t infoPacket;
|
||||
extern IsolationStatusPacket_t ISO;
|
||||
extern volatile SC_Source_t g_sc_command_source;
|
||||
|
||||
#endif // SERIALCONTROL_H
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
#ifndef SMA_FILTER_H
|
||||
#define SMA_FILTER_H
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
@@ -18,6 +17,3 @@ typedef struct {
|
||||
|
||||
void SMAFilter_Init(SMAFilter_t* f);
|
||||
int32_t SMAFilter_Update(SMAFilter_t* f, int32_t x);
|
||||
|
||||
#endif // SMA_FILTER_H
|
||||
|
||||
|
||||
+1
-11
@@ -1,12 +1,4 @@
|
||||
/*
|
||||
* soft_rtc.h
|
||||
*
|
||||
* Created on: Jul 22, 2024
|
||||
* Author: colorbass
|
||||
*/
|
||||
|
||||
#ifndef INC_SOFT_RTC_H_
|
||||
#define INC_SOFT_RTC_H_
|
||||
#pragma once
|
||||
|
||||
#include "main.h"
|
||||
|
||||
@@ -15,5 +7,3 @@ void set_Time(uint32_t unix_time);
|
||||
void unix_to_bcd(uint32_t unix_time, uint8_t *time);
|
||||
void writeTimeReg(uint8_t reg_number, uint8_t value);
|
||||
uint8_t getTimeReg(uint8_t reg_number);
|
||||
|
||||
#endif /* INC_SOFT_RTC_H_ */
|
||||
|
||||
@@ -1,20 +1,5 @@
|
||||
/* USER CODE BEGIN Header */
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file stm32f1xx_hal_conf.h
|
||||
* @brief HAL configuration file.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* Copyright (c) 2017 STMicroelectronics.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This software is licensed under terms that can be found in the LICENSE file
|
||||
* in the root directory of this software component.
|
||||
* If no LICENSE file comes with this software, it is provided AS-IS.
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
/* USER CODE END Header */
|
||||
|
||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||
|
||||
+5
-16
@@ -1,20 +1,5 @@
|
||||
/* USER CODE BEGIN Header */
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file stm32f1xx_it.h
|
||||
* @brief This file contains the headers of the interrupt handlers.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* Copyright (c) 2024 STMicroelectronics.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This software is licensed under terms that can be found in the LICENSE file
|
||||
* in the root directory of this software component.
|
||||
* If no LICENSE file comes with this software, it is provided AS-IS.
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
/* USER CODE END Header */
|
||||
|
||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||
@@ -56,6 +41,10 @@ void DebugMon_Handler(void);
|
||||
void PendSV_Handler(void);
|
||||
void SysTick_Handler(void);
|
||||
void DMA1_Channel1_IRQHandler(void);
|
||||
void DMA1_Channel2_IRQHandler(void);
|
||||
void DMA1_Channel3_IRQHandler(void);
|
||||
void DMA1_Channel6_IRQHandler(void);
|
||||
void DMA1_Channel7_IRQHandler(void);
|
||||
void ADC1_2_IRQHandler(void);
|
||||
void CAN1_RX0_IRQHandler(void);
|
||||
void TIM3_IRQHandler(void);
|
||||
|
||||
+1
-17
@@ -1,21 +1,5 @@
|
||||
/* USER CODE BEGIN Header */
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file tim.h
|
||||
* @brief This file contains all the function prototypes for
|
||||
* the tim.c file
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* Copyright (c) 2025 STMicroelectronics.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This software is licensed under terms that can be found in the LICENSE file
|
||||
* in the root directory of this software component.
|
||||
* If no LICENSE file comes with this software, it is provided AS-IS.
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
/* USER CODE END Header */
|
||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||
#ifndef __TIM_H__
|
||||
|
||||
+1
-17
@@ -1,21 +1,5 @@
|
||||
/* USER CODE BEGIN Header */
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file usart.h
|
||||
* @brief This file contains all the function prototypes for
|
||||
* the usart.c file
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* Copyright (c) 2025 STMicroelectronics.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This software is licensed under terms that can be found in the LICENSE file
|
||||
* in the root directory of this software component.
|
||||
* If no LICENSE file comes with this software, it is provided AS-IS.
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
/* USER CODE END Header */
|
||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||
#ifndef __USART_H__
|
||||
|
||||
Vendored
BIN
Binary file not shown.
+3
-19
@@ -1,21 +1,5 @@
|
||||
/* USER CODE BEGIN Header */
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file adc.c
|
||||
* @brief This file provides code for the configuration
|
||||
* of the ADC instances.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* Copyright (c) 2024 STMicroelectronics.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This software is licensed under terms that can be found in the LICENSE file
|
||||
* in the root directory of this software component.
|
||||
* If no LICENSE file comes with this software, it is provided AS-IS.
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
/* USER CODE END Header */
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "adc.h"
|
||||
@@ -180,7 +164,7 @@ void HAL_ADC_MspInit(ADC_HandleTypeDef* adcHandle)
|
||||
hdma_adc1.Init.PeriphDataAlignment = DMA_PDATAALIGN_HALFWORD;
|
||||
hdma_adc1.Init.MemDataAlignment = DMA_MDATAALIGN_HALFWORD;
|
||||
hdma_adc1.Init.Mode = DMA_CIRCULAR;
|
||||
hdma_adc1.Init.Priority = DMA_PRIORITY_HIGH;
|
||||
hdma_adc1.Init.Priority = DMA_PRIORITY_MEDIUM;
|
||||
if (HAL_DMA_Init(&hdma_adc1) != HAL_OK)
|
||||
{
|
||||
Error_Handler();
|
||||
@@ -189,7 +173,7 @@ void HAL_ADC_MspInit(ADC_HandleTypeDef* adcHandle)
|
||||
__HAL_LINKDMA(adcHandle,DMA_Handle,hdma_adc1);
|
||||
|
||||
/* ADC1 interrupt Init */
|
||||
HAL_NVIC_SetPriority(ADC1_2_IRQn, 0, 0);
|
||||
HAL_NVIC_SetPriority(ADC1_2_IRQn, 7, 0);
|
||||
HAL_NVIC_EnableIRQ(ADC1_2_IRQn);
|
||||
/* USER CODE BEGIN ADC1_MspInit 1 */
|
||||
|
||||
|
||||
+27
-20
@@ -1,13 +1,9 @@
|
||||
|
||||
#include "main.h"
|
||||
#include "board.h"
|
||||
#include "adc.h"
|
||||
#include "tim.h"
|
||||
#include "sma_filter.h"
|
||||
|
||||
//TODO:
|
||||
//TEMP READ
|
||||
// Connector temperature sensors
|
||||
#include "adc.h"
|
||||
#include "main.h"
|
||||
#include "sma_filter.h"
|
||||
#include "tim.h"
|
||||
|
||||
InfoBlock_t *InfoBlock = (InfoBlock_t *)(VERSION_OFFSET);
|
||||
|
||||
@@ -74,19 +70,31 @@ uint8_t IN_ReadInput(inputNum_t input_n){
|
||||
}
|
||||
}
|
||||
|
||||
uint8_t GetBoardTemp(){
|
||||
//TODO
|
||||
// HAL_ADC_Start(&hadc1); // start the adc
|
||||
//
|
||||
// HAL_ADC_PollForConversion(&hadc1, 100); // poll for conversion
|
||||
//
|
||||
// adc_val = HAL_ADC_GetValue(&hadc1); // get the adc value
|
||||
//
|
||||
// HAL_ADC_Stop(&hadc1); // stop adc
|
||||
/* Заглушка: температура платы не измеряется (нет реализации АЦП для канала). */
|
||||
uint8_t GetBoardTemp(void){
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Force PC12 (HEATER) as GPIO output via CRH/ODR, overriding UART5 MspInit.
|
||||
* CubeMX assigns PC12 to UART5_TX; on the board it drives the heater relay.
|
||||
*/
|
||||
static void Heater_PinForceOutput(void)
|
||||
{
|
||||
const uint32_t pin_cfg = GPIO_SPEED_FREQ_LOW; /* MODE=10, CNF=00: GP output PP, 2 MHz */
|
||||
|
||||
__HAL_RCC_GPIOC_CLK_ENABLE();
|
||||
|
||||
MODIFY_REG(HEATER_GPIO_Port->CRH,
|
||||
(GPIO_CRH_MODE12 | GPIO_CRH_CNF12),
|
||||
(pin_cfg << GPIO_CRH_MODE12_Pos));
|
||||
|
||||
HEATER_GPIO_Port->BSRR = (uint32_t)HEATER_Pin << 16U;
|
||||
}
|
||||
|
||||
void Init_Peripheral(){
|
||||
Heater_PinForceOutput();
|
||||
HAL_GPIO_WritePin(HEATER_GPIO_Port, HEATER_Pin, GPIO_PIN_RESET);
|
||||
HAL_ADCEx_Calibration_Start(&hadc1);
|
||||
ADC_ScanStart();
|
||||
|
||||
@@ -95,8 +103,8 @@ void Init_Peripheral(){
|
||||
RELAY_Write(RELAY3, 0);
|
||||
RELAY_Write(RELAY_DC, 0);
|
||||
RELAY_Write(RELAY_AC, 0);
|
||||
RELAY_Write(RELAY_CP, 1);
|
||||
RELAY_Write(RELAY_CC, 1);
|
||||
RELAY_Write(RELAY_CP, 0);
|
||||
RELAY_Write(RELAY_CC, 0);
|
||||
RELAY_Write(RELAY_DC1, 0);
|
||||
|
||||
SMAFilter_Init(&conn_temp_adc_filter[0]);
|
||||
@@ -138,7 +146,6 @@ int16_t CONN_ReadTemp(uint8_t ch){
|
||||
return 20; //Термодатчик не подключен
|
||||
}
|
||||
|
||||
// int adc_value = 2048; // Пример значения АЦП
|
||||
float Vref = 3.3; // Напряжение опорное
|
||||
float Vin = 5.0; // Входное напряжение
|
||||
float R = 1000; // Сопротивление резистора в Омах
|
||||
|
||||
+3
-19
@@ -1,21 +1,5 @@
|
||||
/* USER CODE BEGIN Header */
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file can.c
|
||||
* @brief This file provides code for the configuration
|
||||
* of the CAN instances.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* Copyright (c) 2025 STMicroelectronics.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This software is licensed under terms that can be found in the LICENSE file
|
||||
* in the root directory of this software component.
|
||||
* If no LICENSE file comes with this software, it is provided AS-IS.
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
/* USER CODE END Header */
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "can.h"
|
||||
@@ -127,7 +111,7 @@ void HAL_CAN_MspInit(CAN_HandleTypeDef* canHandle)
|
||||
__HAL_AFIO_REMAP_CAN1_3();
|
||||
|
||||
/* CAN1 interrupt Init */
|
||||
HAL_NVIC_SetPriority(CAN1_RX0_IRQn, 0, 0);
|
||||
HAL_NVIC_SetPriority(CAN1_RX0_IRQn, 3, 0);
|
||||
HAL_NVIC_EnableIRQ(CAN1_RX0_IRQn);
|
||||
/* USER CODE BEGIN CAN1_MspInit 1 */
|
||||
|
||||
@@ -165,7 +149,7 @@ void HAL_CAN_MspInit(CAN_HandleTypeDef* canHandle)
|
||||
/* CAN2 interrupt Init */
|
||||
HAL_NVIC_SetPriority(CAN2_TX_IRQn, 0, 0);
|
||||
HAL_NVIC_EnableIRQ(CAN2_TX_IRQn);
|
||||
HAL_NVIC_SetPriority(CAN2_RX1_IRQn, 0, 0);
|
||||
HAL_NVIC_SetPriority(CAN2_RX1_IRQn, 3, 0);
|
||||
HAL_NVIC_EnableIRQ(CAN2_RX1_IRQn);
|
||||
/* USER CODE BEGIN CAN2_MspInit 1 */
|
||||
|
||||
|
||||
+31
-30
@@ -1,57 +1,65 @@
|
||||
|
||||
#include "charger_control.h"
|
||||
|
||||
#include "charger_config.h"
|
||||
#include "psu_control.h"
|
||||
#include "connector.h"
|
||||
#include "debug.h"
|
||||
#include "fire_alarm.h"
|
||||
#include "psu_control.h"
|
||||
|
||||
ChargingConnector_t CONN;
|
||||
CONN_State_t connectorState;
|
||||
extern uint8_t config_initialized;
|
||||
|
||||
void CONN_Init(){
|
||||
|
||||
CONN.connControl = CMD_NONE;
|
||||
CONN.connState = Unknown;
|
||||
CONN.RequestedVoltage = PSU_MIN_VOLTAGE;
|
||||
CONN.ChargingTime = 0;
|
||||
CONN.hv_limit = 0u;
|
||||
CONN.hv_tick = 0u;
|
||||
CONN.hv_limit_count = 0u;
|
||||
|
||||
}
|
||||
|
||||
void CONN_Loop(){
|
||||
static uint32_t charging_time_tick = 0;
|
||||
static CONN_State_t last_connState = Unknown;
|
||||
if(last_connState != CONN.connState){
|
||||
last_connState = CONN.connState;
|
||||
CONN.connControl = CMD_NONE;
|
||||
}
|
||||
|
||||
if(PSU0.cont_fault){
|
||||
if (FireAlarm_IsLatched()) {
|
||||
CONN.chargingError = CONN_ERR_FIRE_ALARM;
|
||||
} else if(PSU0.cont_fault){
|
||||
CONN.chargingError = CONN_ERR_CONTACTOR;
|
||||
} else if(PSU0.psu_fault){
|
||||
CONN.chargingError = CONN_ERR_PSU_FAULT;
|
||||
// } else if(!CTRL.ac_ok) {
|
||||
// CONN.chargingError = CONN_ERR_AC_FAULT;
|
||||
// } else
|
||||
}else if (CONN.EvConnected == 0){
|
||||
CONN.chargingError = CONN_NO_ERROR;
|
||||
}
|
||||
|
||||
if(ED_TraceWarning(CONN.chargingError, 0)) printf("CONN%d Error: %d\n", 0, CONN.chargingError);
|
||||
|
||||
}
|
||||
|
||||
void CONN_Task(){
|
||||
/* CCS state machine is handled in serial.c.
|
||||
* Keep this task lightweight for scheduler compatibility.
|
||||
*/
|
||||
if (CONN.chargingError != CONN_NO_ERROR) {
|
||||
CONN_SetState(Disabled);
|
||||
return;
|
||||
if(ED_TraceWarning(CONN.chargingError, 0)) {
|
||||
log_printf(LOG_WARN, "CONN0 Error: %d\n", (int)CONN.chargingError);
|
||||
}
|
||||
|
||||
if (connectorState == Unknown && config_initialized) {
|
||||
CONN_SetState(Unplugged);
|
||||
} else if (connectorState == Disabled && CONN.chargingError == CONN_NO_ERROR) {
|
||||
CONN_SetState(Unplugged);
|
||||
if (HAL_GetTick() - charging_time_tick >= 1000U) {
|
||||
charging_time_tick += 1000U;
|
||||
if (CONN.connState == Charging) {
|
||||
CONN.ChargingTime++;
|
||||
}
|
||||
if (CONN.connState == Unplugged) {
|
||||
CONN.ChargingTime = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CONN_GetElapsedForMonitoring(uint16_t *min, uint8_t *sec) {
|
||||
uint32_t elapsed_sec = CONN.ChargingTime;
|
||||
if (min != NULL) {
|
||||
*min = (uint16_t)(elapsed_sec / 60U);
|
||||
}
|
||||
if (sec != NULL) {
|
||||
*sec = (uint8_t)(elapsed_sec % 60U);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -80,10 +88,3 @@ void CONN_SetState(CONN_State_t state){
|
||||
|
||||
CONN.connState = state;
|
||||
}
|
||||
|
||||
void CONN_PrintChargingTotal(){
|
||||
printf("CONN%d Charging Finished:\n", 0);
|
||||
// printf("Charging Time: %d\n", CONN.chargingTime);
|
||||
printf("Charging Energy: %d\n", CONN.Energy);
|
||||
// printf("Charging Power: %d\n", CONN.chargingPower);
|
||||
}
|
||||
|
||||
+64
-1
@@ -1,15 +1,19 @@
|
||||
#include "cp.h"
|
||||
|
||||
#include "adc.h"
|
||||
#include "board.h"
|
||||
#include "debug.h"
|
||||
#include "tim.h"
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#define MAX_DUTY 450
|
||||
#define FILTER_ORDER 100
|
||||
|
||||
static int32_t cp_voltage_mv = 0;
|
||||
static uint8_t cp_duty = 0;
|
||||
CP_State_t fake_cp_state = EV_STATE_ACQUIRING;
|
||||
CP_State_t cp_state_buffer = EV_STATE_ACQUIRING;
|
||||
|
||||
#define VREFINT_CAL_ADDR ((uint16_t*)0x1FFFF7BA) // для STM32F1!
|
||||
|
||||
@@ -93,7 +97,66 @@ CP_State_t CP_GetState(void) {
|
||||
}
|
||||
}
|
||||
|
||||
CP_State_t CP_GetFilteredState(void) {
|
||||
return cp_state_buffer;
|
||||
}
|
||||
|
||||
void CP_FilterState(void) {
|
||||
|
||||
static CP_State_t pending_state = EV_STATE_ACQUIRING;
|
||||
static uint8_t stable_count = 0u;
|
||||
CP_State_t current_state = CP_GetState();
|
||||
|
||||
/* Keep last accepted state while CP is still acquiring. */
|
||||
if (current_state == EV_STATE_ACQUIRING) {
|
||||
pending_state = EV_STATE_ACQUIRING;
|
||||
stable_count = 0u;
|
||||
return;
|
||||
}
|
||||
|
||||
if (current_state != pending_state) {
|
||||
pending_state = current_state;
|
||||
stable_count = 1u;
|
||||
return;
|
||||
}
|
||||
|
||||
if (stable_count < FILTER_ORDER) {
|
||||
stable_count++;
|
||||
}
|
||||
|
||||
if (stable_count >= FILTER_ORDER) {
|
||||
cp_state_buffer = pending_state;
|
||||
}
|
||||
}
|
||||
|
||||
void CP_Loop(void) {
|
||||
(void)CP_GetState();
|
||||
static uint32_t tick;
|
||||
if ((int32_t)(HAL_GetTick() - tick) < 1) return;
|
||||
tick = HAL_GetTick();
|
||||
static uint8_t initialized = 0;
|
||||
static CP_State_t prev_state = EV_STATE_ACQUIRING;
|
||||
static uint8_t prev_duty = 0;
|
||||
|
||||
CP_FilterState();
|
||||
|
||||
CP_State_t current_state = CP_GetFilteredState();
|
||||
uint8_t current_duty = cp_duty;
|
||||
|
||||
if (!initialized) {
|
||||
prev_state = current_state;
|
||||
prev_duty = current_duty;
|
||||
initialized = 1;
|
||||
return;
|
||||
}
|
||||
|
||||
if (current_state != prev_state) {
|
||||
log_printf(LOG_INFO, "CP state changed: %d -> %d\n", prev_state, current_state);
|
||||
prev_state = current_state;
|
||||
}
|
||||
|
||||
if (current_duty != prev_duty) {
|
||||
log_printf(LOG_INFO, "CP duty changed: %u -> %u\n", prev_duty, current_duty);
|
||||
prev_duty = current_duty;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-17
@@ -1,21 +1,5 @@
|
||||
/* USER CODE BEGIN Header */
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file crc.c
|
||||
* @brief This file provides code for the configuration
|
||||
* of the CRC instances.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* Copyright (c) 2025 STMicroelectronics.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This software is licensed under terms that can be found in the LICENSE file
|
||||
* in the root directory of this software component.
|
||||
* If no LICENSE file comes with this software, it is provided AS-IS.
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
/* USER CODE END Header */
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "crc.h"
|
||||
|
||||
+8
-232
@@ -1,21 +1,14 @@
|
||||
/*
|
||||
* debug.c
|
||||
*
|
||||
* Created on: Apr 16, 2024
|
||||
* Author: colorbass
|
||||
*/
|
||||
|
||||
#include "main.h"
|
||||
#include "board.h"
|
||||
#include "connector.h"
|
||||
#include "debug.h"
|
||||
#include "serial_control.h"
|
||||
#include "usart.h"
|
||||
#include <stdarg.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdint.h>
|
||||
#include <stdarg.h>
|
||||
#include "debug.h"
|
||||
#include "board.h"
|
||||
#include "usart.h"
|
||||
#include <time.h>
|
||||
#include <connector.h>
|
||||
#include "serial_control.h"
|
||||
|
||||
// Кольцевой буфер для отладочных сообщений
|
||||
#define DEBUG_BUFFER_SIZE 1024
|
||||
@@ -112,7 +105,7 @@ void debug_buffer_send(void)
|
||||
__enable_irq();
|
||||
}
|
||||
|
||||
#define LOG_BUFFER_SIZE 128
|
||||
#define LOG_BUFFER_SIZE 256
|
||||
uint8_t log_buffer[LOG_BUFFER_SIZE];
|
||||
|
||||
// Кастомный printf с приоритетом лога
|
||||
@@ -148,220 +141,3 @@ int log_printf(LogLevel_t level, const char *format, ...)
|
||||
return result;
|
||||
}
|
||||
|
||||
#ifndef USE_WEB_INTERFACE
|
||||
|
||||
#include "isr_opt.h"
|
||||
|
||||
extern UART_HandleTypeDef huart2;
|
||||
|
||||
|
||||
uint8_t debug_rx_buffer[256];
|
||||
uint8_t debug_cmd_received;
|
||||
uint8_t debug_rx_buffer_size = 0;
|
||||
|
||||
|
||||
ISR_FAST void HAL_UARTEx_RxEventCallback(UART_HandleTypeDef *huart, uint16_t Size){
|
||||
|
||||
// if(huart->Instance == USART1){
|
||||
// mm_rx_interrupt(huart, Size);
|
||||
// }
|
||||
if(huart->Instance == USART2){
|
||||
debug_rx_interrupt(huart, Size);
|
||||
}
|
||||
}
|
||||
|
||||
ISR_FAST void debug_rx_interrupt(UART_HandleTypeDef *huart, uint16_t Size){
|
||||
debug_rx_buffer[Size] = '\0';
|
||||
debug_rx_buffer_size = Size;
|
||||
debug_cmd_received = 1;
|
||||
}
|
||||
|
||||
void debug_init(){
|
||||
HAL_UARTEx_ReceiveToIdle_IT(&huart2,debug_rx_buffer,255);
|
||||
}
|
||||
|
||||
void parse_command(uint8_t* buffer, size_t length) {
|
||||
// ignore \r \n symbols
|
||||
size_t i = 0;
|
||||
for (i = 0; i < length; i++) {
|
||||
if (buffer[i] == '\r' || buffer[i] == '\n') {
|
||||
buffer[i] = '\0';
|
||||
length = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (buffer[0] == 0) return;
|
||||
if (strncmp((const char*)buffer, "reset", length) == 0) {
|
||||
log_printf(LOG_INFO, "Resetting...\n");
|
||||
NVIC_SystemReset();
|
||||
|
||||
} else if (strncmp((const char*)buffer, "relayaux", length) == 0) {
|
||||
log_printf(LOG_INFO, "Relaying...\n");
|
||||
RELAY_Write(RELAY_AUX, 1);
|
||||
HAL_Delay(2000);
|
||||
RELAY_Write(RELAY_AUX, 0);
|
||||
} else if (strncmp((const char*)buffer, "relaycc", length) == 0) {
|
||||
log_printf(LOG_INFO, "Relaying...\n");
|
||||
RELAY_Write(RELAY_CC, 1);
|
||||
HAL_Delay(200);
|
||||
RELAY_Write(RELAY_CC, 0);
|
||||
} else if (strncmp((const char*)buffer, "relaydc", length) == 0) {
|
||||
log_printf(LOG_INFO, "Relaying...\n");
|
||||
RELAY_Write(RELAY_DC, 1);
|
||||
HAL_Delay(200);
|
||||
RELAY_Write(RELAY_DC, 0);
|
||||
} else if (strncmp((const char*)buffer, "relayac", length) == 0) {
|
||||
log_printf(LOG_INFO, "Relaying...\n");
|
||||
RELAY_Write(RELAY_AC, 1);
|
||||
HAL_Delay(200);
|
||||
RELAY_Write(RELAY_AC, 0);
|
||||
|
||||
} else if (strncmp((const char*)buffer, "adc", length) == 0) {
|
||||
log_printf(LOG_INFO, "CC1=%.2f\n", CONN_CC_GetAdc());
|
||||
|
||||
} else if (strncmp((const char*)buffer, "lock_state", length) == 0) {
|
||||
log_printf(LOG_INFO, "Lock state=%d\n", GBT_LockGetState());
|
||||
|
||||
} else if (strncmp((const char*)buffer, "lock_lock", length) == 0) {
|
||||
log_printf(LOG_INFO, "Locked\n");
|
||||
GBT_Lock(1);
|
||||
|
||||
} else if (strncmp((const char*)buffer, "lock_unlock", length) == 0) {
|
||||
log_printf(LOG_INFO, "Unlocked\n");
|
||||
GBT_Lock(0);
|
||||
|
||||
} else if (strncmp((const char*)buffer, "complete", length) == 0) {
|
||||
CONN_SetState(Finished);
|
||||
|
||||
} else if (strncmp((const char*)buffer, "start", length) == 0) {
|
||||
log_printf(LOG_INFO, "Started\n");
|
||||
GBT_Start();
|
||||
|
||||
} else if (strncmp((const char*)buffer, "stop", length) == 0) {
|
||||
log_printf(LOG_INFO, "Stopped\n");
|
||||
GBT_StopEVSE(GBT_CST_SUSPENDS_ARTIFICIALLY);
|
||||
|
||||
} else if (strncmp((const char*)buffer, "stop1", length) == 0) {
|
||||
log_printf(LOG_INFO, "Stopped\n");
|
||||
GBT_ForceStop();
|
||||
|
||||
// } else if (strncmp((const char*)buffer, "force", length) == 0) {
|
||||
// log_printf(LOG_INFO, "Stopped\n");
|
||||
// GBT_Lock(1);
|
||||
// GBT_SwitchState(GBT_S2_LOCKED);
|
||||
// GBT_Delay(500);
|
||||
|
||||
} else if (strncmp((const char*)buffer, "cc_state", length) == 0) {
|
||||
switch(CONN_CC_GetState()){
|
||||
case GBT_CC_UNKNOWN:
|
||||
log_printf(LOG_INFO, "GBT_CC_UNKNOWN\n");
|
||||
break;
|
||||
case GBT_CC_12V:
|
||||
log_printf(LOG_INFO, "GBT_CC_12V\n");
|
||||
break;
|
||||
case GBT_CC_6V:
|
||||
log_printf(LOG_INFO, "GBT_CC_6V\n");
|
||||
break;
|
||||
case GBT_CC_4V:
|
||||
log_printf(LOG_INFO, "GBT_CC_4V\n");
|
||||
break;
|
||||
case GBT_CC_2V:
|
||||
log_printf(LOG_INFO, "GBT_CC_2V\n");
|
||||
break;
|
||||
|
||||
}
|
||||
} else if (strncmp((const char*)buffer, "temp", length) == 0) {
|
||||
log_printf(LOG_INFO, "temp1 %d\n",GBT_ReadTemp(0));
|
||||
log_printf(LOG_INFO, "temp2 %d\n",GBT_ReadTemp(1));
|
||||
} else if (strncmp((const char*)buffer, "info1", length) == 0) {
|
||||
log_printf(LOG_INFO, "Battery info:\n");
|
||||
log_printf(LOG_INFO, "maxCV %dV\n",GBT_BATStat.maxCellVoltage/100); // 0.01v/bit
|
||||
log_printf(LOG_INFO, "maxCC %dA\n",GBT_BATStat.maxChargingCurrent/10); // 0.1A/bit
|
||||
log_printf(LOG_INFO, "totE %dkWh\n",GBT_BATStat.totalEnergy/10); // 0.1kWh
|
||||
log_printf(LOG_INFO, "maxCV %dV\n",GBT_BATStat.maxChargingVoltage/10); // 0.1V/ bit
|
||||
log_printf(LOG_INFO, "maxT %dC\n",(int16_t)GBT_BATStat.maxTemp-50); // 1C/bit, -50C offset
|
||||
log_printf(LOG_INFO, "SOC %dp\n",GBT_BATStat.SOC/10); // 0.1%/bit , 0..100%
|
||||
log_printf(LOG_INFO, "Volt. %dV\n",GBT_BATStat.measVoltage/10); // 0.1V/bit
|
||||
|
||||
} else if (strncmp((const char*)buffer, "info2", length) == 0) {
|
||||
log_printf(LOG_INFO, "EV info:\n");
|
||||
log_printf(LOG_INFO, "GBT_ver V%d.%d%d\n",GBT_EVInfo.version[0],GBT_EVInfo.version[1],GBT_EVInfo.version[2]);
|
||||
log_printf(LOG_INFO, "Battery type: %d\n",GBT_EVInfo.batteryType);
|
||||
log_printf(LOG_INFO, "Battery capacity: %d\n", GBT_EVInfo.batteryCapacity); // 0.1Ah/bit
|
||||
log_printf(LOG_INFO, "Battery voltage: %d\n", GBT_EVInfo.batteryVoltage); // 0.1V/bit
|
||||
log_printf(LOG_INFO, "Battery vendor: %.4s\n", GBT_EVInfo.batteryVendor); // Battery vendor (ASCII string)
|
||||
log_printf(LOG_INFO, "Battery SN: %lu\n", GBT_EVInfo.batterySN); // int
|
||||
log_printf(LOG_INFO, "Battery manufacture date: %02d.%02d.%04d\n", GBT_EVInfo.batteryManuD, GBT_EVInfo.batteryManuM ,GBT_EVInfo.batteryManuY+1985); // year (offset 1985)
|
||||
log_printf(LOG_INFO, "Battery cycles: %d\n", GBT_EVInfo.batteryCycleCount); //uint24_t
|
||||
log_printf(LOG_INFO, "Own auto: %d\n", GBT_EVInfo.ownAuto); // 0 = lizing, 1 = own auto
|
||||
log_printf(LOG_INFO, "EVIN: %.17s\n", GBT_EVInfo.EVIN); //EVIN
|
||||
log_printf(LOG_INFO, "EV_SW_VER: %.8s\n", GBT_EVInfo.EV_SW_VER);
|
||||
|
||||
} else if (strncmp((const char*)buffer, "info3", length) == 0) {
|
||||
log_printf(LOG_INFO, "GBT_MaxLoad info:\n");
|
||||
log_printf(LOG_INFO, "Output max current: %d\n",GBT_MaxLoad.maxOutputCurrent);
|
||||
log_printf(LOG_INFO, "Output min current: %d\n",GBT_MaxLoad.minOutputCurrent);
|
||||
log_printf(LOG_INFO, "Output max voltage: %d\n",GBT_MaxLoad.maxOutputVoltage);
|
||||
log_printf(LOG_INFO, "Output min voltage: %d\n",GBT_MaxLoad.minOutputVoltage);
|
||||
log_printf(LOG_INFO, "\nGBT_ChargerInfo info:\n");
|
||||
log_printf(LOG_INFO, "BMS Recognized: %d\n",GBT_ChargerInfo.bmsIdentified);
|
||||
log_printf(LOG_INFO, "Charger location: %.3s\n",GBT_ChargerInfo.chargerLocation);
|
||||
log_printf(LOG_INFO, "Charger number: %lu\n",GBT_ChargerInfo.chargerNumber);
|
||||
|
||||
|
||||
} else if (strncmp((const char*)buffer, "help", length) == 0) {
|
||||
log_printf(LOG_INFO, "Command list:\n");
|
||||
log_printf(LOG_INFO, "reset\n");
|
||||
log_printf(LOG_INFO, "help\n");
|
||||
log_printf(LOG_INFO, "cc_state\n");
|
||||
log_printf(LOG_INFO, "lock_lock\n");
|
||||
log_printf(LOG_INFO, "lock_unlock\n");
|
||||
log_printf(LOG_INFO, "lock_state\n");
|
||||
log_printf(LOG_INFO, "adc\n");
|
||||
log_printf(LOG_INFO, "relay(cc,aux,ac,dc)\n");
|
||||
log_printf(LOG_INFO, "start\n");
|
||||
log_printf(LOG_INFO, "stop\n");
|
||||
log_printf(LOG_INFO, "stop1\n");
|
||||
// log_printf(LOG_INFO, "force\n");
|
||||
log_printf(LOG_INFO, "temp\n");
|
||||
log_printf(LOG_INFO, "info1\n");
|
||||
log_printf(LOG_INFO, "info2\n");
|
||||
log_printf(LOG_INFO, "info3\n");
|
||||
log_printf(LOG_INFO, "time\n");
|
||||
log_printf(LOG_INFO, "cantest\n");
|
||||
|
||||
//TODO: info commands
|
||||
|
||||
} else if (strncmp((const char*)buffer, "time", length) == 0) {
|
||||
|
||||
time_t unix_time = (time_t)get_Current_Time();
|
||||
struct tm *parts = localtime(&unix_time);
|
||||
|
||||
log_printf(LOG_INFO, "Year: %d\n", parts->tm_year + 1900);
|
||||
log_printf(LOG_INFO, "Month: %d\n", parts->tm_mon + 1);
|
||||
log_printf(LOG_INFO, "Day: %d\n", parts->tm_mday);
|
||||
log_printf(LOG_INFO, "Hour: %d\n", parts->tm_hour);
|
||||
log_printf(LOG_INFO, "Minute: %d\n", parts->tm_min);
|
||||
log_printf(LOG_INFO, "Second: %d\n", parts->tm_sec);
|
||||
|
||||
} else if (strncmp((const char*)buffer, "cantest", length) == 0) {
|
||||
//GBT_SendCHM();
|
||||
GBT_Error(0xFDF0C0FC); //BRM Timeout
|
||||
log_printf(LOG_INFO, "can test\n");
|
||||
|
||||
} else {
|
||||
log_printf(LOG_INFO, "Unknown command\n");
|
||||
}
|
||||
}
|
||||
|
||||
void debug_task(){
|
||||
if(debug_cmd_received){
|
||||
parse_command(debug_rx_buffer, debug_rx_buffer_size);
|
||||
HAL_UARTEx_ReceiveToIdle_IT(&huart2,debug_rx_buffer,255);
|
||||
debug_cmd_received = 0;
|
||||
}
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
#endif // USE_WEB_INTERFACE
|
||||
|
||||
+14
-18
@@ -1,21 +1,5 @@
|
||||
/* USER CODE BEGIN Header */
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file dma.c
|
||||
* @brief This file provides code for the configuration
|
||||
* of all the requested memory to memory DMA transfers.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* Copyright (c) 2026 STMicroelectronics.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This software is licensed under terms that can be found in the LICENSE file
|
||||
* in the root directory of this software component.
|
||||
* If no LICENSE file comes with this software, it is provided AS-IS.
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
/* USER CODE END Header */
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
@@ -44,8 +28,20 @@ void MX_DMA_Init(void)
|
||||
|
||||
/* DMA interrupt init */
|
||||
/* DMA1_Channel1_IRQn interrupt configuration */
|
||||
HAL_NVIC_SetPriority(DMA1_Channel1_IRQn, 0, 0);
|
||||
HAL_NVIC_SetPriority(DMA1_Channel1_IRQn, 1, 0);
|
||||
HAL_NVIC_EnableIRQ(DMA1_Channel1_IRQn);
|
||||
/* DMA1_Channel2_IRQn interrupt configuration */
|
||||
HAL_NVIC_SetPriority(DMA1_Channel2_IRQn, 4, 0);
|
||||
HAL_NVIC_EnableIRQ(DMA1_Channel2_IRQn);
|
||||
/* DMA1_Channel3_IRQn interrupt configuration */
|
||||
HAL_NVIC_SetPriority(DMA1_Channel3_IRQn, 1, 0);
|
||||
HAL_NVIC_EnableIRQ(DMA1_Channel3_IRQn);
|
||||
/* DMA1_Channel6_IRQn interrupt configuration */
|
||||
HAL_NVIC_SetPriority(DMA1_Channel6_IRQn, 1, 0);
|
||||
HAL_NVIC_EnableIRQ(DMA1_Channel6_IRQn);
|
||||
/* DMA1_Channel7_IRQn interrupt configuration */
|
||||
HAL_NVIC_SetPriority(DMA1_Channel7_IRQn, 4, 0);
|
||||
HAL_NVIC_EnableIRQ(DMA1_Channel7_IRQn);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
#include "fire_alarm.h"
|
||||
|
||||
#include "charger_control.h"
|
||||
#include "debug.h"
|
||||
#include "serial.h"
|
||||
|
||||
static uint8_t fire_alarm_latched = 0;
|
||||
|
||||
uint8_t FireAlarm_IsLatched(void) {
|
||||
return fire_alarm_latched;
|
||||
}
|
||||
|
||||
void FireAlarm_Activate(void) {
|
||||
if (fire_alarm_latched) {
|
||||
return;
|
||||
}
|
||||
|
||||
fire_alarm_latched = 1;
|
||||
log_printf(LOG_ERR, "FIRE ALARM activated\n");
|
||||
}
|
||||
+6
-21
@@ -1,21 +1,5 @@
|
||||
/* USER CODE BEGIN Header */
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file gpio.c
|
||||
* @brief This file provides code for the configuration
|
||||
* of all used GPIO pins.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* Copyright (c) 2024 STMicroelectronics.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This software is licensed under terms that can be found in the LICENSE file
|
||||
* in the root directory of this software component.
|
||||
* If no LICENSE file comes with this software, it is provided AS-IS.
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
/* USER CODE END Header */
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
@@ -54,7 +38,8 @@ void MX_GPIO_Init(void)
|
||||
__HAL_RCC_GPIOD_CLK_ENABLE();
|
||||
|
||||
/*Configure GPIO pin Output Level */
|
||||
HAL_GPIO_WritePin(GPIOC, DBG1_Pin|RELAY_CP_Pin|LOCK_A_Pin|LOCK_B_Pin, GPIO_PIN_RESET);
|
||||
HAL_GPIO_WritePin(GPIOC, DBG1_Pin|RELAY_CP_Pin|LOCK_A_Pin|LOCK_B_Pin
|
||||
|LED_DATA_Pin, GPIO_PIN_RESET);
|
||||
|
||||
/*Configure GPIO pin Output Level */
|
||||
HAL_GPIO_WritePin(GPIOA, DBG2_Pin|DBG3_Pin|RELAY_CC_Pin, GPIO_PIN_RESET);
|
||||
@@ -69,12 +54,12 @@ void MX_GPIO_Init(void)
|
||||
/*Configure GPIO pin Output Level */
|
||||
HAL_GPIO_WritePin(GPIOD, RELAY_DC_Pin|USART2_DIR_Pin, GPIO_PIN_RESET);
|
||||
|
||||
/*Configure GPIO pin : DBG1_Pin */
|
||||
GPIO_InitStruct.Pin = DBG1_Pin;
|
||||
/*Configure GPIO pins : DBG1_Pin LED_DATA_Pin */
|
||||
GPIO_InitStruct.Pin = DBG1_Pin|LED_DATA_Pin;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
|
||||
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH;
|
||||
HAL_GPIO_Init(DBG1_GPIO_Port, &GPIO_InitStruct);
|
||||
HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);
|
||||
|
||||
/*Configure GPIO pins : RELAY_CP_Pin LOCK_A_Pin LOCK_B_Pin */
|
||||
GPIO_InitStruct.Pin = RELAY_CP_Pin|LOCK_A_Pin|LOCK_B_Pin;
|
||||
|
||||
+48
-16
@@ -1,4 +1,5 @@
|
||||
/* USER CODE BEGIN Header */
|
||||
|
||||
/* USER CODE END Header */
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "main.h"
|
||||
@@ -13,15 +14,17 @@
|
||||
|
||||
/* Private includes ----------------------------------------------------------*/
|
||||
/* USER CODE BEGIN Includes */
|
||||
#include "can.h"
|
||||
#include "board.h"
|
||||
#include <stdio.h>
|
||||
#include "debug.h"
|
||||
#include "soft_rtc.h"
|
||||
#include "connector.h"
|
||||
#include "serial_control.h"
|
||||
#include "charger_config.h"
|
||||
#include "connector.h"
|
||||
#include "debug.h"
|
||||
#include "meter.h"
|
||||
#include "psu_control.h"
|
||||
#include "rgb_controller.h"
|
||||
#include "serial.h"
|
||||
#include "serial_control.h"
|
||||
#include "soft_rtc.h"
|
||||
#include <stdio.h>
|
||||
/* USER CODE END Includes */
|
||||
|
||||
/* Private typedef -----------------------------------------------------------*/
|
||||
@@ -53,6 +56,7 @@ void SystemClock_Config(void);
|
||||
|
||||
/* Private user code ---------------------------------------------------------*/
|
||||
/* USER CODE BEGIN 0 */
|
||||
static void StopButtonControl(void);
|
||||
|
||||
/**
|
||||
* @brief Vector base address configuration. It should no longer be at the start of
|
||||
@@ -97,23 +101,53 @@ void ED_Delay(uint32_t Delay)
|
||||
|
||||
while ((HAL_GetTick() - tickstart) < wait){
|
||||
CCS_SerialLoop();
|
||||
// CP_Loop();
|
||||
CONN_Task();
|
||||
StopButtonControl();
|
||||
CP_Loop();
|
||||
LED_Task();
|
||||
SC_Task();
|
||||
}
|
||||
}
|
||||
|
||||
void StopButtonControl(){
|
||||
static void StopButtonControl(void){
|
||||
static uint32_t tick;
|
||||
static uint32_t hold_time;
|
||||
static uint8_t stop_btn_fault = 1;
|
||||
uint32_t now = HAL_GetTick();
|
||||
|
||||
//Charging do nothing
|
||||
if(!IN_ReadInput(IN_ESTOP)){
|
||||
CONN.connControl = CMD_STOP;
|
||||
/* Run no faster than once per 10 ms. */
|
||||
if((now - tick) < 10){
|
||||
return;
|
||||
}
|
||||
tick = now;
|
||||
|
||||
uint8_t pressed = !IN_ReadInput(IN_ESTOP);
|
||||
if(!pressed){
|
||||
stop_btn_fault = 0;
|
||||
}
|
||||
|
||||
}
|
||||
if(stop_btn_fault){
|
||||
return;
|
||||
}
|
||||
|
||||
uint8_t temp0, temp1;
|
||||
if(pressed){
|
||||
if(hold_time == 0){
|
||||
CONN.connControl = CMD_STOP;
|
||||
}
|
||||
hold_time += 10;
|
||||
if(hold_time == 5000){
|
||||
CONN.connControl = CMD_FORCE_UNLOCK;
|
||||
}
|
||||
if(hold_time > 40000){
|
||||
SC_SendPacket(NULL, 0, RESP_SUCCESS);
|
||||
while(huart2.gState == HAL_UART_STATE_BUSY_TX);
|
||||
HAL_Delay(10);
|
||||
NVIC_SystemReset();
|
||||
}
|
||||
}
|
||||
else{
|
||||
hold_time = 0;
|
||||
}
|
||||
}
|
||||
|
||||
static void CAN1_MinimalReInit(void)
|
||||
{
|
||||
@@ -205,8 +239,6 @@ int main(void)
|
||||
CONN_Loop();
|
||||
LED_Write();
|
||||
ED_Delay(10);
|
||||
StopButtonControl();
|
||||
ED_Delay(50);
|
||||
|
||||
}
|
||||
/* USER CODE END 3 */
|
||||
|
||||
+1
-9
@@ -1,13 +1,5 @@
|
||||
/*
|
||||
* meter.c
|
||||
*
|
||||
* Created on: 27 сент. 2024 г.
|
||||
* Author: root
|
||||
*/
|
||||
|
||||
|
||||
#include "meter.h"
|
||||
#include "charger_config.h"
|
||||
|
||||
#include "charger_control.h"
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,196 @@
|
||||
#include "power_setpoint_executor.h"
|
||||
|
||||
#include "charger_config.h"
|
||||
#include "charger_control.h"
|
||||
#include "debug.h"
|
||||
#include "psu_control.h"
|
||||
#include "serial.h"
|
||||
|
||||
static PowerSetpoint_t applied;
|
||||
static PowerSetpoint_t pending;
|
||||
static PowerSetpoint_t fd_target;
|
||||
static uint8_t setpoint_dirty;
|
||||
static uint8_t fd_active;
|
||||
static uint8_t power_delivery_latched;
|
||||
static uint8_t fast_discharge_count;
|
||||
static uint32_t last_fast_discharge_ms;
|
||||
static uint32_t measured_high_current_since_ms;
|
||||
|
||||
static uint8_t session_ended_state(CONN_State_t state)
|
||||
{
|
||||
return (state == Unknown) || (state == Unplugged) || (state == Finished) ||
|
||||
(state == FinishedEV) || (state == FinishedEVSE);
|
||||
}
|
||||
|
||||
void PowerSetpoint_Init(void)
|
||||
{
|
||||
applied.voltage_V = PSU_MIN_VOLTAGE;
|
||||
applied.current_0p1A = 0u;
|
||||
pending = applied;
|
||||
fd_target = applied;
|
||||
setpoint_dirty = 0u;
|
||||
fd_active = 0u;
|
||||
power_delivery_latched = 0u;
|
||||
fast_discharge_count = 0u;
|
||||
last_fast_discharge_ms = 0u;
|
||||
measured_high_current_since_ms = 0u;
|
||||
}
|
||||
|
||||
void PowerSetpoint_OnCommand(uint16_t voltage_V, uint16_t current_0p1A)
|
||||
{
|
||||
#if PSD_ENABLE
|
||||
pending.voltage_V = voltage_V;
|
||||
pending.current_0p1A = current_0p1A;
|
||||
setpoint_dirty = 1u;
|
||||
#else
|
||||
(void)voltage_V;
|
||||
(void)current_0p1A;
|
||||
#endif
|
||||
}
|
||||
|
||||
void PowerSetpoint_UpdateDeliveryLatch(void)
|
||||
{
|
||||
#if PSD_ENABLE
|
||||
uint32_t now = HAL_GetTick();
|
||||
|
||||
if (!CONN.EnableOutput || !CONN.EvConnected || session_ended_state(CCS_EvseState)) {
|
||||
power_delivery_latched = 0u;
|
||||
fast_discharge_count = 0u;
|
||||
last_fast_discharge_ms = 0u;
|
||||
measured_high_current_since_ms = 0u;
|
||||
return;
|
||||
}
|
||||
|
||||
if (CONN.WantedCurrent > PSD_MAX_CMD_CURRENT_0P1A) {
|
||||
power_delivery_latched = 1u;
|
||||
}
|
||||
|
||||
if (CCS_EvseState == Charging) {
|
||||
power_delivery_latched = 1u;
|
||||
}
|
||||
|
||||
if (CONN.MeasuredCurrent >= PSD_MAX_MEASURED_CURRENT_0P1A) {
|
||||
if (measured_high_current_since_ms == 0u) {
|
||||
measured_high_current_since_ms = now;
|
||||
} else if ((now - measured_high_current_since_ms) >= PSD_MEASURED_LATCH_MS) {
|
||||
power_delivery_latched = 1u;
|
||||
}
|
||||
} else {
|
||||
measured_high_current_since_ms = 0u;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
uint8_t PowerSetpoint_HasPending(void)
|
||||
{
|
||||
#if PSD_ENABLE
|
||||
return setpoint_dirty;
|
||||
#else
|
||||
return 0u;
|
||||
#endif
|
||||
}
|
||||
|
||||
uint8_t PowerSetpoint_IsBusy(void)
|
||||
{
|
||||
#if PSD_ENABLE
|
||||
if (!fd_active) {
|
||||
return 0u;
|
||||
}
|
||||
switch (PSU0.state) {
|
||||
case PSU_FAST_DISCHARGE_OFF:
|
||||
case PSU_FAST_DISCHARGE_WAIT:
|
||||
case PSU_FAST_DISCHARGE_SET:
|
||||
case PSU_FAST_DISCHARGE_ON:
|
||||
case PSU_FAST_DISCHARGE_ON_WAIT:
|
||||
return 1u;
|
||||
default:
|
||||
return 0u;
|
||||
}
|
||||
#else
|
||||
return 0u;
|
||||
#endif
|
||||
}
|
||||
|
||||
static PowerPathContext_t build_context(void)
|
||||
{
|
||||
PowerPathContext_t ctx;
|
||||
|
||||
ctx.dc_contactor_closed = PSU0.CONT_enabled;
|
||||
ctx.psu_hv_enabled = PSU0.PSU_enabled;
|
||||
ctx.measured_voltage_V = CONN.MeasuredVoltage;
|
||||
ctx.measured_current_0p1A = (uint16_t)CONN.MeasuredCurrent;
|
||||
ctx.power_delivery_active = power_delivery_latched;
|
||||
ctx.enable_output = CONN.EnableOutput;
|
||||
ctx.psu_state_connected = (PSU0.state == PSU_CONNECTED) ? 1u : 0u;
|
||||
ctx.psu_cont_fault = PSU0.cont_fault;
|
||||
ctx.psu_fault = PSU0.psu_fault;
|
||||
ctx.fast_discharge_count = fast_discharge_count;
|
||||
ctx.last_fast_discharge_ms = last_fast_discharge_ms;
|
||||
ctx.now_ms = HAL_GetTick();
|
||||
return ctx;
|
||||
}
|
||||
|
||||
PowerSetpointTryResult_t PowerSetpoint_TryApply(void)
|
||||
{
|
||||
#if PSD_ENABLE
|
||||
PowerPathContext_t ctx;
|
||||
PowerSetpointAction_t action;
|
||||
|
||||
if (!setpoint_dirty || fd_active) {
|
||||
return PSD_TRY_IDLE;
|
||||
}
|
||||
|
||||
ctx = build_context();
|
||||
action = PowerSetpoint_Decide(&applied, &pending, &ctx);
|
||||
|
||||
if (action == POWER_SETPOINT_FAST_DISCHARGE) {
|
||||
fd_target = pending;
|
||||
fd_active = 1u;
|
||||
setpoint_dirty = 0u;
|
||||
log_printf(LOG_INFO, "Fast discharge trigger %u->%u I=%u\n",
|
||||
(unsigned)applied.voltage_V,
|
||||
(unsigned)fd_target.voltage_V,
|
||||
(unsigned)fd_target.current_0p1A);
|
||||
return PSD_TRY_START_FAST_DISCHARGE;
|
||||
}
|
||||
|
||||
if (!PSU0.ready) {
|
||||
return PSD_TRY_IDLE;
|
||||
}
|
||||
|
||||
PSU_SetVoltageCurrent(0, pending.voltage_V, pending.current_0p1A);
|
||||
applied = pending;
|
||||
setpoint_dirty = 0u;
|
||||
return PSD_TRY_APPLIED_NORMAL;
|
||||
#else
|
||||
return PSD_TRY_IDLE;
|
||||
#endif
|
||||
}
|
||||
|
||||
void PowerSetpoint_GetFastDischargeTarget(PowerSetpoint_t *target)
|
||||
{
|
||||
if (target != 0) {
|
||||
*target = fd_target;
|
||||
}
|
||||
}
|
||||
|
||||
void PowerSetpoint_OnFastDischargeComplete(void)
|
||||
{
|
||||
#if PSD_ENABLE
|
||||
applied = fd_target;
|
||||
fd_active = 0u;
|
||||
fast_discharge_count++;
|
||||
last_fast_discharge_ms = HAL_GetTick();
|
||||
log_printf(LOG_INFO, "Fast discharge complete, V=%u\n", (unsigned)CONN.MeasuredVoltage);
|
||||
#endif
|
||||
}
|
||||
|
||||
void PowerSetpoint_OnFastDischargeAbort(void)
|
||||
{
|
||||
#if PSD_ENABLE
|
||||
fd_active = 0u;
|
||||
pending = fd_target;
|
||||
setpoint_dirty = 1u;
|
||||
log_printf(LOG_WARN, "Fast discharge aborted, V=%u\n", (unsigned)CONN.MeasuredVoltage);
|
||||
#endif
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
#include "power_setpoint_policy.h"
|
||||
|
||||
PowerSetpointAction_t PowerSetpoint_Decide(
|
||||
const PowerSetpoint_t *applied,
|
||||
const PowerSetpoint_t *next,
|
||||
const PowerPathContext_t *ctx)
|
||||
{
|
||||
#if !PSD_ENABLE
|
||||
(void)applied;
|
||||
(void)next;
|
||||
(void)ctx;
|
||||
return POWER_SETPOINT_NORMAL;
|
||||
#else
|
||||
uint16_t delta_v;
|
||||
|
||||
if (applied == 0 || next == 0 || ctx == 0) {
|
||||
return POWER_SETPOINT_NORMAL;
|
||||
}
|
||||
|
||||
if (next->voltage_V >= applied->voltage_V) {
|
||||
return POWER_SETPOINT_NORMAL;
|
||||
}
|
||||
|
||||
delta_v = (uint16_t)(applied->voltage_V - next->voltage_V);
|
||||
if (delta_v < PSD_MIN_VOLTAGE_STEP_V) {
|
||||
return POWER_SETPOINT_NORMAL;
|
||||
}
|
||||
|
||||
if (applied->current_0p1A > PSD_MAX_CMD_CURRENT_0P1A ||
|
||||
next->current_0p1A > PSD_MAX_CMD_CURRENT_0P1A) {
|
||||
return POWER_SETPOINT_NORMAL;
|
||||
}
|
||||
|
||||
if (ctx->measured_current_0p1A >= PSD_MAX_MEASURED_CURRENT_0P1A) {
|
||||
return POWER_SETPOINT_NORMAL;
|
||||
}
|
||||
|
||||
if (ctx->measured_voltage_V <= (uint16_t)(next->voltage_V + PSD_DISCHARGE_MARGIN_V)) {
|
||||
return POWER_SETPOINT_NORMAL;
|
||||
}
|
||||
|
||||
if (ctx->power_delivery_active) {
|
||||
return POWER_SETPOINT_NORMAL;
|
||||
}
|
||||
|
||||
if (!ctx->enable_output) {
|
||||
return POWER_SETPOINT_NORMAL;
|
||||
}
|
||||
|
||||
if (!ctx->psu_state_connected) {
|
||||
return POWER_SETPOINT_NORMAL;
|
||||
}
|
||||
|
||||
if (!ctx->dc_contactor_closed) {
|
||||
return POWER_SETPOINT_NORMAL;
|
||||
}
|
||||
|
||||
if (!ctx->psu_hv_enabled) {
|
||||
return POWER_SETPOINT_NORMAL;
|
||||
}
|
||||
|
||||
if (ctx->psu_cont_fault || ctx->psu_fault) {
|
||||
return POWER_SETPOINT_NORMAL;
|
||||
}
|
||||
|
||||
if (ctx->fast_discharge_count >= PSD_MAX_PER_SESSION) {
|
||||
return POWER_SETPOINT_NORMAL;
|
||||
}
|
||||
|
||||
if (ctx->last_fast_discharge_ms != 0u &&
|
||||
(ctx->now_ms - ctx->last_fast_discharge_ms) < PSD_DEBOUNCE_MS) {
|
||||
return POWER_SETPOINT_NORMAL;
|
||||
}
|
||||
|
||||
return POWER_SETPOINT_FAST_DISCHARGE;
|
||||
#endif
|
||||
}
|
||||
+499
-27
@@ -1,14 +1,14 @@
|
||||
#include "psu_control.h"
|
||||
|
||||
#include <psu_control.h>
|
||||
|
||||
#include "board.h"
|
||||
#include "can.h"
|
||||
#include "string.h"
|
||||
#include "stdio.h"
|
||||
#include "charger_config.h"
|
||||
#include "charger_control.h"
|
||||
#include "board.h"
|
||||
#include "debug.h"
|
||||
#include "isr_opt.h"
|
||||
#include "power_setpoint_executor.h"
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
PSU_02_t PSU_02;
|
||||
PSU_04_t PSU_04;
|
||||
@@ -26,12 +26,344 @@ PSU_t PSU0;
|
||||
#define PSU_VOLTAGE_THRESHOLD 20 // Порог напряжения для определения состояния (В)
|
||||
#define PSU_ONLINE_TIMEOUT 500 // Таймаут для определения состояния (мс)
|
||||
#define PSU_STARTUP_DELAY 4000 // Задержка 2 секунды перед включением
|
||||
#define PSU_DIAG_LOG_MS 2000u
|
||||
#define PSU_SUDDEN_OFF_DEBOUNCE_MS 200u
|
||||
|
||||
uint32_t can_lastpacket;
|
||||
|
||||
extern CAN_HandleTypeDef hcan2;
|
||||
|
||||
static uint16_t psu_last_can_v;
|
||||
static uint16_t psu_last_can_i_0p1A;
|
||||
static uint8_t psu_last_good_s0;
|
||||
static uint8_t psu_last_good_s1;
|
||||
static uint8_t psu_last_good_s2;
|
||||
|
||||
static void PSU_SendCmd(uint8_t source, uint8_t destination, uint8_t cmd, void *data);
|
||||
static void PSU_LogActiveStatusFlags(LogLevel_t level);
|
||||
static void PSU_MonitorStatusAndUnexpectedOff(void);
|
||||
|
||||
static const char *PSU_StateName(PSU_State_t state)
|
||||
{
|
||||
switch (state) {
|
||||
case PSU_UNREADY: return "UNREADY";
|
||||
case PSU_INITIALIZING: return "INIT";
|
||||
case PSU_READY: return "READY";
|
||||
case PSU_WAIT_ACK_ON: return "WAIT_ON";
|
||||
case PSU_CONT_WAIT_ACK_ON: return "CONT_ON";
|
||||
case PSU_CONNECTED: return "CONNECTED";
|
||||
case PSU_FAST_DISCHARGE_OFF: return "FD_OFF";
|
||||
case PSU_FAST_DISCHARGE_WAIT: return "FD_WAIT";
|
||||
case PSU_FAST_DISCHARGE_SET: return "FD_SET";
|
||||
case PSU_FAST_DISCHARGE_ON: return "FD_ON";
|
||||
case PSU_FAST_DISCHARGE_ON_WAIT: return "FD_ON_WAIT";
|
||||
case PSU_CURRENT_DROP: return "CUR_DROP";
|
||||
case PSU_CONT_WAIT_ACK_OFF: return "CONT_OFF";
|
||||
case PSU_WAIT_ACK_OFF: return "WAIT_OFF";
|
||||
case PSU_OFF_PAUSE: return "OFF_PAUSE";
|
||||
default: return "?";
|
||||
}
|
||||
}
|
||||
|
||||
static void PSU_LogPeriodicDiag(void)
|
||||
{
|
||||
static uint32_t last_log_ms;
|
||||
uint32_t now = HAL_GetTick();
|
||||
uint8_t block_setpoint;
|
||||
|
||||
/* Periodic PSU telemetry only while session is in Charging. */
|
||||
if (CONN.connState != Charging) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ((now - last_log_ms) < PSU_DIAG_LOG_MS) {
|
||||
return;
|
||||
}
|
||||
last_log_ms = now;
|
||||
|
||||
#if PSD_ENABLE
|
||||
block_setpoint = PowerSetpoint_HasPending() || PowerSetpoint_IsBusy();
|
||||
#else
|
||||
block_setpoint = 0u;
|
||||
#endif
|
||||
|
||||
log_printf(LOG_INFO,
|
||||
"PSU diag st=%s req=%uV/%u.%uA want=%uV/%u.%uA "
|
||||
"can=%uV/%u.%uA meas=%uV/%d.%uA "
|
||||
"enOut=%u out=%u rdy=%u on=%u cont=%u ac=%u hv=%u psd_blk=%u "
|
||||
"err=%u s0=0x%02x s1=0x%02x s2=0x%02x can_age=%lums\n",
|
||||
PSU_StateName(PSU0.state),
|
||||
(unsigned)CONN.RequestedVoltage,
|
||||
(unsigned)(CONN.RequestedCurrent / 10u),
|
||||
(unsigned)(CONN.RequestedCurrent % 10u),
|
||||
(unsigned)CONN.RequestedVoltage,
|
||||
(unsigned)(CONN.WantedCurrent / 10u),
|
||||
(unsigned)(CONN.WantedCurrent % 10u),
|
||||
(unsigned)psu_last_can_v,
|
||||
(unsigned)(psu_last_can_i_0p1A / 10u),
|
||||
(unsigned)(psu_last_can_i_0p1A % 10u),
|
||||
(unsigned)CONN.MeasuredVoltage,
|
||||
(int)(CONN.MeasuredCurrent / 10),
|
||||
(unsigned)(((CONN.MeasuredCurrent < 0) ?
|
||||
-CONN.MeasuredCurrent : CONN.MeasuredCurrent) % 10),
|
||||
(unsigned)CONN.EnableOutput,
|
||||
(unsigned)CONN.outputEnabled,
|
||||
(unsigned)PSU0.ready,
|
||||
(unsigned)PSU0.PSU_enabled,
|
||||
(unsigned)PSU0.CONT_enabled,
|
||||
(unsigned)PSU0.enableAC,
|
||||
(unsigned)CONN.hv_limit,
|
||||
(unsigned)block_setpoint,
|
||||
(unsigned)CONN.chargingError,
|
||||
(unsigned)PSU0.status0.raw,
|
||||
(unsigned)PSU0.status1.raw,
|
||||
(unsigned)PSU0.status2.raw,
|
||||
(unsigned long)(can_lastpacket ? (now - can_lastpacket) : 9999u));
|
||||
}
|
||||
|
||||
static void PSU_LogActiveStatusFlags(LogLevel_t level)
|
||||
{
|
||||
PSU_Status0_t s0 = PSU0.status0.bits;
|
||||
PSU_Status1_t s1 = PSU0.status1.bits;
|
||||
PSU_Status2_t s2 = PSU0.status2.bits;
|
||||
|
||||
log_printf(level,
|
||||
"PSU flags%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s\n",
|
||||
s0.shortCircuitFault ? " sc" : "",
|
||||
s0.unevenFlowAlarm ? " uneven" : "",
|
||||
s0.internalCommunicationFault ? " int_comm" : "",
|
||||
s0.inputBusLineFault ? " in_bus" : "",
|
||||
s0.lockProtection ? " lock" : "",
|
||||
s0.dischargeFault ? " disch" : "",
|
||||
s0.eepromFault ? " eeprom" : "",
|
||||
s1.dcSideOffStatus ? " dc_off" : "",
|
||||
s1.moduleFaultAlarm ? " fault" : "",
|
||||
s1.moduleProtectionAlarm ? " prot" : "",
|
||||
s1.fanFaultAlarm ? " fan" : "",
|
||||
s1.overTempAlarm ? " ot" : "",
|
||||
s1.outputOverVoltageAlarm ? " oov" : "",
|
||||
s1.outputOverCurrentAlarm ? " ooc" : "",
|
||||
s1.canCommunicationInterruptAlarm ? " can_int" : "",
|
||||
s2.powerLimitStatus ? " plim" : "",
|
||||
s2.moduleAddressDuplicate ? " addr_dup" : "",
|
||||
s2.severeUnevenFlowFault ? " uneven_hi" : "",
|
||||
s2.threePhaseInputPhaseLossAlarm ? " ph_loss" : "",
|
||||
s2.threePhaseInputUnbalanceAlarm ? " unbal" : "",
|
||||
s2.inputUnderVoltageAlarm ? " uv" : "",
|
||||
s2.inputOverVoltageAlarm ? " ov" : "",
|
||||
s2.pfcSideOffStatus ? " pfc_off" : "");
|
||||
}
|
||||
|
||||
/*
|
||||
* Observability only: does not change PSU/contactor state machine.
|
||||
* Armed only in CONN Charging phase:
|
||||
* - status bit edges while output is requested
|
||||
* - PSU_enabled 1->0 while CONNECTED + EnableOutput (sudden disable)
|
||||
*
|
||||
* Note: PSU_enabled is derived from V >= PSU_VOLTAGE_THRESHOLD, not from
|
||||
* the module enable command bit.
|
||||
*/
|
||||
static void PSU_MonitorStatusAndUnexpectedOff(void)
|
||||
{
|
||||
static uint8_t prev_s0;
|
||||
static uint8_t prev_s1;
|
||||
static uint8_t prev_s2;
|
||||
static uint8_t prev_enabled;
|
||||
static uint8_t inited;
|
||||
static uint8_t sudden_latched;
|
||||
static uint32_t sudden_cand_ms;
|
||||
|
||||
uint32_t now = HAL_GetTick();
|
||||
uint8_t in_charging;
|
||||
uint8_t watch_status;
|
||||
uint8_t expect_on;
|
||||
|
||||
in_charging = (CONN.connState == Charging);
|
||||
watch_status = in_charging && (CONN.EnableOutput != 0) && (PSU0.online != 0) &&
|
||||
((PSU0.state == PSU_CONNECTED) ||
|
||||
(PSU0.state == PSU_WAIT_ACK_ON) ||
|
||||
(PSU0.state == PSU_CONT_WAIT_ACK_ON));
|
||||
|
||||
expect_on = in_charging && (CONN.EnableOutput != 0) && (PSU0.state == PSU_CONNECTED);
|
||||
|
||||
if (!inited) {
|
||||
prev_s0 = PSU0.status0.raw;
|
||||
prev_s1 = PSU0.status1.raw;
|
||||
prev_s2 = PSU0.status2.raw;
|
||||
prev_enabled = PSU0.PSU_enabled;
|
||||
inited = 1u;
|
||||
return;
|
||||
}
|
||||
|
||||
if (watch_status) {
|
||||
if ((PSU0.status0.raw != prev_s0) ||
|
||||
(PSU0.status1.raw != prev_s1) ||
|
||||
(PSU0.status2.raw != prev_s2)) {
|
||||
log_printf(LOG_WARN,
|
||||
"PSU status change s0=0x%02x->0x%02x s1=0x%02x->0x%02x s2=0x%02x->0x%02x\n",
|
||||
(unsigned)prev_s0, (unsigned)PSU0.status0.raw,
|
||||
(unsigned)prev_s1, (unsigned)PSU0.status1.raw,
|
||||
(unsigned)prev_s2, (unsigned)PSU0.status2.raw);
|
||||
PSU_LogActiveStatusFlags(LOG_WARN);
|
||||
}
|
||||
}
|
||||
|
||||
prev_s0 = PSU0.status0.raw;
|
||||
prev_s1 = PSU0.status1.raw;
|
||||
prev_s2 = PSU0.status2.raw;
|
||||
|
||||
if (!expect_on) {
|
||||
sudden_cand_ms = 0u;
|
||||
if ((CONN.EnableOutput == 0) ||
|
||||
(CONN.connState != Charging) ||
|
||||
(PSU0.state == PSU_READY) ||
|
||||
(PSU0.state == PSU_UNREADY) ||
|
||||
(PSU0.state == PSU_OFF_PAUSE) ||
|
||||
(PSU0.state == PSU_WAIT_ACK_OFF) ||
|
||||
(PSU0.state == PSU_CONT_WAIT_ACK_OFF) ||
|
||||
(PSU0.state == PSU_CURRENT_DROP)) {
|
||||
sudden_latched = 0u;
|
||||
}
|
||||
prev_enabled = PSU0.PSU_enabled;
|
||||
return;
|
||||
}
|
||||
|
||||
if (PSU0.PSU_enabled) {
|
||||
sudden_cand_ms = 0u;
|
||||
sudden_latched = 0u;
|
||||
prev_enabled = 1u;
|
||||
return;
|
||||
}
|
||||
|
||||
if (sudden_latched) {
|
||||
prev_enabled = 0u;
|
||||
return;
|
||||
}
|
||||
|
||||
if (!prev_enabled) {
|
||||
sudden_cand_ms = 0u;
|
||||
return;
|
||||
}
|
||||
|
||||
/* Falling edge of PSU_enabled while still CONNECTED + EnableOutput + Charging */
|
||||
if (!PSU0.online) {
|
||||
log_printf(LOG_ERR,
|
||||
"PSU suddenly disabled while charging reason=can_lost "
|
||||
"V=%u I=%d cont=%u s0=0x%02x s1=0x%02x s2=0x%02x can_age=%lums\n",
|
||||
(unsigned)PSU0.outputVoltage,
|
||||
(int)PSU0.outputCurrent,
|
||||
(unsigned)PSU0.CONT_enabled,
|
||||
(unsigned)psu_last_good_s0,
|
||||
(unsigned)psu_last_good_s1,
|
||||
(unsigned)psu_last_good_s2,
|
||||
(unsigned long)(can_lastpacket ? (now - can_lastpacket) : 9999u));
|
||||
PSU_LogActiveStatusFlags(LOG_ERR);
|
||||
sudden_latched = 1u;
|
||||
sudden_cand_ms = 0u;
|
||||
prev_enabled = 0u;
|
||||
return;
|
||||
}
|
||||
|
||||
if (sudden_cand_ms == 0u) {
|
||||
sudden_cand_ms = now;
|
||||
return;
|
||||
}
|
||||
|
||||
if ((now - sudden_cand_ms) < PSU_SUDDEN_OFF_DEBOUNCE_MS) {
|
||||
return;
|
||||
}
|
||||
|
||||
log_printf(LOG_ERR,
|
||||
"PSU suddenly disabled while charging reason=output_lost "
|
||||
"V=%u I=%d cont=%u s0=0x%02x s1=0x%02x s2=0x%02x can_age=%lums\n",
|
||||
(unsigned)PSU0.outputVoltage,
|
||||
(int)PSU0.outputCurrent,
|
||||
(unsigned)PSU0.CONT_enabled,
|
||||
(unsigned)PSU0.status0.raw,
|
||||
(unsigned)PSU0.status1.raw,
|
||||
(unsigned)PSU0.status2.raw,
|
||||
(unsigned long)(can_lastpacket ? (now - can_lastpacket) : 9999u));
|
||||
PSU_LogActiveStatusFlags(LOG_ERR);
|
||||
sudden_latched = 1u;
|
||||
sudden_cand_ms = 0u;
|
||||
prev_enabled = 0u;
|
||||
}
|
||||
|
||||
static void PSU_HvControl(void)
|
||||
{
|
||||
if (CONN.EnableOutput == 0u) {
|
||||
if ((CONN.hv_limit != 0u) || (CONN.hv_limit_count != 0u)) {
|
||||
log_printf(LOG_INFO, "HV limit reset output off\n");
|
||||
}
|
||||
CONN.hv_limit = 0u;
|
||||
CONN.hv_tick = 0u;
|
||||
CONN.hv_limit_count = 0u;
|
||||
return;
|
||||
}
|
||||
|
||||
if (!PSU0.online) {
|
||||
if ((CONN.hv_limit != 0u) || (CONN.hv_limit_count != 0u)) {
|
||||
log_printf(LOG_INFO, "HV limit reset no PSU\n");
|
||||
}
|
||||
CONN.hv_limit = 0u;
|
||||
CONN.hv_tick = 0u;
|
||||
CONN.hv_limit_count = 0u;
|
||||
return;
|
||||
}
|
||||
|
||||
if (CONN.hv_limit == 0u) {
|
||||
if ((CONN.hv_limit_count < PSU_HV_LIMIT_MAX_COUNT) &&
|
||||
(CONN.MeasuredVoltage < PSU_HV_LIMIT_ON_THRESHOLD) &&
|
||||
(CONN.MeasuredCurrent > PSU_HV_LOAD_CURRENT)) {
|
||||
if (CONN.hv_tick == 0u) {
|
||||
CONN.hv_tick = HAL_GetTick();
|
||||
} else if ((HAL_GetTick() - CONN.hv_tick) >= PSU_HV_SWITCH_DELAY_MS) {
|
||||
CONN.hv_limit = 1u;
|
||||
CONN.hv_limit_count++;
|
||||
CONN.hv_tick = 0u;
|
||||
log_printf(LOG_WARN, "HV limit ON V=%d I=%d cnt=%d\n",
|
||||
(int)CONN.MeasuredVoltage,
|
||||
(int)CONN.MeasuredCurrent,
|
||||
(int)CONN.hv_limit_count);
|
||||
if (CONN.hv_limit_count >= PSU_HV_LIMIT_MAX_COUNT) {
|
||||
log_printf(LOG_WARN, "HV limit locked cnt=%d\n",
|
||||
(int)CONN.hv_limit_count);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
CONN.hv_tick = 0u;
|
||||
}
|
||||
} else {
|
||||
if ((CONN.MeasuredVoltage > PSU_HV_LIMIT_OFF_THRESHOLD) ||
|
||||
(CONN.MeasuredCurrent <= PSU_HV_LOAD_CURRENT)) {
|
||||
if (CONN.hv_tick == 0u) {
|
||||
CONN.hv_tick = HAL_GetTick();
|
||||
} else if ((HAL_GetTick() - CONN.hv_tick) >= PSU_HV_SWITCH_DELAY_MS) {
|
||||
CONN.hv_limit = 0u;
|
||||
CONN.hv_tick = 0u;
|
||||
log_printf(LOG_INFO, "HV limit OFF V=%d I=%d cnt=%d\n",
|
||||
(int)CONN.MeasuredVoltage,
|
||||
(int)CONN.MeasuredCurrent,
|
||||
(int)CONN.hv_limit_count);
|
||||
}
|
||||
} else {
|
||||
CONN.hv_tick = 0u;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void PSU_SwitchState(PSU_State_t state){
|
||||
if (PSU0.state != state) {
|
||||
log_printf(LOG_INFO,
|
||||
"PSU st %s->%s enOut=%u rdy=%u on=%u cont=%u err=%u\n",
|
||||
PSU_StateName(PSU0.state),
|
||||
PSU_StateName(state),
|
||||
(unsigned)CONN.EnableOutput,
|
||||
(unsigned)PSU0.ready,
|
||||
(unsigned)PSU0.PSU_enabled,
|
||||
(unsigned)PSU0.CONT_enabled,
|
||||
(unsigned)CONN.chargingError);
|
||||
}
|
||||
PSU0.state = state;
|
||||
PSU0.statetick = HAL_GetTick();
|
||||
}
|
||||
@@ -40,6 +372,24 @@ static uint32_t PSU_StateTime(void){
|
||||
return HAL_GetTick() - PSU0.statetick;
|
||||
}
|
||||
|
||||
static void PSU_FastDischarge_PushTarget(void)
|
||||
{
|
||||
PowerSetpoint_t fd_sp;
|
||||
|
||||
PowerSetpoint_GetFastDischargeTarget(&fd_sp);
|
||||
PSU_SetVoltageCurrent(0, fd_sp.voltage_V, fd_sp.current_0p1A);
|
||||
PSU_Enable(0, 1);
|
||||
}
|
||||
|
||||
static void PSU_FastDischarge_AbortToConnected(void)
|
||||
{
|
||||
PowerSetpoint_OnFastDischargeAbort();
|
||||
if (!PSU0.PSU_enabled) {
|
||||
PSU_FastDischarge_PushTarget();
|
||||
}
|
||||
PSU_SwitchState(PSU_CONNECTED);
|
||||
}
|
||||
|
||||
ISR_FAST void HAL_CAN_RxFifo1MsgPendingCallback(CAN_HandleTypeDef *hcan){
|
||||
|
||||
static CAN_RxHeaderTypeDef RxHeader;
|
||||
@@ -64,6 +414,9 @@ ISR_FAST void HAL_CAN_RxFifo1MsgPendingCallback(CAN_HandleTypeDef *hcan){
|
||||
PSU0.status0.raw = PSU_04.modularForm0;
|
||||
PSU0.status1.raw = PSU_04.modularForm1;
|
||||
PSU0.status2.raw = PSU_04.modularForm2;
|
||||
psu_last_good_s0 = PSU0.status0.raw;
|
||||
psu_last_good_s1 = PSU0.status1.raw;
|
||||
psu_last_good_s2 = PSU0.status2.raw;
|
||||
}
|
||||
if(CanId.command==0x06){
|
||||
memcpy(&PSU_06, RxData, 8);
|
||||
@@ -149,9 +502,9 @@ void PSU_Init(){
|
||||
PSU0.statetick = HAL_GetTick();
|
||||
|
||||
PSU0.power_limit = PSU_MAX_POWER; // kW
|
||||
PSU0.hv_mode = 0;
|
||||
|
||||
PSU_Enable(0, 0);
|
||||
PowerSetpoint_Init();
|
||||
}
|
||||
|
||||
void PSU_Enable(uint8_t addr, uint8_t enable){
|
||||
@@ -181,7 +534,9 @@ void PSU_SetVoltageCurrent(uint8_t addr, uint16_t voltage, uint16_t current){
|
||||
|
||||
if(voltage<PSU_MIN_VOLTAGE) voltage = PSU_MIN_VOLTAGE;
|
||||
|
||||
if((PSU0.hv_mode==0) && voltage>499) voltage = 499;
|
||||
if((CONN.hv_limit != 0u) && (voltage > PSU_LV_CLAMP_V)){
|
||||
voltage = PSU_LV_CLAMP_V;
|
||||
}
|
||||
|
||||
uint32_t current_ma = current * 100;
|
||||
uint32_t voltage_mv = voltage * 1000;
|
||||
@@ -196,6 +551,8 @@ void PSU_SetVoltageCurrent(uint8_t addr, uint16_t voltage, uint16_t current){
|
||||
data.moduleVoltage[2] = (voltage_mv >> 8) & 0xFF;
|
||||
data.moduleVoltage[3] = (voltage_mv >> 0) & 0xFF;
|
||||
|
||||
psu_last_can_v = voltage;
|
||||
psu_last_can_i_0p1A = current;
|
||||
PSU_SendCmd(0xF0, addr, 0x1C, &data);
|
||||
|
||||
}
|
||||
@@ -226,7 +583,6 @@ void PSU_SendCmd(uint8_t source, uint8_t destination, uint8_t cmd, void *data){
|
||||
/* если отправка удалась, выход */
|
||||
if(CAN_result == HAL_OK) {
|
||||
return;
|
||||
retry_counter = 0;
|
||||
}
|
||||
}
|
||||
ED_Delay(1);
|
||||
@@ -236,11 +592,6 @@ void PSU_SendCmd(uint8_t source, uint8_t destination, uint8_t cmd, void *data){
|
||||
|
||||
}
|
||||
|
||||
uint32_t max(uint32_t a, uint32_t b){
|
||||
if(a>b) return a;
|
||||
else return b;
|
||||
}
|
||||
|
||||
void PSU_ReadWrite(){
|
||||
|
||||
uint8_t zero_data[8] = {0,0,0,0,0,0,0,0};
|
||||
@@ -262,28 +613,50 @@ void PSU_ReadWrite(){
|
||||
}
|
||||
CONN.RequestedPower = CONN.RequestedCurrent * CONN.RequestedVoltage / 10;
|
||||
|
||||
if(PSU0.ready){
|
||||
if (CONN.RequestedVoltage == 500) { // fake
|
||||
PSU_SetVoltageCurrent(0, 300, 10); // Normal mode
|
||||
}else{
|
||||
PSU_SetVoltageCurrent(0, CONN.RequestedVoltage, CONN.RequestedCurrent); // Normal mode
|
||||
}
|
||||
ED_Delay(CAN_DELAY);
|
||||
if(CONN.MeasuredVoltage>490) PSU0.hv_mode = 1;
|
||||
}
|
||||
#if PSD_ENABLE
|
||||
{
|
||||
uint8_t block_setpoint = PowerSetpoint_HasPending() || PowerSetpoint_IsBusy();
|
||||
|
||||
// PSU_SetHVMode(0, PSU0.hv_mode); // auto set, no need
|
||||
// ED_Delay(CAN_DELAY);
|
||||
if (PSU0.ready && !block_setpoint) {
|
||||
PSU_SetVoltageCurrent(0, CONN.RequestedVoltage, CONN.RequestedCurrent);
|
||||
ED_Delay(CAN_DELAY);
|
||||
}
|
||||
}
|
||||
#else
|
||||
if (PSU0.ready) {
|
||||
PSU_SetVoltageCurrent(0, CONN.RequestedVoltage, CONN.RequestedCurrent); // Normal mode
|
||||
ED_Delay(CAN_DELAY);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (PSU0.ready) {
|
||||
PSU_HvControl();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void PSU_Task(void){
|
||||
static uint32_t psu_on_tick = 0;
|
||||
static uint32_t dc_on_tick = 0;
|
||||
static uint32_t cont_ok_tick = 0;
|
||||
static uint32_t fd_on_last_cmd_ms = 0;
|
||||
PowerSetpointTryResult_t psd_result;
|
||||
|
||||
#if PSD_ENABLE
|
||||
PowerSetpoint_UpdateDeliveryLatch();
|
||||
if (PowerSetpoint_HasPending()) {
|
||||
psd_result = PowerSetpoint_TryApply();
|
||||
if (psd_result == PSD_TRY_START_FAST_DISCHARGE) {
|
||||
PSU_SwitchState(PSU_FAST_DISCHARGE_OFF);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// Обновляем ONLINE/READY по таймауту
|
||||
if((HAL_GetTick() - can_lastpacket) > PSU_ONLINE_TIMEOUT){
|
||||
if (PSU0.online) {
|
||||
log_printf(LOG_WARN, "PSU CAN timeout age=%lums -> offline\n",
|
||||
(unsigned long)(HAL_GetTick() - can_lastpacket));
|
||||
}
|
||||
PSU0.online = 0;
|
||||
PSU0.PSU_enabled = 0;
|
||||
PSU_04.moduleTemperature = 0;
|
||||
@@ -324,6 +697,9 @@ void PSU_Task(void){
|
||||
PSU0.ready = 0;
|
||||
}
|
||||
|
||||
/* Before state transitions so CONNECTED+can_lost is still visible */
|
||||
PSU_MonitorStatusAndUnexpectedOff();
|
||||
|
||||
switch(PSU0.state){
|
||||
case PSU_UNREADY:
|
||||
PSU0.enableOutput = 0;
|
||||
@@ -342,7 +718,9 @@ void PSU_Task(void){
|
||||
|
||||
case PSU_READY:
|
||||
// модуль готов, но выключен
|
||||
PSU0.hv_mode = 0;
|
||||
CONN.hv_limit = 0u;
|
||||
CONN.hv_tick = 0u;
|
||||
CONN.hv_limit_count = 0u;
|
||||
|
||||
RELAY_Write(RELAY_DC, 0);
|
||||
if(!PSU0.ready){
|
||||
@@ -358,7 +736,6 @@ void PSU_Task(void){
|
||||
case PSU_WAIT_ACK_ON:
|
||||
|
||||
if(PSU0.PSU_enabled && PSU0.ready){
|
||||
dc_on_tick = HAL_GetTick();
|
||||
PSU_SwitchState(PSU_CONT_WAIT_ACK_ON);
|
||||
}else if(PSU_StateTime() > 10000){
|
||||
PSU0.psu_fault = 1;
|
||||
@@ -400,6 +777,99 @@ void PSU_Task(void){
|
||||
}
|
||||
break;
|
||||
|
||||
case PSU_FAST_DISCHARGE_OFF:
|
||||
if (!CONN.EnableOutput || !PSU0.ready || PSU0.cont_fault || PSU0.psu_fault) {
|
||||
log_printf(LOG_WARN, "Fast discharge abort -> stop\n");
|
||||
PowerSetpoint_OnFastDischargeAbort();
|
||||
PSU_SwitchState(PSU_CURRENT_DROP);
|
||||
break;
|
||||
}
|
||||
PSU_Enable(0, 0);
|
||||
PSU_SwitchState(PSU_FAST_DISCHARGE_WAIT);
|
||||
break;
|
||||
|
||||
case PSU_FAST_DISCHARGE_WAIT: {
|
||||
PowerSetpoint_t fd_sp;
|
||||
|
||||
if (!CONN.EnableOutput || !PSU0.ready || PSU0.cont_fault || PSU0.psu_fault) {
|
||||
log_printf(LOG_WARN, "Fast discharge abort -> stop\n");
|
||||
PowerSetpoint_OnFastDischargeAbort();
|
||||
PSU_SwitchState(PSU_CURRENT_DROP);
|
||||
break;
|
||||
}
|
||||
|
||||
/* Как PSU_WAIT_ACK_OFF: 0–20 V на телеметрии = модуль выключен */
|
||||
if (!PSU0.PSU_enabled) {
|
||||
PowerSetpoint_GetFastDischargeTarget(&fd_sp);
|
||||
log_printf(LOG_INFO, "Fast discharge off ack, V=%u -> set %u\n",
|
||||
(unsigned)CONN.MeasuredVoltage, (unsigned)fd_sp.voltage_V);
|
||||
PSU_SwitchState(PSU_FAST_DISCHARGE_SET);
|
||||
} else if (PSU_StateTime() > PSD_OFF_TIMEOUT_MS) {
|
||||
log_printf(LOG_WARN, "Fast discharge off timeout, V=%u\n",
|
||||
(unsigned)CONN.MeasuredVoltage);
|
||||
PSU_FastDischarge_AbortToConnected();
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case PSU_FAST_DISCHARGE_SET: {
|
||||
PowerSetpoint_t fd_sp;
|
||||
|
||||
if (!CONN.EnableOutput || !PSU0.ready || PSU0.cont_fault || PSU0.psu_fault) {
|
||||
log_printf(LOG_WARN, "Fast discharge abort -> stop\n");
|
||||
PowerSetpoint_OnFastDischargeAbort();
|
||||
PSU_SwitchState(PSU_CURRENT_DROP);
|
||||
break;
|
||||
}
|
||||
PowerSetpoint_GetFastDischargeTarget(&fd_sp);
|
||||
PSU_SetVoltageCurrent(0, fd_sp.voltage_V, fd_sp.current_0p1A);
|
||||
PSU_SwitchState(PSU_FAST_DISCHARGE_ON);
|
||||
break;
|
||||
}
|
||||
|
||||
case PSU_FAST_DISCHARGE_ON:
|
||||
if (!CONN.EnableOutput || !PSU0.ready || PSU0.cont_fault || PSU0.psu_fault) {
|
||||
log_printf(LOG_WARN, "Fast discharge abort -> stop\n");
|
||||
PowerSetpoint_OnFastDischargeAbort();
|
||||
PSU_SwitchState(PSU_CURRENT_DROP);
|
||||
break;
|
||||
}
|
||||
PSU_Enable(0, 1);
|
||||
fd_on_last_cmd_ms = HAL_GetTick();
|
||||
PSU_SwitchState(PSU_FAST_DISCHARGE_ON_WAIT);
|
||||
break;
|
||||
|
||||
case PSU_FAST_DISCHARGE_ON_WAIT: {
|
||||
PowerSetpoint_t fd_sp;
|
||||
uint16_t v_low;
|
||||
|
||||
if (!CONN.EnableOutput || !PSU0.ready || PSU0.cont_fault || PSU0.psu_fault) {
|
||||
log_printf(LOG_WARN, "Fast discharge abort -> stop\n");
|
||||
PowerSetpoint_OnFastDischargeAbort();
|
||||
PSU_SwitchState(PSU_CURRENT_DROP);
|
||||
break;
|
||||
}
|
||||
PowerSetpoint_GetFastDischargeTarget(&fd_sp);
|
||||
v_low = (fd_sp.voltage_V > PSD_PRECHARGE_TOLERANCE_V) ?
|
||||
(uint16_t)(fd_sp.voltage_V - PSD_PRECHARGE_TOLERANCE_V) : 0u;
|
||||
|
||||
if (PSU0.PSU_enabled && CONN.MeasuredVoltage >= v_low) {
|
||||
PowerSetpoint_OnFastDischargeComplete();
|
||||
PSU_SwitchState(PSU_CONNECTED);
|
||||
} else {
|
||||
if ((HAL_GetTick() - fd_on_last_cmd_ms) >= PSD_ON_RETRY_MS) {
|
||||
PSU_FastDischarge_PushTarget();
|
||||
fd_on_last_cmd_ms = HAL_GetTick();
|
||||
}
|
||||
if (PSU_StateTime() > PSD_ON_TIMEOUT_MS) {
|
||||
log_printf(LOG_WARN, "Fast discharge on timeout, V=%u (target %u)\n",
|
||||
(unsigned)CONN.MeasuredVoltage, (unsigned)fd_sp.voltage_V);
|
||||
PSU_FastDischarge_AbortToConnected();
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case PSU_CURRENT_DROP:
|
||||
// снижаем ток до нуля перед отключением DC
|
||||
CONN.RequestedCurrent = 0;
|
||||
@@ -446,6 +916,8 @@ void PSU_Task(void){
|
||||
PSU_SwitchState(PSU_UNREADY);
|
||||
break;
|
||||
}
|
||||
|
||||
PSU_LogPeriodicDiag();
|
||||
}
|
||||
|
||||
|
||||
|
||||
+378
-147
@@ -1,147 +1,255 @@
|
||||
#include "rgb_controller.h"
|
||||
#include "main.h"
|
||||
#include "string.h"
|
||||
#include "charger_control.h"
|
||||
|
||||
#include "board.h"
|
||||
#include "charger_control.h"
|
||||
#include "main.h"
|
||||
#include "tim.h"
|
||||
#include <string.h>
|
||||
|
||||
/* Второй светодиод в цепочке WS2812 */
|
||||
static RGB_t ws2812_led1 = { .R = 0, .G = 0, .B = 0 };
|
||||
|
||||
#define WS2812_ERROR_BLINK_MS 100
|
||||
#define WS2812_ERROR_BLINK_PAUSE 30
|
||||
|
||||
/* Яркость обоих WS2812 на плате, 0..255 */
|
||||
#define WS2812_BRIGHTNESS 60
|
||||
|
||||
RGB_State_t LED_State;
|
||||
RGB_Cycle_t LED_Cycle;
|
||||
|
||||
RGB_Cycle_t color_estop = {
|
||||
static const RGB_Cycle_t color_estop = {
|
||||
.Color1 = { .R = 250, .G = 0, .B = 0 },
|
||||
.Color2 = { .R = 250, .G = 0, .B = 0 },
|
||||
.Tr = 50,
|
||||
.Th = 50,
|
||||
.Tf = 50,
|
||||
.Tl = 50,
|
||||
.Color2 = { .R = 0, .G = 0, .B = 0 },
|
||||
.Tr = 40,
|
||||
.Th = 10,
|
||||
.Tf = 40,
|
||||
.Tl = 10,
|
||||
};
|
||||
|
||||
static const RGB_Cycle_t color_unlock = {
|
||||
.Color1 = { .R = 255, .G = 0, .B = 0 },
|
||||
.Color2 = { .R = 0, .G = 0, .B = 0 },
|
||||
.Tr = 10,
|
||||
.Th = 10,
|
||||
.Tf = 10,
|
||||
.Tl = 10,
|
||||
};
|
||||
|
||||
RGB_Cycle_t color_unknown = {
|
||||
.Color1 = { .R = 64, .G = 0, .B = 0 },
|
||||
.Color2 = { .R = 64, .G = 0, .B = 0 },
|
||||
.Tr = 50,
|
||||
.Th = 10,
|
||||
.Tf = 50,
|
||||
.Tl = 0,
|
||||
};
|
||||
/* Same init shimmer as AC22/tkzu22: hue=85, sat breathes 30↔250 (not fade-to-black). */
|
||||
static uint8_t lighting_init_active;
|
||||
|
||||
RGB_Cycle_t color_light = {
|
||||
.Color1 = { .R = 0, .G = 255, .B = 0 },
|
||||
.Color2 = { .R = 0, .G = 255, .B = 0 },
|
||||
.Tr = 50,
|
||||
.Th = 10,
|
||||
.Tf = 50,
|
||||
.Tl = 0,
|
||||
};
|
||||
static void LED_HsvToRgb(uint8_t hue, uint8_t sat, uint8_t val, RGB_t *out)
|
||||
{
|
||||
uint8_t region;
|
||||
uint8_t remainder;
|
||||
uint8_t p;
|
||||
uint8_t q;
|
||||
uint8_t t;
|
||||
|
||||
RGB_Cycle_t color_disabled = {
|
||||
.Color1 = { .R = 250, .G = 0, .B = 0 },
|
||||
.Color2 = { .R = 32, .G = 0, .B = 0 },
|
||||
.Tr = 50,
|
||||
.Th = 10,
|
||||
.Tf = 50,
|
||||
.Tl = 0,
|
||||
};
|
||||
|
||||
RGB_Cycle_t color_unplugged = {
|
||||
.Color1 = { .R = 0, .G = 128, .B = 0 },
|
||||
.Color2 = { .R = 0, .G = 128, .B = 0 },
|
||||
.Tr = 50,
|
||||
.Th = 10,
|
||||
.Tf = 50,
|
||||
.Tl = 0,
|
||||
};
|
||||
|
||||
RGB_Cycle_t color_preparing = {
|
||||
.Color1 = { .R = 0, .G = 0, .B = 250 },
|
||||
.Color2 = { .R = 0, .G = 0, .B = 250 },
|
||||
.Tr = 50,
|
||||
.Th = 10,
|
||||
.Tf = 50,
|
||||
.Tl = 0,
|
||||
};
|
||||
|
||||
RGB_Cycle_t color_charging = {
|
||||
.Color1 = { .R = 0, .G = 255, .B = 0 },
|
||||
.Color2 = { .R = 0, .G = 32, .B = 0 },
|
||||
.Tr = 50,
|
||||
.Th = 10,
|
||||
.Tf = 50,
|
||||
.Tl = 0,
|
||||
};
|
||||
|
||||
RGB_Cycle_t color_finished = {
|
||||
.Color1 = { .R = 255, .G = 255, .B = 255 },
|
||||
.Color2 = { .R = 255, .G = 255, .B = 255 },
|
||||
.Tr = 50,
|
||||
.Th = 10,
|
||||
.Tf = 50,
|
||||
.Tl = 0,
|
||||
};
|
||||
|
||||
RGB_Cycle_t color_error = {
|
||||
.Color1 = { .R = 255, .G = 0, .B = 0 },
|
||||
.Color2 = { .R = 32, .G = 0, .B = 0 },
|
||||
.Tr = 50,
|
||||
.Th = 10,
|
||||
.Tf = 50,
|
||||
.Tl = 0,
|
||||
};
|
||||
|
||||
void LED_Write(){
|
||||
if(CONN.chargingError != CONN_NO_ERROR){
|
||||
LED_SetColor(&color_error);
|
||||
if (sat == 0U) {
|
||||
out->R = out->G = out->B = val;
|
||||
return;
|
||||
}
|
||||
switch(CONN.connState){
|
||||
case Unknown:
|
||||
LED_SetColor(&color_unknown);
|
||||
region = (uint8_t)(hue / 43U);
|
||||
remainder = (uint8_t)((hue - (uint8_t)(region * 43U)) * 6U);
|
||||
p = (uint8_t)((val * (255U - sat)) >> 8);
|
||||
q = (uint8_t)((val * (255U - ((sat * remainder) >> 8))) >> 8);
|
||||
t = (uint8_t)((val * (255U - ((sat * (255U - remainder)) >> 8))) >> 8);
|
||||
switch (region) {
|
||||
case 0:
|
||||
out->R = val;
|
||||
out->G = t;
|
||||
out->B = p;
|
||||
break;
|
||||
case Unplugged:
|
||||
LED_SetColor(&color_unplugged);
|
||||
case 1:
|
||||
out->R = q;
|
||||
out->G = val;
|
||||
out->B = p;
|
||||
break;
|
||||
case Disabled:
|
||||
LED_SetColor(&color_error);
|
||||
case 2:
|
||||
out->R = p;
|
||||
out->G = val;
|
||||
out->B = t;
|
||||
break;
|
||||
case Preparing:
|
||||
LED_SetColor(&color_preparing);
|
||||
case 3:
|
||||
out->R = p;
|
||||
out->G = q;
|
||||
out->B = val;
|
||||
break;
|
||||
case AuthRequired:
|
||||
LED_SetColor(&color_preparing);
|
||||
break;
|
||||
case WaitingForEnergy:
|
||||
LED_SetColor(&color_charging);
|
||||
break;
|
||||
case ChargingPausedEV:
|
||||
LED_SetColor(&color_charging);
|
||||
break;
|
||||
case ChargingPausedEVSE:
|
||||
LED_SetColor(&color_charging);
|
||||
break;
|
||||
case Charging:
|
||||
LED_SetColor(&color_charging);
|
||||
break;
|
||||
case AuthTimeout:
|
||||
LED_SetColor(&color_finished);
|
||||
break;
|
||||
case Finished:
|
||||
LED_SetColor(&color_finished);
|
||||
break;
|
||||
case FinishedEVSE:
|
||||
LED_SetColor(&color_finished);
|
||||
break;
|
||||
case FinishedEV:
|
||||
LED_SetColor(&color_finished);
|
||||
break;
|
||||
case Replugging:
|
||||
LED_SetColor(&color_preparing);
|
||||
case 4:
|
||||
out->R = t;
|
||||
out->G = p;
|
||||
out->B = val;
|
||||
break;
|
||||
default:
|
||||
LED_SetColor(&color_unknown);
|
||||
out->R = val;
|
||||
out->G = p;
|
||||
out->B = q;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/** AC22-compatible init «перелив»: fixed green hue, saturation pulse. */
|
||||
static void LED_RenderInitShimmer(void)
|
||||
{
|
||||
static uint8_t sat = 250U;
|
||||
static uint8_t rising = 0U;
|
||||
const uint8_t hue = 85U;
|
||||
const uint8_t val = 245U;
|
||||
|
||||
if (sat >= 250U) {
|
||||
rising = 0U;
|
||||
}
|
||||
if (sat <= 30U) {
|
||||
rising = 1U;
|
||||
}
|
||||
if (rising) {
|
||||
sat = (sat <= 246U) ? (uint8_t)(sat + 4U) : 250U;
|
||||
} else {
|
||||
sat = (sat >= 34U) ? (uint8_t)(sat - 4U) : 30U;
|
||||
}
|
||||
LED_HsvToRgb(hue, sat, val, &LED_State.color);
|
||||
}
|
||||
|
||||
static LightingConfigPacket_t committed_lighting = {
|
||||
.mode = 0,
|
||||
.roles = {
|
||||
{ 0, 128, 0, 100, 0, 40, 0 },
|
||||
{ 0, 0, 255, 100, 1, 55, 100 },
|
||||
{ 0, 255, 0, 100, 1, 40, 87 },
|
||||
{ 255, 255, 255, 100, 0, 40, 0 },
|
||||
{ 255, 0, 0, 100, 1, 50, 87 },
|
||||
},
|
||||
};
|
||||
static LightingConfigPacket_t preview_lighting;
|
||||
static uint32_t preview_expires_at;
|
||||
static uint8_t preview_active;
|
||||
|
||||
static RGB_Cycle_t LED_CycleFromRole(const LightingRolePacket_t *role)
|
||||
{
|
||||
const uint8_t fade_to_black = role->fadeTo >= 95;
|
||||
RGB_Cycle_t cycle = {
|
||||
.Color1 = {
|
||||
.R = (uint8_t)((uint16_t)role->r * role->brightness / 100),
|
||||
.G = (uint8_t)((uint16_t)role->g * role->brightness / 100),
|
||||
.B = (uint8_t)((uint16_t)role->b * role->brightness / 100),
|
||||
},
|
||||
.Tr = (uint8_t)((100 - role->speed) < 5 ? 5 : (100 - role->speed)),
|
||||
.Th = 10,
|
||||
.Tf = (uint8_t)((100 - role->speed) < 5 ? 5 : (100 - role->speed)),
|
||||
.Tl = fade_to_black ? 10 : 0,
|
||||
};
|
||||
|
||||
if (role->effect == 0) {
|
||||
cycle.Color2 = cycle.Color1;
|
||||
} else {
|
||||
cycle.Color2.R = (uint8_t)((uint16_t)cycle.Color1.R * (100 - role->fadeTo) / 100);
|
||||
cycle.Color2.G = (uint8_t)((uint16_t)cycle.Color1.G * (100 - role->fadeTo) / 100);
|
||||
cycle.Color2.B = (uint8_t)((uint16_t)cycle.Color1.B * (100 - role->fadeTo) / 100);
|
||||
}
|
||||
return cycle;
|
||||
}
|
||||
|
||||
static uint8_t LED_IsLightingConfigValid(const LightingConfigPacket_t *config)
|
||||
{
|
||||
if (config == NULL || config->mode > 1 || (config->flags & 0xFE) != 0 ||
|
||||
config->reserved != 0 || ((config->flags & 0x01) && config->previewSec == 0) ||
|
||||
(!(config->flags & 0x01) && config->previewSec != 0)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
for (uint8_t i = 0; i < 5; i++) {
|
||||
const LightingRolePacket_t *role = &config->roles[i];
|
||||
if (role->brightness > 100 || role->effect > 1 || role->speed > 100 || role->fadeTo > 100) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
uint8_t LED_ApplyLightingConfig(const LightingConfigPacket_t *config)
|
||||
{
|
||||
if (!LED_IsLightingConfigValid(config)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (config->flags & 0x01) {
|
||||
memcpy(&preview_lighting, config, sizeof(preview_lighting));
|
||||
preview_active = 1;
|
||||
preview_expires_at = HAL_GetTick() + ((uint32_t)config->previewSec * 1000U);
|
||||
} else {
|
||||
memcpy(&committed_lighting, config, sizeof(committed_lighting));
|
||||
preview_active = 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
void LED_Write(void)
|
||||
{
|
||||
const LightingConfigPacket_t *lighting = &committed_lighting;
|
||||
RGB_Cycle_t cycle;
|
||||
|
||||
lighting_init_active = 0;
|
||||
|
||||
if (CONN.connControl == CMD_STOP) {
|
||||
LED_SetColor(&color_estop);
|
||||
return;
|
||||
}
|
||||
if (CONN.chargingError != CONN_NO_ERROR || CONN.connState == Disabled) {
|
||||
cycle = LED_CycleFromRole(&lighting->roles[4]);
|
||||
LED_SetColor(&cycle);
|
||||
return;
|
||||
}
|
||||
|
||||
if (preview_active && (int32_t)(HAL_GetTick() - preview_expires_at) >= 0) {
|
||||
preview_active = 0;
|
||||
}
|
||||
if (preview_active) {
|
||||
lighting = &preview_lighting;
|
||||
}
|
||||
|
||||
if (lighting->mode == 1) {
|
||||
RGB_Cycle_t off = { 0 };
|
||||
LED_SetColor(&off);
|
||||
return;
|
||||
}
|
||||
if (CONN.connControl == CMD_FORCE_UNLOCK) {
|
||||
LED_SetColor(&color_unlock);
|
||||
return;
|
||||
}
|
||||
if (CONN.connState == Unknown) {
|
||||
lighting_init_active = 1;
|
||||
return;
|
||||
}
|
||||
|
||||
switch (CONN.connState) {
|
||||
case Unplugged:
|
||||
cycle = LED_CycleFromRole(&lighting->roles[0]);
|
||||
break;
|
||||
case Preparing:
|
||||
case AuthRequired:
|
||||
case Replugging:
|
||||
cycle = LED_CycleFromRole(&lighting->roles[1]);
|
||||
break;
|
||||
case WaitingForEnergy:
|
||||
case ChargingPausedEV:
|
||||
case ChargingPausedEVSE:
|
||||
case Charging:
|
||||
cycle = LED_CycleFromRole(&lighting->roles[2]);
|
||||
break;
|
||||
case AuthTimeout:
|
||||
case Finished:
|
||||
case FinishedEVSE:
|
||||
case FinishedEV:
|
||||
cycle = LED_CycleFromRole(&lighting->roles[3]);
|
||||
break;
|
||||
default:
|
||||
lighting_init_active = 1;
|
||||
return;
|
||||
}
|
||||
LED_SetColor(&cycle);
|
||||
}
|
||||
|
||||
void interpolateColors(RGB_t* color1, RGB_t* color2, uint16_t a, uint16_t b, RGB_t *result) {
|
||||
|
||||
@@ -161,13 +269,150 @@ void interpolateColors(RGB_t* color1, RGB_t* color2, uint16_t a, uint16_t b, RGB
|
||||
}
|
||||
|
||||
|
||||
#pragma GCC push_options
|
||||
#pragma GCC optimize("O2")
|
||||
|
||||
|
||||
#define WS2812_T0H_NOP 25
|
||||
#define WS2812_T0L_NOP 52
|
||||
#define WS2812_T1H_NOP 52
|
||||
#define WS2812_T1L_NOP 25
|
||||
|
||||
#define _WS2812_DELAY_NOPS(n) __asm volatile(".rept " #n "\nnop\n.endr" ::: "memory")
|
||||
#define WS2812_DELAY_NOPS(n) _WS2812_DELAY_NOPS(n)
|
||||
|
||||
static void ws2812_send_pixel(uint8_t r, uint8_t g, uint8_t b)
|
||||
{
|
||||
uint32_t tmp = ~(((uint32_t)g << 16) | ((uint32_t)r << 8) | (uint32_t)b);
|
||||
|
||||
for (int i = 0; i < 24; i++) {
|
||||
LED_DATA_GPIO_Port->BSRR = LED_DATA_Pin;
|
||||
if (tmp & (1U << 23)) {
|
||||
WS2812_DELAY_NOPS(WS2812_T0H_NOP);
|
||||
LED_DATA_GPIO_Port->BRR = LED_DATA_Pin;
|
||||
WS2812_DELAY_NOPS(WS2812_T0L_NOP);
|
||||
} else {
|
||||
WS2812_DELAY_NOPS(WS2812_T1H_NOP);
|
||||
LED_DATA_GPIO_Port->BRR = LED_DATA_Pin;
|
||||
WS2812_DELAY_NOPS(WS2812_T1L_NOP);
|
||||
}
|
||||
tmp <<= 1;
|
||||
}
|
||||
}
|
||||
|
||||
static void ws2812_update(RGB_t *led0, RGB_t *led1)
|
||||
{
|
||||
uint32_t primask = __get_PRIMASK();
|
||||
|
||||
__disable_irq();
|
||||
ws2812_send_pixel(led0->R, led0->G, led0->B);
|
||||
ws2812_send_pixel(led1->R, led1->G, led1->B);
|
||||
__set_PRIMASK(primask);
|
||||
}
|
||||
|
||||
#pragma GCC pop_options
|
||||
|
||||
static RGB_t RGB_ScaleBrightness(const RGB_t *color)
|
||||
{
|
||||
RGB_t out = {
|
||||
.R = (uint8_t)((uint16_t)color->R * WS2812_BRIGHTNESS / 255),
|
||||
.G = (uint8_t)((uint16_t)color->G * WS2812_BRIGHTNESS / 255),
|
||||
.B = (uint8_t)((uint16_t)color->B * WS2812_BRIGHTNESS / 255),
|
||||
};
|
||||
return out;
|
||||
}
|
||||
|
||||
/*
|
||||
* Моргание красным на втором WS2812 при chargingError > 0.
|
||||
* Логика как Slave-LB24 LED_Task: N вспышек = код ошибки, пауза 30×100 ms.
|
||||
* Вызывается из LED_Task каждые 20 ms; шаг FSM — 100 ms.
|
||||
*/
|
||||
static void LED_Ws2812ErrorBlinkUpdate(void)
|
||||
{
|
||||
static uint8_t err_counter;
|
||||
static uint8_t led_state;
|
||||
static uint8_t led_pause;
|
||||
static uint32_t blink_tick;
|
||||
static uint32_t flash_until;
|
||||
static CONN_Error_t last_error = CONN_NO_ERROR;
|
||||
|
||||
const CONN_Error_t err = CONN.chargingError;
|
||||
const uint32_t now = HAL_GetTick();
|
||||
|
||||
if (err == CONN_NO_ERROR) {
|
||||
err_counter = 0;
|
||||
led_state = 0;
|
||||
led_pause = 0;
|
||||
flash_until = 0;
|
||||
last_error = CONN_NO_ERROR;
|
||||
ws2812_led1.R = 0;
|
||||
ws2812_led1.G = 0;
|
||||
ws2812_led1.B = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
if (err != last_error) {
|
||||
err_counter = 0;
|
||||
led_state = 0;
|
||||
led_pause = 0;
|
||||
flash_until = 0;
|
||||
last_error = err;
|
||||
}
|
||||
|
||||
if (now < flash_until) {
|
||||
ws2812_led1.R = 255;
|
||||
ws2812_led1.G = 0;
|
||||
ws2812_led1.B = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
ws2812_led1.R = 0;
|
||||
ws2812_led1.G = 0;
|
||||
ws2812_led1.B = 0;
|
||||
|
||||
if ((now - blink_tick) < WS2812_ERROR_BLINK_MS) {
|
||||
return;
|
||||
}
|
||||
blink_tick = now;
|
||||
|
||||
uint8_t led_flash = 0;
|
||||
|
||||
if (led_pause > 0) {
|
||||
led_pause--;
|
||||
} else if (err_counter < (uint8_t)err) {
|
||||
if (led_state == 0) {
|
||||
led_state = 1;
|
||||
} else {
|
||||
led_flash = 1;
|
||||
led_state = 0;
|
||||
err_counter++;
|
||||
}
|
||||
} else {
|
||||
err_counter = 0;
|
||||
led_pause = WS2812_ERROR_BLINK_PAUSE;
|
||||
}
|
||||
|
||||
if (led_flash) {
|
||||
flash_until = now + WS2812_ERROR_BLINK_MS;
|
||||
ws2812_led1.R = 255;
|
||||
ws2812_led1.G = 0;
|
||||
ws2812_led1.B = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void RGB_SetColor(RGB_t *color){
|
||||
htim4.Instance->CCR2 = color->R * 100 / 255;
|
||||
htim4.Instance->CCR3 = color->G * 100 / 255;
|
||||
htim4.Instance->CCR4 = color->B * 100 / 255;
|
||||
}
|
||||
|
||||
void LED_SetColor(RGB_Cycle_t *color){
|
||||
void WS2812_SetColor(RGB_t *color){
|
||||
RGB_t led0 = RGB_ScaleBrightness(color);
|
||||
RGB_t led1 = RGB_ScaleBrightness(&ws2812_led1);
|
||||
ws2812_update(&led0, &led1);
|
||||
}
|
||||
|
||||
void LED_SetColor(const RGB_Cycle_t *color){
|
||||
memcpy(&LED_Cycle, color, sizeof(RGB_Cycle_t));
|
||||
}
|
||||
|
||||
@@ -178,38 +423,23 @@ void LED_Init(){
|
||||
HAL_TIM_PWM_Start(&htim4, TIM_CHANNEL_3);
|
||||
HAL_TIM_PWM_Start(&htim4, TIM_CHANNEL_4);
|
||||
RGB_SetColor(&color);
|
||||
WS2812_SetColor(&color);
|
||||
}
|
||||
|
||||
// void LED_PhaseSync(uint8_t led_n){
|
||||
// if(LED_State[led_n].phasesync){
|
||||
// LED_State[led_n].phasesync = 0;
|
||||
// //default settings
|
||||
// LED_State[led_n].state = LED_HIGH;
|
||||
// LED_State[led_n].tick = 0;
|
||||
// //ищем среди всех светодиодов такую же последовательность
|
||||
// for (uint8_t led_n1 = 0; led_n1 < 5; led_n1++){
|
||||
// if ((LED_Cycle[led_n].Tf == LED_Cycle[led_n1].Tf) &&
|
||||
// (LED_Cycle[led_n].Tr == LED_Cycle[led_n1].Tr) &&
|
||||
// (LED_Cycle[led_n].Th == LED_Cycle[led_n1].Th) &&
|
||||
// (LED_Cycle[led_n].Tl == LED_Cycle[led_n1].Tl) &&
|
||||
// (led_n != led_n1)){
|
||||
// //если нашли, то копируем фазу оттуда
|
||||
// LED_State[led_n].state = LED_State[led_n1].state;
|
||||
// LED_State[led_n].tick = LED_State[led_n1].tick;
|
||||
// return;
|
||||
|
||||
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
void LED_Task(){
|
||||
static uint32_t led_tick;
|
||||
if((HAL_GetTick() - led_tick) > 20){
|
||||
led_tick = HAL_GetTick();
|
||||
LED_Ws2812ErrorBlinkUpdate();
|
||||
|
||||
if (lighting_init_active) {
|
||||
LED_RenderInitShimmer();
|
||||
RGB_SetColor(&LED_State.color);
|
||||
WS2812_SetColor(&LED_State.color);
|
||||
return;
|
||||
}
|
||||
|
||||
LED_State.tick++;
|
||||
// LED_PhaseSync(led_n);
|
||||
switch(LED_State.state){
|
||||
case LED_RISING:
|
||||
interpolateColors(&LED_Cycle.Color2, &LED_Cycle.Color1, LED_State.tick, LED_Cycle.Tr, &LED_State.color);
|
||||
@@ -247,5 +477,6 @@ void LED_Task(){
|
||||
LED_State.state = LED_RISING;
|
||||
}
|
||||
RGB_SetColor(&LED_State.color);
|
||||
WS2812_SetColor(&LED_State.color);
|
||||
}
|
||||
}
|
||||
|
||||
+162
-66
@@ -1,13 +1,16 @@
|
||||
#include "serial.h"
|
||||
#include "cp.h"
|
||||
#include "connector.h"
|
||||
|
||||
#include "board.h"
|
||||
#include "charger_config.h"
|
||||
#include "connector.h"
|
||||
#include "cp.h"
|
||||
#include "debug.h"
|
||||
#include "isr_opt.h"
|
||||
#include "psu_control.h"
|
||||
#include "power_setpoint_executor.h"
|
||||
#include "serial_control.h"
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
#include "charger_config.h"
|
||||
#include "psu_control.h"
|
||||
|
||||
extern UART_HandleTypeDef huart3;
|
||||
extern uint8_t config_initialized;
|
||||
@@ -27,13 +30,15 @@ CONN_Control_t last_cmd = CMD_NONE;
|
||||
uint8_t ev_enable_output = 0;
|
||||
|
||||
#define CMD_INTERVAL 10
|
||||
#define MAX_TX_BUFFER_SIZE 256
|
||||
#define MAX_RX_BUFFER_SIZE 256
|
||||
#define EVEREST_TIMEOUT_MS 5000u
|
||||
#define EVEREST_TIMEOUT_WARN_MS 5000u
|
||||
#define EVEREST_TIMEOUT_STOP_MS 10000u
|
||||
#define UART3_REINIT_TIMEOUT_MS 1500u
|
||||
|
||||
static uint8_t rx_buffer[MAX_RX_BUFFER_SIZE];
|
||||
static uint8_t tx_buffer[MAX_TX_BUFFER_SIZE];
|
||||
static uint8_t tx_pending_buffer[MAX_TX_BUFFER_SIZE];
|
||||
static uint16_t tx_pending_len = 0;
|
||||
static uint8_t uart3_tx_busy = 0;
|
||||
|
||||
uint8_t ESTOP = 0;
|
||||
uint8_t REPLUG = 0;
|
||||
@@ -43,18 +48,19 @@ static uint8_t pwm_duty_percent = 100;
|
||||
uint8_t isolation_enable = 0;
|
||||
static uint32_t last_host_seen = 0;
|
||||
static uint8_t everest_timed_out = 0;
|
||||
static uint32_t last_everest_timeout_log_tick = 0;
|
||||
static uint8_t everest_timeout_warn_latched = 0;
|
||||
static uint8_t everest_timeout_stop_latched = 0;
|
||||
static uint32_t uart3_last_packet_tick = 0;
|
||||
static uint32_t uart3_last_reinit_tick = 0;
|
||||
static CP_State_t cp_state_buffer = EV_STATE_ACQUIRING;
|
||||
|
||||
CCS_State_t CCS_State;
|
||||
CCS_EvInfo_t CCS_EvInfo;
|
||||
CONN_State_t CCS_EvseState;
|
||||
CCS_ConnectorState_t CCS_ConnectorState = CCS_UNPLUGGED;
|
||||
CCS_ConnectorState_t CCS_ConnectorState = CCS_UNKNOWN;
|
||||
|
||||
ISR_FAST static uint8_t process_received_packet(const uint8_t* packet, uint16_t packet_len);
|
||||
static void CCS_UART3_Watchdog(void);
|
||||
static void CCS_LogUart3Error(const char *tag);
|
||||
|
||||
ISR_FAST static void uart3_log_hal_error(uint8_t uart_num, uint32_t err) {
|
||||
if (err == HAL_UART_ERROR_NONE) {
|
||||
@@ -77,7 +83,7 @@ ISR_FAST static void uart3_log_hal_error(uint8_t uart_num, uint32_t err) {
|
||||
}
|
||||
|
||||
ISR_FAST static void uart3_arm_rx_or_log(const char *where) {
|
||||
HAL_StatusTypeDef st = HAL_UARTEx_ReceiveToIdle_IT(&huart3, rx_buffer, sizeof(rx_buffer));
|
||||
HAL_StatusTypeDef st = HAL_UARTEx_ReceiveToIdle_DMA(&huart3, rx_buffer, sizeof(rx_buffer));
|
||||
if (st == HAL_OK) {
|
||||
return;
|
||||
}
|
||||
@@ -86,8 +92,9 @@ ISR_FAST static void uart3_arm_rx_or_log(const char *where) {
|
||||
"UART3 RX arm failed (%s): HAL_Status=%d err_after=0x%08lx\n",
|
||||
where, (int)st, (unsigned long)err_after);
|
||||
uart3_log_hal_error(3u, err_after);
|
||||
CCS_LogUart3Error("UART3 RX arm failed details");
|
||||
if (err_after != HAL_UART_ERROR_NONE) {
|
||||
(void)HAL_UART_Abort_IT(&huart3);
|
||||
(void)HAL_UART_AbortReceive(&huart3);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -124,35 +131,74 @@ ISR_FAST void HAL_UART_ErrorCallback(UART_HandleTypeDef *huart) {
|
||||
"UART%u HAL error (ISR): raw=0x%08lx — RX may be corrupted until re-arm\n",
|
||||
uart_num, (unsigned long)error);
|
||||
uart3_log_hal_error(uart_num, error);
|
||||
(void)HAL_UART_Abort_IT(huart);
|
||||
(void)HAL_UART_AbortReceive(huart);
|
||||
(void)HAL_UART_AbortTransmit(huart);
|
||||
if (huart == &huart3) {
|
||||
uart3_tx_busy = 0;
|
||||
uart3_arm_rx_or_log("ErrorCallback");
|
||||
} else {
|
||||
SC_RecoverUartDma(huart);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void CCS_TxCpltCallback(UART_HandleTypeDef *huart) {
|
||||
if (huart != &huart3) {
|
||||
return;
|
||||
}
|
||||
uart3_tx_busy = 0;
|
||||
if (tx_pending_len > 0) {
|
||||
memcpy(tx_buffer, tx_pending_buffer, tx_pending_len);
|
||||
uart3_tx_busy = 1;
|
||||
if (HAL_UART_Transmit_DMA(&huart3, tx_buffer, tx_pending_len) != HAL_OK) {
|
||||
uart3_tx_busy = 0;
|
||||
CCS_LogUart3Error("UART3 TX DMA resend failed");
|
||||
}
|
||||
tx_pending_len = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void CCS_SerialLoop(void) {
|
||||
static uint32_t tick;
|
||||
if ((int32_t)(HAL_GetTick() - tick) < 1) return;
|
||||
tick = HAL_GetTick();
|
||||
|
||||
static uint32_t replug_tick = 0;
|
||||
static uint32_t replug_watchdog_tick = 0;
|
||||
static uint32_t replug_watchdog1_tick = 0;
|
||||
static uint32_t last_state_sent = 0;
|
||||
|
||||
if ((&huart3)->RxState == HAL_UART_STATE_READY) {
|
||||
uart3_arm_rx_or_log("SerialLoop");
|
||||
}
|
||||
static uint32_t force_unlock_tick = 0;
|
||||
static uint32_t stop_tick = 0;
|
||||
|
||||
CCS_UART3_Watchdog();
|
||||
|
||||
/* Read CP once per loop and use buffered value below. */
|
||||
cp_state_buffer = CP_GetState();
|
||||
|
||||
if (CONN.connControl != CMD_NONE) {
|
||||
last_cmd = CONN.connControl;
|
||||
}
|
||||
|
||||
if((HAL_GetTick() - last_cmd_sent) > CMD_INTERVAL){
|
||||
if ((HAL_GetTick() - last_state_sent) >= 200) {
|
||||
if (CONN.connControl == CMD_FORCE_UNLOCK) {
|
||||
if (force_unlock_tick == 0) {
|
||||
force_unlock_tick = HAL_GetTick();
|
||||
} else if ((int32_t)(HAL_GetTick() - force_unlock_tick) >= 10000) {
|
||||
CONN.connControl = CMD_NONE;
|
||||
force_unlock_tick = 0;
|
||||
}
|
||||
} else {
|
||||
force_unlock_tick = 0;
|
||||
}
|
||||
|
||||
if (CONN.connControl == CMD_STOP) {
|
||||
if (stop_tick == 0) {
|
||||
stop_tick = HAL_GetTick();
|
||||
} else if ((int32_t)(HAL_GetTick() - stop_tick) >= 1000) {
|
||||
CONN.connControl = CMD_NONE;
|
||||
stop_tick = 0;
|
||||
}
|
||||
} else {
|
||||
stop_tick = 0;
|
||||
}
|
||||
|
||||
if((int32_t)(HAL_GetTick() - last_cmd_sent) > (int32_t)CMD_INTERVAL){
|
||||
if ((int32_t)(HAL_GetTick() - last_state_sent) >= 200) {
|
||||
send_state();
|
||||
last_state_sent = HAL_GetTick();
|
||||
}
|
||||
@@ -164,15 +210,19 @@ void CCS_SerialLoop(void) {
|
||||
}
|
||||
|
||||
if (((CONN.connControl == CMD_STOP) ||
|
||||
(CONN.connControl == CMD_FORCE_UNLOCK) ||
|
||||
(CONN.chargingError != CONN_NO_ERROR)) &&
|
||||
((HAL_GetTick() - last_stop_sent) > 1000)) {
|
||||
((int32_t)(HAL_GetTick() - last_stop_sent) > 1000)) {
|
||||
last_stop_sent = HAL_GetTick();
|
||||
log_printf(LOG_WARN, "Stopping charging...\n");
|
||||
if (CONN.connControl == CMD_FORCE_UNLOCK) {
|
||||
CP_SetDuty(100);
|
||||
}
|
||||
CCS_SendEmergencyStop();
|
||||
}
|
||||
|
||||
if (((CCS_EvseState == FinishedEV) || (CCS_EvseState == FinishedEVSE)) &&
|
||||
((HAL_GetTick() - last_stop_sent) > 1000)) {
|
||||
((int32_t)(HAL_GetTick() - last_stop_sent) > 1000)) {
|
||||
last_stop_sent = HAL_GetTick();
|
||||
log_printf(LOG_WARN, "FinishedEV, stopping...\n");
|
||||
CCS_SendEmergencyStop();
|
||||
@@ -182,16 +232,38 @@ void CCS_SerialLoop(void) {
|
||||
(void)replug_watchdog_tick;
|
||||
(void)replug_watchdog1_tick;
|
||||
|
||||
if (!config_initialized) {
|
||||
// Keep connector in Unknown until host sends valid SET_CONFIG.
|
||||
RELAY_Write(RELAY_CP, 1);
|
||||
CONN_SetState(Unknown);
|
||||
} else {
|
||||
uint8_t host_timeout_warn = (last_host_seen > 0u) && ((int32_t)(HAL_GetTick() - last_host_seen) > (int32_t)EVEREST_TIMEOUT_WARN_MS);
|
||||
uint8_t host_timeout_stop = (last_host_seen > 0u) && ((int32_t)(HAL_GetTick() - last_host_seen) > (int32_t)EVEREST_TIMEOUT_STOP_MS);
|
||||
uint8_t host_timed_out = host_timeout_stop;
|
||||
|
||||
if (host_timeout_warn && !everest_timeout_warn_latched) {
|
||||
log_printf(LOG_ERR, "Everest timeout\n");
|
||||
everest_timeout_warn_latched = 1;
|
||||
}
|
||||
|
||||
if (host_timeout_stop && !everest_timeout_stop_latched) {
|
||||
log_printf(LOG_ERR, "Everest timeout, stopping charging...\n");
|
||||
everest_timeout_stop_latched = 1;
|
||||
}
|
||||
|
||||
if (!host_timeout_warn) {
|
||||
everest_timeout_warn_latched = 0;
|
||||
everest_timeout_stop_latched = 0;
|
||||
}
|
||||
|
||||
everest_timed_out = host_timeout_stop;
|
||||
switch(CCS_ConnectorState){
|
||||
case CCS_UNKNOWN:
|
||||
RELAY_Write(RELAY_CP, 0);
|
||||
CONN_SetState(Unknown);
|
||||
if (config_initialized && !host_timed_out) {
|
||||
CCS_ConnectorState = CCS_UNPLUGGED;
|
||||
}
|
||||
break;
|
||||
case CCS_DISABLED:
|
||||
RELAY_Write(RELAY_CP, 0);
|
||||
CONN_SetState(Disabled);
|
||||
if (CONN.chargingError == CONN_NO_ERROR){
|
||||
if ((CONN.chargingError == CONN_NO_ERROR) && !host_timed_out){
|
||||
CCS_ConnectorState = CCS_UNPLUGGED;
|
||||
}
|
||||
break;
|
||||
@@ -221,7 +293,7 @@ void CCS_SerialLoop(void) {
|
||||
break;
|
||||
case CCS_CONNECTED:
|
||||
RELAY_Write(RELAY_CP, 1);
|
||||
if(CCS_EvseState < Preparing) {
|
||||
if((CCS_EvseState < Preparing) || (CCS_EvseState == AuthRequired)) {
|
||||
CONN_SetState(Preparing);
|
||||
} else {
|
||||
CONN_SetState(CCS_EvseState);
|
||||
@@ -238,7 +310,7 @@ void CCS_SerialLoop(void) {
|
||||
case CCS_REPLUGGING:
|
||||
RELAY_Write(RELAY_CP, 0);
|
||||
CONN_SetState(Replugging);
|
||||
if((HAL_GetTick() - replug_tick) > 1000){
|
||||
if((int32_t)(HAL_GetTick() - replug_tick) > 1000){
|
||||
replug_tick = HAL_GetTick();
|
||||
if(REPLUG > 0){
|
||||
if (REPLUG != 0xFF) REPLUG--;
|
||||
@@ -256,28 +328,20 @@ void CCS_SerialLoop(void) {
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// If Everest timeout happened, keep safe-state and limit log frequency.
|
||||
// The safe-state must remain until we receive a valid packet from the host.
|
||||
if (everest_timed_out) {
|
||||
if (last_everest_timeout_log_tick == 0 ||
|
||||
(HAL_GetTick() - last_everest_timeout_log_tick) >= EVEREST_TIMEOUT_MS) {
|
||||
log_printf(LOG_ERR, "Everest timeout\n");
|
||||
last_everest_timeout_log_tick = HAL_GetTick();
|
||||
}
|
||||
CONN.EnableOutput = 0;
|
||||
CCS_EvseState = Unknown;
|
||||
CP_SetDuty(100);
|
||||
} else if (last_host_seen > 0 && (HAL_GetTick() - last_host_seen) > EVEREST_TIMEOUT_MS) {
|
||||
log_printf(LOG_ERR, "Everest timeout\n");
|
||||
everest_timed_out = 1;
|
||||
last_host_seen = HAL_GetTick(); // reset after the first timeout
|
||||
last_everest_timeout_log_tick = HAL_GetTick();
|
||||
|
||||
// 10s timeout: enforce safe-state until host communication recovers.
|
||||
{
|
||||
static uint8_t prev_enable_output = 0xFFu;
|
||||
uint8_t new_enable_output;
|
||||
|
||||
if (host_timeout_stop) {
|
||||
CONN.EnableOutput = 0;
|
||||
CCS_EvseState = Unknown;
|
||||
CP_SetDuty(100);
|
||||
if (CCS_ConnectorState != CCS_DISABLED && CCS_ConnectorState != CCS_UNKNOWN) {
|
||||
CCS_ConnectorState = CCS_DISABLED;
|
||||
}
|
||||
new_enable_output = 0u;
|
||||
} else {
|
||||
if (last_cmd == CMD_STOP) {
|
||||
CONN.EnableOutput = 0;
|
||||
@@ -287,6 +351,20 @@ void CCS_SerialLoop(void) {
|
||||
CONN.EnableOutput = 0;
|
||||
}
|
||||
}
|
||||
new_enable_output = CONN.EnableOutput;
|
||||
}
|
||||
|
||||
if (prev_enable_output != 0xFFu && prev_enable_output != new_enable_output) {
|
||||
log_printf(LOG_INFO,
|
||||
"EnableOutput %u->%u ev=%u stop=%u host_to=%u err=%u\n",
|
||||
(unsigned)prev_enable_output,
|
||||
(unsigned)new_enable_output,
|
||||
(unsigned)ev_enable_output,
|
||||
(unsigned)(last_cmd == CMD_STOP),
|
||||
(unsigned)host_timeout_stop,
|
||||
(unsigned)CONN.chargingError);
|
||||
}
|
||||
prev_enable_output = new_enable_output;
|
||||
}
|
||||
|
||||
if ((cp_state_buffer == EV_STATE_B_CONN_PREP) ||
|
||||
@@ -308,6 +386,7 @@ void CCS_Init(void){
|
||||
CCS_MaxLoad.maxPower = PSU_MAX_POWER; //30000W
|
||||
uart3_last_packet_tick = HAL_GetTick();
|
||||
uart3_last_reinit_tick = uart3_last_packet_tick;
|
||||
uart3_arm_rx_or_log("Init");
|
||||
CCS_SendResetReason();
|
||||
log_printf(LOG_INFO, "CCS init\n");
|
||||
}
|
||||
@@ -346,7 +425,16 @@ static uint16_t CCS_BuildPacket(uint8_t cmd, const void* payload, uint16_t paylo
|
||||
static void CCS_SendPacket(uint8_t cmd, const void* payload, uint16_t payload_len) {
|
||||
uint16_t len = CCS_BuildPacket(cmd, payload, payload_len, tx_buffer, sizeof(tx_buffer));
|
||||
if (len > 0) {
|
||||
HAL_UART_Transmit_IT(&huart3, tx_buffer, len);
|
||||
if (uart3_tx_busy) {
|
||||
memcpy(tx_pending_buffer, tx_buffer, len);
|
||||
tx_pending_len = len;
|
||||
} else {
|
||||
uart3_tx_busy = 1;
|
||||
if (HAL_UART_Transmit_DMA(&huart3, tx_buffer, len) != HAL_OK) {
|
||||
uart3_tx_busy = 0;
|
||||
CCS_LogUart3Error("UART3 TX DMA start failed");
|
||||
}
|
||||
}
|
||||
}
|
||||
last_cmd_sent = HAL_GetTick();
|
||||
}
|
||||
@@ -384,7 +472,6 @@ static void send_state(void) {
|
||||
CCS_State.DutyCycle = CP_GetDuty();
|
||||
CCS_State.OutputEnabled = PSU0.CONT_enabled;
|
||||
CCS_State.MeasuredVoltage = (uint16_t)CONN.MeasuredVoltage;
|
||||
if (CONN.RequestedVoltage == 500) CCS_State.MeasuredVoltage = 500; // fake
|
||||
CCS_State.MeasuredCurrent = (uint16_t)CONN.MeasuredCurrent;
|
||||
CCS_State.Power = CCS_Power;
|
||||
CCS_State.Energy = CCS_Energy;
|
||||
@@ -426,14 +513,17 @@ ISR_FAST static void apply_command(uint8_t cmd, const uint8_t* payload, uint16_t
|
||||
(void)payload_len;
|
||||
last_host_seen = HAL_GetTick();
|
||||
everest_timed_out = 0;
|
||||
last_everest_timeout_log_tick = 0;
|
||||
everest_timeout_warn_latched = 0;
|
||||
everest_timeout_stop_latched = 0;
|
||||
switch (cmd) {
|
||||
case CMD_E2M_PWM_DUTY: {
|
||||
const e2m_pwm_duty_t* p = (const e2m_pwm_duty_t*)payload;
|
||||
uint8_t duty = p->pwm_duty_percent;
|
||||
if (duty > 100) duty = 100;
|
||||
pwm_duty_percent = duty;
|
||||
if (CONN.connControl != CMD_FORCE_UNLOCK) {
|
||||
CP_SetDuty(duty);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case CMD_E2M_ENABLE_OUTPUT: {
|
||||
@@ -461,6 +551,7 @@ ISR_FAST static void apply_command(uint8_t cmd, const uint8_t* payload, uint16_t
|
||||
const e2m_set_output_t* p = (const e2m_set_output_t*)payload;
|
||||
CONN.RequestedVoltage = p->voltage_V;
|
||||
CONN.WantedCurrent = p->current_0p1A;
|
||||
PowerSetpoint_OnCommand(p->voltage_V, p->current_0p1A);
|
||||
break;
|
||||
}
|
||||
case CMD_E2M_ISOLATION_CONTROL: {
|
||||
@@ -548,19 +639,24 @@ ISR_FAST static uint8_t process_received_packet(const uint8_t* packet, uint16_t
|
||||
}
|
||||
|
||||
static void CCS_UART3_Watchdog(void) {
|
||||
const uint32_t now = HAL_GetTick();
|
||||
const uint32_t since_last_packet = now - uart3_last_packet_tick;
|
||||
const int32_t since_last_packet = (int32_t)(HAL_GetTick() - uart3_last_packet_tick);
|
||||
const int32_t since_last_reinit = (int32_t)(HAL_GetTick() - uart3_last_reinit_tick);
|
||||
|
||||
if ((since_last_packet >= UART3_REINIT_TIMEOUT_MS) &&
|
||||
((now - uart3_last_reinit_tick) >= UART3_REINIT_TIMEOUT_MS)) {
|
||||
(void)HAL_UART_Abort_IT(&huart3);
|
||||
(void)HAL_UART_DeInit(&huart3);
|
||||
(void)HAL_UART_Init(&huart3);
|
||||
(void)HAL_UARTEx_ReceiveToIdle_IT(&huart3, rx_buffer, sizeof(rx_buffer));
|
||||
log_printf(LOG_ERR,
|
||||
"UART3 RX recover: stalled (no RxEvent data for %ums), hard reinit\n",
|
||||
(unsigned)UART3_REINIT_TIMEOUT_MS);
|
||||
uart3_last_reinit_tick = now;
|
||||
if ((since_last_packet >= (int32_t)UART3_REINIT_TIMEOUT_MS) &&
|
||||
(since_last_reinit >= (int32_t)UART3_REINIT_TIMEOUT_MS) &&
|
||||
(huart3.RxState == HAL_UART_STATE_READY)) {
|
||||
uart3_arm_rx_or_log("Watchdog");
|
||||
CCS_LogUart3Error("UART3 watchdog rearm");
|
||||
uart3_last_reinit_tick = HAL_GetTick();
|
||||
}
|
||||
}
|
||||
|
||||
static void CCS_LogUart3Error(const char *tag) {
|
||||
log_printf(LOG_ERR, "%s: err=0x%08lx g=%lu rx=%lu tx_busy=%u\n",
|
||||
tag,
|
||||
(unsigned long)HAL_UART_GetError(&huart3),
|
||||
(unsigned long)huart3.gState,
|
||||
(unsigned long)huart3.RxState,
|
||||
(unsigned)uart3_tx_busy);
|
||||
}
|
||||
|
||||
|
||||
+92
-69
@@ -1,9 +1,10 @@
|
||||
#include "serial_control.h"
|
||||
#include "usart.h"
|
||||
|
||||
#include "board.h"
|
||||
#include "serial.h"
|
||||
#include "debug.h"
|
||||
#include "isr_opt.h"
|
||||
#include "serial.h"
|
||||
#include "usart.h"
|
||||
|
||||
// Приватные функции
|
||||
ISR_FAST static uint32_t calculate_crc32(const uint8_t* data, uint16_t length);
|
||||
@@ -11,6 +12,9 @@ ISR_FAST static uint16_t encode_packet(const uint8_t* payload, uint16_t payload_
|
||||
ISR_FAST static uint8_t parse_packet(const uint8_t* packet_data, uint16_t packet_len, ReceivedCommand_t* out_cmd);
|
||||
ISR_FAST static uint8_t process_received_packet(SerialControl_t *ctx, const uint8_t* packet_data, uint16_t packet_len);
|
||||
static void SC_UART2_Watchdog(void);
|
||||
static void SC_ArmUart2RxDma(void);
|
||||
static void SC_ArmUart5RxDma(void);
|
||||
static void SC_LogUartError(const char *tag, UART_HandleTypeDef *huart);
|
||||
|
||||
uint8_t test_crc_invalid = 0;
|
||||
|
||||
@@ -20,11 +24,9 @@ static SerialControl_t serial_iso;
|
||||
volatile SC_Source_t g_sc_command_source = SC_SOURCE_UART2;
|
||||
static volatile uint8_t sc_uart2_timed_out = 0;
|
||||
static uint32_t sc_uart2_last_packet_tick = 0;
|
||||
static uint32_t sc_uart2_last_reinit_tick = 0;
|
||||
/** Событие приёма по UART2 при активной передаче (см. HAL_UARTEx_RxEventCallback / SC_UART2_Watchdog). */
|
||||
static volatile uint8_t sc_uart2_rx_during_tx = 0;
|
||||
static uint32_t sc_uart2_last_recover_tick = 0;
|
||||
|
||||
#define SC_UART2_REINIT_TIMEOUT_MS 500u
|
||||
#define SC_UART2_RECOVER_GUARD_MS 200u
|
||||
#define SC_UART2_PACKET_TIMEOUT_MS 5000u
|
||||
|
||||
StatusPacket_t statusPacket = {
|
||||
@@ -85,34 +87,26 @@ void SC_Init() {
|
||||
memset(&serial_iso, 0, sizeof(serial_iso));
|
||||
sc_uart2_timed_out = 0;
|
||||
sc_uart2_last_packet_tick = HAL_GetTick();
|
||||
sc_uart2_last_reinit_tick = sc_uart2_last_packet_tick;
|
||||
sc_uart2_rx_during_tx = 0;
|
||||
sc_uart2_last_recover_tick = sc_uart2_last_packet_tick;
|
||||
SC_ArmUart2RxDma();
|
||||
SC_ArmUart5RxDma();
|
||||
}
|
||||
|
||||
void SC_Task() {
|
||||
static uint32_t tick;
|
||||
if ((int32_t)(HAL_GetTick() - tick) < 1) return;
|
||||
tick = HAL_GetTick();
|
||||
SC_UART2_Watchdog();
|
||||
|
||||
// Запуск приема в режиме прерывания с ожиданием idle
|
||||
if ((huart2.RxState == HAL_UART_STATE_READY) && (serial_control.command_ready == 0)) {
|
||||
if ((HAL_UARTEx_ReceiveToIdle_IT(&huart2, serial_control.rx_buffer, MAX_RX_BUFFER_SIZE - 1) != HAL_OK) &&
|
||||
(HAL_UART_GetError(&huart2) != HAL_UART_ERROR_NONE)) {
|
||||
(void)HAL_UART_Abort_IT(&huart2);
|
||||
}
|
||||
}
|
||||
if (huart5.RxState == HAL_UART_STATE_READY) {
|
||||
if ((HAL_UARTEx_ReceiveToIdle_IT(&huart5, serial_iso.rx_buffer, MAX_RX_BUFFER_SIZE - 1) != HAL_OK) &&
|
||||
(HAL_UART_GetError(&huart5) != HAL_UART_ERROR_NONE)) {
|
||||
(void)HAL_UART_Abort_IT(&huart5);
|
||||
}
|
||||
}
|
||||
// Запуск приема в режиме DMA + idle
|
||||
SC_ArmUart2RxDma();
|
||||
SC_ArmUart5RxDma();
|
||||
|
||||
// Проверка таймаута отправки пакета (больше 100 мс)
|
||||
if (huart2.gState == HAL_UART_STATE_BUSY_TX && serial_control.tx_tick != 0) {
|
||||
if ((HAL_GetTick() - serial_control.tx_tick) > 100) {
|
||||
if ((int32_t)(HAL_GetTick() - serial_control.tx_tick) > 100) {
|
||||
// Таймаут: принудительно сбрасываем передачу
|
||||
HAL_UART_Abort_IT(&huart2);
|
||||
// Выключаем DIR при сбросе передачи
|
||||
HAL_GPIO_WritePin(USART2_DIR_GPIO_Port, USART2_DIR_Pin, GPIO_PIN_RESET);
|
||||
(void)HAL_UART_AbortTransmit(&huart2);
|
||||
serial_control.tx_tick = 0; // Сбрасываем tick
|
||||
}
|
||||
}
|
||||
@@ -120,34 +114,37 @@ void SC_Task() {
|
||||
// Проверка наличия принятой команды для обработки
|
||||
if (serial_control.command_ready && (huart2.gState != HAL_UART_STATE_BUSY_TX)) {
|
||||
// HAL_Delay(2);
|
||||
SC_CommandHandler(&serial_control.received_command);
|
||||
if ((HAL_UARTEx_ReceiveToIdle_IT(&huart2, serial_control.rx_buffer, MAX_RX_BUFFER_SIZE - 1) != HAL_OK) &&
|
||||
(HAL_UART_GetError(&huart2) != HAL_UART_ERROR_NONE)) {
|
||||
(void)HAL_UART_Abort_IT(&huart2);
|
||||
}
|
||||
SC_CommandHandler((ReceivedCommand_t*)&serial_control.received_command);
|
||||
serial_control.command_ready = 0; // Сбрасываем флаг
|
||||
SC_ArmUart2RxDma();
|
||||
}
|
||||
}
|
||||
|
||||
ISR_FAST void HAL_UARTEx_RxEventCallback(UART_HandleTypeDef *huart, uint16_t Size) {
|
||||
if (huart->Instance == huart2.Instance) {
|
||||
if (huart2.gState == HAL_UART_STATE_BUSY_TX) {
|
||||
sc_uart2_rx_during_tx = 1u;
|
||||
if (Size == 0u) {
|
||||
log_printf(LOG_WARN, "UART2 RX idle event with zero size\n");
|
||||
}
|
||||
sc_uart2_last_packet_tick = HAL_GetTick();
|
||||
sc_uart2_last_reinit_tick = sc_uart2_last_packet_tick;
|
||||
sc_uart2_last_recover_tick = sc_uart2_last_packet_tick;
|
||||
sc_uart2_timed_out = 0;
|
||||
if(!process_received_packet(&serial_control, serial_control.rx_buffer, Size)){
|
||||
log_printf(LOG_WARN, "UART2 RX invalid packet len=%u\n", (unsigned)Size);
|
||||
SC_SendPacket(NULL, 0, RESP_INVALID);
|
||||
}
|
||||
g_sc_command_source = SC_SOURCE_UART2;
|
||||
HAL_UARTEx_ReceiveToIdle_IT(&huart2, serial_control.rx_buffer, MAX_RX_BUFFER_SIZE - 1);
|
||||
SC_ArmUart2RxDma();
|
||||
} else if (huart->Instance == huart5.Instance) {
|
||||
if (Size == 0u) {
|
||||
log_printf(LOG_WARN, "UART5 RX idle event with zero size\n");
|
||||
}
|
||||
if (process_received_packet(&serial_iso, serial_iso.rx_buffer, Size)) {
|
||||
g_sc_command_source = SC_SOURCE_UART5;
|
||||
SC_CommandHandler((ReceivedCommand_t*)&serial_iso.received_command);
|
||||
} else {
|
||||
log_printf(LOG_WARN, "UART5 RX invalid packet len=%u\n", (unsigned)Size);
|
||||
}
|
||||
HAL_UARTEx_ReceiveToIdle_IT(&huart5, serial_iso.rx_buffer, MAX_RX_BUFFER_SIZE - 1);
|
||||
SC_ArmUart5RxDma();
|
||||
} else if (huart->Instance == huart3.Instance) {
|
||||
CCS_RxEventCallback(huart, Size);
|
||||
}
|
||||
@@ -155,8 +152,9 @@ ISR_FAST void HAL_UARTEx_RxEventCallback(UART_HandleTypeDef *huart, uint16_t Siz
|
||||
|
||||
ISR_FAST void HAL_UART_TxCpltCallback(UART_HandleTypeDef *huart) {
|
||||
if (huart->Instance == huart2.Instance) {
|
||||
HAL_GPIO_WritePin(USART2_DIR_GPIO_Port, USART2_DIR_Pin, GPIO_PIN_RESET);
|
||||
serial_control.tx_tick = 0;
|
||||
} else if (huart->Instance == huart3.Instance) {
|
||||
CCS_TxCpltCallback(huart);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -217,16 +215,14 @@ ISR_FAST void SC_SendPacket(const uint8_t* payload, uint16_t payload_len, uint8_
|
||||
uint16_t packet_len = encode_packet(payload, payload_len, serial_control.tx_buffer, response_code);
|
||||
|
||||
if (packet_len > 0) {
|
||||
if (huart2.gState == HAL_UART_STATE_BUSY_TX) {
|
||||
HAL_UART_Abort_IT(&huart2);
|
||||
HAL_GPIO_WritePin(USART2_DIR_GPIO_Port, USART2_DIR_Pin, GPIO_PIN_RESET);
|
||||
if (huart2.gState != HAL_UART_STATE_READY) {
|
||||
(void)HAL_UART_AbortTransmit(&huart2);
|
||||
log_printf(LOG_WARN, "UART2 TX busy, abort transmit before resend\n");
|
||||
}
|
||||
if (HAL_UART_Transmit_DMA(&huart2, serial_control.tx_buffer, packet_len) != HAL_OK) {
|
||||
SC_LogUartError("UART2 TX DMA start failed", &huart2);
|
||||
return;
|
||||
}
|
||||
|
||||
HAL_GPIO_WritePin(USART2_DIR_GPIO_Port, USART2_DIR_Pin, GPIO_PIN_SET);
|
||||
|
||||
sc_uart2_rx_during_tx = 0u;
|
||||
|
||||
HAL_UART_Transmit_IT(&huart2, serial_control.tx_buffer, packet_len);
|
||||
|
||||
serial_control.tx_tick = HAL_GetTick();
|
||||
}
|
||||
@@ -276,39 +272,66 @@ ISR_FAST static uint8_t process_received_packet(SerialControl_t *ctx, const uint
|
||||
|
||||
static void SC_UART2_Watchdog(void) {
|
||||
const uint32_t now = HAL_GetTick();
|
||||
const uint32_t since_last_packet = now - sc_uart2_last_packet_tick;
|
||||
const int32_t since_last_packet = (int32_t)(now - sc_uart2_last_packet_tick);
|
||||
|
||||
if ((huart2.gState == HAL_UART_STATE_BUSY_TX) && (sc_uart2_rx_during_tx != 0u)) {
|
||||
HAL_GPIO_WritePin(USART2_DIR_GPIO_Port, USART2_DIR_Pin, GPIO_PIN_RESET);
|
||||
(void)HAL_UART_Abort_IT(&huart2);
|
||||
(void)HAL_UART_DeInit(&huart2);
|
||||
(void)HAL_UART_Init(&huart2);
|
||||
(void)HAL_UARTEx_ReceiveToIdle_IT(&huart2, serial_control.rx_buffer, MAX_RX_BUFFER_SIZE - 1);
|
||||
serial_control.tx_tick = 0;
|
||||
sc_uart2_rx_during_tx = 0u;
|
||||
sc_uart2_last_reinit_tick = now;
|
||||
log_printf(LOG_ERR, "USART2 BUSY_TX: hard reinit\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if (since_last_packet >= SC_UART2_PACKET_TIMEOUT_MS) {
|
||||
if (since_last_packet >= (int32_t)SC_UART2_PACKET_TIMEOUT_MS) {
|
||||
if (sc_uart2_timed_out == 0u) {
|
||||
serial_control.command_ready = 0;
|
||||
log_printf(LOG_WARN, "UART2 RX packet timeout (%u ms)\n", (unsigned)SC_UART2_PACKET_TIMEOUT_MS);
|
||||
}
|
||||
sc_uart2_timed_out = 1;
|
||||
} else {
|
||||
sc_uart2_timed_out = 0;
|
||||
}
|
||||
|
||||
if ((since_last_packet >= SC_UART2_REINIT_TIMEOUT_MS) &&
|
||||
((now - sc_uart2_last_reinit_tick) >= SC_UART2_REINIT_TIMEOUT_MS)) {
|
||||
HAL_GPIO_WritePin(USART2_DIR_GPIO_Port, USART2_DIR_Pin, GPIO_PIN_RESET);
|
||||
(void)HAL_UART_Abort_IT(&huart2);
|
||||
(void)HAL_UART_DeInit(&huart2);
|
||||
(void)HAL_UART_Init(&huart2);
|
||||
(void)HAL_UARTEx_ReceiveToIdle_IT(&huart2, serial_control.rx_buffer, MAX_RX_BUFFER_SIZE - 1);
|
||||
sc_uart2_last_reinit_tick = now;
|
||||
log_printf(LOG_ERR, "USART2 stalled: hard reinit\n");
|
||||
if ((huart2.RxState == HAL_UART_STATE_READY) &&
|
||||
((int32_t)(now - sc_uart2_last_recover_tick) >= (int32_t)SC_UART2_RECOVER_GUARD_MS)) {
|
||||
SC_ArmUart2RxDma();
|
||||
sc_uart2_last_recover_tick = now;
|
||||
}
|
||||
}
|
||||
|
||||
static void SC_ArmUart2RxDma(void) {
|
||||
if ((huart2.RxState == HAL_UART_STATE_READY) && (serial_control.command_ready == 0)) {
|
||||
if (HAL_UARTEx_ReceiveToIdle_DMA(&huart2, serial_control.rx_buffer, MAX_RX_BUFFER_SIZE - 1) != HAL_OK) {
|
||||
SC_LogUartError("UART2 RX DMA arm failed", &huart2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void SC_ArmUart5RxDma(void) {
|
||||
if (huart5.RxState == HAL_UART_STATE_READY) {
|
||||
if (HAL_UARTEx_ReceiveToIdle_IT(&huart5, serial_iso.rx_buffer, MAX_RX_BUFFER_SIZE - 1) == HAL_OK) {
|
||||
return;
|
||||
}
|
||||
SC_LogUartError("UART5 RX IT arm failed", &huart5);
|
||||
}
|
||||
}
|
||||
|
||||
void SC_RecoverUartDma(UART_HandleTypeDef *huart) {
|
||||
if (huart == &huart2) {
|
||||
SC_LogUartError("UART2 recover start", &huart2);
|
||||
(void)HAL_UART_AbortReceive(&huart2);
|
||||
(void)HAL_UART_AbortTransmit(&huart2);
|
||||
serial_control.tx_tick = 0;
|
||||
SC_ArmUart2RxDma();
|
||||
sc_uart2_last_recover_tick = HAL_GetTick();
|
||||
} else if (huart == &huart5) {
|
||||
SC_LogUartError("UART5 recover start", &huart5);
|
||||
(void)HAL_UART_AbortReceive(&huart5);
|
||||
SC_ArmUart5RxDma();
|
||||
}
|
||||
}
|
||||
|
||||
static void SC_LogUartError(const char *tag, UART_HandleTypeDef *huart) {
|
||||
if (tag == NULL || huart == NULL) {
|
||||
return;
|
||||
}
|
||||
log_printf(LOG_ERR, "%s: instance=0x%08lx err=0x%08lx g=%lu rx=%lu\n",
|
||||
tag,
|
||||
(unsigned long)huart->Instance,
|
||||
(unsigned long)HAL_UART_GetError(huart),
|
||||
(unsigned long)huart->gState,
|
||||
(unsigned long)huart->RxState);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,14 +1,16 @@
|
||||
#include "serial_control.h"
|
||||
#include "usart.h"
|
||||
#include "charger_control.h"
|
||||
|
||||
#include "board.h"
|
||||
#include "psu_control.h"
|
||||
#include "charger_control.h"
|
||||
#include "debug.h"
|
||||
#include "fire_alarm.h"
|
||||
#include "psu_control.h"
|
||||
#include "rgb_controller.h"
|
||||
#include "usart.h"
|
||||
#include <string.h>
|
||||
|
||||
#ifdef USE_WEB_INTERFACE
|
||||
|
||||
extern volatile SC_Source_t g_sc_command_source;
|
||||
static void monitoring_data_callback(void);
|
||||
|
||||
IsolationStatusPacket_t ISO = {
|
||||
.isolationResistance = 0xFFFF
|
||||
@@ -57,6 +59,14 @@ void SC_CommandHandler(ReceivedCommand_t* cmd) {
|
||||
}
|
||||
response_code = RESP_FAILED;
|
||||
break;
|
||||
case CMD_SET_LIGHTING:
|
||||
if (cmd->argument_length == sizeof(LightingConfigPacket_t) &&
|
||||
LED_ApplyLightingConfig((const LightingConfigPacket_t *)cmd->argument)) {
|
||||
response_code = RESP_SUCCESS;
|
||||
break;
|
||||
}
|
||||
response_code = RESP_FAILED;
|
||||
break;
|
||||
case CMD_SET_POWER_LIMIT:
|
||||
if (cmd->argument_length == 1) {
|
||||
PSU0.power_limit = ((uint8_t*)cmd->argument)[0] * 1000;
|
||||
@@ -86,6 +96,10 @@ void SC_CommandHandler(ReceivedCommand_t* cmd) {
|
||||
// }
|
||||
response_code = RESP_FAILED;
|
||||
break;
|
||||
case CMD_FIRE_ALARM:
|
||||
FireAlarm_Activate();
|
||||
response_code = RESP_SUCCESS;
|
||||
break;
|
||||
case CMD_DEVICE_RESET:
|
||||
// 2. Отправляем SUCCESS (хост может успеть получить его перед ребутом)
|
||||
SC_SendPacket(NULL, 0, RESP_SUCCESS);
|
||||
@@ -122,7 +136,7 @@ void SC_CommandHandler(ReceivedCommand_t* cmd) {
|
||||
|
||||
|
||||
// Колбэк для заполнения данных мониторинга
|
||||
void monitoring_data_callback() {
|
||||
static void monitoring_data_callback(void) {
|
||||
|
||||
// Информация о зарядной сессии
|
||||
statusPacket.SOC = CONN.SOC;
|
||||
@@ -134,8 +148,9 @@ void monitoring_data_callback() {
|
||||
statusPacket.outputEnabled = CONN.outputEnabled;
|
||||
statusPacket.chargingError = CONN.chargingError;
|
||||
statusPacket.connState = CONN.connState;
|
||||
statusPacket.chargingElapsedTimeMin = 0;
|
||||
statusPacket.chargingElapsedTimeSec = 0;
|
||||
CONN_GetElapsedForMonitoring(
|
||||
&statusPacket.chargingElapsedTimeMin,
|
||||
&statusPacket.chargingElapsedTimeSec);
|
||||
statusPacket.estimatedRemainingChargingTime = 0;
|
||||
|
||||
// состояние зарядной станции
|
||||
@@ -202,4 +217,3 @@ void monitoring_data_callback() {
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
+2
-22
@@ -1,11 +1,4 @@
|
||||
/*
|
||||
* rtc.c
|
||||
*
|
||||
* Created on: Jul 22, 2024
|
||||
* Author: colorbass
|
||||
*/
|
||||
|
||||
#include <soft_rtc.h>
|
||||
#include "soft_rtc.h"
|
||||
#include <stdint.h>
|
||||
#include <time.h>
|
||||
|
||||
@@ -63,20 +56,7 @@ uint8_t getTimeReg(uint8_t reg_number){
|
||||
}else{
|
||||
return 0x00;
|
||||
}
|
||||
};
|
||||
//int main() {
|
||||
// uint32_t unix_time = 1672531199; // Example Unix timestamp
|
||||
// uint8_t time[8];
|
||||
//
|
||||
// unix_to_bcd(unix_time, time);
|
||||
//
|
||||
// // Print the BCD values for verification
|
||||
// for (int i = 0; i < 8; i++) {
|
||||
// log_printf(LOG_INFO, "time[%d]: %02X\n", i, time[i]);
|
||||
// }
|
||||
//
|
||||
// return 0;
|
||||
//}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Read the time counter available in RTC_CNT registers.
|
||||
|
||||
@@ -1,21 +1,5 @@
|
||||
/* USER CODE BEGIN Header */
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file stm32f1xx_hal_msp.c
|
||||
* @brief This file provides code for the MSP Initialization
|
||||
* and de-Initialization codes.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* Copyright (c) 2024 STMicroelectronics.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This software is licensed under terms that can be found in the LICENSE file
|
||||
* in the root directory of this software component.
|
||||
* If no LICENSE file comes with this software, it is provided AS-IS.
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
/* USER CODE END Header */
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
|
||||
+61
-16
@@ -1,20 +1,5 @@
|
||||
/* USER CODE BEGIN Header */
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file stm32f1xx_it.c
|
||||
* @brief Interrupt Service Routines.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* Copyright (c) 2024 STMicroelectronics.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This software is licensed under terms that can be found in the LICENSE file
|
||||
* in the root directory of this software component.
|
||||
* If no LICENSE file comes with this software, it is provided AS-IS.
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
/* USER CODE END Header */
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
@@ -63,6 +48,10 @@ extern ADC_HandleTypeDef hadc1;
|
||||
extern CAN_HandleTypeDef hcan1;
|
||||
extern CAN_HandleTypeDef hcan2;
|
||||
extern TIM_HandleTypeDef htim3;
|
||||
extern DMA_HandleTypeDef hdma_usart2_rx;
|
||||
extern DMA_HandleTypeDef hdma_usart2_tx;
|
||||
extern DMA_HandleTypeDef hdma_usart3_rx;
|
||||
extern DMA_HandleTypeDef hdma_usart3_tx;
|
||||
extern UART_HandleTypeDef huart5;
|
||||
extern UART_HandleTypeDef huart1;
|
||||
extern UART_HandleTypeDef huart2;
|
||||
@@ -223,6 +212,62 @@ HAL_GPIO_WritePin(DBG4_GPIO_Port, DBG4_Pin, GPIO_PIN_RESET);
|
||||
/* USER CODE END DMA1_Channel1_IRQn 1 */
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief This function handles DMA1 channel2 global interrupt.
|
||||
*/
|
||||
void DMA1_Channel2_IRQHandler(void)
|
||||
{
|
||||
/* USER CODE BEGIN DMA1_Channel2_IRQn 0 */
|
||||
|
||||
/* USER CODE END DMA1_Channel2_IRQn 0 */
|
||||
HAL_DMA_IRQHandler(&hdma_usart3_tx);
|
||||
/* USER CODE BEGIN DMA1_Channel2_IRQn 1 */
|
||||
|
||||
/* USER CODE END DMA1_Channel2_IRQn 1 */
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief This function handles DMA1 channel3 global interrupt.
|
||||
*/
|
||||
void DMA1_Channel3_IRQHandler(void)
|
||||
{
|
||||
/* USER CODE BEGIN DMA1_Channel3_IRQn 0 */
|
||||
|
||||
/* USER CODE END DMA1_Channel3_IRQn 0 */
|
||||
HAL_DMA_IRQHandler(&hdma_usart3_rx);
|
||||
/* USER CODE BEGIN DMA1_Channel3_IRQn 1 */
|
||||
|
||||
/* USER CODE END DMA1_Channel3_IRQn 1 */
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief This function handles DMA1 channel6 global interrupt.
|
||||
*/
|
||||
void DMA1_Channel6_IRQHandler(void)
|
||||
{
|
||||
/* USER CODE BEGIN DMA1_Channel6_IRQn 0 */
|
||||
|
||||
/* USER CODE END DMA1_Channel6_IRQn 0 */
|
||||
HAL_DMA_IRQHandler(&hdma_usart2_rx);
|
||||
/* USER CODE BEGIN DMA1_Channel6_IRQn 1 */
|
||||
|
||||
/* USER CODE END DMA1_Channel6_IRQn 1 */
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief This function handles DMA1 channel7 global interrupt.
|
||||
*/
|
||||
void DMA1_Channel7_IRQHandler(void)
|
||||
{
|
||||
/* USER CODE BEGIN DMA1_Channel7_IRQn 0 */
|
||||
|
||||
/* USER CODE END DMA1_Channel7_IRQn 0 */
|
||||
HAL_DMA_IRQHandler(&hdma_usart2_tx);
|
||||
/* USER CODE BEGIN DMA1_Channel7_IRQn 1 */
|
||||
|
||||
/* USER CODE END DMA1_Channel7_IRQn 1 */
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief This function handles ADC1 and ADC2 global interrupts.
|
||||
*/
|
||||
|
||||
+2
-18
@@ -1,21 +1,5 @@
|
||||
/* USER CODE BEGIN Header */
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file tim.c
|
||||
* @brief This file provides code for the configuration
|
||||
* of the TIM instances.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* Copyright (c) 2025 STMicroelectronics.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This software is licensed under terms that can be found in the LICENSE file
|
||||
* in the root directory of this software component.
|
||||
* If no LICENSE file comes with this software, it is provided AS-IS.
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
/* USER CODE END Header */
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "tim.h"
|
||||
@@ -166,7 +150,7 @@ void HAL_TIM_Base_MspInit(TIM_HandleTypeDef* tim_baseHandle)
|
||||
__HAL_RCC_TIM3_CLK_ENABLE();
|
||||
|
||||
/* TIM3 interrupt Init */
|
||||
HAL_NVIC_SetPriority(TIM3_IRQn, 0, 0);
|
||||
HAL_NVIC_SetPriority(TIM3_IRQn, 6, 0);
|
||||
HAL_NVIC_EnableIRQ(TIM3_IRQn);
|
||||
/* USER CODE BEGIN TIM3_MspInit 1 */
|
||||
|
||||
|
||||
+86
-24
@@ -1,21 +1,5 @@
|
||||
/* USER CODE BEGIN Header */
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file usart.c
|
||||
* @brief This file provides code for the configuration
|
||||
* of the USART instances.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* Copyright (c) 2025 STMicroelectronics.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This software is licensed under terms that can be found in the LICENSE file
|
||||
* in the root directory of this software component.
|
||||
* If no LICENSE file comes with this software, it is provided AS-IS.
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
/* USER CODE END Header */
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "usart.h"
|
||||
@@ -28,6 +12,10 @@ UART_HandleTypeDef huart5;
|
||||
UART_HandleTypeDef huart1;
|
||||
UART_HandleTypeDef huart2;
|
||||
UART_HandleTypeDef huart3;
|
||||
DMA_HandleTypeDef hdma_usart2_rx;
|
||||
DMA_HandleTypeDef hdma_usart2_tx;
|
||||
DMA_HandleTypeDef hdma_usart3_rx;
|
||||
DMA_HandleTypeDef hdma_usart3_tx;
|
||||
|
||||
/* UART5 init function */
|
||||
void MX_UART5_Init(void)
|
||||
@@ -163,10 +151,10 @@ void HAL_UART_MspInit(UART_HandleTypeDef* uartHandle)
|
||||
PC12 ------> UART5_TX
|
||||
PD2 ------> UART5_RX
|
||||
*/
|
||||
GPIO_InitStruct.Pin = GPIO_PIN_12;
|
||||
GPIO_InitStruct.Pin = HEATER_Pin;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
|
||||
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH;
|
||||
HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);
|
||||
HAL_GPIO_Init(HEATER_GPIO_Port, &GPIO_InitStruct);
|
||||
|
||||
GPIO_InitStruct.Pin = GPIO_PIN_2;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
|
||||
@@ -174,7 +162,7 @@ void HAL_UART_MspInit(UART_HandleTypeDef* uartHandle)
|
||||
HAL_GPIO_Init(GPIOD, &GPIO_InitStruct);
|
||||
|
||||
/* UART5 interrupt Init */
|
||||
HAL_NVIC_SetPriority(UART5_IRQn, 0, 0);
|
||||
HAL_NVIC_SetPriority(UART5_IRQn, 5, 0);
|
||||
HAL_NVIC_EnableIRQ(UART5_IRQn);
|
||||
/* USER CODE BEGIN UART5_MspInit 1 */
|
||||
|
||||
@@ -204,7 +192,7 @@ void HAL_UART_MspInit(UART_HandleTypeDef* uartHandle)
|
||||
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
|
||||
|
||||
/* USART1 interrupt Init */
|
||||
HAL_NVIC_SetPriority(USART1_IRQn, 0, 0);
|
||||
HAL_NVIC_SetPriority(USART1_IRQn, 5, 0);
|
||||
HAL_NVIC_EnableIRQ(USART1_IRQn);
|
||||
/* USER CODE BEGIN USART1_MspInit 1 */
|
||||
|
||||
@@ -235,8 +223,41 @@ void HAL_UART_MspInit(UART_HandleTypeDef* uartHandle)
|
||||
|
||||
__HAL_AFIO_REMAP_USART2_ENABLE();
|
||||
|
||||
/* USART2 DMA Init */
|
||||
/* USART2_RX Init */
|
||||
hdma_usart2_rx.Instance = DMA1_Channel6;
|
||||
hdma_usart2_rx.Init.Direction = DMA_PERIPH_TO_MEMORY;
|
||||
hdma_usart2_rx.Init.PeriphInc = DMA_PINC_DISABLE;
|
||||
hdma_usart2_rx.Init.MemInc = DMA_MINC_ENABLE;
|
||||
hdma_usart2_rx.Init.PeriphDataAlignment = DMA_PDATAALIGN_BYTE;
|
||||
hdma_usart2_rx.Init.MemDataAlignment = DMA_MDATAALIGN_BYTE;
|
||||
hdma_usart2_rx.Init.Mode = DMA_NORMAL;
|
||||
hdma_usart2_rx.Init.Priority = DMA_PRIORITY_VERY_HIGH;
|
||||
if (HAL_DMA_Init(&hdma_usart2_rx) != HAL_OK)
|
||||
{
|
||||
Error_Handler();
|
||||
}
|
||||
|
||||
__HAL_LINKDMA(uartHandle,hdmarx,hdma_usart2_rx);
|
||||
|
||||
/* USART2_TX Init */
|
||||
hdma_usart2_tx.Instance = DMA1_Channel7;
|
||||
hdma_usart2_tx.Init.Direction = DMA_MEMORY_TO_PERIPH;
|
||||
hdma_usart2_tx.Init.PeriphInc = DMA_PINC_DISABLE;
|
||||
hdma_usart2_tx.Init.MemInc = DMA_MINC_ENABLE;
|
||||
hdma_usart2_tx.Init.PeriphDataAlignment = DMA_PDATAALIGN_BYTE;
|
||||
hdma_usart2_tx.Init.MemDataAlignment = DMA_MDATAALIGN_BYTE;
|
||||
hdma_usart2_tx.Init.Mode = DMA_NORMAL;
|
||||
hdma_usart2_tx.Init.Priority = DMA_PRIORITY_HIGH;
|
||||
if (HAL_DMA_Init(&hdma_usart2_tx) != HAL_OK)
|
||||
{
|
||||
Error_Handler();
|
||||
}
|
||||
|
||||
__HAL_LINKDMA(uartHandle,hdmatx,hdma_usart2_tx);
|
||||
|
||||
/* USART2 interrupt Init */
|
||||
HAL_NVIC_SetPriority(USART2_IRQn, 0, 0);
|
||||
HAL_NVIC_SetPriority(USART2_IRQn, 2, 0);
|
||||
HAL_NVIC_EnableIRQ(USART2_IRQn);
|
||||
/* USER CODE BEGIN USART2_MspInit 1 */
|
||||
|
||||
@@ -267,8 +288,41 @@ void HAL_UART_MspInit(UART_HandleTypeDef* uartHandle)
|
||||
|
||||
__HAL_AFIO_REMAP_USART3_PARTIAL();
|
||||
|
||||
/* USART3 DMA Init */
|
||||
/* USART3_RX Init */
|
||||
hdma_usart3_rx.Instance = DMA1_Channel3;
|
||||
hdma_usart3_rx.Init.Direction = DMA_PERIPH_TO_MEMORY;
|
||||
hdma_usart3_rx.Init.PeriphInc = DMA_PINC_DISABLE;
|
||||
hdma_usart3_rx.Init.MemInc = DMA_MINC_ENABLE;
|
||||
hdma_usart3_rx.Init.PeriphDataAlignment = DMA_PDATAALIGN_BYTE;
|
||||
hdma_usart3_rx.Init.MemDataAlignment = DMA_MDATAALIGN_BYTE;
|
||||
hdma_usart3_rx.Init.Mode = DMA_NORMAL;
|
||||
hdma_usart3_rx.Init.Priority = DMA_PRIORITY_VERY_HIGH;
|
||||
if (HAL_DMA_Init(&hdma_usart3_rx) != HAL_OK)
|
||||
{
|
||||
Error_Handler();
|
||||
}
|
||||
|
||||
__HAL_LINKDMA(uartHandle,hdmarx,hdma_usart3_rx);
|
||||
|
||||
/* USART3_TX Init */
|
||||
hdma_usart3_tx.Instance = DMA1_Channel2;
|
||||
hdma_usart3_tx.Init.Direction = DMA_MEMORY_TO_PERIPH;
|
||||
hdma_usart3_tx.Init.PeriphInc = DMA_PINC_DISABLE;
|
||||
hdma_usart3_tx.Init.MemInc = DMA_MINC_ENABLE;
|
||||
hdma_usart3_tx.Init.PeriphDataAlignment = DMA_PDATAALIGN_BYTE;
|
||||
hdma_usart3_tx.Init.MemDataAlignment = DMA_MDATAALIGN_BYTE;
|
||||
hdma_usart3_tx.Init.Mode = DMA_NORMAL;
|
||||
hdma_usart3_tx.Init.Priority = DMA_PRIORITY_HIGH;
|
||||
if (HAL_DMA_Init(&hdma_usart3_tx) != HAL_OK)
|
||||
{
|
||||
Error_Handler();
|
||||
}
|
||||
|
||||
__HAL_LINKDMA(uartHandle,hdmatx,hdma_usart3_tx);
|
||||
|
||||
/* USART3 interrupt Init */
|
||||
HAL_NVIC_SetPriority(USART3_IRQn, 0, 0);
|
||||
HAL_NVIC_SetPriority(USART3_IRQn, 2, 0);
|
||||
HAL_NVIC_EnableIRQ(USART3_IRQn);
|
||||
/* USER CODE BEGIN USART3_MspInit 1 */
|
||||
|
||||
@@ -291,7 +345,7 @@ void HAL_UART_MspDeInit(UART_HandleTypeDef* uartHandle)
|
||||
PC12 ------> UART5_TX
|
||||
PD2 ------> UART5_RX
|
||||
*/
|
||||
HAL_GPIO_DeInit(GPIOC, GPIO_PIN_12);
|
||||
HAL_GPIO_DeInit(HEATER_GPIO_Port, HEATER_Pin);
|
||||
|
||||
HAL_GPIO_DeInit(GPIOD, GPIO_PIN_2);
|
||||
|
||||
@@ -335,6 +389,10 @@ void HAL_UART_MspDeInit(UART_HandleTypeDef* uartHandle)
|
||||
*/
|
||||
HAL_GPIO_DeInit(GPIOD, GPIO_PIN_5|GPIO_PIN_6);
|
||||
|
||||
/* USART2 DMA DeInit */
|
||||
HAL_DMA_DeInit(uartHandle->hdmarx);
|
||||
HAL_DMA_DeInit(uartHandle->hdmatx);
|
||||
|
||||
/* USART2 interrupt Deinit */
|
||||
HAL_NVIC_DisableIRQ(USART2_IRQn);
|
||||
/* USER CODE BEGIN USART2_MspDeInit 1 */
|
||||
@@ -355,6 +413,10 @@ void HAL_UART_MspDeInit(UART_HandleTypeDef* uartHandle)
|
||||
*/
|
||||
HAL_GPIO_DeInit(GPIOC, GPIO_PIN_10|GPIO_PIN_11);
|
||||
|
||||
/* USART3 DMA DeInit */
|
||||
HAL_DMA_DeInit(uartHandle->hdmarx);
|
||||
HAL_DMA_DeInit(uartHandle->hdmatx);
|
||||
|
||||
/* USART3 interrupt Deinit */
|
||||
HAL_NVIC_DisableIRQ(USART3_IRQn);
|
||||
/* USER CODE BEGIN USART3_MspDeInit 1 */
|
||||
|
||||
Vendored
BIN
Binary file not shown.
Binary file not shown.
Executable
BIN
Binary file not shown.
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
+4328
-3575
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Vendored
BIN
Binary file not shown.
@@ -1,5 +0,0 @@
|
||||
../Core/Src/adc.c:29:6:ADC_ScanStart 2
|
||||
../Core/Src/adc.c:37:15:HAL_ADC_ConvCpltCallback 2
|
||||
../Core/Src/adc.c:59:6:MX_ADC1_Init 8
|
||||
../Core/Src/adc.c:146:6:HAL_ADC_MspInit 3
|
||||
../Core/Src/adc.c:200:6:HAL_ADC_MspDeInit 2
|
||||
@@ -1,13 +0,0 @@
|
||||
../Core/Src/board.c:18:6:RELAY_Write 9
|
||||
../Core/Src/board.c:51:9:RELAY_Read 1
|
||||
../Core/Src/board.c:56:9:IN_ReadInput 8
|
||||
../Core/Src/board.c:77:9:GetBoardTemp 1
|
||||
../Core/Src/board.c:89:6:Init_Peripheral 1
|
||||
../Core/Src/board.c:106:7:pt1000_to_temperature 1
|
||||
../Core/Src/board.c:117:7:calculate_NTC_resistance 2
|
||||
../Core/Src/board.c:132:9:CONN_ReadTemp 4
|
||||
../Core/Src/board.c:152:9:GBT_ReadTemp 1
|
||||
../Core/Src/board.c:156:6:ADC_Select_Channel 2
|
||||
../Core/Src/board.c:167:9:ADC_TryLock 4
|
||||
../Core/Src/board.c:183:6:ADC_LockBlocking 2
|
||||
../Core/Src/board.c:189:6:ADC_Unlock 2
|
||||
@@ -1,4 +0,0 @@
|
||||
../Core/Src/can.c:31:6:MX_CAN1_Init 2
|
||||
../Core/Src/can.c:63:6:MX_CAN2_Init 2
|
||||
../Core/Src/can.c:97:6:HAL_CAN_MspInit 5
|
||||
../Core/Src/can.c:176:6:HAL_CAN_MspDeInit 5
|
||||
@@ -1,5 +0,0 @@
|
||||
../Core/Src/charger_control.c:12:6:CONN_Init 1
|
||||
../Core/Src/charger_control.c:20:6:CONN_Loop 6
|
||||
../Core/Src/charger_control.c:42:6:CONN_Task 6
|
||||
../Core/Src/charger_control.c:58:6:CONN_SetState 16
|
||||
../Core/Src/charger_control.c:84:6:CONN_PrintChargingTotal 1
|
||||
@@ -1,2 +0,0 @@
|
||||
../Core/Src/connector.c:12:6:CONN_Task 5
|
||||
../Core/Src/connector.c:28:6:CONN_SetState 16
|
||||
@@ -1,7 +0,0 @@
|
||||
../Core/Src/cp.c:16:16:CP_ReadVoltageMv 1
|
||||
../Core/Src/cp.c:33:6:CP_Init 1
|
||||
../Core/Src/cp.c:50:6:CP_SetDuty 1
|
||||
../Core/Src/cp.c:63:9:CP_GetDuty 1
|
||||
../Core/Src/cp.c:67:9:CP_GetVoltage 1
|
||||
../Core/Src/cp.c:72:12:CP_GetState 12
|
||||
../Core/Src/cp.c:96:6:CP_Loop 1
|
||||
@@ -1,3 +0,0 @@
|
||||
../Core/Src/crc.c:30:6:MX_CRC_Init 2
|
||||
../Core/Src/crc.c:51:6:HAL_CRC_MspInit 2
|
||||
../Core/Src/crc.c:67:6:HAL_CRC_MspDeInit 2
|
||||
@@ -1,5 +0,0 @@
|
||||
../Core/Src/debug.c:42:5:_write 1
|
||||
../Core/Src/debug.c:50:6:debug_buffer_add 3
|
||||
../Core/Src/debug.c:70:10:debug_buffer_available 1
|
||||
../Core/Src/debug.c:79:6:debug_buffer_send 5
|
||||
../Core/Src/debug.c:119:5:log_printf 3
|
||||
@@ -1 +0,0 @@
|
||||
../Core/Src/dma.c:39:6:MX_DMA_Init 1
|
||||
@@ -1,3 +0,0 @@
|
||||
../Core/Src/gbt_control.c:10:6:GBT_SetConfig 1
|
||||
../Core/Src/gbt_control.c:24:6:GBT_ControlRead 1
|
||||
../Core/Src/gbt_control.c:33:6:GBT_ControlWrite 2
|
||||
@@ -1 +0,0 @@
|
||||
../Core/Src/gpio.c:44:6:MX_GPIO_Init 1
|
||||
@@ -1,8 +0,0 @@
|
||||
../Core/Src/main.c:65:13:VectorBase_Config 1
|
||||
../Core/Src/main.c:76:9:ED_TraceWarning 3
|
||||
../Core/Src/main.c:88:6:ED_Delay 3
|
||||
../Core/Src/main.c:107:6:StopButtonControl 2
|
||||
../Core/Src/main.c:118:13:CAN1_MinimalReInit 3
|
||||
../Core/Src/main.c:136:5:main 1
|
||||
../Core/Src/main.c:219:6:SystemClock_Config 4
|
||||
../Core/Src/main.c:279:6:Error_Handler 1
|
||||
@@ -1 +0,0 @@
|
||||
../Core/Src/meter.c:17:6:METER_CalculateEnergy 3
|
||||
@@ -1,12 +0,0 @@
|
||||
../Core/Src/psu_control.c:34:13:PSU_SwitchState 1
|
||||
../Core/Src/psu_control.c:39:17:PSU_StateTime 1
|
||||
../Core/Src/psu_control.c:43:15:HAL_CAN_RxFifo1MsgPendingCallback 9
|
||||
../Core/Src/psu_control.c:117:6:PSU_CAN_FilterInit 2
|
||||
../Core/Src/psu_control.c:140:6:PSU_Init 1
|
||||
../Core/Src/psu_control.c:157:6:PSU_Enable 3
|
||||
../Core/Src/psu_control.c:169:6:PSU_SetHVMode 2
|
||||
../Core/Src/psu_control.c:176:6:PSU_SetVoltageCurrent 5
|
||||
../Core/Src/psu_control.c:203:6:PSU_SendCmd 4
|
||||
../Core/Src/psu_control.c:239:10:max 2
|
||||
../Core/Src/psu_control.c:244:6:PSU_ReadWrite 6
|
||||
../Core/Src/psu_control.c:280:6:PSU_Task 41
|
||||
@@ -1,6 +0,0 @@
|
||||
../Core/Src/rgb_controller.c:92:6:LED_Write 16
|
||||
../Core/Src/rgb_controller.c:146:6:interpolateColors 3
|
||||
../Core/Src/rgb_controller.c:164:6:RGB_SetColor 1
|
||||
../Core/Src/rgb_controller.c:170:6:LED_SetColor 1
|
||||
../Core/Src/rgb_controller.c:175:6:LED_Init 1
|
||||
../Core/Src/rgb_controller.c:207:6:LED_Task 10
|
||||
@@ -1,3 +0,0 @@
|
||||
../Core/Src/rtc.c:14:6:MX_RTC_Init 2
|
||||
../Core/Src/rtc.c:40:6:HAL_RTC_MspInit 2
|
||||
../Core/Src/rtc.c:59:6:HAL_RTC_MspDeInit 2
|
||||
@@ -1,18 +0,0 @@
|
||||
../Core/Src/serial.c:59:22:uart3_log_hal_error 3
|
||||
../Core/Src/serial.c:79:22:uart3_arm_rx_or_log 3
|
||||
../Core/Src/serial.c:94:15:CCS_RxEventCallback 4
|
||||
../Core/Src/serial.c:117:15:HAL_UART_ErrorCallback 5
|
||||
../Core/Src/serial.c:135:6:CCS_SerialLoop 43
|
||||
../Core/Src/serial.c:301:6:CCS_Init 1
|
||||
../Core/Src/serial.c:315:26:crc16_ibm 3
|
||||
../Core/Src/serial.c:330:17:CCS_BuildPacket 4
|
||||
../Core/Src/serial.c:346:13:CCS_SendPacket 2
|
||||
../Core/Src/serial.c:354:13:CCS_SendResetReason 1
|
||||
../Core/Src/serial.c:358:6:CCS_SendEmergencyStop 1
|
||||
../Core/Src/serial.c:362:6:CCS_SendStart 1
|
||||
../Core/Src/serial.c:366:13:CCS_CalculateEnergy 2
|
||||
../Core/Src/serial.c:381:13:send_state 3
|
||||
../Core/Src/serial.c:409:26:expected_payload_len 2
|
||||
../Core/Src/serial.c:425:22:apply_command 13
|
||||
../Core/Src/serial.c:497:25:process_received_packet 8
|
||||
../Core/Src/serial.c:550:13:CCS_UART3_Watchdog 3
|
||||
@@ -1,11 +0,0 @@
|
||||
../Core/Src/serial_control.c:70:6:ReadVersion 1
|
||||
../Core/Src/serial_control.c:82:6:SC_Init 1
|
||||
../Core/Src/serial_control.c:92:6:SC_Task 15
|
||||
../Core/Src/serial_control.c:132:15:HAL_UARTEx_RxEventCallback 7
|
||||
../Core/Src/serial_control.c:156:15:HAL_UART_TxCpltCallback 2
|
||||
../Core/Src/serial_control.c:166:26:calculate_crc32 3
|
||||
../Core/Src/serial_control.c:183:26:encode_packet 5
|
||||
../Core/Src/serial_control.c:216:15:SC_SendPacket 3
|
||||
../Core/Src/serial_control.c:235:25:parse_packet 3
|
||||
../Core/Src/serial_control.c:268:25:process_received_packet 2
|
||||
../Core/Src/serial_control.c:277:13:SC_UART2_Watchdog 7
|
||||
@@ -1,3 +0,0 @@
|
||||
../Drivers/CMSIS/Include/core_cm3.h:1762:34:__NVIC_SystemReset 1
|
||||
../Core/Src/serial_handler.c:26:6:SC_CommandHandler 19
|
||||
../Core/Src/serial_handler.c:125:6:monitoring_data_callback 1
|
||||
@@ -1,2 +0,0 @@
|
||||
../Core/Src/sma_filter.c:3:6:SMAFilter_Init 3
|
||||
../Core/Src/sma_filter.c:16:9:SMAFilter_Update 6
|
||||
@@ -1,10 +0,0 @@
|
||||
../Core/Src/soft_rtc.c:22:10:get_Current_Time 1
|
||||
../Core/Src/soft_rtc.c:26:6:set_Time 1
|
||||
../Core/Src/soft_rtc.c:30:9:to_bcd 1
|
||||
../Core/Src/soft_rtc.c:34:6:unix_to_bcd 1
|
||||
../Core/Src/soft_rtc.c:48:6:writeTimeReg 2
|
||||
../Core/Src/soft_rtc.c:53:9:getTimeReg 5
|
||||
../Core/Src/soft_rtc.c:87:17:RTC1_ReadTimeCounter 2
|
||||
../Core/Src/soft_rtc.c:119:26:RTC1_WriteTimeCounter 3
|
||||
../Core/Src/soft_rtc.c:151:26:RTC1_EnterInitMode 3
|
||||
../Core/Src/soft_rtc.c:178:26:RTC1_ExitInitMode 3
|
||||
@@ -1 +0,0 @@
|
||||
../Core/Src/stm32f1xx_hal_msp.c:63:6:HAL_MspInit 1
|
||||
@@ -1,19 +0,0 @@
|
||||
../Core/Src/stm32f1xx_it.c:80:6:NMI_Handler 1
|
||||
../Core/Src/stm32f1xx_it.c:95:6:HardFault_Handler 1
|
||||
../Core/Src/stm32f1xx_it.c:110:6:MemManage_Handler 1
|
||||
../Core/Src/stm32f1xx_it.c:125:6:BusFault_Handler 1
|
||||
../Core/Src/stm32f1xx_it.c:140:6:UsageFault_Handler 1
|
||||
../Core/Src/stm32f1xx_it.c:155:6:SVC_Handler 1
|
||||
../Core/Src/stm32f1xx_it.c:168:6:DebugMon_Handler 1
|
||||
../Core/Src/stm32f1xx_it.c:181:6:PendSV_Handler 1
|
||||
../Core/Src/stm32f1xx_it.c:194:6:SysTick_Handler 1
|
||||
../Core/Src/stm32f1xx_it.c:215:6:DMA1_Channel1_IRQHandler 1
|
||||
../Core/Src/stm32f1xx_it.c:229:6:ADC1_2_IRQHandler 1
|
||||
../Core/Src/stm32f1xx_it.c:243:6:CAN1_RX0_IRQHandler 1
|
||||
../Core/Src/stm32f1xx_it.c:257:6:TIM3_IRQHandler 1
|
||||
../Core/Src/stm32f1xx_it.c:271:6:USART1_IRQHandler 1
|
||||
../Core/Src/stm32f1xx_it.c:285:6:USART2_IRQHandler 1
|
||||
../Core/Src/stm32f1xx_it.c:299:6:USART3_IRQHandler 1
|
||||
../Core/Src/stm32f1xx_it.c:313:6:UART5_IRQHandler 1
|
||||
../Core/Src/stm32f1xx_it.c:327:6:CAN2_TX_IRQHandler 1
|
||||
../Core/Src/stm32f1xx_it.c:341:6:CAN2_RX1_IRQHandler 1
|
||||
@@ -1,102 +0,0 @@
|
||||
################################################################################
|
||||
# Automatically-generated file. Do not edit!
|
||||
# Toolchain: GNU Tools for STM32 (13.3.rel1)
|
||||
################################################################################
|
||||
|
||||
# Add inputs and outputs from these tool invocations to the build variables
|
||||
C_SRCS += \
|
||||
../Core/Src/adc.c \
|
||||
../Core/Src/board.c \
|
||||
../Core/Src/can.c \
|
||||
../Core/Src/charger_control.c \
|
||||
../Core/Src/cp.c \
|
||||
../Core/Src/crc.c \
|
||||
../Core/Src/debug.c \
|
||||
../Core/Src/dma.c \
|
||||
../Core/Src/gpio.c \
|
||||
../Core/Src/main.c \
|
||||
../Core/Src/meter.c \
|
||||
../Core/Src/psu_control.c \
|
||||
../Core/Src/rgb_controller.c \
|
||||
../Core/Src/rtc.c \
|
||||
../Core/Src/serial.c \
|
||||
../Core/Src/serial_control.c \
|
||||
../Core/Src/serial_handler.c \
|
||||
../Core/Src/sma_filter.c \
|
||||
../Core/Src/soft_rtc.c \
|
||||
../Core/Src/stm32f1xx_hal_msp.c \
|
||||
../Core/Src/stm32f1xx_it.c \
|
||||
../Core/Src/syscalls.c \
|
||||
../Core/Src/sysmem.c \
|
||||
../Core/Src/system_stm32f1xx.c \
|
||||
../Core/Src/tim.c \
|
||||
../Core/Src/usart.c
|
||||
|
||||
C_DEPS += \
|
||||
./Core/Src/adc.d \
|
||||
./Core/Src/board.d \
|
||||
./Core/Src/can.d \
|
||||
./Core/Src/charger_control.d \
|
||||
./Core/Src/cp.d \
|
||||
./Core/Src/crc.d \
|
||||
./Core/Src/debug.d \
|
||||
./Core/Src/dma.d \
|
||||
./Core/Src/gpio.d \
|
||||
./Core/Src/main.d \
|
||||
./Core/Src/meter.d \
|
||||
./Core/Src/psu_control.d \
|
||||
./Core/Src/rgb_controller.d \
|
||||
./Core/Src/rtc.d \
|
||||
./Core/Src/serial.d \
|
||||
./Core/Src/serial_control.d \
|
||||
./Core/Src/serial_handler.d \
|
||||
./Core/Src/sma_filter.d \
|
||||
./Core/Src/soft_rtc.d \
|
||||
./Core/Src/stm32f1xx_hal_msp.d \
|
||||
./Core/Src/stm32f1xx_it.d \
|
||||
./Core/Src/syscalls.d \
|
||||
./Core/Src/sysmem.d \
|
||||
./Core/Src/system_stm32f1xx.d \
|
||||
./Core/Src/tim.d \
|
||||
./Core/Src/usart.d
|
||||
|
||||
OBJS += \
|
||||
./Core/Src/adc.o \
|
||||
./Core/Src/board.o \
|
||||
./Core/Src/can.o \
|
||||
./Core/Src/charger_control.o \
|
||||
./Core/Src/cp.o \
|
||||
./Core/Src/crc.o \
|
||||
./Core/Src/debug.o \
|
||||
./Core/Src/dma.o \
|
||||
./Core/Src/gpio.o \
|
||||
./Core/Src/main.o \
|
||||
./Core/Src/meter.o \
|
||||
./Core/Src/psu_control.o \
|
||||
./Core/Src/rgb_controller.o \
|
||||
./Core/Src/rtc.o \
|
||||
./Core/Src/serial.o \
|
||||
./Core/Src/serial_control.o \
|
||||
./Core/Src/serial_handler.o \
|
||||
./Core/Src/sma_filter.o \
|
||||
./Core/Src/soft_rtc.o \
|
||||
./Core/Src/stm32f1xx_hal_msp.o \
|
||||
./Core/Src/stm32f1xx_it.o \
|
||||
./Core/Src/syscalls.o \
|
||||
./Core/Src/sysmem.o \
|
||||
./Core/Src/system_stm32f1xx.o \
|
||||
./Core/Src/tim.o \
|
||||
./Core/Src/usart.o
|
||||
|
||||
|
||||
# Each subdirectory must supply rules for building sources it contributes
|
||||
Core/Src/%.o Core/Src/%.su Core/Src/%.cyclo: ../Core/Src/%.c Core/Src/subdir.mk
|
||||
arm-none-eabi-gcc "$<" -mcpu=cortex-m3 -std=gnu11 -g3 -DDEBUG -DUSE_HAL_DRIVER -DSTM32F107xC -c -I../Core/Inc -I../Drivers/STM32F1xx_HAL_Driver/Inc -I../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy -I../Drivers/CMSIS/Device/ST/STM32F1xx/Include -I../Drivers/CMSIS/Include -O0 -ffunction-sections -fdata-sections -Wall -fstack-usage -fcyclomatic-complexity -MMD -MP -MF"$(@:%.o=%.d)" -MT"$@" --specs=nano.specs -mfloat-abi=soft -mthumb -o "$@"
|
||||
|
||||
clean: clean-Core-2f-Src
|
||||
|
||||
clean-Core-2f-Src:
|
||||
-$(RM) ./Core/Src/adc.cyclo ./Core/Src/adc.d ./Core/Src/adc.o ./Core/Src/adc.su ./Core/Src/board.cyclo ./Core/Src/board.d ./Core/Src/board.o ./Core/Src/board.su ./Core/Src/can.cyclo ./Core/Src/can.d ./Core/Src/can.o ./Core/Src/can.su ./Core/Src/charger_control.cyclo ./Core/Src/charger_control.d ./Core/Src/charger_control.o ./Core/Src/charger_control.su ./Core/Src/cp.cyclo ./Core/Src/cp.d ./Core/Src/cp.o ./Core/Src/cp.su ./Core/Src/crc.cyclo ./Core/Src/crc.d ./Core/Src/crc.o ./Core/Src/crc.su ./Core/Src/debug.cyclo ./Core/Src/debug.d ./Core/Src/debug.o ./Core/Src/debug.su ./Core/Src/dma.cyclo ./Core/Src/dma.d ./Core/Src/dma.o ./Core/Src/dma.su ./Core/Src/gpio.cyclo ./Core/Src/gpio.d ./Core/Src/gpio.o ./Core/Src/gpio.su ./Core/Src/main.cyclo ./Core/Src/main.d ./Core/Src/main.o ./Core/Src/main.su ./Core/Src/meter.cyclo ./Core/Src/meter.d ./Core/Src/meter.o ./Core/Src/meter.su ./Core/Src/psu_control.cyclo ./Core/Src/psu_control.d ./Core/Src/psu_control.o ./Core/Src/psu_control.su ./Core/Src/rgb_controller.cyclo ./Core/Src/rgb_controller.d ./Core/Src/rgb_controller.o ./Core/Src/rgb_controller.su ./Core/Src/rtc.cyclo ./Core/Src/rtc.d ./Core/Src/rtc.o ./Core/Src/rtc.su ./Core/Src/serial.cyclo ./Core/Src/serial.d ./Core/Src/serial.o ./Core/Src/serial.su ./Core/Src/serial_control.cyclo ./Core/Src/serial_control.d ./Core/Src/serial_control.o ./Core/Src/serial_control.su ./Core/Src/serial_handler.cyclo ./Core/Src/serial_handler.d ./Core/Src/serial_handler.o ./Core/Src/serial_handler.su ./Core/Src/sma_filter.cyclo ./Core/Src/sma_filter.d ./Core/Src/sma_filter.o ./Core/Src/sma_filter.su ./Core/Src/soft_rtc.cyclo ./Core/Src/soft_rtc.d ./Core/Src/soft_rtc.o ./Core/Src/soft_rtc.su ./Core/Src/stm32f1xx_hal_msp.cyclo ./Core/Src/stm32f1xx_hal_msp.d ./Core/Src/stm32f1xx_hal_msp.o ./Core/Src/stm32f1xx_hal_msp.su ./Core/Src/stm32f1xx_it.cyclo ./Core/Src/stm32f1xx_it.d ./Core/Src/stm32f1xx_it.o ./Core/Src/stm32f1xx_it.su ./Core/Src/syscalls.cyclo ./Core/Src/syscalls.d ./Core/Src/syscalls.o ./Core/Src/syscalls.su ./Core/Src/sysmem.cyclo ./Core/Src/sysmem.d ./Core/Src/sysmem.o ./Core/Src/sysmem.su ./Core/Src/system_stm32f1xx.cyclo ./Core/Src/system_stm32f1xx.d ./Core/Src/system_stm32f1xx.o ./Core/Src/system_stm32f1xx.su ./Core/Src/tim.cyclo ./Core/Src/tim.d ./Core/Src/tim.o ./Core/Src/tim.su ./Core/Src/usart.cyclo ./Core/Src/usart.d ./Core/Src/usart.o ./Core/Src/usart.su
|
||||
|
||||
.PHONY: clean-Core-2f-Src
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
../Core/Src/syscalls.c:44:6:initialise_monitor_handles 1
|
||||
../Core/Src/syscalls.c:48:5:_getpid 1
|
||||
../Core/Src/syscalls.c:53:5:_kill 1
|
||||
../Core/Src/syscalls.c:61:6:_exit 1
|
||||
../Core/Src/syscalls.c:67:27:_read 2
|
||||
../Core/Src/syscalls.c:80:27:_write 2
|
||||
../Core/Src/syscalls.c:92:5:_close 1
|
||||
../Core/Src/syscalls.c:99:5:_fstat 1
|
||||
../Core/Src/syscalls.c:106:5:_isatty 1
|
||||
../Core/Src/syscalls.c:112:5:_lseek 1
|
||||
../Core/Src/syscalls.c:120:5:_open 1
|
||||
../Core/Src/syscalls.c:128:5:_wait 1
|
||||
../Core/Src/syscalls.c:135:5:_unlink 1
|
||||
../Core/Src/syscalls.c:142:5:_times 1
|
||||
../Core/Src/syscalls.c:148:5:_stat 1
|
||||
../Core/Src/syscalls.c:155:5:_link 1
|
||||
../Core/Src/syscalls.c:163:5:_fork 1
|
||||
../Core/Src/syscalls.c:169:5:_execve 1
|
||||
@@ -1 +0,0 @@
|
||||
../Core/Src/sysmem.c:53:7:_sbrk 3
|
||||
@@ -1,2 +0,0 @@
|
||||
../Core/Src/system_stm32f1xx.c:175:6:SystemInit 1
|
||||
../Core/Src/system_stm32f1xx.c:224:6:SystemCoreClockUpdate 8
|
||||
@@ -1,5 +0,0 @@
|
||||
../Core/Src/tim.c:31:6:MX_TIM3_Init 8
|
||||
../Core/Src/tim.c:95:6:MX_TIM4_Init 8
|
||||
../Core/Src/tim.c:157:6:HAL_TIM_Base_MspInit 3
|
||||
../Core/Src/tim.c:187:6:HAL_TIM_MspPostInit 3
|
||||
../Core/Src/tim.c:235:6:HAL_TIM_Base_MspDeInit 3
|
||||
@@ -1,6 +0,0 @@
|
||||
../Core/Src/usart.c:33:6:MX_UART5_Init 2
|
||||
../Core/Src/usart.c:62:6:MX_USART1_UART_Init 2
|
||||
../Core/Src/usart.c:91:6:MX_USART2_UART_Init 2
|
||||
../Core/Src/usart.c:120:6:MX_USART3_UART_Init 2
|
||||
../Core/Src/usart.c:148:6:HAL_UART_MspInit 5
|
||||
../Core/Src/usart.c:279:6:HAL_UART_MspDeInit 5
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user