1.优化上下电时序

2.修改开关FCD_EN时的死机问题
3.修改快速开关FCD_EN信号时出现花屏的问题
4.修改cola_set_event事件参数,都是一个32bit的整数,每个事件占用1个bit
5.将B+高低压ADC判断改为电压mv判断
6.修改lvds lock信号消抖时间
7.修改不接lvds线时,快速开关FCD_EN不进入BIST模式的问题
8.添加A样相关资料
This commit is contained in:
chenming 2025-05-30 14:10:31 +08:00
parent 11d318d334
commit 1e21cdb572
41 changed files with 1084 additions and 602 deletions

View File

@ -1,40 +0,0 @@
commit ad53694b3619c35c2a94643a733aebbc70de12dc (HEAD -> main)
Author: chenming <chenming@dcenzix.com>
Date: Thu May 8 17:33:05 2025 +0800
1.添加了断lvds信号12s时进入bist模式功能
commit c8dba04e449b8334369662b61841b14cde821312 (origin/main, origin/HEAD)
Author: chenming <chenming@dcenzix.com>
Date: Thu May 8 15:14:27 2025 +0800
通过ADC采样完成高低压处理当电压低于8.5V或者高于16.5V时,将走下电流程关芯片使能关屏。电压恢复正常时,重新走上电流程供电开屏
commit c06702443619a43d8f92a4bf09ca16a2c7802947
Author: chenming <chenming@dcenzix.com>
Date: Wed May 7 17:38:12 2025 +0800
添加了温度检测功能,当屏幕温度过高时,将降低背光亮度
commit 123e704f8c7d90ccc78544b2a307a41c29e1ef04
Author: chenming <chenming@dcenzix.com>
Date: Wed May 7 14:55:39 2025 +0800
添加了开机自动轮询播放bist模式5s切换一次
commit 4479768b4a7712a408f2da6829cad90235ac213f
Author: chenming <chenming@dcenzix.com>
Date: Tue May 6 16:53:31 2025 +0800
1.添加tp iic驱动,这样作为从机的948那一路i2c可作为主机来访问触摸数据
2.添加tp固件版本读取函数
3.fml_tft_write_BIST_mode不能用,否则显示数据会乱,待查
4.OUT_TFT_SHLR开机要拉高,否则显示会左右镜像
5.打印串口波特率从9600修改成460800,减少对程序正常运行的影响
6.升级屏固件,屏显示正常
commit 8402eff711f515b281fed48a31cc34c38e2b58e7
Author: chenming <chenming@dcenzix.com>
Date: Tue May 6 15:03:14 2025 +0800
1.添加DP1208项目mcu_app部分代码

View File

