From 33523335e2986c8e47309e6bb2050767c0179063 Mon Sep 17 00:00:00 2001 From: songyanguang <345810377@qq.com> Date: Mon, 12 May 2025 16:50:37 +0800 Subject: [PATCH] Modify app address, for AT cmd --- .../Framework/connection/4g/ec801e/ec801e.c | 15 +++++++++++++-- APP_Framework/Framework/connection/adapter.c | 2 +- .../Framework/connection/adapter_agent.c | 1 + APP_Framework/lib/mqtt/platform_mqtt.c | 2 +- .../XiZi_IIoT/board/ch32v208rbt6/.defconfig_boot | 5 +++++ .../board/ch32v208rbt6/link_application.ld | 2 +- .../board/ch32v208rbt6/link_bootloader.ld | 2 +- .../board/ch32v208rbt6/third_party_driver/Kconfig | 3 +++ .../third_party_driver/include/boot_for_ota.h | 2 +- .../ch32v208rbt6/third_party_driver/lte/Makefile | 4 +++- .../third_party_driver/uart/connect_uart.c | 2 +- 11 files changed, 31 insertions(+), 9 deletions(-) diff --git a/APP_Framework/Framework/connection/4g/ec801e/ec801e.c b/APP_Framework/Framework/connection/4g/ec801e/ec801e.c index afbd895a0..c777d3ce4 100644 --- a/APP_Framework/Framework/connection/4g/ec801e/ec801e.c +++ b/APP_Framework/Framework/connection/4g/ec801e/ec801e.c @@ -200,15 +200,26 @@ static int Ec801eConnect(struct Adapter *adapter, enum NetRoleType net_role, con int try = 0; uint8_t ec801e_cmd[64]; - ADAPTER_DEBUG("%s enter\n", __func__); + printf("%s enter\n", __func__); AtSetReplyEndChar(adapter->agent, 0x4F, 0x4B); /*step1: serial write "+++", quit transparent mode*/ PrivTaskDelay(1500); //before +++ command, wait at least 1s - ATOrderSend(adapter->agent, REPLY_TIME_OUT, NULL, "+++"); + ATOrderSend(adapter->agent, REPLY_TIME_OUT, NULL, EC801E_AT_MODE_CMD); PrivTaskDelay(1500); //after +++ command, wait at least 1s + for(try = 0; try < TRY_TIMES; try++){ + ret = AtCmdConfigAndCheck(adapter->agent, EC801E_ATI_CMD, EC801E_OK_REPLY); + if (ret == 0) { + break; + } + } + if (ret < 0) { + goto out; + } + PrivTaskDelay(300); + /*step2: serial write "AT+CPIN?", check SIM status*/ for(try = 0; try < TRY_TIMES; try++){ ret = AtCmdConfigAndCheck(adapter->agent, EC801E_GET_CPIN_CMD, EC801E_READY_REPLY); diff --git a/APP_Framework/Framework/connection/adapter.c b/APP_Framework/Framework/connection/adapter.c index 8b4d9ad59..c49a5ce5e 100644 --- a/APP_Framework/Framework/connection/adapter.c +++ b/APP_Framework/Framework/connection/adapter.c @@ -407,7 +407,7 @@ int AdapterDeviceConnect(struct Adapter *adapter, enum NetRoleType net_role, con if (NULL == ip_done->connect) return -1; - + printf("AdapterDeviceConnect to connect ip=%s port=%s\n", ip, port); return ip_done->connect(adapter, net_role, ip, port, ip_type); } else { printf("AdapterDeviceConnect net_protocol %d not support\n", adapter->net_protocol); diff --git a/APP_Framework/Framework/connection/adapter_agent.c b/APP_Framework/Framework/connection/adapter_agent.c index 4e2702d15..878137939 100755 --- a/APP_Framework/Framework/connection/adapter_agent.c +++ b/APP_Framework/Framework/connection/adapter_agent.c @@ -589,6 +589,7 @@ static void *ATAgentReceiveProcess(void *param) memset(reply->reply_buffer, 0, reply->reply_max_len); memcpy(reply->reply_buffer, agent->maintain_buffer, agent->maintain_len); reply->reply_len = agent->maintain_len; + printf("%s reply->reply_buffer=%s\n", __func__, reply->reply_buffer); } else { diff --git a/APP_Framework/lib/mqtt/platform_mqtt.c b/APP_Framework/lib/mqtt/platform_mqtt.c index 41fc624c0..7ded64209 100644 --- a/APP_Framework/lib/mqtt/platform_mqtt.c +++ b/APP_Framework/lib/mqtt/platform_mqtt.c @@ -74,8 +74,8 @@ out: if (ret < 0) { AdapterDeviceClose(adapter); + KPrintf("%s fail\n", __func__); } - KPrintf("%s fail\n", __func__); return ret; } diff --git a/Ubiquitous/XiZi_IIoT/board/ch32v208rbt6/.defconfig_boot b/Ubiquitous/XiZi_IIoT/board/ch32v208rbt6/.defconfig_boot index 72bbe113e..da2c92c42 100644 --- a/Ubiquitous/XiZi_IIoT/board/ch32v208rbt6/.defconfig_boot +++ b/Ubiquitous/XiZi_IIoT/board/ch32v208rbt6/.defconfig_boot @@ -22,6 +22,7 @@ CONFIG_BSP_USING_LTE=y CONFIG_LTE_BUS_NAME="lte" CONFIG_LTE_DRV_NAME="lte_drv" CONFIG_LTE_DEVICE_NAME_1="lte_dev1" +# CONFIG_LTE_TEST is not set # # Hardware feature @@ -101,6 +102,8 @@ CONFIG_KERNEL_CONSOLEBUF_SIZE=128 # Command shell # # CONFIG_TOOL_SHELL is not set +# CONFIG_SHELL_ENTER_CR_AND_LF is not set +# CONFIG_SHELL_ENTER_CRLF is not set # # Kernel data structure Manage @@ -166,6 +169,8 @@ CONFIG_FS_VFS_DEVFS=y CONFIG_TOOL_USING_OTA=y CONFIG_MCUBOOT_BOOTLOADER=y # CONFIG_MCUBOOT_APPLICATION is not set +# CONFIG_OTA_BY_PLATFORM is not set +# CONFIG_OTA_BY_TCPSERVER is not set # # Flash area address and size configuration. diff --git a/Ubiquitous/XiZi_IIoT/board/ch32v208rbt6/link_application.ld b/Ubiquitous/XiZi_IIoT/board/ch32v208rbt6/link_application.ld index 2a03937ef..8071e4897 100644 --- a/Ubiquitous/XiZi_IIoT/board/ch32v208rbt6/link_application.ld +++ b/Ubiquitous/XiZi_IIoT/board/ch32v208rbt6/link_application.ld @@ -27,7 +27,7 @@ MEMORY FLASH-160K + RAM-32K */ /*FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 448K*/ - FLASH (rx) : ORIGIN = 0x0001c000, LENGTH = 364K + FLASH (rx) : ORIGIN = 0x00010000, LENGTH = 412K RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 64K } diff --git a/Ubiquitous/XiZi_IIoT/board/ch32v208rbt6/link_bootloader.ld b/Ubiquitous/XiZi_IIoT/board/ch32v208rbt6/link_bootloader.ld index 216f29a3f..9758c9ff8 100644 --- a/Ubiquitous/XiZi_IIoT/board/ch32v208rbt6/link_bootloader.ld +++ b/Ubiquitous/XiZi_IIoT/board/ch32v208rbt6/link_bootloader.ld @@ -26,7 +26,7 @@ MEMORY FLASH-144K + RAM-48K FLASH-160K + RAM-32K */ - FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 112K + FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 64K RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 64K } diff --git a/Ubiquitous/XiZi_IIoT/board/ch32v208rbt6/third_party_driver/Kconfig b/Ubiquitous/XiZi_IIoT/board/ch32v208rbt6/third_party_driver/Kconfig index 9d68ab25a..b81a76455 100644 --- a/Ubiquitous/XiZi_IIoT/board/ch32v208rbt6/third_party_driver/Kconfig +++ b/Ubiquitous/XiZi_IIoT/board/ch32v208rbt6/third_party_driver/Kconfig @@ -109,5 +109,8 @@ menuconfig BSP_USING_LTE config LTE_DEVICE_NAME_1 string "lte bus device 1 name" default "lte_dev1" + config LTE_TEST + bool "Enable lte test" + default y endif \ No newline at end of file diff --git a/Ubiquitous/XiZi_IIoT/board/ch32v208rbt6/third_party_driver/include/boot_for_ota.h b/Ubiquitous/XiZi_IIoT/board/ch32v208rbt6/third_party_driver/include/boot_for_ota.h index ce846e67a..83724a265 100644 --- a/Ubiquitous/XiZi_IIoT/board/ch32v208rbt6/third_party_driver/include/boot_for_ota.h +++ b/Ubiquitous/XiZi_IIoT/board/ch32v208rbt6/third_party_driver/include/boot_for_ota.h @@ -22,7 +22,7 @@ #define __BOOT_FOR_OTA_H__ #define IMAGE_IAP_START_ADD 0x08000000 -#define IMAGE_IAP_SIZE (112 * 1024) +#define IMAGE_IAP_SIZE (64 * 1024) #define IMAGE_A_START_ADD (IMAGE_IAP_START_ADD + IMAGE_IAP_SIZE) void mcuboot_bord_init(void); diff --git a/Ubiquitous/XiZi_IIoT/board/ch32v208rbt6/third_party_driver/lte/Makefile b/Ubiquitous/XiZi_IIoT/board/ch32v208rbt6/third_party_driver/lte/Makefile index 928cf6a4f..1cbdde10e 100644 --- a/Ubiquitous/XiZi_IIoT/board/ch32v208rbt6/third_party_driver/lte/Makefile +++ b/Ubiquitous/XiZi_IIoT/board/ch32v208rbt6/third_party_driver/lte/Makefile @@ -1,5 +1,7 @@ # SRC_FILES := connect_uart.c test_uart.c -SRC_DIR := test +ifeq ($(CONFIG_LTE_TEST),y) + SRC_DIR := test +endif SRC_FILES := connect_lte.c include $(KERNEL_ROOT)/compiler.mk diff --git a/Ubiquitous/XiZi_IIoT/board/ch32v208rbt6/third_party_driver/uart/connect_uart.c b/Ubiquitous/XiZi_IIoT/board/ch32v208rbt6/third_party_driver/uart/connect_uart.c index d34c308e6..347782908 100644 --- a/Ubiquitous/XiZi_IIoT/board/ch32v208rbt6/third_party_driver/uart/connect_uart.c +++ b/Ubiquitous/XiZi_IIoT/board/ch32v208rbt6/third_party_driver/uart/connect_uart.c @@ -221,7 +221,7 @@ static int SerialGetChar(struct SerialHardwareDevice *serial_dev) { if (RESET != USART_GetFlagStatus((USART_TypeDef *)serial_cfg->hw_cfg.serial_register_base, USART_FLAG_RXNE)) { ch = USART_ReceiveData((USART_TypeDef *)serial_cfg->hw_cfg.serial_register_base) & 0xff; } -#ifdef BSP_USING_LTE +#ifdef LTE_TEST #define TRANSPARENT_TRANSMISSION_MODE 0 // 数据透传模式 #define COMMAND_LINE_MODE 1 // 命令行模式 /* lte模式下,实现DBG串口和MAIN串口的数据转发 */