没关log,有密码
This commit is contained in:
parent
867e3a21a7
commit
41f7ff50a8
|
@ -5,7 +5,7 @@
|
|||
"type": "mrs-debugger",
|
||||
"request": "launch",
|
||||
"name": "JT-DT-YD4N02A_RTT_MRS-4G",
|
||||
"cwd": "d:\\SXDT\\Project\\CH32\\JT-DT-YD4N02A_RTT_MRS-NT26K",
|
||||
"cwd": "c:\\Users\\16586\\Desktop\\JT-DT-YD4N02A_4G_RTT_MRS",
|
||||
"openOCDCfg": {
|
||||
"useLocalOpenOCD": true,
|
||||
"executable": "c:/MounRiver/MounRiver_Studio2/resources/app/resources/win32/components/WCH/OpenOCD/OpenOCD/bin/openocd.exe",
|
||||
|
@ -39,8 +39,8 @@
|
|||
"additionalCommands": []
|
||||
},
|
||||
"loadedFiles": {
|
||||
"executableFile": "d:\\SXDT\\Project\\CH32\\JT-DT-YD4N02A_RTT_MRS-NT26K\\obj\\JT-DT-YD4N02A_RTT_MRS-4G.elf",
|
||||
"symbolFile": "d:\\SXDT\\Project\\CH32\\JT-DT-YD4N02A_RTT_MRS-NT26K\\obj\\JT-DT-YD4N02A_RTT_MRS-4G.elf",
|
||||
"executableFile": "c:\\Users\\16586\\Desktop\\JT-DT-YD4N02A_4G_RTT_MRS\\obj\\JT-DT-YD4N02A_RTT_MRS-4G.elf",
|
||||
"symbolFile": "c:\\Users\\16586\\Desktop\\JT-DT-YD4N02A_4G_RTT_MRS\\obj\\JT-DT-YD4N02A_RTT_MRS-4G.elf",
|
||||
"executableFileOffset": 0,
|
||||
"symbolFileOffset": 0
|
||||
},
|
||||
|
|
|
@ -9,10 +9,15 @@ Description=============ROM(byte): 256K, SRAM(byte): 64K, CHIP PINS: 64, GPIO PO
|
|||
Mcu Type=CH32V30x
|
||||
Address=0x08000000
|
||||
Target Path=obj\JT-DT-YD4N02A_RTT_MRS-4G.hex
|
||||
Exe Path=
|
||||
Exe Arguments=
|
||||
CLKSpeed=1
|
||||
DebugInterfaceMode=-1
|
||||
DebugInterfaceMode=0
|
||||
Erase All=true
|
||||
Program=true
|
||||
Verify=true
|
||||
Reset=true
|
||||
SDIPrintf=false
|
||||
Disable Power Output=false
|
||||
Clear CodeFlash=false
|
||||
Disable Code-Protect=false
|
|
@ -1,62 +1,62 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<launchConfiguration type="com.mounriver.debug.gdbjtag.openocd.launchConfigurationType">
|
||||
<booleanAttribute key="com.mounriver.debug.gdbjtag.openocd.doStartGdbServer" value="true" />
|
||||
<booleanAttribute key="com.mounriver.debug.gdbjtag.openocd.doFirstReset" value="true" />
|
||||
<booleanAttribute key="com.mounriver.debug.gdbjtag.openocd.enableSemihosting" value="false" />
|
||||
<booleanAttribute key="com.mounriver.debug.gdbjtag.openocd.enableSemihostingNew" value="false" />
|
||||
<booleanAttribute key="com.mounriver.debug.gdbjtag.openocd.doDebugInRam" value="false" />
|
||||
<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.loadSymbols" value="true" />
|
||||
<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.useProjBinaryForSymbols" value="true" />
|
||||
<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.useFileForSymbols" value="false" />
|
||||
<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.loadImage" value="true" />
|
||||
<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.useProjBinaryForImage" value="true" />
|
||||
<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.useFileForImage" value="false" />
|
||||
<booleanAttribute key="com.mounriver.debug.gdbjtag.openocd.doContinue" value="true" />
|
||||
<booleanAttribute key="com.mounriver.debug.gdbjtag.openocd.doSecondReset" value="true" />
|
||||
<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.setStopAt" value="true" />
|
||||
<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.setPcRegister" value="false" />
|
||||
<booleanAttribute key="org.eclipse.cdt.launch.PROJECT_BUILD_CONFIG_AUTO_ATTR" value="true" />
|
||||
<booleanAttribute key="com.mounriver.debug.gdbjtag.openocd.doGdbServerAllocateConsole" value="true" />
|
||||
<booleanAttribute key="com.mounriver.debug.gdbjtag.openocd.doGdbServerAllocateTelnetConsole" value="false" />
|
||||
<booleanAttribute key="com.mounriver.debug.gdbjtag.openocd.doStartGdbCLient" value="true" />
|
||||
<booleanAttribute key="org.eclipse.cdt.dsf.gdb.UPDATE_THREADLIST_ON_SUSPEND" value="false" />
|
||||
<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.setResume" value="false" />
|
||||
<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.useRemoteTarget" value="true" />
|
||||
<stringAttribute key="com.mounriver.debug.gdbjtag.openocd.gdbServerExecutable" value="${eclipse_home}toolchain/OpenOCD/bin/${openocd_executable}" />
|
||||
<stringAttribute key="com.mounriver.debug.gdbjtag.openocd.gdbServerTclPortNumber" value="6666" />
|
||||
<stringAttribute key="com.mounriver.debug.gdbjtag.openocd.gdbServerOther" value="-f "${eclipse_home}toolchain/OpenOCD/bin/wch-riscv.cfg"" />
|
||||
<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.ipAddress" value="localhost" />
|
||||
<stringAttribute key="org.eclipse.cdt.dsf.gdb.DEBUG_NAME" value="${eclipse_home}toolchain/RISC-V Embedded GCC12/bin/riscv-none-elf-gdb.exe" />
|
||||
<stringAttribute key="com.mounriver.debug.gdbjtag.openocd.gdbClientOtherOptions" value="" />
|
||||
<stringAttribute key="com.mounriver.debug.gdbjtag.openocd.gdbClientOtherCommands" value="set mem inaccessible-by-default off
set architecture riscv:rv32
set remotetimeout unlimited
set disassembler-options xw" />
|
||||
<stringAttribute key="com.mounriver.debug.gdbjtag.openocd.firstResetType" value="init" />
|
||||
<stringAttribute key="com.mounriver.debug.gdbjtag.openocd.otherInitCommands" value="" />
|
||||
<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.symbolsOffset" value="" />
|
||||
<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.symbolsFileName" value="" />
|
||||
<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.imageOffset" value="" />
|
||||
<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.imageFileName" value="" />
|
||||
<stringAttribute key="com.mounriver.debug.gdbjtag.openocd.secondResetType" value="halt" />
|
||||
<stringAttribute key="com.mounriver.debug.gdbjtag.openocd.otherRunCommands" value="" />
|
||||
<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.stopAt" value="handle_reset" />
|
||||
<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.pcRegister" value="" />
|
||||
<stringAttribute key="com.mounriver.debug.gdbjtag.svdPath" value="${eclipse_home}template/wizard/WCH/RISC-V/CH32V307/NoneOS/CH32V307xx.svd" />
|
||||
<stringAttribute key="org.eclipse.cdt.launch.PROGRAM_NAME" value="obj\JT-DT-YD4N02A_RTT_MRS-4G.elf" />
|
||||
<stringAttribute key="org.eclipse.cdt.launch.PROJECT_ATTR" value="JT-DT-YD4N02A_RTT_MRS-4G" />
|
||||
<stringAttribute key="org.eclipse.cdt.launch.PROJECT_BUILD_CONFIG_ID_ATTR" value="" />
|
||||
<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.jtagDevice" value="GNU MCU OpenOCD" />
|
||||
<stringAttribute key="com.mounriver.debug.gdbjtag.openocd.gdbServerConnectionAddress" value="" />
|
||||
<stringAttribute key="com.mounriver.debug.gdbjtag.openocd.gdbServerLog" value="" />
|
||||
<stringAttribute key="org.eclipse.cdt.launch.COREFILE_PATH" value="" />
|
||||
<stringAttribute key="process_factory_id" value="org.eclipse.cdt.dsf.gdb.GdbProcessFactory" />
|
||||
<stringAttribute key="org.eclipse.dsf.launch.MEMORY_BLOCKS" value="<?xml version="1.0" encoding="UTF-8" standalone="no"?>\r\n<memoryBlockExpressionList context="Context string"/>\r\n" />
|
||||
<intAttribute key="com.mounriver.debug.gdbjtag.openocd.gdbServerGdbPortNumber" value="3333" />
|
||||
<intAttribute key="com.mounriver.debug.gdbjtag.openocd.gdbServerTelnetPortNumber" value="4444" />
|
||||
<intAttribute key="org.eclipse.cdt.debug.gdbjtag.core.portNumber" value="3333" />
|
||||
<intAttribute key="org.eclipse.cdt.launch.ATTR_BUILD_BEFORE_LAUNCH_ATTR" value="2" />
|
||||
<booleanAttribute key="com.mounriver.debug.gdbjtag.openocd.doStartGdbServer" value="true"/>
|
||||
<booleanAttribute key="com.mounriver.debug.gdbjtag.openocd.doFirstReset" value="true"/>
|
||||
<booleanAttribute key="com.mounriver.debug.gdbjtag.openocd.enableSemihosting" value="false"/>
|
||||
<booleanAttribute key="com.mounriver.debug.gdbjtag.openocd.enableSemihostingNew" value="false"/>
|
||||
<booleanAttribute key="com.mounriver.debug.gdbjtag.openocd.doDebugInRam" value="false"/>
|
||||
<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.loadSymbols" value="true"/>
|
||||
<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.useProjBinaryForSymbols" value="true"/>
|
||||
<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.useFileForSymbols" value="false"/>
|
||||
<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.loadImage" value="true"/>
|
||||
<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.useProjBinaryForImage" value="true"/>
|
||||
<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.useFileForImage" value="false"/>
|
||||
<booleanAttribute key="com.mounriver.debug.gdbjtag.openocd.doContinue" value="true"/>
|
||||
<booleanAttribute key="com.mounriver.debug.gdbjtag.openocd.doSecondReset" value="true"/>
|
||||
<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.setStopAt" value="true"/>
|
||||
<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.setPcRegister" value="false"/>
|
||||
<booleanAttribute key="org.eclipse.cdt.launch.PROJECT_BUILD_CONFIG_AUTO_ATTR" value="true"/>
|
||||
<booleanAttribute key="com.mounriver.debug.gdbjtag.openocd.doGdbServerAllocateConsole" value="true"/>
|
||||
<booleanAttribute key="com.mounriver.debug.gdbjtag.openocd.doGdbServerAllocateTelnetConsole" value="false"/>
|
||||
<booleanAttribute key="com.mounriver.debug.gdbjtag.openocd.doStartGdbCLient" value="true"/>
|
||||
<booleanAttribute key="org.eclipse.cdt.dsf.gdb.UPDATE_THREADLIST_ON_SUSPEND" value="false"/>
|
||||
<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.setResume" value="false"/>
|
||||
<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.useRemoteTarget" value="true"/>
|
||||
<stringAttribute key="com.mounriver.debug.gdbjtag.openocd.gdbServerExecutable" value="${eclipse_home}toolchain/OpenOCD/bin/${openocd_executable}"/>
|
||||
<stringAttribute key="com.mounriver.debug.gdbjtag.openocd.gdbServerTclPortNumber" value="6666"/>
|
||||
<stringAttribute key="com.mounriver.debug.gdbjtag.openocd.gdbServerOther" value="-f "${eclipse_home}toolchain/OpenOCD/bin/wch-riscv.cfg""/>
|
||||
<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.ipAddress" value="localhost"/>
|
||||
<stringAttribute key="org.eclipse.cdt.dsf.gdb.DEBUG_NAME" value="${eclipse_home}toolchain/RISC-V Embedded GCC12/bin/riscv-none-elf-gdb.exe"/>
|
||||
<stringAttribute key="com.mounriver.debug.gdbjtag.openocd.gdbClientOtherOptions" value=""/>
|
||||
<stringAttribute key="com.mounriver.debug.gdbjtag.openocd.gdbClientOtherCommands" value="set mem inaccessible-by-default off
set architecture riscv:rv32
set remotetimeout unlimited
set disassembler-options xw"/>
|
||||
<stringAttribute key="com.mounriver.debug.gdbjtag.openocd.firstResetType" value="init"/>
|
||||
<stringAttribute key="com.mounriver.debug.gdbjtag.openocd.otherInitCommands" value=""/>
|
||||
<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.symbolsOffset" value=""/>
|
||||
<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.symbolsFileName" value=""/>
|
||||
<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.imageOffset" value=""/>
|
||||
<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.imageFileName" value=""/>
|
||||
<stringAttribute key="com.mounriver.debug.gdbjtag.openocd.secondResetType" value="halt"/>
|
||||
<stringAttribute key="com.mounriver.debug.gdbjtag.openocd.otherRunCommands" value=""/>
|
||||
<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.stopAt" value="handle_reset"/>
|
||||
<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.pcRegister" value=""/>
|
||||
<stringAttribute key="com.mounriver.debug.gdbjtag.svdPath" value="${eclipse_home}template/wizard/WCH/RISC-V/CH32V307/NoneOS/CH32V307xx.svd"/>
|
||||
<stringAttribute key="org.eclipse.cdt.launch.PROGRAM_NAME" value="obj/JT-DT-YD4N02A_RTT_MRS-4G.elf"/>
|
||||
<stringAttribute key="org.eclipse.cdt.launch.PROJECT_ATTR" value="JT-DT-YD4N02A_RTT_MRS-4G"/>
|
||||
<stringAttribute key="org.eclipse.cdt.launch.PROJECT_BUILD_CONFIG_ID_ATTR" value=""/>
|
||||
<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.jtagDevice" value="GNU MCU OpenOCD"/>
|
||||
<stringAttribute key="com.mounriver.debug.gdbjtag.openocd.gdbServerConnectionAddress" value=""/>
|
||||
<stringAttribute key="com.mounriver.debug.gdbjtag.openocd.gdbServerLog" value=""/>
|
||||
<stringAttribute key="org.eclipse.cdt.launch.COREFILE_PATH" value=""/>
|
||||
<stringAttribute key="process_factory_id" value="org.eclipse.cdt.dsf.gdb.GdbProcessFactory"/>
|
||||
<stringAttribute key="org.eclipse.dsf.launch.MEMORY_BLOCKS" value="<?xml version="1.0" encoding="UTF-8" standalone="no"?>\r\n<memoryBlockExpressionList context="Context string"/>\r\n"/>
|
||||
<intAttribute key="com.mounriver.debug.gdbjtag.openocd.gdbServerGdbPortNumber" value="3333"/>
|
||||
<intAttribute key="com.mounriver.debug.gdbjtag.openocd.gdbServerTelnetPortNumber" value="4444"/>
|
||||
<intAttribute key="org.eclipse.cdt.debug.gdbjtag.core.portNumber" value="3333"/>
|
||||
<intAttribute key="org.eclipse.cdt.launch.ATTR_BUILD_BEFORE_LAUNCH_ATTR" value="2"/>
|
||||
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
|
||||
<listEntry value="/JT-DT-YD4N02A_RTT_MRS-4G" />
|
||||
<listEntry value="JT-DT-YD4N02A_RTT_MRS-4G"/>
|
||||
</listAttribute>
|
||||
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
|
||||
<listEntry value="4" />
|
||||
<listEntry value="4"/>
|
||||
</listAttribute>
|
||||
</launchConfiguration>
|
|
@ -8,9 +8,9 @@
|
|||
"series": "CH32V307",
|
||||
"rtos": "NoneOS",
|
||||
"mcu": "CH32V307RVT6",
|
||||
"description": "===========ROM(byte): 256K, SRAM(byte): 64K, CHIP PINS: 64, GPIO PORTS: 51.\\nWCH CH32V3 series of mainstream MCUs covers the needs of a large variety of applications in the industrial,medical and consumer markets. High performance with first-class peripherals and low-power,low-voltage operation is paired with a high level of integration at accessible prices with a simple architecture and easy-to-use tools.",
|
||||
"description": "============ROM(byte): 256K, SRAM(byte): 64K, CHIP PINS: 64, GPIO PORTS: 51.\\nWCH CH32V3 series of mainstream MCUs covers the needs of a large variety of applications in the industrial,medical and consumer markets. High performance with first-class peripherals and low-power,low-voltage operation is paired with a high level of integration at accessible prices with a simple architecture and easy-to-use tools.",
|
||||
"link": "WCH-Link",
|
||||
"peripheral_version": "===========1.4"
|
||||
"peripheral_version": "============1.4"
|
||||
},
|
||||
"linkedFolders": [],
|
||||
"removedResources": [
|
||||
|
|
|
@ -192,7 +192,6 @@ int main(void)
|
|||
rt_uint32_t received_event;
|
||||
|
||||
BSP_ADC_Init();
|
||||
BSP_VIN_Detection_Init();
|
||||
|
||||
if (Get_VIN_VoltageInt1000x() > 10000)
|
||||
{
|
||||
|
@ -243,6 +242,9 @@ int main(void)
|
|||
RCC_ClearFlag();
|
||||
NVIC_SystemReset(); // 直接重启系统
|
||||
}
|
||||
BSP_VIN_Detection_Init();
|
||||
// IWDG_Feed();
|
||||
|
||||
while (1)
|
||||
{
|
||||
if (is_event_initialized)
|
||||
|
@ -412,7 +414,9 @@ int main(void)
|
|||
{
|
||||
LOG_D("掉电模式");
|
||||
|
||||
ADC_ITConfig(USED_ADC, ADC_IT_AWD, DISABLE);
|
||||
is_event_initialized = RT_FALSE;
|
||||
|
||||
// ADC_ITConfig(USED_ADC, ADC_IT_AWD, DISABLE);
|
||||
|
||||
H308_PWR_OFF;
|
||||
SysControl.last_status = SysControl.status;
|
||||
|
@ -439,6 +443,7 @@ int main(void)
|
|||
LOG_D("cnt2 = %d", cnt);
|
||||
cnt++;
|
||||
}
|
||||
|
||||
__disable_irq(); // 关闭中断
|
||||
NVIC_SystemReset(); // 直接重启系统
|
||||
|
||||
|
@ -478,6 +483,7 @@ int main(void)
|
|||
else
|
||||
{
|
||||
rt_thread_mdelay(1000);
|
||||
// IWDG_Feed();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -265,6 +265,7 @@ int BSP_SYS_Init(void)
|
|||
BSP_BUTTON_Init();
|
||||
BSP_HR_Init();
|
||||
BSP_Nt26k_Thread_Init();
|
||||
|
||||
return 0;
|
||||
}
|
||||
// INIT_ENV_EXPORT(BSP_SYS_Init);
|
||||
|
|
|
@ -14,6 +14,8 @@
|
|||
#include "rtdef.h"
|
||||
#include "bsp_flash.h"
|
||||
|
||||
|
||||
|
||||
#define MAX_EXPIRATION_YEARS (10U)
|
||||
#define MAX_EXPIRATION_DAYS (365 * MAX_EXPIRATION_YEARS + 30 * 3U)
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
#define H308_RST_OFF rt_pin_write(H308_RST_PIN, PIN_HIGH)
|
||||
|
||||
#define H308_THREAD_STACK_SIZE (2048)
|
||||
#define H308_THREAD_PRIORITY (8)
|
||||
#define H308_THREAD_PRIORITY (7)
|
||||
#define H308_THREAD_TIMESLICE (5)
|
||||
|
||||
typedef enum
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
* @Author : stark1898y 1658608470@qq.com
|
||||
* @Date : 2024-09-13 13:11:09
|
||||
* @LastEditors : stark1898y 1658608470@qq.com
|
||||
* @LastEditTime : 2024-09-24 11:21:59
|
||||
* @FilePath : \JT-DT-YD4N02A_RTT_MRS-4G\bsp\inc\bsp_vin_detection.h
|
||||
* @LastEditTime : 2025-01-23 16:17:44
|
||||
* @FilePath : \JT-DT-YD4N02A_4G_RTT_MRS\bsp\inc\bsp_vin_detection.h
|
||||
* @Description :
|
||||
*
|
||||
* Copyright (c) 2024 by yzy, All Rights Reserved.
|
||||
|
@ -13,9 +13,9 @@
|
|||
|
||||
#include "board.h"
|
||||
|
||||
#if 0
|
||||
#if 1
|
||||
#define VIN_THREAD_STACK_SIZE (1024)
|
||||
#define VIN_THREAD_PRIORITY (1)
|
||||
#define VIN_THREAD_PRIORITY (5)
|
||||
#define VIN_THREAD_TIMESLICE (5)
|
||||
#endif
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
#include "board.h"
|
||||
|
||||
#define WDG_THREAD_STACK_SIZE (1024U)
|
||||
#define WDG_THREAD_PRIORITY 30
|
||||
#define WDG_THREAD_PRIORITY 29
|
||||
#define WDG_THREAD_TIMESLICE 5
|
||||
|
||||
// 暂时只写了IWDG的
|
||||
|
|
|
@ -346,7 +346,7 @@ static void h308_thread_entry(void *param)
|
|||
else if (ret == -RT_ETIMEOUT) // 这个主要是考虑传感器未焊接好,或者脱落的情况,国标要求30s内反应 3*5 = 15s,符合国标
|
||||
{
|
||||
h308_rx_timout_cnt++;
|
||||
if (h308_rx_timout_cnt >= 5)
|
||||
if (h308_rx_timout_cnt >= 6)
|
||||
{
|
||||
H308_RST_ON;
|
||||
rt_thread_mdelay(100);
|
||||
|
|
|
@ -37,6 +37,7 @@ static void BSP_Led_thread_entry(void *param)
|
|||
rt_thread_mdelay(1000);
|
||||
}
|
||||
}
|
||||
|
||||
int BSP_LED_Init(void)
|
||||
{
|
||||
led_r = agile_led_create(LED_R_PIN, PIN_HIGH, "100,0", 0);
|
||||
|
|
|
@ -21,23 +21,22 @@
|
|||
#define LOG_LVL LOG_LVL_DBG // 该模块对应的日志输出级别。不定义时,默认:调试级别
|
||||
#include <ulog.h> // 必须在 LOG_TAG 与 LOG_LVL 下面
|
||||
|
||||
#if 0
|
||||
static rt_sem_t sem_vin;
|
||||
#if 1
|
||||
// static rt_sem_t sem_vin;
|
||||
|
||||
ALIGN(RT_ALIGN_SIZE)
|
||||
static char vin_thread_stack[VIN_THREAD_STACK_SIZE];
|
||||
static struct rt_thread vin_thread;
|
||||
#endif
|
||||
|
||||
|
||||
float Get_VIN_Voltage(void)
|
||||
{
|
||||
float vin_voltage = Get_ADC_Voltage(kVinAdc) * VIN_VOLTAGE_RATIO;
|
||||
|
||||
// int16_t voltage = vin_voltage * 1000;
|
||||
// int16_t voltage = vin_voltage * 1000;
|
||||
|
||||
// LOG_D("Get_VIN_Voltage(V): %d.%d%d%d\r\n", (voltage / 1000), ((voltage % 1000) / 100),
|
||||
// ((voltage % 100) / 10), (voltage % 10));
|
||||
// LOG_D("Get_VIN_Voltage(V): %d.%d%d%d\r\n", (voltage / 1000), ((voltage % 1000) / 100),
|
||||
// ((voltage % 100) / 10), (voltage % 10));
|
||||
|
||||
return vin_voltage;
|
||||
}
|
||||
|
@ -49,20 +48,31 @@ uint16_t Get_VIN_VoltageInt1000x(void)
|
|||
{
|
||||
uint16_t voltage = (Get_ADC_Average(kVinAdc) * 3.3 / 4096) * VIN_VOLTAGE_RATIO * 1000;
|
||||
|
||||
LOG_D("Get_VIN_VoltageInt1000x = %04d", voltage);
|
||||
// LOG_D("Get_VIN_VoltageInt1000x = %04d", voltage);
|
||||
return voltage;
|
||||
}
|
||||
#ifdef FINSH_USING_MSH
|
||||
// MSH_CMD_EXPORT(Get_VIN_VoltageInt1000x, "Get_VIN_VoltageInt1000x");
|
||||
#endif // !FINSH_USING_MSH
|
||||
|
||||
#if 0
|
||||
#if 1
|
||||
static void vin_thread_entry(void *param)
|
||||
{
|
||||
while (1)
|
||||
{
|
||||
rt_sem_take(sem_vin, RT_WAITING_FOREVER);
|
||||
// rt_sem_take(sem_vin, RT_WAITING_FOREVER);
|
||||
// 写入掉电记录
|
||||
if (Get_VIN_VoltageInt1000x() <= 10000)
|
||||
{
|
||||
if (SysControl.status != kPowerDownEvent)
|
||||
{
|
||||
LOG_D("电压低于10V");
|
||||
Send_Laser_Alarm_Event(kPowerDownEvent);
|
||||
}
|
||||
}
|
||||
rt_thread_mdelay(50);
|
||||
|
||||
#if 0
|
||||
Flash_Write_Record(kRecordPowerDown);
|
||||
LOG_D("Enter AnalogWatchdog Interrupt");
|
||||
|
||||
|
@ -78,35 +88,38 @@ static void vin_thread_entry(void *param)
|
|||
}
|
||||
// 还是没断电的话就重启
|
||||
NVIC_SystemReset();
|
||||
#endif
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
int BSP_VIN_Detection_Init(void)
|
||||
{
|
||||
NVIC_InitTypeDef NVIC_InitStructure = {0};
|
||||
// NVIC_InitTypeDef NVIC_InitStructure = {0};
|
||||
|
||||
/* Higher Threshold: 14V, Lower Threshold: 10V */
|
||||
ADC_AnalogWatchdogThresholdsConfig(USED_ADC, VIN_ADC_HIGH_THRESHOLD, VIN_ADC_LOW_THRESHOLD);
|
||||
ADC_AnalogWatchdogSingleChannelConfig(USED_ADC, VIN_ADC_CHANNEL);
|
||||
ADC_AnalogWatchdogCmd(USED_ADC, ADC_AnalogWatchdog_SingleRegEnable);
|
||||
// rt_thread_mdelay(100);
|
||||
|
||||
NVIC_InitStructure.NVIC_IRQChannel = ADC1_2_IRQn;
|
||||
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0;
|
||||
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0;
|
||||
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
|
||||
NVIC_Init(&NVIC_InitStructure);
|
||||
// /* Higher Threshold: 14V, Lower Threshold: 10V */
|
||||
// ADC_AnalogWatchdogThresholdsConfig(USED_ADC, VIN_ADC_HIGH_THRESHOLD, VIN_ADC_LOW_THRESHOLD);
|
||||
// ADC_AnalogWatchdogSingleChannelConfig(USED_ADC, VIN_ADC_CHANNEL);
|
||||
// ADC_AnalogWatchdogCmd(USED_ADC, ADC_AnalogWatchdog_SingleRegEnable);
|
||||
|
||||
rt_thread_mdelay(50);
|
||||
// NVIC_InitStructure.NVIC_IRQChannel = ADC1_2_IRQn;
|
||||
// NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0;
|
||||
// NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0;
|
||||
// NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
|
||||
// NVIC_Init(&NVIC_InitStructure);
|
||||
|
||||
ADC_ITConfig(USED_ADC, ADC_IT_AWD, ENABLE);
|
||||
// rt_thread_mdelay(50);
|
||||
|
||||
#if 0
|
||||
sem_vin = rt_sem_create("sem_vin", 0, RT_IPC_FLAG_PRIO);
|
||||
if (sem_vin == RT_NULL)
|
||||
{
|
||||
LOG_E("create sem_vin fail");
|
||||
}
|
||||
// ADC_ITConfig(USED_ADC, ADC_IT_AWD, ENABLE);
|
||||
|
||||
#if 1
|
||||
// sem_vin = rt_sem_create("sem_vin", 0, RT_IPC_FLAG_PRIO);
|
||||
// if (sem_vin == RT_NULL)
|
||||
// {
|
||||
// LOG_E("create sem_vin fail");
|
||||
// }
|
||||
|
||||
rt_thread_init(&vin_thread,
|
||||
"vin_thread",
|
||||
|
@ -121,10 +134,11 @@ int BSP_VIN_Detection_Init(void)
|
|||
|
||||
return RT_EOK;
|
||||
}
|
||||
#ifdef RT_USING_COMPONENTS_INIT
|
||||
// #ifdef RT_USING_COMPONENTS_INIT
|
||||
// INIT_APP_EXPORT(BSP_VIN_Detection_Init);
|
||||
#endif
|
||||
// #endif
|
||||
|
||||
#if 0
|
||||
void ADC1_2_IRQHandler(void) __attribute__((interrupt()));
|
||||
void ADC1_2_IRQHandler(void)
|
||||
{
|
||||
|
@ -132,19 +146,18 @@ void ADC1_2_IRQHandler(void)
|
|||
/* enter interrupt */
|
||||
rt_interrupt_enter();
|
||||
|
||||
if(ADC_GetITStatus(ADC1, ADC_IT_AWD))
|
||||
if (ADC_GetITStatus(ADC1, ADC_IT_AWD))
|
||||
{
|
||||
ADC_ClearITPendingBit(ADC1, ADC_IT_AWD);
|
||||
|
||||
// ADC_ITConfig(USED_ADC, ADC_IT_AWD, DISABLE);
|
||||
LOG_D("Enter AnalogWatchdog Interrupt");
|
||||
Send_Laser_Alarm_Event(kPowerDownEvent);
|
||||
|
||||
ADC_ITConfig(USED_ADC, ADC_IT_AWD, DISABLE);
|
||||
}
|
||||
|
||||
/* leave interrupt */
|
||||
rt_interrupt_leave();
|
||||
FREE_INT_SP();
|
||||
}
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
|
|
@ -532,7 +532,6 @@ int rt_hw_usart_init(void)
|
|||
continue;
|
||||
}
|
||||
|
||||
|
||||
/* register UART device */
|
||||
result = rt_hw_serial_register(&uart_obj[i].serial, uart_obj[i].config->name,
|
||||
RT_DEVICE_FLAG_RDWR
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
* @Author : stark1898y 1658608470@qq.com
|
||||
* @Date : 2024-07-19 13:49:43
|
||||
* @LastEditors : stark1898y 1658608470@qq.com
|
||||
* @LastEditTime : 2024-09-19 14:25:52
|
||||
* @FilePath : \JT-DT-YD4N02A_RTT_MRS-4G\rt-thread\rtconfig.h
|
||||
* @LastEditTime : 2025-01-23 16:25:55
|
||||
* @FilePath : \JT-DT-YD4N02A_4G_RTT_MRS\rt-thread\rtconfig.h
|
||||
* @Description :
|
||||
*
|
||||
* Copyright (c) 2024 by yzy, All Rights Reserved.
|
||||
|
@ -15,7 +15,7 @@
|
|||
|
||||
/*使用动态日志及密码功能时,需开启宏 FINSH_USING_AUTH ULOG_USING_FILTER ENABLE_LOG_ALL ULOG_OUTPUT_LVL = 7 以及设置ulog.c 1522行 输出等级为0*/
|
||||
/**/
|
||||
// #define FINSH_USING_AUTH //开启终端密码登录功能
|
||||
#define FINSH_USING_AUTH //开启终端密码登录功能
|
||||
// #define ULOG_USING_FILTER //开启动态修改日志等级 默认修改在ulog.c 1522行
|
||||
|
||||
#define ENABLE_LOG_ALL
|
||||
|
@ -23,6 +23,11 @@
|
|||
#define ULOG_OUTPUT_LVL 7 // 生产时将其设为0
|
||||
#define IOT_MODULE_SWITCH 1 //开启物联网功能
|
||||
|
||||
// #ifdef FINSH_USING_AUTH
|
||||
// #define AT_USING_CLI
|
||||
// #define AT_PRINT_RAW_CMD
|
||||
// #endif
|
||||
|
||||
/* RT-Thread Kernel */
|
||||
|
||||
#define RT_NAME_MAX 16
|
||||
|
@ -37,8 +42,6 @@
|
|||
#define RT_USING_IDLE_HOOK
|
||||
|
||||
|
||||
|
||||
|
||||
#define RT_IDLE_HOOK_LIST_SIZE 4
|
||||
#define IDLE_THREAD_STACK_SIZE 512
|
||||
|
||||
|
@ -156,10 +159,7 @@
|
|||
#define AT_USING_CLIENT
|
||||
#define AT_CLIENT_NUM_MAX 1
|
||||
|
||||
// #ifdef FINSH_USING_AUTH
|
||||
#define AT_USING_CLI
|
||||
#define AT_PRINT_RAW_CMD
|
||||
// #endif
|
||||
|
||||
|
||||
#define AT_CMD_MAX_LEN 256
|
||||
#define AT_SW_VERSION_NUM 0x10301
|
||||
|
|
Loading…
Reference in New Issue