@ -35,11 +35,12 @@
<option id="com.nxp.s32ds.cle.arm.mbs.arm32.bare.tool.c.compiler.option.target.libraries.2018444124" name="Libraries support" superClass="com.nxp.s32ds.cle.arm.mbs.arm32.bare.tool.c.compiler.option.target.libraries" useByScannerDiscovery="false" value="com.nxp.s32ds.cle.arm.mbs.arm32.bare.tool.c.compiler.option.target.libraries.newlib_nano_noio" valueType="enumerated"/>
<option id="com.nxp.s32ds.cle.arm.mbs.arm32.bare.tool.c.compiler.option.target.sysroot.139063735" name="Sysroot" superClass="com.nxp.s32ds.cle.arm.mbs.arm32.bare.tool.c.compiler.option.target.sysroot" useByScannerDiscovery="false" value="--sysroot=&quot;${S32DS_ARM32_NEWLIB_DIR}&quot;" valueType="string"/>
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="gnu.c.compiler.option.include.paths.1231539446" name="Include paths (-I)" superClass="gnu.c.compiler.option.include.paths" useByScannerDiscovery="false" valueType="includePath">
<listOptionValue builtIn="false" value="../SDK/platform/drivers/inc"/>
<listOptionValue builtIn="false" value="../SDK/platform/drivers/src/ftm"/>
<listOptionValue builtIn="false" value="../SDK/platform/pal/inc"/>
<listOptionValue builtIn="false" value="../SDK/rtos/osif"/>
<listOptionValue builtIn="false" value="../SDK/platform/drivers/inc"/>
<listOptionValue builtIn="false" value="../SDK/platform/pal/inc"/>
<listOptionValue builtIn="false" value="../SDK/platform/drivers/src/ftm"/>
<listOptionValue builtIn="false" value="../SDK/platform/drivers/src/lpuart"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/app}&quot;"/>
<listOptionValue builtIn="false" value="&quot;../fml&quot;"/>
<listOptionValue builtIn="false" value="&quot;${ProjDirPath}/board&quot;"/>
<listOptionValue builtIn="false" value="&quot;${ProjDirPath}/SDK/platform/devices/common&quot;"/>
@ -115,6 +116,7 @@
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="com.freescale.s32ds.cross.gnu.tool.c.linker.option.scriptfile.1548727758" name="Script files (-T)" superClass="com.freescale.s32ds.cross.gnu.tool.c.linker.option.scriptfile" valueType="stringList">
<listOptionValue builtIn="false" value="&quot;${ProjDirPath}/Project_Settings/Linker_Files/S32K118_25_flash.ld&quot;"/>
</option>
<option id="com.nxp.s32ds.cle.arm.mbs.arm32.bare.tool.c.linker.option.useprintffloat.1506497620" name="Support print float format for newlib_nano library (-u _printf_float)" superClass="com.nxp.s32ds.cle.arm.mbs.arm32.bare.tool.c.linker.option.useprintffloat" useByScannerDiscovery="false" value="true" valueType="boolean"/>
<inputType id="com.freescale.s32ds.cross.gnu.tool.c.linker.inputType.scriptfile.86424158" superClass="com.freescale.s32ds.cross.gnu.tool.c.linker.inputType.scriptfile"/>
</tool>
<tool id="com.nxp.s32ds.cle.arm.mbs.arm32.bare.tool.cpp.linker.844065084" name="Standard S32DS C++ Linker" superClass="com.nxp.s32ds.cle.arm.mbs.arm32.bare.tool.cpp.linker">
@ -136,10 +138,10 @@
<option id="com.nxp.s32ds.cle.arm.mbs.arm32.bare.tool.assembler.option.target.libraries.1650903618" name="Libraries support" superClass="com.nxp.s32ds.cle.arm.mbs.arm32.bare.tool.assembler.option.target.libraries" useByScannerDiscovery="false" value="com.nxp.s32ds.cle.arm.mbs.arm32.bare.tool.assembler.option.target.libraries.newlib_nano_noio" valueType="enumerated"/>
<option id="com.nxp.s32ds.cle.arm.mbs.arm32.bare.tool.assembler.option.target.sysroot.178697363" name="Sysroot" superClass="com.nxp.s32ds.cle.arm.mbs.arm32.bare.tool.assembler.option.target.sysroot" useByScannerDiscovery="false" value="--sysroot=&quot;${S32DS_ARM32_NEWLIB_DIR}&quot;" valueType="string"/>
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="gnu.both.asm.option.include.paths.698683580" name="Include paths (-I)" superClass="gnu.both.asm.option.include.paths" useByScannerDiscovery="false" valueType="includePath">
<listOptionValue builtIn="false" value="../SDK/platform/drivers/inc"/>
<listOptionValue builtIn="false" value="../SDK/platform/drivers/src/ftm"/>
<listOptionValue builtIn="false" value="../SDK/platform/pal/inc"/>
<listOptionValue builtIn="false" value="../SDK/rtos/osif"/>
<listOptionValue builtIn="false" value="../SDK/platform/drivers/inc"/>
<listOptionValue builtIn="false" value="../SDK/platform/pal/inc"/>
<listOptionValue builtIn="false" value="../SDK/platform/drivers/src/ftm"/>
<listOptionValue builtIn="false" value="../SDK/platform/drivers/src/lpuart"/>
<listOptionValue builtIn="false" value="&quot;${ProjDirPath}/board&quot;"/>
<listOptionValue builtIn="false" value="&quot;${ProjDirPath}/SDK/platform/devices/common&quot;"/>
@ -235,6 +237,7 @@
<sourceEntries>
<entry excluding="Debugger" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="Project_Settings"/>
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="SDK"/>
<entry flags="VALUE_WORKSPACE_PATH" kind="sourcePath" name="app"/>
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="board"/>
<entry flags="VALUE_WORKSPACE_PATH" kind="sourcePath" name="bsp"/>
<entry flags="VALUE_WORKSPACE_PATH" kind="sourcePath" name="cola_os"/>
@ -280,10 +283,10 @@
<option id="com.nxp.s32ds.cle.arm.mbs.arm32.bare.tool.c.compiler.option.target.libraries.1136492126" name="Libraries support" superClass="com.nxp.s32ds.cle.arm.mbs.arm32.bare.tool.c.compiler.option.target.libraries" useByScannerDiscovery="false" value="com.nxp.s32ds.cle.arm.mbs.arm32.bare.tool.c.compiler.option.target.libraries.newlib_nano_noio" valueType="enumerated"/>
<option id="com.nxp.s32ds.cle.arm.mbs.arm32.bare.tool.c.compiler.option.target.sysroot.1033987629" name="Sysroot" superClass="com.nxp.s32ds.cle.arm.mbs.arm32.bare.tool.c.compiler.option.target.sysroot" useByScannerDiscovery="false" value="--sysroot=&quot;${S32DS_ARM32_NEWLIB_DIR}&quot;" valueType="string"/>
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="gnu.c.compiler.option.include.paths.1285815828" name="Include paths (-I)" superClass="gnu.c.compiler.option.include.paths" useByScannerDiscovery="false" valueType="includePath">
<listOptionValue builtIn="false" value="../SDK/platform/drivers/inc"/>
<listOptionValue builtIn="false" value="../SDK/platform/drivers/src/ftm"/>
<listOptionValue builtIn="false" value="../SDK/platform/pal/inc"/>
<listOptionValue builtIn="false" value="../SDK/rtos/osif"/>
<listOptionValue builtIn="false" value="../SDK/platform/drivers/inc"/>
<listOptionValue builtIn="false" value="../SDK/platform/pal/inc"/>
<listOptionValue builtIn="false" value="../SDK/platform/drivers/src/ftm"/>
<listOptionValue builtIn="false" value="../SDK/platform/drivers/src/lpuart"/>
<listOptionValue builtIn="false" value="&quot;${ProjDirPath}/board&quot;"/>
<listOptionValue builtIn="false" value="&quot;${ProjDirPath}/SDK/platform/devices/common&quot;"/>
@ -380,10 +383,10 @@
<option id="com.nxp.s32ds.cle.arm.mbs.arm32.bare.tool.assembler.option.target.libraries.1074354711" name="Libraries support" superClass="com.nxp.s32ds.cle.arm.mbs.arm32.bare.tool.assembler.option.target.libraries" value="com.nxp.s32ds.cle.arm.mbs.arm32.bare.tool.assembler.option.target.libraries.newlib_nano_noio" valueType="enumerated"/>
<option id="com.nxp.s32ds.cle.arm.mbs.arm32.bare.tool.assembler.option.target.sysroot.1632309429" name="Sysroot" superClass="com.nxp.s32ds.cle.arm.mbs.arm32.bare.tool.assembler.option.target.sysroot" value="--sysroot=&quot;${S32DS_ARM32_NEWLIB_DIR}&quot;" valueType="string"/>
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="gnu.both.asm.option.include.paths.809906851" name="Include paths (-I)" superClass="gnu.both.asm.option.include.paths" valueType="includePath">
<listOptionValue builtIn="false" value="../SDK/platform/drivers/inc"/>
<listOptionValue builtIn="false" value="../SDK/platform/drivers/src/ftm"/>
<listOptionValue builtIn="false" value="../SDK/platform/pal/inc"/>
<listOptionValue builtIn="false" value="../SDK/rtos/osif"/>
<listOptionValue builtIn="false" value="../SDK/platform/drivers/inc"/>
<listOptionValue builtIn="false" value="../SDK/platform/pal/inc"/>
<listOptionValue builtIn="false" value="../SDK/platform/drivers/src/ftm"/>
<listOptionValue builtIn="false" value="../SDK/platform/drivers/src/lpuart"/>
<listOptionValue builtIn="false" value="&quot;${ProjDirPath}/board&quot;"/>
<listOptionValue builtIn="false" value="&quot;${ProjDirPath}/SDK/platform/devices/common&quot;"/>
@ -472,10 +475,10 @@
<option id="com.nxp.s32ds.cle.arm.mbs.arm32.bare.tool.c.compiler.option.target.libraries.562110248" name="Libraries support" superClass="com.nxp.s32ds.cle.arm.mbs.arm32.bare.tool.c.compiler.option.target.libraries" useByScannerDiscovery="false" value="com.nxp.s32ds.cle.arm.mbs.arm32.bare.tool.c.compiler.option.target.libraries.newlib_nano_noio" valueType="enumerated"/>
<option id="com.nxp.s32ds.cle.arm.mbs.arm32.bare.tool.c.compiler.option.target.sysroot.2141574877" name="Sysroot" superClass="com.nxp.s32ds.cle.arm.mbs.arm32.bare.tool.c.compiler.option.target.sysroot" useByScannerDiscovery="false" value="--sysroot=&quot;${S32DS_ARM32_NEWLIB_DIR}&quot;" valueType="string"/>
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="gnu.c.compiler.option.include.paths.1325352655" name="Include paths (-I)" superClass="gnu.c.compiler.option.include.paths" useByScannerDiscovery="false" valueType="includePath">
<listOptionValue builtIn="false" value="../SDK/platform/drivers/inc"/>
<listOptionValue builtIn="false" value="../SDK/platform/drivers/src/ftm"/>
<listOptionValue builtIn="false" value="../SDK/platform/pal/inc"/>
<listOptionValue builtIn="false" value="../SDK/rtos/osif"/>
<listOptionValue builtIn="false" value="../SDK/platform/drivers/inc"/>
<listOptionValue builtIn="false" value="../SDK/platform/pal/inc"/>
<listOptionValue builtIn="false" value="../SDK/platform/drivers/src/ftm"/>
<listOptionValue builtIn="false" value="../SDK/platform/drivers/src/lpuart"/>
<listOptionValue builtIn="false" value="&quot;${ProjDirPath}/board&quot;"/>
<listOptionValue builtIn="false" value="&quot;${ProjDirPath}/SDK/platform/devices/common&quot;"/>
@ -572,10 +575,10 @@
<option id="com.nxp.s32ds.cle.arm.mbs.arm32.bare.tool.assembler.option.target.libraries.1063813713" name="Libraries support" superClass="com.nxp.s32ds.cle.arm.mbs.arm32.bare.tool.assembler.option.target.libraries" value="com.nxp.s32ds.cle.arm.mbs.arm32.bare.tool.assembler.option.target.libraries.newlib_nano_noio" valueType="enumerated"/>
<option id="com.nxp.s32ds.cle.arm.mbs.arm32.bare.tool.assembler.option.target.sysroot.1479052780" name="Sysroot" superClass="com.nxp.s32ds.cle.arm.mbs.arm32.bare.tool.assembler.option.target.sysroot" value="--sysroot=&quot;${S32DS_ARM32_NEWLIB_DIR}&quot;" valueType="string"/>
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="gnu.both.asm.option.include.paths.1019363341" name="Include paths (-I)" superClass="gnu.both.asm.option.include.paths" valueType="includePath">
<listOptionValue builtIn="false" value="../SDK/platform/drivers/inc"/>
<listOptionValue builtIn="false" value="../SDK/platform/drivers/src/ftm"/>
<listOptionValue builtIn="false" value="../SDK/platform/pal/inc"/>
<listOptionValue builtIn="false" value="../SDK/rtos/osif"/>
<listOptionValue builtIn="false" value="../SDK/platform/drivers/inc"/>
<listOptionValue builtIn="false" value="../SDK/platform/pal/inc"/>
<listOptionValue builtIn="false" value="../SDK/platform/drivers/src/ftm"/>
<listOptionValue builtIn="false" value="../SDK/platform/drivers/src/lpuart"/>
<listOptionValue builtIn="false" value="&quot;${ProjDirPath}/board&quot;"/>
<listOptionValue builtIn="false" value="&quot;${ProjDirPath}/SDK/platform/devices/common&quot;"/>
@ -664,10 +667,10 @@
<option id="com.nxp.s32ds.cle.arm.mbs.arm32.bare.tool.c.compiler.option.target.libraries.1632139982" name="Libraries support" superClass="com.nxp.s32ds.cle.arm.mbs.arm32.bare.tool.c.compiler.option.target.libraries" useByScannerDiscovery="false" value="com.nxp.s32ds.cle.arm.mbs.arm32.bare.tool.c.compiler.option.target.libraries.newlib_nano_noio" valueType="enumerated"/>
<option id="com.nxp.s32ds.cle.arm.mbs.arm32.bare.tool.c.compiler.option.target.sysroot.1036394228" name="Sysroot" superClass="com.nxp.s32ds.cle.arm.mbs.arm32.bare.tool.c.compiler.option.target.sysroot" useByScannerDiscovery="false" value="--sysroot=&quot;${S32DS_ARM32_NEWLIB_DIR}&quot;" valueType="string"/>
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="gnu.c.compiler.option.include.paths.1241005780" name="Include paths (-I)" superClass="gnu.c.compiler.option.include.paths" useByScannerDiscovery="false" valueType="includePath">
<listOptionValue builtIn="false" value="../SDK/platform/drivers/inc"/>
<listOptionValue builtIn="false" value="../SDK/platform/drivers/src/ftm"/>
<listOptionValue builtIn="false" value="../SDK/platform/pal/inc"/>
<listOptionValue builtIn="false" value="../SDK/rtos/osif"/>
<listOptionValue builtIn="false" value="../SDK/platform/drivers/inc"/>
<listOptionValue builtIn="false" value="../SDK/platform/pal/inc"/>
<listOptionValue builtIn="false" value="../SDK/platform/drivers/src/ftm"/>
<listOptionValue builtIn="false" value="../SDK/platform/drivers/src/lpuart"/>
<listOptionValue builtIn="false" value="&quot;${ProjDirPath}/board&quot;"/>
<listOptionValue builtIn="false" value="&quot;${ProjDirPath}/SDK/platform/devices/common&quot;"/>
@ -764,10 +767,10 @@
<option id="com.nxp.s32ds.cle.arm.mbs.arm32.bare.tool.assembler.option.target.libraries.1761669153" name="Libraries support" superClass="com.nxp.s32ds.cle.arm.mbs.arm32.bare.tool.assembler.option.target.libraries" value="com.nxp.s32ds.cle.arm.mbs.arm32.bare.tool.assembler.option.target.libraries.newlib_nano_noio" valueType="enumerated"/>
<option id="com.nxp.s32ds.cle.arm.mbs.arm32.bare.tool.assembler.option.target.sysroot.934915267" name="Sysroot" superClass="com.nxp.s32ds.cle.arm.mbs.arm32.bare.tool.assembler.option.target.sysroot" value="--sysroot=&quot;${S32DS_ARM32_NEWLIB_DIR}&quot;" valueType="string"/>
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="gnu.both.asm.option.include.paths.2032830847" name="Include paths (-I)" superClass="gnu.both.asm.option.include.paths" valueType="includePath">
<listOptionValue builtIn="false" value="../SDK/platform/drivers/inc"/>
<listOptionValue builtIn="false" value="../SDK/platform/drivers/src/ftm"/>
<listOptionValue builtIn="false" value="../SDK/platform/pal/inc"/>
<listOptionValue builtIn="false" value="../SDK/rtos/osif"/>
<listOptionValue builtIn="false" value="../SDK/platform/drivers/inc"/>
<listOptionValue builtIn="false" value="../SDK/platform/pal/inc"/>
<listOptionValue builtIn="false" value="../SDK/platform/drivers/src/ftm"/>
<listOptionValue builtIn="false" value="../SDK/platform/drivers/src/lpuart"/>
<listOptionValue builtIn="false" value="&quot;${ProjDirPath}/board&quot;"/>
<listOptionValue builtIn="false" value="&quot;${ProjDirPath}/SDK/platform/devices/common&quot;"/>

View File

@ -5,7 +5,7 @@
<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
<provider class="com.freescale.s32ds.cross.gnu.CrossGCCBuiltinSpecsDetector" console="false" env-hash="1165920240417889736" id="com.freescale.s32ds.cross.gnu.CrossGCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT S32DS Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
<provider class="com.freescale.s32ds.cross.gnu.CrossGCCBuiltinSpecsDetector" console="false" env-hash="-1119501728947462585" id="com.freescale.s32ds.cross.gnu.CrossGCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT S32DS Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
<language-scope id="org.eclipse.cdt.core.gcc"/>
<language-scope id="org.eclipse.cdt.core.g++"/>
</provider>
@ -16,7 +16,7 @@
<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
<provider class="com.freescale.s32ds.cross.gnu.CrossGCCBuiltinSpecsDetector" console="false" env-hash="1062631116365500840" id="com.freescale.s32ds.cross.gnu.CrossGCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT S32DS Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
<provider class="com.freescale.s32ds.cross.gnu.CrossGCCBuiltinSpecsDetector" console="false" env-hash="-1222790852999851481" id="com.freescale.s32ds.cross.gnu.CrossGCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT S32DS Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
<language-scope id="org.eclipse.cdt.core.gcc"/>
<language-scope id="org.eclipse.cdt.core.g++"/>
</provider>
@ -27,7 +27,7 @@
<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
<provider class="com.freescale.s32ds.cross.gnu.CrossGCCBuiltinSpecsDetector" console="false" env-hash="1062631116365500840" id="com.freescale.s32ds.cross.gnu.CrossGCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT S32DS Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
<provider class="com.freescale.s32ds.cross.gnu.CrossGCCBuiltinSpecsDetector" console="false" env-hash="-1222790852999851481" id="com.freescale.s32ds.cross.gnu.CrossGCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT S32DS Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
<language-scope id="org.eclipse.cdt.core.gcc"/>
<language-scope id="org.eclipse.cdt.core.g++"/>
</provider>
@ -38,7 +38,7 @@
<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
<provider class="com.freescale.s32ds.cross.gnu.CrossGCCBuiltinSpecsDetector" console="false" env-hash="1062631116365500840" id="com.freescale.s32ds.cross.gnu.CrossGCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT S32DS Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
<provider class="com.freescale.s32ds.cross.gnu.CrossGCCBuiltinSpecsDetector" console="false" env-hash="-1222790852999851481" id="com.freescale.s32ds.cross.gnu.CrossGCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT S32DS Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
<language-scope id="org.eclipse.cdt.core.gcc"/>
<language-scope id="org.eclipse.cdt.core.g++"/>
</provider>

