没关log,有密码

This commit is contained in:
stark1898y 2025-01-23 16:29:51 +08:00
parent 867e3a21a7
commit 41f7ff50a8
18 changed files with 164 additions and 137 deletions

View File

@ -648,4 +648,4 @@
</storageModule>
<storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
<storageModule moduleId="org.eclipse.cdt.make.core.buildtargets"/>
</cproject>
</cproject>

View File

@ -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
},

View File

@ -31,4 +31,4 @@
</matcher>
</filter>
</filteredResources>
</projectDescription>
</projectDescription>

View File

@ -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

View File

@ -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 &quot;${eclipse_home}toolchain/OpenOCD/bin/wch-riscv.cfg&quot;" />
<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&#xD;&#xA;set architecture riscv:rv32&#xD;&#xA;set remotetimeout unlimited&#xD;&#xA;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="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;\r\n&lt;memoryBlockExpressionList context=&quot;Context string&quot;/&gt;\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 &quot;${eclipse_home}toolchain/OpenOCD/bin/wch-riscv.cfg&quot;"/>
<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&#xD;&#xA;set architecture riscv:rv32&#xD;&#xA;set remotetimeout unlimited&#xD;&#xA;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="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?>\r\n&lt;memoryBlockExpressionList context=&quot;Context string&quot;/>\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>
</launchConfiguration>

View File

@ -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": [

View File

@ -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();
}
}
}

View File

@ -253,9 +253,9 @@ rt_uint32_t IMEI_Delay(void)
int BSP_SYS_Init(void)
{
BSP_WDG_Init();
BSP_RTC_Init();
BSP_Rng_Init();
BSP_LED_Init();
@ -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);

View File

@ -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)
@ -35,7 +37,7 @@
do { \
rt_kprintf("Compiled on: %s at %s\n", __DATE__, __TIME__); \
} while (0)
typedef enum
{
kPowerOnEvent,

View File

@ -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

View File

@ -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

View File

@ -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的

View File

@ -37,7 +37,7 @@ static rt_sem_t uart4_rx_ok_sem;
static struct rt_timer uart4_rx_timer;
uint8_t sensor_rx_flag = 0; // 接收缓冲区中已经收到的数据包数量static rt_uint8_t alarm_flag = 0, fault_flag = 0;
static rt_uint8_t alarm_flag = 0, fault_flag = 0;
static rt_uint8_t alarm_flag = 0, fault_flag = 0;
TsH308 H308 = {0};
void _UART4_RxTimeout(void *parameter)
@ -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);
@ -415,7 +415,7 @@ void UART4_IRQHandler(void)
{
sensor_rx_flag = 1;
rt_timer_start(&uart4_rx_timer);
}
}
}
rt_interrupt_leave();

View File

@ -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);

View File

@ -817,12 +817,12 @@ int Nt26k_Process_Events(Nt26kEvent nt26k_recv_event, struct at_device *device,
return RT_EOK;
}
}
if (rt_strcmp(event->event_name, "掉电事件") == RT_EOK)
if (rt_strcmp(event->event_name, "掉电事件") == RT_EOK)
{
rt_uint8_t cnt = 0;
while ((device_power_down_flag == 0)&&(cnt < 10))
{
rt_thread_mdelay(500);
rt_thread_mdelay(500);
}
if (device->class->device_ops->control(device, AT_DEVICE_CTRL_POWER_OFF, RT_NULL) == RT_EOK)
{
@ -830,7 +830,7 @@ int Nt26k_Process_Events(Nt26kEvent nt26k_recv_event, struct at_device *device,
nt26k_power_down_flag = 1;
return RT_EOK;
}
}
}
}
}
else
@ -1504,7 +1504,7 @@ static void Nt26k_Life_Thread_Entry(void *parameter)
{
device->class->device_ops->control(device, AT_DEVICE_RF_CLOSE, RT_NULL);
result = -RT_ETIMEOUT;
goto __exit;
}
at_delete_resp(resp);
@ -1521,7 +1521,7 @@ static void Nt26k_Life_Thread_Entry(void *parameter)
{
nt26k_disconnect_retry_flag = 1;
LOG_D("重连网络失败,等待%d s后重连\n",delay_n * 5);
rt_thread_mdelay(delay_n * 5000);
delay_n++;
if (delay_n >= 66)//大于3小时的重连都不行则重启设备
@ -1531,7 +1531,7 @@ static void Nt26k_Life_Thread_Entry(void *parameter)
reboot();
}
rt_sem_release(nt26k_disconnect_sem);
}
}
}
@ -1549,7 +1549,7 @@ int BSP_Nt26k_Thread_Init(void)
Nt26k_Event_Init();
rt_uint32_t iot_upload_time = (uint16_t)Flash_Get_SysCfg(kIotUploadCycleId);
rt_uint32_t timeout = 0;
if (iot_upload_time > 24 * 60 * 60 * RT_TICK_PER_SECOND)
{
timeout = 24 * 60 * 60 * RT_TICK_PER_SECOND;
@ -1559,7 +1559,7 @@ int BSP_Nt26k_Thread_Init(void)
{
timeout = iot_upload_time * 60 * RT_TICK_PER_SECOND;
}
LOG_I("上报服务器周期:%d分钟", iot_upload_time);
nt26k_mutex = rt_mutex_create("nt26k_mutex", RT_IPC_FLAG_PRIO);
if (nt26k_mutex == RT_NULL)

View File

@ -17,27 +17,26 @@
#include "user_sys.h"
#define LOG_TAG "bsp_vin_detection" // 该模块对应的标签。不定义时默认NO_TAG
#define LOG_LVL LOG_LVL_DBG // 该模块对应的日志输出级别。不定义时,默认:调试级别
#define LOG_TAG "bsp_vin_detection" // 该模块对应的标签。不定义时默认NO_TAG
#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

View File

@ -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

View File

@ -1,9 +1,9 @@
/*
* @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
* @LastEditors : stark1898y 1658608470@qq.com
* @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,11 +23,16 @@
#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
#define RT_ALIGN_SIZE 4
#define RT_THREAD_PRIORITY_32
#define RT_THREAD_PRIORITY_32
#define RT_THREAD_PRIORITY_MAX 32
#define RT_TICK_PER_SECOND 1000
@ -37,8 +42,6 @@
#define RT_USING_IDLE_HOOK
#define RT_IDLE_HOOK_LIST_SIZE 4
#define IDLE_THREAD_STACK_SIZE 512
@ -155,11 +158,8 @@
#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