diff --git a/CHANGELOG b/CHANGELOG index ba103fc..0c5f0cb 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,15 @@ +---------------------------------------------------------------------------- +2020-12-09 V1.42 +1.DAP固件升级到V1.04版本 + -增加离线版RTT Viewer功能(无需PC机) + -增加离线串口监视功能(无需PC机) +2.APP固件修正bsp_InitHardTimer()函数的bug(运行时间us数错误) +3.00联机界面去掉端口号显示 + +---------------------------------------------------------------------------- +2020-12-06 V1.41b +1.DAP固件升级到V1.03版本,解决低电流板子调试异常问题 + ---------------------------------------------------------------------------- 2020-12-04 V1.41 1.lua接口增加LCD显示函数,可以构建图形元素. 新增文件 lua_if_disp.c diff --git a/Project/MDK-ARM(uV5)/project.uvoptx b/Project/MDK-ARM(uV5)/project.uvoptx index 02738f3..872bc62 100755 --- a/Project/MDK-ARM(uV5)/project.uvoptx +++ b/Project/MDK-ARM(uV5)/project.uvoptx @@ -185,6 +185,11 @@ 1 s_DS18B20_TempReg + + 5 + 1 + g_uiTimeHighWord + @@ -208,7 +213,7 @@ 0 1 - 0 + 1 0 0 0 @@ -244,6 +249,12 @@ + + + System Viewer\TIM2 + 35905 + + 1 0 @@ -552,7 +563,7 @@ BSP - 1 + 0 0 0 0 @@ -1016,7 +1027,7 @@ MDK-ARM - 1 + 0 0 0 0 @@ -1708,7 +1719,7 @@ Doc - 1 + 0 0 0 0 @@ -2820,7 +2831,7 @@ Programmer - 0 + 1 0 0 0 diff --git a/Project/MDK-ARM(uV5)/startup_stm32h743xx.s b/Project/MDK-ARM(uV5)/startup_stm32h743xx.s index 524c7a2..b1d161d 100755 --- a/Project/MDK-ARM(uV5)/startup_stm32h743xx.s +++ b/Project/MDK-ARM(uV5)/startup_stm32h743xx.s @@ -68,7 +68,7 @@ __Vectors DCD __initial_sp ; Top of Stack DCD MemManage_Handler ; MPU Fault Handler DCD BusFault_Handler ; Bus Fault Handler DCD UsageFault_Handler ; Usage Fault Handler - DCD 0x00000141 ; Reserved H7-TOOL APP 固件版本 + DCD 0x00000142 ; Reserved H7-TOOL APP 固件版本 DCD 0 ; Reserved 固件小版本 DCD 0 ; Reserved DCD 0 ; Reserved diff --git a/Project/dap.bin b/Project/dap.bin index be1f0e4..2bb6ae5 100644 Binary files a/Project/dap.bin and b/Project/dap.bin differ diff --git a/Project/h7_tool_app(V1.41a).bin b/Project/h7_tool_app(V1.42).bin similarity index 78% rename from Project/h7_tool_app(V1.41a).bin rename to Project/h7_tool_app(V1.42).bin index dc2afea..78ca482 100644 Binary files a/Project/h7_tool_app(V1.41a).bin and b/Project/h7_tool_app(V1.42).bin differ diff --git a/User/app/inc/modify_param.h b/User/app/inc/modify_param.h index 5b41322..0a59d9d 100644 --- a/User/app/inc/modify_param.h +++ b/User/app/inc/modify_param.h @@ -21,6 +21,7 @@ enum MODIFY_PARAM_SYSTEM, /* 系统参数 */ MODIFY_PARAM_NET, /* 网络参数 */ MODIFY_PARAM_PROG, /* 脱机烧录器参数 */ + MODIFY_PARAM_DAPLINK, /* DAP-LINK参数 */ }; /* 参数列表结构 */ diff --git a/User/app/src/modify_param.c b/User/app/src/modify_param.c index 7b73859..3d14c13 100644 --- a/User/app/src/modify_param.c +++ b/User/app/src/modify_param.c @@ -94,18 +94,33 @@ const PARAM_LIST_T NetParamList[NET_PARAM_COUNT] = { 0, "端口号: ", 0, 1024, 65535, 30010}, }; - /****** 烧录参数 ******************************************************************************/ #define PROG_PARAM_COUNT 4 const char *ProgParam0[] = {"关闭", "1路", "1-2路", "1-3路", "1-4路"}; -//const char *ProgParam1[] = {"缺省", "单路烧录", "多路烧录", "DAP-Link"}; + const PARAM_LIST_T ProgParamList[PROG_PARAM_COUNT] = { /* 数据类型, 名称 可选列表, 最小值, 最大值, 缺省值 */ { 0, "多路模式: ", ProgParam0, 0, 4, 4}, { 0, "工厂代码: ", 0, 0, 999, 0}, { 0, "烧录器编号: ", 0, 0, 999, 0}, - { 0, "开机启动: ", SysBaseParam3, 0, 3, 0}, + { 0, "开机启动: ", SysBaseParam3, 0, 3, 0}, +}; + +/****** DAP-Link参数 ******************************************************************************/ +#define DAP_PARAM_COUNT 4 +const char *DapParam1[] = {"关闭", "1.2V", "1.5V", "1.8V", "2.0V", "2.5V", "2.8V", "3.0V", + "3.3V", "3.6V", "4.2V", "4.5V", "4.8V", "5.0V"}; +const char *DapParam2[] = {"关闭", "开启"}; +const char *DapParam3[] = {"缺省", "单路烧录", "多路烧录", "DAP-Link"}; + +const PARAM_LIST_T DapParamList[DAP_PARAM_COUNT] = +{ + /* 数据类型, 名称 可选列表, 最小值, 最大值, 缺省值 */ + { 0, "TVCC电压: ", DapParam1, 0, 13, 0}, + { 0, "蜂鸣使能: ", DapParam2, 0, 1, 1}, + { 0, "开机启动: ", DapParam3, 0, 3, 0}, + { 0, "DAP 编号: ", 0, 1, 99, 1}, }; /* @@ -333,7 +348,12 @@ void UartMonInitParam(uint16_t _ParamID) { s_pParamList = NetParamList; s_ParamCount = NET_PARAM_COUNT; - } + } + else if (_ParamID == MODIFY_PARAM_DAPLINK) + { + s_pParamList = DapParamList; + s_ParamCount = DAP_PARAM_COUNT; + } } /* @@ -387,7 +407,14 @@ static int32_t MonDispReadParam(uint8_t _index) else if (_index == 1) value = g_tParam.FactoryId; else if (_index == 2) value = g_tParam.ToolSn; else if (_index == 3) value = g_tParam.StartRun; - } + } + else if (s_pParamList == DapParamList) + { + if (_index == 0) value = g_tParam.DAP_TVCCVolt; + else if (_index == 1) value = g_tParam.DAP_BeepEn; + else if (_index == 2) value = g_tParam.StartRun; + else if (_index == 3) value = g_tParam.DAP_Sn; + } return value; } @@ -442,6 +469,13 @@ static void MonDispWriteParam(uint8_t _index, int32_t _value) else if (_index == 2) g_tParam.ToolSn = _value; else if (_index == 3) g_tParam.StartRun = _value; } + else if (s_pParamList == DapParamList) + { + if (_index == 0) g_tParam.DAP_TVCCVolt = _value; + else if (_index == 1) g_tParam.DAP_BeepEn = _value; + else if (_index == 2) g_tParam.StartRun = _value; + else if (_index == 3) g_tParam.DAP_Sn = _value; + } } /* diff --git a/User/app/src/status_link_mode.c b/User/app/src/status_link_mode.c index 348f9a2..288fb42 100755 --- a/User/app/src/status_link_mode.c +++ b/User/app/src/status_link_mode.c @@ -25,11 +25,11 @@ #define TIME_X 120 - (5 * 16 / 2) #define TIME_Y DATE_Y + 30 -#define RJ45_IP_X 5 -#define RJ45_IP_Y TIME_Y + 60 +#define RJ45_IP_X (240 - 20 * 8) +#define RJ45_IP_Y TIME_Y + 90 -#define WIFI_IP_X 5 -#define WIFI_IP_Y RJ45_IP_Y + 20 +#define WIFI_IP_X RJ45_IP_X +#define WIFI_IP_Y RJ45_IP_Y + 18 #define UDP_PORT_X 5 #define UDP_PORT_Y WIFI_IP_Y + 20 @@ -164,21 +164,21 @@ static void DispLinkStatus(void) /* 设置字体参数 */ { tFont.FontCode = FC_ST_16; /* 字体代码 16点阵 */ - tFont.FrontColor = INFO_NAME_COLOR; /* 字体颜色 */ + tFont.FrontColor = HELP_TEXT_COLOR; /* 字体颜色 */ tFont.BackColor = INFO_BACK_COLOR; /* 文字背景颜色 */ tFont.Space = 0; /* 文字间距,单位 = 像素 */ } - sprintf(buf, "RJ45 IP:%d.%d.%d.%d", g_tParam.LocalIPAddr[0], g_tParam.LocalIPAddr[1], + sprintf(buf, "RJ45 %d.%d.%d.%d", g_tParam.LocalIPAddr[0], g_tParam.LocalIPAddr[1], g_tParam.LocalIPAddr[2], g_tParam.LocalIPAddr[3]); LCD_DispStr(RJ45_IP_X, RJ45_IP_Y, buf, &tFont); - sprintf(buf, "WiFi IP:%d.%d.%d.%d", g_tParam.WiFiIPAddr[0], g_tParam.WiFiIPAddr[1], + sprintf(buf, "WiFi %d.%d.%d.%d", g_tParam.WiFiIPAddr[0], g_tParam.WiFiIPAddr[1], g_tParam.WiFiIPAddr[2], g_tParam.WiFiIPAddr[3]); LCD_DispStr(WIFI_IP_X, WIFI_IP_Y, buf, &tFont); - sprintf(buf, "端口号:%d", g_tParam.LocalTCPPort); - LCD_DispStr(UDP_PORT_X, UDP_PORT_Y, buf, &tFont); +// sprintf(buf, "端口号:%d", g_tParam.LocalTCPPort); +// LCD_DispStr(UDP_PORT_X, UDP_PORT_Y, buf, &tFont); /* 显示APP版本 */ tFont.FrontColor = HELP_TEXT_COLOR; diff --git a/User/bsp/src/bsp_timer.c b/User/bsp/src/bsp_timer.c index 83615f5..2e31ee8 100755 --- a/User/bsp/src/bsp_timer.c +++ b/User/bsp/src/bsp_timer.c @@ -3,8 +3,8 @@ * * 模块名称 : 定时器模块 * 文件名称 : bsp_timer.c -* 版 本 : V1.5 -* 说 明 : 配置systick定时器作为系统滴答定时器。缺省定时周期为1ms。 +* 版 本 : V1.7 +* 说 明 : 配置systik定时器作为系统滴答定时器。缺省定时周期为1ms。 * * 实现了多个软件定时器供主程序使用(精度1ms), 可以通过修改 TMR_COUNT 增减定时器个数 * 实现了ms级别延迟函数(精度1ms) 和us级延迟函数 @@ -19,7 +19,9 @@ * V1.4 2015-05-22 armfly 完善 bsp_InitHardTimer() ,增加条件编译选择TIM2-5 * V1.5 2018-11-26 armfly s_tTmr赋初值0; 增加g_ucEnableSystickISR变量避免HAL提前打开systick中断 * 引起的异常。 -* V1.6 2020-02-19 armfly g_iRunTime 运行时间改用 TIMx->CNT 实现,避免1ms中断丢失导致时长不准 +* V1.6 2020-11-19 armfly g_iRunTime 运行时间改用 TIMx->CNT 实现,避免1ms中断丢失导致时长不准 +* V1.7 2020-12-09 armfly 增加bsp_GetRunTimeUs(),bsp_CheckRunTime() +* * Copyright (C), 2015-2030, 安富莱电子 www.armfly.com * ********************************************************************************************************* @@ -37,6 +39,7 @@ #ifdef USE_TIM2 #define TIM_HARD TIM2 #define RCC_TIM_HARD_CLK_ENABLE() __HAL_RCC_TIM2_CLK_ENABLE() +#define RCC_TIM_HARD_CLK_DISABLE() __HAL_RCC_TIM2_CLK_DISABLE() #define TIM_HARD_IRQn TIM2_IRQn #define TIM_HARD_IRQHandler TIM2_IRQHandler #endif @@ -421,7 +424,9 @@ int32_t bsp_GetRunTime(void) uint64_t tus; int32_t ms; - tus = (bsp_GetRunTimeUs() / 1000) & 0x7FFFFFFF; /* 取低4字节 */ + tus = bsp_GetRunTimeUs(); + + tus = (tus / 1000) & 0x7FFFFFFF; /* 取低4字节 */ ms = tus; return ms; @@ -441,7 +446,8 @@ int32_t bsp_CheckRunTime(int32_t _LastTime) int32_t now_time; int32_t time_diff; - tus = bsp_GetRunTimeUs() / 1000; + tus = bsp_GetRunTimeUs(); + tus = tus / 1000; now_time = tus & 0x7FFFFFFF; /* 取低4字节 */ @@ -529,7 +535,7 @@ int64_t bsp_CheckRunTimeUs(int64_t _LastTime) /* ********************************************************************************************************* * 函 数 名: bsp_DelayNS -* 功能说明: us级延迟。 必须在systick定时器启动后才能调用此函数。 +* 功能说明: ns级延迟。 必须在systick定时器启动后才能调用此函数。 * 形 参: n : 延迟长度,单位NS * 返 回 值: 无 ********************************************************************************************************* @@ -618,7 +624,9 @@ void bsp_InitHardTimer(void) uint32_t usPeriod; uint16_t usPrescaler; uint32_t uiTIMxCLK; - TIM_TypeDef* TIMx = TIM_HARD; + TIM_TypeDef* TIMx = TIM_HARD; + + RCC_TIM_HARD_CLK_DISABLE(); /* 禁止TIM时钟 */ RCC_TIM_HARD_CLK_ENABLE(); /* 使能TIM时钟 */ @@ -678,13 +686,19 @@ void bsp_InitHardTimer(void) TimHandle.Init.ClockDivision = 0; TimHandle.Init.CounterMode = TIM_COUNTERMODE_UP; TimHandle.Init.RepetitionCounter = 0; - TimHandle.Init.AutoReloadPreload = TIM_AUTORELOAD_PRELOAD_ENABLE; - + TimHandle.Init.AutoReloadPreload = TIM_AUTORELOAD_PRELOAD_ENABLE; if (HAL_TIM_Base_Init(&TimHandle) != HAL_OK) { Error_Handler(__FILE__, __LINE__); } + /* 必须先清除这些标志,再使能中断 */ + TIMx->SR = (uint16_t)~TIM_IT_UPDATE; /* 清除UPDATE中断标志 */ + TIMx->SR = (uint16_t)~TIM_IT_CC1; /* 清除CC1中断标志 */ + TIMx->SR = (uint16_t)~TIM_IT_CC2; /* 清除CC2中断标志 */ + TIMx->SR = (uint16_t)~TIM_IT_CC3; /* 清除CC3中断标志 */ + TIMx->SR = (uint16_t)~TIM_IT_CC4; /* 清除CC4中断标志 */ + /* 配置定时器中断,给CC捕获比较中断使用 */ { HAL_NVIC_SetPriority(TIM_HARD_IRQn, 0, 2); @@ -694,9 +708,7 @@ void bsp_InitHardTimer(void) /* 启动定时器 */ HAL_TIM_Base_Start(&TimHandle); - /* 启动溢出中断,用于运行时间计数, us单位 */ - TIMx->SR = (uint16_t)~TIM_IT_UPDATE; /* 清除UPDATE中断标志 */ - TIMx->DIER |= TIM_IT_UPDATE; /* 使能UPDATE中断 */ + TIMx->DIER |= TIM_IT_UPDATE; /* 使能UPDATE中断 */ } /* @@ -776,7 +788,7 @@ void TIM_HARD_IRQHandler(void) timesr = TIMx->SR; - /* 溢出中断,用于CPU运行时间计算. 65.535ms进入一次 */ + /* 溢出中断,用于CPU运行时间计算. */ if (timesr & TIM_IT_UPDATE) { TIMx->SR = (uint16_t)~TIM_IT_UPDATE; diff --git a/User/bsp/src/bsp_uart_fifo.c b/User/bsp/src/bsp_uart_fifo.c index 9239a4b..ef88814 100755 --- a/User/bsp/src/bsp_uart_fifo.c +++ b/User/bsp/src/bsp_uart_fifo.c @@ -1779,5 +1779,12 @@ void UART8_IRQHandler(void) UartIRQ(&g_tUart8); } #endif + +int stdout_putchar (int ch) +{ + (void)ch; + + return ch; +} /***************************** 安富莱电子 www.armfly.com (END OF FILE) *********************************/