View File

@ -0,0 +1,3 @@
eclipse.preferences.version=1
formatter_profile=org.eclipse.cdt.ui.default.allman_profile
formatter_settings_version=1

View File

@ -3,7 +3,7 @@ encoding//bsp/bsp_register_map.h=UTF-8
encoding//fml/fml_TFT.c=UTF-8
encoding//fml/fml_adc.c=UTF-8
encoding//fml/fml_max25512.c=UTF-8
encoding//logic/logic_app_start.c=UTF-8
encoding//logic/logic_diagnose.c=UTF-8
encoding//logic/logic_public.c=UTF-8
encoding//logic/logic_test_mode.c=UTF-8
encoding//logic/logic_mode_eol.c=UTF-8
encoding//logic/logic_parse.c=UTF-8
encoding/<project>=UTF-8

36
DP1208/mcu_app/app/app.c Normal file
View File

@ -0,0 +1,36 @@
/*
* app.c
*
* Created on: 2025518
* Author: chenm
* Description: app调用logic相关模块进行初始化
*/
#include "cola_init.h"
#include "shell_port.h"
#include "fml_flash.h"
#include "fml_master_iic.h"
#include "fml_gpio.h"
#include "fml_adc.h"
extern void logic_power_init(void);
extern void logic_parse_init(void);
extern void logic_bist_init(void);
extern void logic_diagnose_init(void);
void app_init(void)
{
fml_shell_init();
fml_flash_init();
fml_master_init();
//fml_ds90ub948_open();
//fml_touch_init();
fml_gpio_init();
fml_adc_init();
logic_power_init();
//test_mode_open();
logic_parse_init();
logic_bist_init();
//fml_touch_read_version_info();
logic_diagnose_init();
}
app_initcall(app_init);

13
DP1208/mcu_app/app/app.h Normal file
View File

@ -0,0 +1,13 @@
/*
* app.h
*
* Created on: 2025518
* Author: chenm
*/
#ifndef APP_H_
#define APP_H_
#endif /* APP_H_ */

View File

@ -69,7 +69,7 @@
#define DIAG_REG 0x15U
typedef enum{
LCD_BACKLIGHT = 0x03U,
LCD_BACKLIGHT_PWM = 0x03U,
LCD_BACKLIGHT_SWITCH = 0x04U,
DAY_NIGHT_MODE = 0x07U,
TOUCH_RESET = 0x11U,

View File

@ -18,8 +18,12 @@ void bsp_drv_pwm_deinit(void)
status = PWM_Deinit(&pwm_pal_1_instance);
DEV_ASSERT(status == STATUS_SUCCESS);
}
void bsp_drv_change_duty(uint32_t duty)
{
int period = pwm_pal_1_configs.pwmChannels[0].period;
if(duty > period)
duty = period;
uint8_t channel = pwm_pal_1_configs.pwmChannels[0].channel;
pwm_pal_1_configs.pwmChannels[0].duty = duty;
status = PWM_UpdateDuty(&pwm_pal_1_instance, channel, duty);

View File

@ -15,6 +15,7 @@
* *
*----------------------------------------------*/
#include <stdio.h>
#include <stdint.h>
#include "cola_os.h"
#include "s32_core_cm0.h"
@ -97,7 +98,7 @@ static TASK_LIST_HEAD(task_list);
* \brief
*/
volatile unsigned int jiffies = 0;
volatile uint32_t jiffies = 0;
/** \var jiffies
* \brief

View File

@ -81,7 +81,7 @@ typedef struct task_s
/*----------------------------------------------*
* *
*----------------------------------------------*/
extern volatile unsigned int jiffies;
extern volatile uint32_t jiffies;
/*----------------------------------------------*
* *

View File

@ -33,7 +33,7 @@ void fml_pmic_init(void)
g_pDev_pmic_iic = cola_device_find("PMIC_IIC");
fml_PAVDD_out_voltage(0x10);//5.8v
cola_delay_ms(10);
fml_NAVDD_out_voltage(0x10);//5.8v
fml_NAVDD_out_voltage(0x10);//-5.8v
cola_delay_ms(10);
fml_VGH_out_voltage(0x06); //10v
cola_delay_ms(10);

View File

@ -11,5 +11,6 @@
extern void fml_pmic_init(void);
extern bool fml_PAVDD_out_voltage(uint8_t data);
extern void fml_pmic_write_to_mtp(void);
#endif /* FML_PWM_H_ */

View File

@ -1,7 +1,7 @@
/*
* fml_adc.c
*
* Created on: 2025<EFBFBD>4<EFBFBD>7<EFBFBD>
* Created on: 202547
* Author: 22332
*/
#include <stdio.h>
@ -9,86 +9,145 @@
#include "cola_os.h"
#include "cola_device.h"
#include "fml_adc.h"
static task_t gadcTask;
extern void logWrite(const char *fmt, ...);
#include "fml_public.h"
static const cola_device_t *g_pDevadc = NULL;
uint16_t adc_temp_value[10];
uint16_t adc_batt_value[10];
uint16_t V_battery_ad = 0;
uint16_t adc_temp = 0;
float V_battery_ad_3V3;
uint16_t adc_filter(uint16_t *adc_values) {
uint16_t sum = 0;
uint16_t min, max;
uint8_t i;
// 1. 采集10次ADC值这里需要替换为实际的ADC读取函数
// 2. 找出最大值和最小值
min = max = adc_values[0];
for (i = 1; i < 10; i++) {
if (adc_values[i] < min) {
min = adc_values[i];
}
if (adc_values[i] > max) {
max = adc_values[i];
}
}
// 3. 计算去掉最大最小值后的和
uint8_t count = 0;
for (i = 0; i < 10; i++) {
if (adc_values[i] != min && adc_values[i] != max) {
sum += adc_values[i];
count++;
}
}
// 处理所有值相同的情况避免除以0
if (count == 0) {
return adc_values[9]; // 如果所有值相同,直接返回平均值
}
// 4. 计算平均值并返回
return sum / count;
}
void fml_adc_read_polling(void *arg, uint32_t event)
typedef enum BSP_ADC_OPS_TYPE
{
static uint8_t i,j;
adc_batt_value[i++] = cola_device_read(g_pDevadc,2,0,0);
adc_temp_value[j++] = cola_device_read(g_pDevadc,3,0,0);
if((i==10) &&(j==10))
EN_ADC_OPS_TYPE_MCU = 1, //MCU内部温度(暂未用)
EN_ADC_OPS_TYPE_BAT, //读取B+电压
EN_ADC_OPS_TYPE_NTC, //读取NTC温度值
} EN_ADC_OPS_TYPE;
#if 0
//小数
#define BAT_Rp 37.4 //上拉电阻37.4K
#define BAT_R1 4.7 //分压电阻4.7k
#define BAT_LOSS 0.5 //二极管损耗0.5v
#define ADC_VREF (3.3) //ADC参考电压3.3v
#define ADC_ACCURACY (1UL << 12U) //12位采样ADC
#define ADC_CAL_VOL(adcVal) (float)(((float)(adcVal) * ADC_VREF) / ((float)ADC_ACCURACY))//ADC采集到的电压值
#define BAT_RATIO (((float)BAT_R1+(float)BAT_Rp)/(float)BAT_R1) //按电阻比例进行分压
#define BAT_GET(adcVal) ((BAT_RATIO*(float)ADC_CAL_VOL(adcVal))+BAT_LOSS) //计算板子这端的B+电压
#else
//整数
#define BAT_Rp 374 //上拉电阻37.4K
#define BAT_R1 47 //分压电阻4.7k
#define BAT_LOSS (500+400) //二极管损耗0.5v
#define ADC_VREF (3300) //ADC参考电压3.3v
#define ADC_ACCURACY (1UL << 12U) //12位采样ADC
#define ADC_CAL_VOL(adcVal) adcVal * ADC_VREF / ADC_ACCURACY//ADC采集到的电压值
#define BAT_RATIO (BAT_R1+BAT_Rp)/BAT_R1 //按电阻比例进行分压
#define BAT_GET(adcVal) ((BAT_R1+BAT_Rp)*(adcVal * ADC_VREF)/(BAT_R1*ADC_ACCURACY)+BAT_LOSS)//计算板子这端的B+电压
#endif
static cola_device_t *g_pDevadc = NULL;
static uint16_t g_iNTCAd=0; //NTC温度ADC
/*FUNCTION**********************************************************************
*
* Function Name : sort
* Description :
*
*END**************************************************************************/
static void sort(uint16_t *pBuf,int len)
{
uint16_t temp;
uint8_t i,j;
for(i=0; i<len-1; i++)
{
V_battery_ad = adc_filter(adc_batt_value);
adc_temp = adc_filter(adc_temp_value);
i = j = 0;
logWrite("V_battery_ad = %d\r\n",V_battery_ad);
logWrite("adc_temp = %d\r\n",fml_adc_read_once_temp());
for(j=i+1; j<len; j++)
{
if(pBuf[i]>pBuf[j])
{
temp = pBuf[i];
pBuf[i] = pBuf[j];
pBuf[j] = temp;
}
}
}
}
/*FUNCTION**********************************************************************
*
* Function Name : fml_adc_filter
* Description : ,,
*
*END**************************************************************************/
uint16_t fml_adc_filter(uint16_t *buf,int len)
{
int sum = 0;
sort(buf,len);
for(int i=1; i<(len-1); i++)
sum+= buf[i];
//sum = sum/(len-2);
sum = buf[len/2];
return sum;
}
/*FUNCTION**********************************************************************
*
* Function Name : fml_adc_to_bat_voltage
* Description : ADC值,B+
*
*END**************************************************************************/
uint16_t fml_adc_to_bat_voltage(uint16_t adc)
{
return BAT_GET(adc);
}
/*FUNCTION**********************************************************************
*
* Function Name : fml_adc_read_bat_ad
* Description : BAT检测AD值
*
*END**************************************************************************/
uint16_t fml_adc_read_bat_ad(void)
{
uint16_t iBattAd = cola_device_read(g_pDevadc,EN_ADC_OPS_TYPE_BAT,0,0);
return iBattAd;
}
/*FUNCTION**********************************************************************
*
* Function Name : fml_adc_read_temp_ad
* Description : NTC检测AD值
*
*END**************************************************************************/
uint16_t fml_adc_read_temp_ad(void)
{
uint16_t iBattAd = cola_device_read(g_pDevadc,EN_ADC_OPS_TYPE_NTC,0,0);
g_iNTCAd = iBattAd;
return iBattAd;
}
/*FUNCTION**********************************************************************
*
* Function Name : fml_adc_init
* Description : ADC采集任务
*
*END**************************************************************************/
void fml_adc_init(void)
{
g_pDevadc = cola_device_find("DEVICE_ADC");
if(g_pDevadc)
cola_device_open(g_pDevadc, 0);
V_battery_ad = cola_device_read(g_pDevadc,2,0,0);
adc_temp = cola_device_read(g_pDevadc,3,0,0);
cola_timer_create(&gadcTask, fml_adc_read_polling, NULL);
cola_timer_start(&gadcTask, EN_COLA_TIMER_ALWAYS, 100);
cola_device_open(g_pDevadc, 0);
}
uint8_t fml_adc_read_once_temp(void)
/*FUNCTION**********************************************************************
*
* Function Name : fml_convert_ntc_ad_to_temp
* Description : NTC AD值按协议0x0F命令规则转换成实际温度值给到主机
*
*END**************************************************************************/
uint8_t fml_convert_ntc_ad_to_temp(void)
{
//V_temp_ad = cola_device_read(g_pDevadc,3,0,0);
uint16_t adc_temp = g_iNTCAd;
if(adc_temp<252)
return 190;
else if(adc_temp<257)

View File

@ -9,7 +9,11 @@
#define FML_ADC_H_
extern uint8_t fml_adc_read_once(uint8_t pos);
extern uint8_t fml_adc_read_once_temp(void);
extern uint8_t fml_convert_ntc_ad_to_temp(void);
extern void fml_adc_init(void);
extern uint16_t fml_adc_read_bat_ad(void);
extern uint16_t fml_adc_read_temp_ad(void);
extern uint16_t fml_adc_filter(uint16_t *buf,int len);
extern uint16_t fml_adc_to_bat_voltage(uint16_t adc);
#endif /* FML_ADC_H_ */

View File

@ -7,6 +7,8 @@
#ifndef FML_FLASH_H_
#define FML_FLASH_H_
#include <stdint.h>
typedef struct VENDOR_DATA//新增结构体内容时时刻关注字节对齐问题以及写flash大小必须为8的倍数
{
uint32_t crc32;

View File

@ -9,24 +9,25 @@
#include "cola_device.h"
#include "cola_os.h"
#include "fml_gpio.h"
#include <string.h>
extern void logWrite(const char *fmt, ...);
static cola_device_t *g_pDevgpio = NULL;
int fml_gpio_read(uint8_t pos)
bool fml_gpio_read(uint8_t pos)
{
return cola_device_read(g_pDevgpio,pos,0,0);;
return cola_device_read(g_pDevgpio,pos,0,0)?true:false;
}
void fml_gpio_write(uint8_t pos,bool status)
{
cola_device_write(g_pDevgpio,pos,0,status);
}
void fml_gpio_init(void)
{
g_pDevgpio = cola_device_find("GPIO");
if(g_pDevgpio)
cola_device_open(g_pDevgpio, 0);
}

View File

@ -8,36 +8,54 @@
#ifndef FML_GPIO_H_
#define FML_GPIO_H_
typedef enum{
#include <stdbool.h>
IN_LVDS_UNLOCK = 0x00U,
typedef enum
{
IN_LVDS_UNLOCK = 0x00U,
IN_WAKEUP,
IN_TFT_ERR,
IN_LDO_1V2_PG,
IN_SW_3V3_PG,
IN_PMIC_FLTB,
IN_BL_ERR,
} gpio_input;
typedef enum{
OUT_BL_PWM = 0x00U,
OUT_BL_EN,
OUT_LVDS_PDB,
OUT_PON_HOLD,
OUT_TFT_BIST,
OUT_TFT_SYBYB,
OUT_TFT_DISP,
OUT_TFT_SHLR,
OUT_TFT_RST,
OUT_TP_RST,
OUT_3V3_TFT_EN,
OUT_PMIC_EN,
OUT_MCU_INT,
OUT_LDO_1V2_EN,
typedef enum
{
OUT_BL_PWM = 0x00U,
OUT_BL_EN,
OUT_LVDS_PDB,
OUT_PON_HOLD,
OUT_TFT_BIST,
OUT_TFT_SYBYB,
OUT_TFT_DISP,
OUT_TFT_SHLR,
OUT_TFT_RST,
OUT_TP_RST,
OUT_3V3_TFT_EN,
OUT_PMIC_EN,
OUT_MCU_INT,
OUT_LDO_1V2_EN,
} gpio_output;
extern int fml_gpio_read(uint8_t pos);
typedef enum {
GPIO_EVENT_RISING,
GPIO_EVENT_FALLING,
GPIO_EVENT_STABLE
} gpio_event_t;
typedef struct {
gpio_input pin;
uint8_t debounce_ms;
uint8_t last_state;
uint32_t timestamp;
} gpio_obj_t;
extern bool fml_gpio_read(uint8_t pos);
extern void fml_gpio_write(uint8_t pos,bool status);
extern void fml_gpio_init(void);

View File

@ -10,6 +10,7 @@
#include "cola_os.h"
#include "fml_master_iic.h"
#include "shell.h"
#include "fml_gpio.h"
#define TXBUFFER_LEN 8u
@ -123,6 +124,37 @@ int masteri2c(int argc, char *argv[]) {
else if(mode == 1)
bEnableWrite = true;
}
else if(strcmp(pDevStrName,"backlight") == 0)
{
extern void fml_gpio_write(uint8_t pos,bool status);
extern bool fml_Write_ISET(uint8_t value);
logWrite("backlight=%d\r\n",mode);
fml_gpio_write(1,mode);
}
else if(strcmp(pDevStrName,"iset") == 0)
{
extern void fml_gpio_write(uint8_t pos,bool status);
extern bool fml_Write_ISET(uint8_t value);
logWrite("fml_Write_ISET=%d\r\n",mode);
fml_Write_ISET(0x02);
}
else if(strcmp(pDevStrName,"bist") == 0)
{
extern void fml_gpio_write(uint8_t pos,bool status);
logWrite("OUT_TFT_BIST=%d\r\n",mode);
fml_gpio_write(4,mode);
}
else if(strcmp(pDevStrName,"pdb") == 0)
{
extern void fml_gpio_write(uint8_t pos,bool status);
logWrite("pdb=%d\r\n",mode);
fml_gpio_write(2,mode);
}
else if(strcmp(pDevStrName,"pmic_en") == 0)
{
logWrite("pmic en=%d\r\n",mode);
fml_gpio_write(OUT_BL_EN,false);
}
else
{
//logWrite("not support\r\n");

View File

@ -11,11 +11,11 @@
#include "cola_os.h"
#include "bsp_register_map.h"
#include "shell.h"
#include "fml_gpio.h"
static cola_device_t *g_pDev_max25512_iic = NULL;
static bool ACK;
static bool OUT[8] = {0};
static task_t s_max_task;
uint8_t data_receive123[1] ={0};
uint8_t data_TRANS123[1] ={0x0F};
extern void logWrite(const char *fmt, ...);
@ -28,6 +28,7 @@ void fml_Read_Device_ID(uint8_t data_receive)
}
bool fml_Write_ISET(uint8_t value)
{
uint8_t address = ISET_REG;
@ -35,18 +36,17 @@ bool fml_Write_ISET(uint8_t value)
return ACK;
}
void fml_max25512_set_bklight_on(bool bON)
{
fml_gpio_write(OUT_BL_EN,bON);
cola_delay_ms(5);
if(bON)
fml_Write_ISET(0x02);
}
void fml_max25512_init(void)
{
bool bACK = false;
g_pDev_max25512_iic = cola_device_find("max25512_IIC");
//bACK = fml_Write_ISET(0x02);// ENA set 1
//if(bACK == false)
// logWrite("max25512:fml_Write_ISET fail\r\n");
// fml_Read_Device_ID(data_transfer);
// cola_timer_create(&s_max_task, fml_Write_ISET, NULL);
// cola_timer_start(&s_max_task, EN_COLA_TIMER_ALWAYS, 50);
}
/*

View File

@ -0,0 +1,13 @@
/*
* fml_public.h
*
* Created on: 2025521
* Author: chenm
*/
#ifndef FML_PUBLIC_H_
#define FML_PUBLIC_H_
extern void logWrite(const char *fmt, ...);
#endif /* FML_PUBLIC_H_ */

View File

@ -5,14 +5,17 @@
* Author: 22332
*/
#include <stdio.h>
#include <stdlib.h>
#include "cola_init.h"
#include "cola_device.h"
#include "cola_os.h"
#include "fml_pwm.h"
#include "shell.h"
extern void logWrite(const char *fmt, ...);
static cola_device_t *g_pDevpwm = NULL;
static uint8_t g_iHostPWMValue = 240; //主机发过来的PWM值
void fml_pwm_init(void)
{
@ -20,7 +23,56 @@ void fml_pwm_init(void)
if(g_pDevpwm)
cola_device_open(g_pDevpwm, 0);
}
void fml_pwm_change_duty(uint8_t duty)
{
g_iHostPWMValue = duty;
cola_device_cfg(g_pDevpwm,duty,0);
}
void fml_pwm_adjust(bool bTempHigh)
{
if(g_iHostPWMValue > 0)
{
uint8_t value = g_iHostPWMValue;
if(bTempHigh)
value /= 2;
cola_device_cfg(g_pDevpwm,value,0);
}
//logWrite("fml_pwm_adjust,g_iHostPWMValue=%d\r\n",g_iHostPWMValue);
}
void fml_pwm_deinit(void)
{
if(g_pDevpwm)
{
g_pDevpwm = NULL;
cola_device_close(g_pDevpwm);
}
}
int fml_pwm(int argc, char *argv[])
{
if (argc < 3)
{
logWrite("para length must greater than 3\r\n");
return 0;
}
int mode = atoi(argv[1]);
int value = atoi(argv[2]);
if(mode == 0)
{
logWrite("pwm_value=%d\r\n",value);
fml_pwm_change_duty(value);
}
else if(mode == 1)
{
logWrite("g_iHostPWMValue=%d\r\n",g_iHostPWMValue);
}
return 0;
}
SHELL_EXPORT_CMD(SHELL_CMD_PERMISSION(0)|SHELL_CMD_TYPE(SHELL_TYPE_CMD_MAIN),pwm, fml_pwm, pwm control);

View File

@ -11,5 +11,7 @@
extern void fml_pwm_init(void);
extern void fml_pwm_change_duty(uint8_t duty);
extern void fml_pwm_deinit(void);
extern void fml_pwm_adjust(bool bTempHigh);
#endif /* FML_PWM_H_ */

View File

@ -1,65 +0,0 @@
#include <stdio.h>
#include "cola_init.h"
#include "cola_device.h"
#include "cola_os.h"
#include "../fml/fml_gpio.h"
#include "../fml/fml_master_iic.h"
#include "../fml/fml_TFT.h"
static task_t s_bist_task;
static task_t s_bist_check_task;
extern bool bist_mode;
extern bool test_mode_flag;
uint32_t last_time = 0;
uint8_t style = 0;
static bool last_bist_mode = false;
void logic_polling_change_pattern(void *arg, uint32_t event)
{
(void) arg;
if((bist_mode == false) && (last_bist_mode != bist_mode))
{
fml_gpio_write(OUT_TFT_BIST,false);
last_bist_mode = bist_mode;
}
else if ((bist_mode == true) && (last_bist_mode != bist_mode))
{
fml_gpio_write(OUT_TFT_BIST,true);
last_bist_mode = bist_mode;
style=0;
last_time = jiffies-10000;
}
if(jiffies-last_time > 5000)
{
last_time = jiffies;
fml_tft_BIST_clear();
fml_tft_write_BIST_mode(style);
style = style+1;
if(style == 24)
{
style=0;
}
}
}
void check_LVDS_floating(void)
{
if(bist_mode == true)
{
fml_gpio_write(OUT_TFT_BIST,true);
fml_Write_ISET(0x02);
fml_tft_BIST_clear();
last_time = jiffies;
cola_timer_create(&s_bist_task, logic_polling_change_pattern, NULL);
cola_timer_start(&s_bist_task, EN_COLA_TIMER_ALWAYS, 50);
cola_timer_stop(&s_bist_check_task);
}
}
void Turn_BIST_init(void)
{
cola_timer_create(&s_bist_check_task, check_LVDS_floating, NULL);
cola_timer_start(&s_bist_check_task, EN_COLA_TIMER_ALWAYS, 100);
}

View File

@ -1,42 +0,0 @@
/*
* logic_app_start.c
*
* Created on: 2025425
* Author: 22332
*/
#include "cola_init.h"
#include "cola_device.h"
#include "cola_os.h"
#include "../fml/fml_adc.h"
#include "../fml/fml_flash.h"
#include "../fml/fml_gpio.h"
#include "../fml/fml_master_iic.h"
#include "../fml/fml_ds90ub948.h"
extern void test_mode_open(void);
extern void Turn_BIST_init(void);
extern void power_on_manage(void);
extern void logic_diagnose_init(void);
extern void fml_shell_init(void);
extern void fml_touch_init(void);
extern void fml_touch_read_version_info(void);
extern void logic_init(void);
void fml_init(void)
{
fml_shell_init();
fml_flash_init();
fml_master_init();
//fml_ds90ub948_open();
//fml_touch_init();
fml_gpio_init();
fml_adc_init();
power_on_manage();
//test_mode_open();
logic_init();
Turn_BIST_init();
//fml_touch_read_version_info();
logic_diagnose_init();
}
device_initcall(fml_init);

View File

@ -1,34 +1,37 @@
/*
* logic_diagnose.c
/*!
* @ logic_diagnose.c
*
* Created on: 2025<EFBFBD>4<EFBFBD>18<EFBFBD>
* Author: 22332
* @
* GPIO以及寄存器,max25512,pmic,tft的故障原因
*/
#include "logic_public.h"
extern task_t s_logic_check_wakeup;
extern task_t s_logic_check_lvds;
extern task_t s_bist_check_task;
static task_t s_diagnose_task;
#include "bsp_register_map.h"
#include "cola_init.h"
#include "cola_device.h"
#include "cola_os.h"
#include <stdio.h>
#include "../fml/fml_pwm.h"
#include "../fml/fml_gpio.h"
#include "../fml/fml_adc.h"
extern uint16_t V_battery_ad;
extern uint16_t adc_temp;
//-----注意: 温度越大,ADC值越小
#define NTC_86_D_ADC 947 //NTC对应86度对应的ADC值,查表为[947]
#define NTC_75_D_ADC 1190 //NTC对应75度对应的ADC值,查表为[1190]
#define NTC_43_D_ADC 2164 //NTC对应43度对应的ADC值,查表为[2164]
#define NTC_39_D_ADC 2303 //NTC对应39度对应的ADC值,查表为[2303]
#define NTC_HIGH_TEMP_IN NTC_86_D_ADC
#define NTC_HIGH_TEMP_OUT NTC_75_D_ADC
static task_t loop_diagnose_task;
extern void logWrite(const char *fmt, ...);
#define ADC_SAMPLE_CNT 10 //ADC采样次数
static uint16_t g_pAdcTempArray[ADC_SAMPLE_CNT]={0}; //温度AD采集BUF
static uint16_t g_pAdcBattArray[ADC_SAMPLE_CNT]={0}; //电压AD采集BUF
static uint8_t g_iHostPWMValue = 0x00; //主机发过来的PWM值
ST_DIAGNOSE1_DATA Err_status1 = {};
ST_DIAGNOSE2_DATA Err_status2 = {};
uint8_t result1,result2;
uint8_t convertBoolStruc1ToUint8(ST_DIAGNOSE1_DATA bs) {
uint8_t result = 0;
// 璁剧疆姣忎釜浣<E9879C>
uint8_t convertBoolStruc1ToUint8(ST_DIAGNOSE1_DATA bs)
{
uint8_t result = 0;
if (bs.LOW_VOL_FAIL) result |= (1 << 0);
if (bs.HIGH_VOL_FAIL) result |= (1 << 1);
if (bs.LCD_FAIL) result |= (1 << 2);
@ -37,13 +40,12 @@ uint8_t convertBoolStruc1ToUint8(ST_DIAGNOSE1_DATA bs) {
if (bs.LCD_NTC_FAIL) result |= (1 << 5);
if (bs.RESERVER1) result |= (1 << 6);
if (bs.RESERVER2) result |= (1 << 7);
return result;
}
uint8_t convertBoolStruct2ToUint8(ST_DIAGNOSE2_DATA bs) {
uint8_t result = 0;
// 璁剧疆姣忎釜浣<E9879C>
uint8_t convertBoolStruct2ToUint8(ST_DIAGNOSE2_DATA bs)
{
uint8_t result = 0;
if (bs.RESERVER0) result |= (1 << 0);
if (bs.RESERVER1) result |= (1 << 1);
if (bs.LOCK_FAIL) result |= (1 << 2);
@ -52,91 +54,111 @@ uint8_t convertBoolStruct2ToUint8(ST_DIAGNOSE2_DATA bs) {
if (bs.RESERVER5) result |= (1 << 5);
if (bs.RESERVER6) result |= (1 << 6);
if (bs.RESERVER7) result |= (1 << 7);
return result;
}
void diagnose_polling(void)
/*FUNCTION**********************************************************************
*
* Function Name : disgnose_batt_voltage_process
* Description : B+,
*
*END**************************************************************************/
void disgnose_batt_voltage_process(void)
{
static uint8_t low_vol_cnt = 0;
static uint8_t high_vol_cnt = 0;
static uint8_t high_temp_cnt = 0;
// vol_diagnose
if((Err_status1.LOW_VOL_FAIL||Err_status1.HIGH_VOL_FAIL) == 0)
uint16_t iBattAd,iBattVoltage=0;
static int i = 0;
static eNotifyEvent voltageStatusNow = EN_NOTIFY_VOLTAGE_NORMAL;
static eNotifyEvent voltageStatusOld = EN_NOTIFY_VOLTAGE_NORMAL;
g_pAdcBattArray[i++] = fml_adc_read_bat_ad();
if(i==ADC_SAMPLE_CNT)
{
if(V_battery_ad<=1172)//灏忎簬8.5V
{
low_vol_cnt++;
if(low_vol_cnt>=10)//妫<><EFBFBD>100ms
{
Err_status1.LOW_VOL_FAIL = 1;
logWrite("Err_status1.LOW_VOL_FAIL = %d",Err_status1.LOW_VOL_FAIL);
}
}
else if(V_battery_ad>=2273)//澶т簬16.5V
{
high_vol_cnt++;
if(high_vol_cnt>=10)//妫<><EFBFBD>100ms
{
Err_status1.HIGH_VOL_FAIL = 1;
logWrite("Err_status1.HIGH_VOL_FAIL = %d",Err_status1.HIGH_VOL_FAIL);
}
}
else
{
low_vol_cnt = 0;
high_vol_cnt = 0;
}
}
else
{
if((V_battery_ad>=1239)&&(V_battery_ad<=2204))//鐢靛帇鍦<E5B887>9V~16V涔嬮棿
i = 0;
iBattAd = fml_adc_filter(g_pAdcBattArray,ADC_SAMPLE_CNT);
iBattVoltage = fml_adc_to_bat_voltage(iBattAd);
//logWrite("iBattVoltage=%d\r\n",iBattVoltage);
if(iBattVoltage > VOLTAGE_HIGH_IN)
{
Err_status1.HIGH_VOL_FAIL = 1;
voltageStatusNow = EN_NOTIFY_VOLTAGE_HIGH;
}
else if(iBattVoltage < VOLTAGE_LOW_IN)
{
Err_status1.LOW_VOL_FAIL = 1;
voltageStatusNow = EN_NOTIFY_VOLTAGE_LOW;
}
else if(iBattVoltage <= VOLTAGE_NORMAL_MAX && iBattVoltage >= VOLTAGE_NORMAL_MIN)
{
Err_status1.LOW_VOL_FAIL = 0;
Err_status1.HIGH_VOL_FAIL = 0;
Err_status1.LOW_VOL_FAIL = 0;
voltageStatusNow = EN_NOTIFY_VOLTAGE_NORMAL;
}
if(voltageStatusOld != voltageStatusNow)
{
voltageStatusOld = voltageStatusNow;
cola_set_event(&s_bist_check_task,voltageStatusNow);
cola_set_event(&s_logic_check_wakeup,voltageStatusNow);
}
}
//high_temperature_diagnose
if(Err_status1.LCD_TEMPERATURE_FAIL == 0)
{
if(adc_temp<2164)//947
{
high_temp_cnt++;
if(high_temp_cnt>=100)//妫<><EFBFBD>1000ms
{
Err_status1.LCD_TEMPERATURE_FAIL = 1;
}
}
else
{
high_temp_cnt = 0;
}
}
else if(Err_status1.LCD_TEMPERATURE_FAIL == 1)
{
if(adc_temp>2303)//1190
{
high_temp_cnt++;
if(high_temp_cnt>=100)//妫<><EFBFBD>1000ms
Err_status1.LCD_TEMPERATURE_FAIL = 0;
}
else
{
high_temp_cnt = 0;
}
}
if(adc_temp == 0 || adc_temp == 4095)
Err_status1.LCD_NTC_FAIL = 1;
}
/*FUNCTION**********************************************************************
*
* Function Name : disgnose_ntc_voltage_process
* Description : NTC电压,
*
*END**************************************************************************/
void disgnose_ntc_voltage_process(void)
{
uint16_t iTempAd=0;
static int i;
static bool bLCDTempHighNow = false,bLCDTempHighOld = false;
g_pAdcTempArray[i++] = fml_adc_read_temp_ad();
if(i==ADC_SAMPLE_CNT)
{
i = 0;
iTempAd = fml_adc_filter(g_pAdcTempArray,ADC_SAMPLE_CNT);
if(iTempAd<NTC_HIGH_TEMP_IN)
bLCDTempHighNow = true;
else if(iTempAd>NTC_HIGH_TEMP_OUT)
bLCDTempHighNow = false;
if(bLCDTempHighOld != bLCDTempHighNow)
{
bLCDTempHighOld = bLCDTempHighNow;
Err_status1.LCD_TEMPERATURE_FAIL = bLCDTempHighNow?1:0;
fml_pwm_adjust(bLCDTempHighNow);
logWrite("iTempAd=%d,LCD_TEMPERATURE_FAIL=%d\r\n",iTempAd,Err_status1.LCD_TEMPERATURE_FAIL);
}
}
}
/*FUNCTION**********************************************************************
*
* Function Name : diagnose_polling_task
* Description :
*
*END**************************************************************************/
void diagnose_polling_task(void *arg, uint32_t event)
{
(void)arg;
(void)event;
disgnose_batt_voltage_process();
disgnose_ntc_voltage_process();
Err_status1.LCD_FAIL = fml_gpio_read(IN_TFT_ERR);
Err_status1.BACKLIGHT_FAIL = fml_gpio_read(IN_BL_ERR);
Err_status2.LOCK_FAIL = fml_gpio_read(IN_LVDS_UNLOCK);
result1 = convertBoolStruc1ToUint8(Err_status1);
result2 = convertBoolStruct2ToUint8(Err_status2);
}
/*FUNCTION**********************************************************************
*
* Function Name : logic_diagnose_init
* Description :
*
*END**************************************************************************/
void logic_diagnose_init(void)
{
cola_timer_create(&loop_diagnose_task, diagnose_polling, NULL);
cola_timer_start(&loop_diagnose_task, EN_COLA_TIMER_ALWAYS, 10);
cola_timer_create(&s_diagnose_task, diagnose_polling_task, NULL);
cola_timer_start(&s_diagnose_task, EN_COLA_TIMER_ALWAYS, 100);
}

View File

@ -0,0 +1,145 @@
/*!
* @ logic_mode_bist.c
*
* @
* 948LVDS Lock信号,BIST模式
*/
#include "logic_public.h"
#define PERIOD_CHECK_LVDS_LOCK 10 //检测LVDS信号的周期
task_t s_bist_check_task; //BIST模式检测
extern void logic_power_up_step2(void); //跨模块调用,违背了原则^-^
/*FUNCTION**********************************************************************
*
* Function Name : check_lvds_floating
* Description : LVDS Lock信号,BIST模式
*
*END**************************************************************************/
static void check_lvds_floating(void *arg, uint32_t event)
{
(void)arg;
(void)event;
static bool bVoltageNormal = true;
static uint8_t style = 0;
static bool bBistMode = false;
static bool bFirst = true;
static bool bLockStatusOld = false;
static int iCheckDurCnt = 0, iDlyCnt = 0,iPeriodCnt = 0;
if(event > 0)
{//事件解析
if((event & EN_NOTIFY_SYS_POWER_DOWN) == EN_NOTIFY_SYS_POWER_DOWN)
{
bFirst = true;
logWrite("bist mode rx power down nofity\r\n");
}
if((event & EN_NOTIFY_VOLTAGE_LOW) == EN_NOTIFY_VOLTAGE_LOW)
{
bVoltageNormal = false;
logWrite("bist mode rx EN_NOTIFY_VOLTAGE_LOW\r\n");
}
if((event & EN_NOTIFY_VOLTAGE_HIGH) == EN_NOTIFY_VOLTAGE_HIGH)
{
bVoltageNormal = false;
logWrite("bist mode rx EN_NOTIFY_VOLTAGE_HIGH\r\n");
}
if((event & EN_NOTIFY_VOLTAGE_NORMAL) == EN_NOTIFY_VOLTAGE_NORMAL)
{
bVoltageNormal = true;
logWrite("bist mode rx EN_NOTIFY_VOLTAGE_NORMAL\r\n");
if(bBistMode)
{
logic_power_up_step2();
fml_max25512_set_bklight_on(true);
fml_gpio_write(OUT_TFT_BIST,true);
}
}
}
if(iCheckDurCnt < 6000)
{//前6秒不检测该信号丢失
iCheckDurCnt+=PERIOD_CHECK_LVDS_LOCK;
bLockStatusOld = !fml_gpio_read(IN_LVDS_UNLOCK);
}
else
{//读取LVDS Lock信号
bool bLockStatus = fml_gpio_read(IN_LVDS_UNLOCK);
bool bWakeUpStatus = fml_gpio_read(IN_WAKEUP);
if(bWakeUpStatus == false || bVoltageNormal == false)
return;
if((event & EN_NOTIFY_SYS_POWER_UP) == EN_NOTIFY_SYS_POWER_UP)
{
if(bBistMode)
{
logWrite("bist mode rx power up nofity\r\n");
iPeriodCnt = 0;
logic_power_up_step2();
fml_max25512_set_bklight_on(true); //开背光
fml_gpio_write(OUT_TFT_BIST,true);
}
}
if(bLockStatusOld != bLockStatus)
{//5次消抖
iDlyCnt = 5;
bLockStatusOld = bLockStatus;
}
if(iDlyCnt > 0)
{
iDlyCnt--;
if(0 == iDlyCnt)
{
style = 0;
iPeriodCnt = 0;
if(bLockStatus)
{//检测到LVDS Lock信号生效
bFirst = false;
bBistMode = false;
logWrite("exit bist\r\n");
fml_max25512_set_bklight_on(true); //开背光
}
else
{//检测到LVDS Lock信号丢失
bBistMode = true;
logWrite("enter bist\r\n");
if(bFirst)
{//首次上电时,需要进行如下系列供电
bFirst = false;
iPeriodCnt = 0;
logic_power_up_step2();
}
fml_max25512_set_bklight_on(true); //开背光
fml_tft_BIST_clear();//写寄存器清除BIST模式设置
}
fml_gpio_write(OUT_TFT_BIST,!bLockStatus);//设置Bist模式输出引脚
}
}
if(bLockStatus == false && bBistMode)
{
iPeriodCnt+=PERIOD_CHECK_LVDS_LOCK;
if(iPeriodCnt > 5000)
{//每隔5秒切换一次bist模式
//logWrite("iPeriodCnt=%d\r\n",iPeriodCnt);
iPeriodCnt = 0;
fml_tft_BIST_clear();
fml_tft_write_BIST_mode(style);
style++;
if(style == 24)//切换到第24个模式再从0开始
style=0;
}
}
}
}
/*FUNCTION**********************************************************************
*
* Function Name : logic_bist_init
* Description : BIST模式检测任务
*
*END**************************************************************************/
void logic_bist_init(void)
{
cola_timer_create(&s_bist_check_task, check_lvds_floating, NULL);
cola_timer_start(&s_bist_check_task, EN_COLA_TIMER_ALWAYS, PERIOD_CHECK_LVDS_LOCK);
}

View File

@ -1,22 +1,10 @@
/*
* logic_test_mode.c
/*!
* @ logic_mode_eol.c
*
* Created on: 2025<EFBFBD>4<EFBFBD>23<EFBFBD>
* Author: 22332
* @
* ,,EOL模式,便线
*/
#include <stdio.h>
#include "cola_init.h"
#include "cola_device.h"
#include "cola_os.h"
#include "sdk_project_config.h"
#include "../fml/fml_ds90ub948.h"
#include "../fml/fml_gpio.h"
#include "../fml/fml_pwm.h"
#include "../fml/fml_adc.h"
#include "../fml/fml_TFT.h"
#include "../fml/fml_flash.h"
#include "bsp_register_map.h"
#include "version.h"
#include "logic_public.h"
#define READ_COMD 0x22
#define WRITE_COMD 0x2E
@ -45,8 +33,7 @@ void (*p_turn_read)(uint8_t*) = fml_ds90ub948_read_commod;
void logic_vendor_task(void *arg, uint32_t event)
{
(void) arg;
(void)arg;
if(event == 1)
{
printf("vendor_data_load");
@ -57,7 +44,6 @@ void logic_vendor_task(void *arg, uint32_t event)
printf("vendor_data_save");
vendor_data_save();
}
}
@ -75,6 +61,7 @@ void check_one_second(void)
cola_timer_stop(&s_test_task);
}
}
void test_mode_open(void)
{
int test_Rx_length = sizeof(test_slaveRxBuffer);
@ -95,15 +82,12 @@ void fml_test_mode(uint8_t *pBuf)
case APP_VERSION:
if(pBuf[0] == READ_COMD)
{
cola_set_event(&s_vendor_task, 1);
test_slaveTxBuffer[0] = gst_vendor_data.SOFTWARE_VERSION0;
test_slaveTxBuffer[1] = gst_vendor_data.SOFTWARE_VERSION1;
test_slaveTxBuffer[2] = gst_vendor_data.SOFTWARE_VERSION2;
test_slaveTxBuffer[3] = gst_vendor_data.SOFTWARE_VERSION3;
test_slaveTxBuffer[4] = gst_vendor_data.SOFTWARE_VERSION4;
test_slaveTxBuffer[5] = gst_vendor_data.SOFTWARE_VERSION5;
}
else if (pBuf[0] == WRITE_COMD)
{
@ -113,17 +97,12 @@ void fml_test_mode(uint8_t *pBuf)
gst_vendor_data.SOFTWARE_VERSION3 = pBuf[5];
gst_vendor_data.SOFTWARE_VERSION4 = pBuf[6];
gst_vendor_data.SOFTWARE_VERSION5 = pBuf[7];
cola_set_event(&s_vendor_task, 2);
}
/* code */
break;
case PN_VERSION:
if(pBuf[0] == READ_COMD)
{
cola_set_event(&s_vendor_task, 1);
test_slaveTxBuffer[0] = gst_vendor_data.PN_VERSION0;
test_slaveTxBuffer[1] = gst_vendor_data.PN_VERSION1;
test_slaveTxBuffer[2] = gst_vendor_data.PN_VERSION2;
@ -139,16 +118,12 @@ void fml_test_mode(uint8_t *pBuf)
gst_vendor_data.PN_VERSION3 = pBuf[5];
gst_vendor_data.PN_VERSION4 = pBuf[6];
gst_vendor_data.PN_VERSION5 = pBuf[7];
cola_set_event(&s_vendor_task, 2);
}
/* code */
break;
case HARDWARE_VERSION:
if(pBuf[0] == READ_COMD)
{
cola_set_event(&s_vendor_task, 1);
test_slaveTxBuffer[0] = gst_vendor_data.HARDWARE_VERSION0;
test_slaveTxBuffer[1] = gst_vendor_data.HARDWARE_VERSION1;
test_slaveTxBuffer[2] = gst_vendor_data.HARDWARE_VERSION2;
@ -165,7 +140,6 @@ void fml_test_mode(uint8_t *pBuf)
gst_vendor_data.HARDWARE_VERSION3 = pBuf[5];
gst_vendor_data.HARDWARE_VERSION4 = pBuf[6];
gst_vendor_data.HARDWARE_VERSION5 = pBuf[7];
cola_set_event(&s_vendor_task, 2);
}
/* code */
break;
@ -179,7 +153,7 @@ void fml_test_mode(uint8_t *pBuf)
case BLACKLIGHT_EN:
if (pBuf[0] == WRITE_COMD)
{
fml_gpio_write(OUT_BL_EN,pBuf[2]);
fml_max25512_set_bklight_on(pBuf[2]);
}
/* code */
break;
@ -204,7 +178,7 @@ void fml_test_mode(uint8_t *pBuf)
/* code */
break;
case TEMP_AD_VALUE:
test_slaveTxBuffer[0] = fml_adc_read_once_temp();
test_slaveTxBuffer[0] = fml_convert_ntc_ad_to_temp();
/* code */
break;
case TP_POSITION:

View File

@ -1,22 +1,10 @@
/*
* logic_public.c
/*!
* @ logic_parse.c
*
* Created on: 2025<EFBFBD>4<EFBFBD>14<EFBFBD>
* Author: 22332
* @
* 948I2C读写命令来执行主机对屏的控制动作
*/
#include "bsp_register_map.h"
#include "version.h"
#include "cola_init.h"
#include "cola_device.h"
#include "cola_os.h"
#include "cola_fifo.h"
#include <stdio.h>
#include "../fml/fml_pwm.h"
#include "../fml/fml_gpio.h"
#include "../fml/fml_adc.h"
#include "../fml/fml_ds90ub948.h"
#include "../fml/fml_flash.h"
#include "logic_public.h"
extern ST_VENDOR_DATA gst_vendor_data;
extern uint8_t result1,result2;
@ -33,24 +21,13 @@ void (*p_read_commod)(uint8_t*) = fml_ds90ub948_read_commod;
static task_t s_948_task;
static cola_fifo_t g_rx_fifo;
static uint8_t g_rx_buf[MAX_RX_SIZE];
volatile unsigned int time_tag1 = 0;
volatile unsigned int time_tag2 = 0;
static int receive_iic = 0;
bool bist_mode = false;
void logic_read_948_task(void *arg, uint32_t event)
{
(void) arg;
if(jiffies-time_tag1 > 12000)
{
bist_mode = true;
}
if((jiffies-time_tag2 > 3000) && (receive_iic == 1))
{
bist_mode = true;
}
(void)arg;
if(event == 1)
{
{//接收底层发来的事件
#if 0
//Here print cause data wrong display
for(int i=0; i<sizeof(pub_slaveRxBuffer); i++)
@ -58,10 +35,6 @@ void logic_read_948_task(void *arg, uint32_t event)
logWrite("\r\n");
#endif
fml_ds90ub948_read_commod(pub_slaveRxBuffer);
receive_iic = 1;
time_tag1 = jiffies;
time_tag2 = jiffies;
bist_mode = false;
}
#if 0
else
@ -76,7 +49,7 @@ void logic_read_948_task(void *arg, uint32_t event)
#endif
}
void logic_init(void)
void logic_parse_init(void)
{
cola_fifo_init(&g_rx_fifo, g_rx_buf, MAX_RX_SIZE);
fml_ds90ub948_init(pub_slaveRxBuffer,Rx_length,pub_slaveTxBuffer,Tx_length,p_read_commod,&s_948_task);
@ -85,31 +58,40 @@ void logic_init(void)
void fml_ds90ub948_read_commod(uint8_t *pBuf)
{
cola_fifo_write(&g_rx_fifo, pBuf, 2);
static int pwmValue = -1;
static int backlightOnOff = -1;
//cola_fifo_write(&g_rx_fifo, pBuf, 2);
switch (pBuf[0])
{
case LCD_BACKLIGHT:
if(Err_status1.LCD_TEMPERATURE_FAIL == 1)
case LCD_BACKLIGHT_PWM:
if(pwmValue != pBuf[1])
{
fml_pwm_change_duty(pBuf[1]/2);
pwmValue = pBuf[1];
if(Err_status1.LCD_TEMPERATURE_FAIL == 1)
{
fml_pwm_change_duty(pwmValue/2);
}
else
{
fml_pwm_change_duty(pwmValue);
}
//logWrite("pwm=%d\r\n",pwmValue);
}
else
{
fml_pwm_change_duty(pBuf[1]);
}
/* code */
break;
case LCD_BACKLIGHT_SWITCH:
if(pBuf[1] == 1)
{
fml_gpio_write(OUT_BL_EN,true);
fml_Write_ISET(0x02);
}
else
{
fml_gpio_write(OUT_BL_EN,false);
}
/* code */
if(backlightOnOff != pBuf[1])
{
backlightOnOff = pBuf[1];
if(backlightOnOff == 1)
{
fml_max25512_set_bklight_on(true);
}
else
{
fml_max25512_set_bklight_on(false);
}
//logWrite("backlight=%d\r\n",backlightOnOff);
}
break;
case DAY_NIGHT_MODE:
/* code */
@ -144,7 +126,7 @@ void fml_ds90ub948_read_commod(uint8_t *pBuf)
/* code */
break;
case LCD_TEMPURATURE:
pub_slaveTxBuffer[0] = fml_adc_read_once_temp();
pub_slaveTxBuffer[0] = fml_convert_ntc_ad_to_temp();
/* code */
break;
case UPDATE_READ:
@ -264,7 +246,6 @@ void fml_ds90ub948_read_commod(uint8_t *pBuf)
break;
case BOOTLOADER_VERSION:
pub_slaveTxBuffer[0] = BOOTLOADER_VERSION_V;
/* code */
break;
case I2C_CLASSIFY_FLASH_VERSION_READ:

View File

@ -0,0 +1,303 @@
/*!
* @ logic_power.c
*
* @
* 1.FCD_EN信号,
* 2.948LVDS Lock信号,
* 3.,,stop模式
*/
#include "logic_public.h"
#define PERIOD_CHECK_WAKEUP 10 //检测FCD_EN信号的周期,10ms
#define PERIOD_CHECK_LVDS_LOCK 10 //检测LVDS lock信号的周期,10ms
static eNotifyEvent g_BattStatus = EN_NOTIFY_VOLTAGE_NORMAL; //电源状态
static bool g_bPowerDown = true; //false[已上电] true[已下电]
static bool g_bWakeUp = false; //false[系统未唤醒] true[系统已唤醒]
static bool bWakeUpStatusOld = false;
static bool bLockStatusOld = false;
extern task_t s_bist_check_task; //bist任务
task_t s_logic_check_lvds; //周期检测LVDS lock信号的任务句柄
task_t s_logic_check_wakeup; //周期检测Wakup信号的任务句柄(即主机FCD_EN信号)
/*FUNCTION**********************************************************************
*
* Function Name : logic_power_up_step1
* Description : FCD_EN信号时,948 ,便LOCK
*
* :
* 1.FCD_EN信号->SW_3V3_EN[H]->SW_3V3[H]: AD上拉有了,3.3v供电有了,948,max25512,pmic供上电
* 2.
*
*END**************************************************************************/
static void logic_power_up_step1(void)
{
//1.检测到FCD_EN信号->SW_3V3_EN[H]->SW_3V3[H]: AD上拉有了,器件3.3v供电有了,948,max25512,pmic供上电
//2.拉高PON_HOLD自锁接管电源
fml_gpio_write(OUT_PON_HOLD,true);
//3.拉高LDO_1V2_EN,使能1.2v电压输出,948有用到1.2v
fml_gpio_write(OUT_LDO_1V2_EN,true);
//4.拉高3V3_TFT_EN,使能TFT_VDD输出,给TDDI供电
fml_gpio_write(OUT_3V3_TFT_EN,true);
//5.使能948 LVDS输出
fml_gpio_write(OUT_LVDS_PDB,true);
//6.拉低TP_RST,将TDDI TP触摸复位
fml_gpio_write(OUT_TP_RST,false);
//7.拉低TFT_RST,将TDDI DP显示复位
fml_gpio_write(OUT_TFT_RST,false);
logWrite("logic_power_up_step1\r\n");
}
/*FUNCTION**********************************************************************
*
* Function Name : logic_power_up_step2
* Description : LVDS Lock信号时,TFT相关电压,
*
*END**************************************************************************/
void logic_power_up_step2(void)
{
//1.拉高TP_RST
fml_gpio_write(OUT_TP_RST,true);
//2.拉高TFT_RST
fml_gpio_write(OUT_TFT_RST,true);
//3.拉高TFT_SHLR,左右镜像控制
fml_gpio_write(OUT_TFT_SHLR,true);
//4.拉高TFT_SYBYB,TDDI退出Standby模式
fml_gpio_write(OUT_TFT_SYBYB,true);
//5.拉高TFT_DISP,使能显示
fml_gpio_write(OUT_TFT_DISP,true);
//6.拉低TFT_BIST,退出BIST测试模式
fml_gpio_write(OUT_TFT_BIST,false);
//7.拉高PMIC_EN,使能屏电压输出,具体输出还要写寄存器
fml_gpio_write(OUT_PMIC_EN,true);
//8.拉高BL_EN,使能MAX25512背光输出,具体输出还要写寄存器
fml_gpio_write(OUT_BL_EN,true);
//10.找到master i2c这路设备
fml_tft_init();
cola_delay_ms(10);//必须加延时,否则后面i2c写入会出现失败情况!
//11.按TFT规格书,i2c配置pmic输出电压:PAVDD,NAVDD,VGH,VGL
fml_pmic_init();
//12.i2c配置max25512背光输出
fml_max25512_init();
//13.输出PWM背光控制(pwm输出放在最后,可避免闪屏!!)
fml_pwm_init();
fml_pwm_adjust(false);
logWrite("logic_power_up_step2\r\n");
}
/*FUNCTION**********************************************************************
*
* Function Name : logic_power_down
* Description :
*
*END**************************************************************************/
static void logic_power_down(void)
{
//1.关闭pwm输出
fml_pwm_change_duty(0);
fml_pwm_deinit();
//6.拉低TFT_SYBYB,TDDI进入Standby模式
fml_gpio_write(OUT_TFT_SYBYB,false);
cola_delay_ms(50);
//5.拉低TFT_DISP,关闭显示
fml_gpio_write(OUT_TFT_DISP,false);
cola_delay_ms(16);
//2.拉低BL_EN,关闭MAX25512背光输出
fml_gpio_write(OUT_BL_EN,false);
//3.拉低PMIC_EN,关闭PMIC给屏的相关供电
fml_gpio_write(OUT_PMIC_EN,false);
//4.拉低TFT_BIST,退出BIST测试模式
fml_gpio_write(OUT_TFT_BIST,false);
//7.拉低TFT_RST,复位DP
fml_gpio_write(OUT_TFT_RST,false);
//8.拉低TP_RST,复位TP
fml_gpio_write(OUT_TP_RST,false);
//9.关闭948 LVDS输出
fml_gpio_write(OUT_LVDS_PDB,false);
//10.拉低3V3_TFT_EN,关闭TFT_VDD输出,给TDDI断电
fml_gpio_write(OUT_3V3_TFT_EN,false);
//11.拉低LDO_1V2_EN,关闭1.2v电压输出
fml_gpio_write(OUT_LDO_1V2_EN,false);
//12.拉低PON_HOLD,MCU关闭整个系统电源,包括自身供电[但电源异常时不能关闭电源]
if(g_BattStatus == EN_NOTIFY_VOLTAGE_NORMAL)
fml_gpio_write(OUT_PON_HOLD,false);
}
/*FUNCTION**********************************************************************
*
* Function Name : logic_task_check_lvds_lock
* Description : 948 LVDS Lock信号,TFT的显示与关闭
*
*END**************************************************************************/
static void logic_task_check_lvds_lock(void *arg, uint32_t event)
{
(void)arg;
(void)event;
static int iDlyCnt = 0;
if(g_bWakeUp == false)
return;
if(g_BattStatus != EN_NOTIFY_VOLTAGE_NORMAL)
return;
bool bLockStatus = fml_gpio_read(IN_LVDS_UNLOCK);
if(bLockStatusOld != bLockStatus)
{
iDlyCnt = 10;
#if 0
if(bLockStatus)
logWrite("detect bLockStatus = %d,signal match\r\n",bLockStatus);
else
logWrite("detect bLockStatus = %d,signal lost\r\n",bLockStatus);
#endif
bLockStatusOld = bLockStatus;
}
if(iDlyCnt > 0)
{
iDlyCnt--;
if(0 == iDlyCnt)
{
if(bLockStatus)
{//检测lvds锁信号生效
if(g_bPowerDown)
{
g_bPowerDown = false;
logic_power_up_step2();
logWrite("first lock, power on tft\r\n");
if(cola_get_ticker() > 15000)
{//用于解决上电没有接lvds线,后面再接上不亮屏的情况
logWrite("tft self make bk light on\r\n");
fml_max25512_set_bklight_on(true);
}
}
else
{
logWrite("lock signal match,enable backlight\r\n");
fml_max25512_set_bklight_on(true);
}
}
else
{//检测lvds锁信号丢失
//fml_max25512_set_bklight_on(false);
//logWrite("lock signal lost,disable backlight\r\n");
}
}
}
}
/*FUNCTION**********************************************************************
*
* Function Name : logic_task_check_wakeup_signal
* Description : FCD_EN信号,
*
*END**************************************************************************/
static void logic_task_check_wakeup_signal(void *arg, uint32_t event)
{
(void)arg;
(void)event;
static int iDlyCnt = 0;
bool bWakeUpStatus = fml_gpio_read(IN_WAKEUP);
bool bEnable = false;
if(bWakeUpStatusOld != bWakeUpStatus)
{
iDlyCnt = 10;
bWakeUpStatusOld = bWakeUpStatus;
}
if(iDlyCnt > 0)
{
iDlyCnt--;
if(0 == iDlyCnt)
{
bEnable = true;
logWrite("detect fcd_en=%d:",bWakeUpStatus);
}
}
if(event > 0)
{
if((event & EN_NOTIFY_VOLTAGE_LOW) == EN_NOTIFY_VOLTAGE_LOW)
{
bEnable = true;
logWrite("detect bat low:");
}
if((event & EN_NOTIFY_VOLTAGE_HIGH) == EN_NOTIFY_VOLTAGE_HIGH)
{
bEnable = true;
logWrite("detect bat high:");
}
if((event & EN_NOTIFY_VOLTAGE_NORMAL) == EN_NOTIFY_VOLTAGE_NORMAL)
{
bEnable = true;
logWrite("detect bat normal:");
}
}
if(bEnable)
{
if(g_bWakeUp == false)
{//上电
logWrite("power up\r\n");
g_bWakeUp = true;
bLockStatusOld = false;
logic_power_up_step1();
cola_timer_create(&s_logic_check_lvds, logic_task_check_lvds_lock, NULL);
cola_timer_start(&s_logic_check_lvds, EN_COLA_TIMER_ALWAYS, PERIOD_CHECK_LVDS_LOCK);
cola_set_event(&s_bist_check_task,EN_NOTIFY_SYS_POWER_UP);
}
else if(g_bWakeUp == true)
{//下电
logWrite("power down\r\n");
cola_set_event(&s_bist_check_task,EN_NOTIFY_SYS_POWER_DOWN);
cola_timer_stop(&s_logic_check_lvds);
cola_timer_delete(&s_logic_check_lvds);
g_bWakeUp = false;
g_bPowerDown = true;
logic_power_down();
cola_delay_ms(200);
}
}
}
/*FUNCTION**********************************************************************
*
* Function Name : logic_power_init
* Description :
*
*END**************************************************************************/
void logic_power_init(void)
{
logWrite("getSoftwareVersion:%s\r\n",getSoftwareVersion());
bWakeUpStatusOld = !fml_gpio_read(IN_WAKEUP);
cola_timer_create(&s_logic_check_wakeup, logic_task_check_wakeup_signal, NULL);
cola_timer_start(&s_logic_check_wakeup, EN_COLA_TIMER_ALWAYS, PERIOD_CHECK_WAKEUP);
}

View File

@ -1,125 +0,0 @@
#include <stdio.h>
#include "cola_init.h"
#include "cola_device.h"
#include "cola_os.h"
#include "fml_gpio.h"
#include "fml_pwm.h"
#include "fml_PMIC.h"
#include "bsp_register_map.h"
static task_t gpioTask1;
static task_t gpioTask2;
static task_t gpioTask3;
bool wakeup = false;
bool lock = false;
extern ST_DIAGNOSE1_DATA Err_status1;
extern bool bist_mode;
void lock_detect(void *arg, uint32_t event)
{
lock = fml_gpio_read(IN_LVDS_UNLOCK);
if((lock == true)||(bist_mode == true))
{
cola_delay_ms(200);
lock = fml_gpio_read(IN_LVDS_UNLOCK);
if((lock == true)||(bist_mode == true))
{
cola_task_delete(&gpioTask2);
fml_gpio_write(OUT_TFT_SHLR,true);
fml_gpio_write(OUT_TFT_RST,false);
cola_delay_ms(100);
fml_gpio_write(OUT_TFT_RST,true);
fml_gpio_write(OUT_TFT_SYBYB,true);
fml_gpio_write(OUT_TFT_DISP,true);
//fml_gpio_write(OUT_TFT_BIST,true);
fml_gpio_write(OUT_BL_EN,true);
fml_gpio_write(OUT_PMIC_EN,true);
fml_pwm_init();
cola_delay_ms(10);
fml_tft_init();
cola_delay_ms(10);
fml_pmic_init();
fml_max25512_init();
power_up_manage();
}
}
}
void power_on_detect(void *arg, uint32_t event)
{
wakeup = fml_gpio_read(IN_WAKEUP);
if((wakeup == true)&&(Err_status1.HIGH_VOL_FAIL == 0)&&(Err_status1.LOW_VOL_FAIL==0))
{
cola_task_delete(&gpioTask1);
fml_gpio_write(OUT_TP_RST,true);
fml_gpio_write(OUT_PON_HOLD,true);
fml_gpio_write(OUT_LDO_1V2_EN,true);
fml_gpio_write(OUT_3V3_TFT_EN,true);
fml_gpio_write(OUT_LVDS_PDB,true);
cola_task_create(&gpioTask2, lock_detect, NULL);
}
}
//start
void power_on_manage(void)
{
// fml_gpio_write(OUT_TP_RST,true);
// fml_gpio_write(OUT_PON_HOLD,true);
// fml_gpio_write(OUT_LDO_1V2_EN,true);
//
// fml_gpio_write(OUT_3V3_TFT_EN,true);
// cola_delay_ms(200);
// fml_gpio_write(OUT_LVDS_PDB,true);
//
//
// fml_gpio_write(OUT_TFT_SHLR,true);
// fml_gpio_write(OUT_TFT_RST,false);
// cola_delay_ms(200);
// fml_gpio_write(OUT_TFT_RST,true);
//
// fml_gpio_write(OUT_TFT_SYBYB,true);
// fml_gpio_write(OUT_TFT_DISP,true);
// fml_gpio_write(OUT_BL_EN,true);
// fml_pwm_init();
// //fml_gpio_write(OUT_TFT_BIST,true);
// fml_gpio_write(OUT_PMIC_EN,true);
// cola_delay_ms(10);
// fml_tft_init();
// cola_delay_ms(10);
// fml_pmic_init();
// fml_max25512_init();
//fml_tft_write_BIST_mode(0);
cola_task_create(&gpioTask1, power_on_detect, NULL);
}
void power_up_detect(void)
{
wakeup = fml_gpio_read(IN_WAKEUP);
if((wakeup == false)||(Err_status1.HIGH_VOL_FAIL == 1)||(Err_status1.LOW_VOL_FAIL==1))
{
cola_delay_ms(200);
wakeup = fml_gpio_read(IN_WAKEUP);
if((wakeup == false)||(Err_status1.HIGH_VOL_FAIL == 1)||(Err_status1.LOW_VOL_FAIL==1))
{
cola_task_delete(&gpioTask3);
fml_gpio_write(OUT_BL_EN,false);
fml_gpio_write(OUT_PMIC_EN,false);
fml_gpio_write(OUT_TFT_SYBYB,false);
fml_gpio_write(OUT_TFT_DISP,false);
fml_gpio_write(OUT_LVDS_PDB,false);
fml_gpio_write(OUT_3V3_TFT_EN,false);
fml_gpio_write(OUT_LDO_1V2_EN,false);
fml_gpio_write(OUT_PON_HOLD,false);
power_on_manage();
}
}
}
void power_up_manage(void)
{
cola_task_create(&gpioTask3, power_up_detect, NULL);
}

View File

@ -0,0 +1,64 @@
/*
* logic_public.h
*
* Created on: 2025521
* Author: chenm
*/
#ifndef LOGIC_PUBLIC_H_
#define LOGIC_PUBLIC_H_
#include "bsp_register_map.h"
#include <stdio.h>
#include "cola_init.h"
#include "cola_device.h"
#include "cola_os.h"
#include "cola_fifo.h"
#include "fml_gpio.h"
#include "fml_pwm.h"
#include "fml_PMIC.h"
#include "fml_tft.h"
#include "fml_flash.h"
#include "fml_adc.h"
#include "fml_ds90ub948.h"
#include "version.h"
typedef enum
{
EN_NOTIFY_NONE = 0,
EN_NOTIFY_SYS_POWER_DOWN = 0x01, //通知系统已下电
EN_NOTIFY_SYS_POWER_UP = 0x02, //通知系统上电
EN_NOTIFY_VOLTAGE_NORMAL = 0x04, //通知系统电压正常
EN_NOTIFY_VOLTAGE_HIGH = 0x08, //通知系统高压异常
EN_NOTIFY_VOLTAGE_LOW = 0x10, //通知系统低压异常
}eNotifyEvent;
#if 1
//规范要求值:
#define VOLTAGE_LOW_IN 8500 // 低压进入电压
#define VOLTAGE_LOW_OUT 9000 // 低压退出电压
#define VOLTAGE_NORMAL_MIN 9000 // 正常电压最小电压
#define VOLTAGE_NORMAL_MAX 16000 // 正常电压最大电压
#define VOLTAGE_HIGH_IN 16500 // 高压进入电压
#define VOLTAGE_HIGH_OUT 16000 // 高压退出电压
#else
//这几个值用于做实验
#define VOLTAGE_LOW_IN 9500 // 低压进入电压
#define VOLTAGE_LOW_OUT 10000 // 低压退出电压
#define VOLTAGE_NORMAL_MIN 10000 // 正常电压最小电压
#define VOLTAGE_NORMAL_MAX 15000 // 正常电压最大电压
#define VOLTAGE_HIGH_IN 15500 // 高压进入电压
#define VOLTAGE_HIGH_OUT 15000 // 高压退出电压
#endif
extern void logWrite(const char *fmt, ...);
extern void fml_max25512_init(void);
extern void fml_max25512_set_bklight_on(bool bON);
extern void logic_process_bist_mode(bool bEnable);
extern void fml_tft_BIST_clear(void);
#endif /* LOGIC_PUBLIC_H_ */

View File

@ -0,0 +1,21 @@
/*
* version.c
*
* Created on: 2025520
* Author: chenm
*/
#include "version.h"
#define HARDWARE_VERSION "V1.0.3" //len=6
#define SOFTWARE_VERSION "V1.0.0" //len=6
#define PN_VERSION "PN0001" //len=6
#define I2C_CLASSIFY_VERSION "0001" //len=4
#define I2C_CLASSIFY_FBL_VERSION "001" //len=3
char g_pVersion[] = SOFTWARE_VERSION;
char * getSoftwareVersion(void)
{
return SOFTWARE_VERSION;
}

View File

@ -50,6 +50,6 @@
#define BOOTLOADER_VERSION_V 0x0FU;
#define FALSH_VERSION 0x01U;
extern char * getSoftwareVersion(void);
#endif /* VERSION_H_ */

View File

@ -36,7 +36,7 @@ void logWrite(const char *fmt, ...)
#define LOG_BUFFER_SIZE 256
static char logBuffer[LOG_BUFFER_SIZE];
va_list vargs;
int len;
volatile int len = 0;
va_start(vargs, fmt);
len = vsnprintf(logBuffer, LOG_BUFFER_SIZE - 1, fmt, vargs);

View File

@ -1,10 +1,10 @@
#ifndef _SHELL_PORT_H_
#define _SHELL_PORT_H_
//#include "system.h"
#include "shell.h"
extern Shell shell;
void User_Shell_Init(void);
//#include "shell.h"
//extern Shell shell;
//void User_Shell_Init(void);
extern void fml_shell_init(void);
#endif