ppp默认打印等级info,降级一些打印,
author孙春阳 <snickersun@163.com>
Thu, 18 Sep 2025 06:23:02 +0000 (14:23 +0800)
committer孙春阳 <snickersun@163.com>
Thu, 18 Sep 2025 06:23:02 +0000 (14:23 +0800)
code/sdk/zhihui/ppp/include/ppp_config.h
code/sdk/zhihui/ppp/include/ppp_power_ctl.h
code/sdk/zhihui/ppp/src/ppp_api.c
code/sdk/zhihui/ppp/src/ppp_at_handler.c
code/sdk/zhihui/ppp/src/ppp_lwip.c
code/sdk/zhihui/ppp/src/ppp_lwip_thread.c
code/sdk/zhihui/ppp/src/ppp_power_ctl.c
code/sdk/zhihui/ppp/src/ppp_serial.c

index 188bdb6..65730f1 100644 (file)
@@ -63,7 +63,7 @@ extern "C" {
 
 /* 调试配置 */
 #define PPP_DEBUG_ENABLE            1                   // 启用调试输出
-#define PPP_DEBUG_LEVEL             PPP_DEBUG_LEVEL_WARN // 默认只显示警告和错误 (1=ERROR, 2=WARN, 3=INFO, 4=DEBUG)
+#define PPP_DEBUG_LEVEL             PPP_DEBUG_LEVEL_INFO // 默认只显示警告和错误 (1=ERROR, 2=WARN, 3=INFO, 4=DEBUG)
 
 /*
  * 调试级别说明:
index 487bf0b..b00eff9 100644 (file)
@@ -47,21 +47,21 @@ void ppp_api_uart_init(void);
  * @param pwron 1-开启电源,0-关闭电源
  * @return 0-成功,其他-失败
  */
-uint32_t ppp_api_cat1_power_on(uint32_t pwron);
+uint32_t ppp_api_cat1_power_pin(uint32_t pwron);
 
 /**
  * @brief PPP模块设置复位引脚状态
  * @param pwron 1-复位,0-释放复位
  * @return 0-成功,其他-失败
  */
-uint32_t ppp_api_cat1_reset(uint32_t pwron);
+uint32_t ppp_api_cat1_reset_pin(uint32_t pwron);
 
 /**
  * @brief PPP模块设置电池引脚状态
  * @param pwron 1-开启电池,0-关闭电池
  * @return 0-成功,其他-失败
  */
-uint32_t ppp_api_cat1_bat_on(uint32_t pwron);
+uint32_t ppp_api_cat1_bat_pin(uint32_t pwron);
 
 /**
  * @brief PPP模块4G上电序列
@@ -73,6 +73,11 @@ void ppp_power_on_cat1(void);
  */
 void ppp_power_off_cat1(void);
 
+/**
+ * @brief PPP模块4G重置序列
+ */
+void ppp_power_reset_cat1(void);
+
 /**
  * @brief PPP模块检查4G是否使能
  * @return true-已使能,false-未使能
index 245be7a..a4130d2 100644 (file)
@@ -246,17 +246,16 @@ static void ppp_lwip_event_callback(const ppp_lwip_event_t *event, void *arg)
                               (lwip_info.local_ip >> 16) & 0xFF,
                               (lwip_info.local_ip >> 24) & 0xFF);
             } else {
-                PPP_DEBUG_INFO("PPP network info not immediately available, IPCP negotiation may still be in progress");
+                PPP_DEBUG_DEBUG("PPP network info not immediately available, IPCP negotiation may still be in progress");
                 
                 // 确保网络接口处于激活状态
                 struct netif *ppp_netif = ppp_lwip_get_netif();
                 if (ppp_netif) {
                     netif_set_up(ppp_netif);
                     netif_set_link_up(ppp_netif);
-                    PPP_DEBUG_INFO("Ensured netif is up, flags: 0x%02x", ppp_netif->flags);
-                    
+                    PPP_DEBUG_DEBUG("Ensured netif is up, flags: 0x%02x", ppp_netif->flags);
                     /* 启动异步检查任务 - 在后台检查IP地址分配 */
-                    PPP_DEBUG_INFO("Will rely on netif status callback for default interface setting");
+                    PPP_DEBUG_DEBUG("Will rely on netif status callback for default interface setting");
                 }
             }
             
@@ -315,8 +314,8 @@ errcode_t ppp_start_dial(void)
     }
 
     PPP_DEBUG_CRITICAL("PPP dial started successfully (async mode)");
-    PPP_DEBUG_INFO("Use AT^PPPSTATUS to check connection status");
-    PPP_DEBUG_INFO("Connection will be established in background");
+    PPP_DEBUG_DEBUG("Use AT^PPPSTATUS to check connection status");
+    PPP_DEBUG_DEBUG("Connection will be established in background");
 
     PPP_DEBUG_PRINT("Starting PPP dial sequence\n");
     ppp_error_t ret = PPP_ERR_OK;
@@ -417,7 +416,7 @@ errcode_t ppp_start_dial(void)
     g_ppp_state = PPP_STATE_CONNECTING;
     PPP_DEBUG_PRINT("PPP dial completed successfully - now in data mode\n");
     PPP_DEBUG_CRITICAL("PPP dial completed - now in data mode");
-    PPP_DEBUG_INFO("PPP negotiation will start automatically...");
+            PPP_DEBUG_DEBUG("PPP negotiation will start automatically...");
 
     return ERRCODE_SUCC;
 
@@ -582,9 +581,7 @@ errcode_t ppp_stop_dial(void)
     
     // 第二步:短暂断电复位(更温和的方式)
     PPP_DEBUG_INFO("Step 2: Brief power cycle...");
-    ppp_api_cat1_reset(1);
-    osal_msleep(500);  // 减少断电时间到1秒
-    ppp_api_cat1_reset(0);
+    ppp_power_reset_cat1();
     osal_msleep(5000);  // 等待2秒让调制解调器启动
     
     PPP_DEBUG_INFO("Gentle 4G modem reset completed - modem should be stable now");
@@ -646,20 +643,21 @@ errcode_t ppp_stop_dial(void)
         PPP_DEBUG_ERROR("AT communication failed after 5 attempts - modem may need manual intervention");
         // 不返回错误,继续执行,让上层决定如何处理
     }
-    
+    // reset方式 停止ppp,因此不必再发送AT挂断命令
+
     // 8. 发送AT挂断命令确保PPP连接完全断开
-    if (at_communication_ok) {
-        PPP_DEBUG_INFO("Sending AT hangup command to ensure PPP disconnection...");
-        ppp_error_t hangup_ret = ppp_at_hangup_ppp();
-        if (hangup_ret != PPP_ERR_OK) {
-            PPP_DEBUG_WARN("AT hangup command failed: %d", hangup_ret);
-            // 不作为致命错误,因为PPP可能已经通过其他方式断开
-        } else {
-            PPP_DEBUG_INFO("AT hangup command completed successfully");
-        }
-    } else {
-        PPP_DEBUG_WARN("Skipping AT hangup command due to communication issues");
-    }
+    // if (at_communication_ok) {
+    //     PPP_DEBUG_INFO("Sending AT hangup command to ensure PPP disconnection...");
+    //     ppp_error_t hangup_ret = ppp_at_hangup_ppp();
+    //     if (hangup_ret != PPP_ERR_OK) {
+    //         PPP_DEBUG_WARN("AT hangup command failed: %d", hangup_ret);
+    //         // 不作为致命错误,因为PPP可能已经通过其他方式断开
+    //     } else {
+    //         PPP_DEBUG_INFO("AT hangup command completed successfully");
+    //     }
+    // } else {
+    //     PPP_DEBUG_WARN("Skipping AT hangup command due to communication issues");
+    // }
     
     PPP_DEBUG_CRITICAL("=== PPP Stop Dial Completed ===");
     
index a11e2c4..d8877aa 100644 (file)
@@ -108,16 +108,14 @@ ppp_error_t ppp_at_baudrate_handshake(void)
     PPP_DEBUG_INFO("Starting baudrate handshake (prove 2000000 not working, then try auto handshake)");
 
     // 1. 先reset模组,证明2000000没有正常工作
-    PPP_DEBUG_INFO("Resetting module to prove 2000000 baudrate is not working...");
-    ppp_api_cat1_reset(1);
-    osal_msleep(50);
-    ppp_api_cat1_reset(0);
+    PPP_DEBUG_DEBUG("Resetting module to prove 2000000 baudrate is not working...");
+    ppp_power_reset_cat1();
     osal_msleep(5000);
 
     // 2. 依次尝试自动波特率列表
     for (int i = 0; i < PPP_BAUDRATE_AUTO_COUNT; i++) {
         uint32_t baudrate = g_auto_baudrates[i];
-        PPP_DEBUG_INFO("=== Trying Baudrate %u (index %d/%d) ===", baudrate, i + 1, PPP_BAUDRATE_AUTO_COUNT);
+        PPP_DEBUG_DEBUG("=== Trying Baudrate %u (index %d/%d) ===", baudrate, i + 1, PPP_BAUDRATE_AUTO_COUNT);
 
         // 配置串口波特率
         uart_attr_t uart_attr = {
@@ -130,7 +128,7 @@ ppp_error_t ppp_at_baudrate_handshake(void)
             PPP_DEBUG_WARN("Failed to set baudrate %u", baudrate);
             continue;
         }
-        PPP_DEBUG_INFO("UART configured for baudrate %u", baudrate);
+        PPP_DEBUG_DEBUG("UART configured for baudrate %u", baudrate);
 
         // 清空接收缓冲区
         PPP_DEBUG_DEBUG("Clearing UART RX buffer before AT test...");
@@ -146,7 +144,7 @@ ppp_error_t ppp_at_baudrate_handshake(void)
         // 3次重试AT
         ppp_error_t ret = PPP_ERR_AT_FAILED;
         for (int retry = 0; retry < 3; retry++) {
-            PPP_DEBUG_INFO("--- AT Test at %u baud, retry %d/3 ---", baudrate, retry + 1);
+            PPP_DEBUG_DEBUG("--- AT Test at %u baud, retry %d/3 ---", baudrate, retry + 1);
 
             // 再次清空缓冲区,防止上次残留
             while (uapi_uart_read(g_at_ctx.uart_bus, dummy_buffer, sizeof(dummy_buffer), 100) > 0) {}
@@ -160,7 +158,7 @@ ppp_error_t ppp_at_baudrate_handshake(void)
                 // 在当前波特率下,设置AT+IPR=2000000
                 char ipr_cmd[32];
                 snprintf_s(ipr_cmd, sizeof(ipr_cmd), sizeof(ipr_cmd) - 1, "AT+IPR=2000000");
-                PPP_DEBUG_INFO("Setting module baudrate to 2000000 with: %s", ipr_cmd);
+                PPP_DEBUG_DEBUG("Setting module baudrate to 2000000 with: %s", ipr_cmd);
 
                 ppp_at_response_t ipr_response;
                 ppp_error_t ipr_ret = ppp_at_send_command(ipr_cmd, "OK", 3000, &ipr_response);
@@ -172,10 +170,8 @@ ppp_error_t ppp_at_baudrate_handshake(void)
                 ppp_at_set_baudrate(PPP_UART_BAUDRATE);
 
                 // 再次reset模组,让其自动工作在2000000波特率下
-                PPP_DEBUG_INFO("Resetting module again to switch to 2000000 baudrate...");
-                ppp_api_cat1_reset(1);
-                osal_msleep(50);
-                ppp_api_cat1_reset(0);                
+                PPP_DEBUG_DEBUG("Resetting module again to switch to 2000000 baudrate...");
+                ppp_power_reset_cat1();               
                 osal_msleep(5000);
                 PPP_DEBUG_INFO("Baudrate handshake successful, now at 2000000 baud");
                 return PPP_ERR_OK;
@@ -244,7 +240,7 @@ ppp_error_t ppp_at_set_baudrate(uint32_t baudrate)
     g_at_ctx.current_baudrate = baudrate;
     g_at_ctx.auto_baudrate_mode = false;
     
-    PPP_DEBUG_INFO("Baudrate set bus(%d)  to %u (fixed)",g_at_ctx.uart_bus, baudrate);
+    PPP_DEBUG_DEBUG("Baudrate set bus(%d)  to %u (fixed)",g_at_ctx.uart_bus, baudrate);
     return PPP_ERR_OK;
 }
 
@@ -260,10 +256,10 @@ ppp_error_t ppp_at_send_command(const char *command, const char *expected_respon
 
     osal_mutex_lock(&g_at_ctx.at_mutex);
 
-    PPP_DEBUG_INFO("=== AT Command Send ===");
-    PPP_DEBUG_INFO("Command: %s", command);
-    PPP_DEBUG_INFO("Expected: %s", expected_response ? expected_response : "None");
-    PPP_DEBUG_INFO("Timeout: %u ms", timeout);
+    PPP_DEBUG_DEBUG("=== AT Command Send ===");
+    PPP_DEBUG_DEBUG("Command: %s", command);
+    PPP_DEBUG_DEBUG("Expected: %s", expected_response ? expected_response : "None");
+    PPP_DEBUG_DEBUG("Timeout: %u ms", timeout);
 
     /* 清空响应缓冲区 */
     memset_s(response, sizeof(ppp_at_response_t), 0, sizeof(ppp_at_response_t));
@@ -304,7 +300,7 @@ ppp_error_t ppp_at_send_command(const char *command, const char *expected_respon
         }
     }
     printable_cmd[j] = '\0';
-    PPP_DEBUG_INFO("Send String: %s", printable_cmd);
+    PPP_DEBUG_DEBUG("Send String: %s", printable_cmd);
     free(printable_cmd);
     
     if (uapi_uart_write(g_at_ctx.uart_bus, (const uint8_t *)cmd_with_crlf, cmd_len, 0) != cmd_len) {
@@ -313,15 +309,15 @@ ppp_error_t ppp_at_send_command(const char *command, const char *expected_respon
         return PPP_ERR_UART;
     }
     
-    PPP_DEBUG_INFO("AT command sent successfully bus(%d)",g_at_ctx.uart_bus);
+    PPP_DEBUG_DEBUG("AT command sent successfully bus(%d)",g_at_ctx.uart_bus);
 
     /* 等待响应 */
     ppp_error_t ret = ppp_at_wait_response(response, timeout);
     
     /* 打印响应结果 */
-    PPP_DEBUG_INFO("=== AT Command Response ===");
+    PPP_DEBUG_DEBUG("=== AT Command Response ===");
     if (ret == PPP_ERR_OK) {
-        PPP_DEBUG_INFO("Response received (%u bytes):", response->length);
+        PPP_DEBUG_DEBUG("Response received (%u bytes):", response->length);
         
         /* 打印接收的原始数据(十六进制) */
         // for (uint32_t i = 0; i < response->length; i++) {
@@ -348,10 +344,10 @@ ppp_error_t ppp_at_send_command(const char *command, const char *expected_respon
                 }
             }
             printable_resp[j] = '\0';
-            PPP_DEBUG_INFO("Response String: %s", printable_resp);
+            PPP_DEBUG_DEBUG("Response String: %s", printable_resp);
             free(printable_resp);
         }
-        PPP_DEBUG_INFO("Raw Response: %s", response->response);
+        PPP_DEBUG_DEBUG("Raw Response: %s", response->response);
     } else {
         PPP_DEBUG_ERROR("No response received (error: %d)", ret);
     }
@@ -365,7 +361,7 @@ ppp_error_t ppp_at_send_command(const char *command, const char *expected_respon
                 response->error_code = PPP_ERR_AT_FAILED;
                 ret = PPP_ERR_AT_FAILED;
             } else {
-                PPP_DEBUG_INFO("Response validation successful - Expected: %s", expected_response);
+                PPP_DEBUG_DEBUG("Response validation successful - Expected: %s", expected_response);
                 response->success = true;
                 response->error_code = PPP_ERR_OK;
             }
@@ -379,7 +375,7 @@ ppp_error_t ppp_at_send_command(const char *command, const char *expected_respon
         response->error_code = ret;
     }
     
-    PPP_DEBUG_INFO("=== AT Command Complete (Result: %s) ===", ret == PPP_ERR_OK ? "SUCCESS" : "FAILED");
+    PPP_DEBUG_DEBUG("=== AT Command Complete (Result: %s) ===", ret == PPP_ERR_OK ? "SUCCESS" : "FAILED");
 
     osal_mutex_unlock(&g_at_ctx.at_mutex);
     return ret;
@@ -390,7 +386,7 @@ ppp_error_t ppp_at_send_command(const char *command, const char *expected_respon
  */
 static ppp_error_t ppp_at_skip_startup_logs(void)
 {
-    PPP_DEBUG_INFO("Skipping startup logs...");
+    PPP_DEBUG_DEBUG("Skipping startup logs...");
     
     // 清空接收缓冲区,跳过开机时的各种日志输出
     uint8_t dummy_buffer[256];
@@ -416,7 +412,7 @@ static ppp_error_t ppp_at_skip_startup_logs(void)
         osal_msleep(100);
     } while (retry_count < max_retries);
     
-    PPP_DEBUG_INFO("Startup logs skipped");
+    PPP_DEBUG_DEBUG("Startup logs skipped");
     return PPP_ERR_OK;
 }
 
@@ -461,7 +457,7 @@ ppp_error_t ppp_at_complete_dial_sequence(const char *apn)
         PPP_DEBUG_ERROR("Modem not responding to AT - may already be in data mode");
         // 这可能是正常的,如果调制解调器已经在数据模式
     } else {
-        PPP_DEBUG_INFO("Modem still in AT mode, proceeding with dial sequence");
+        PPP_DEBUG_DEBUG("Modem still in AT mode, proceeding with dial sequence");
     }
     
     // 4. 设置PDP上下文 (对应chat文件: OK 'AT+CGDCONT=3,"IP"')
@@ -500,7 +496,7 @@ ppp_error_t ppp_at_complete_dial_sequence(const char *apn)
     // 4.7. 检查网络状态
     ret = ppp_at_send_command("AT+CREG?", "OK", 5000, &response);
     if (ret == PPP_ERR_OK) {
-        PPP_DEBUG_INFO("Network registration status: %s", response.response);
+        PPP_DEBUG_DEBUG("Network registration status: %s", response.response);
     }
     
     // 5. 发送PPP拨号指令 - 使用Neoway N706A特有的XIIC命令
index 75fd6ce..c474d2a 100644 (file)
@@ -81,7 +81,7 @@ ppp_error_t ppp_lwip_init(const ppp_lwip_config_t *config)
     memset_s(g_lwip_ctx.netif, sizeof(struct netif), 0, sizeof(struct netif));
 
     /* 创建PPPoS接口 - 使用线程安全的API */
-    PPP_DEBUG_INFO("Creating PPPoS interface using thread-safe API...");
+    PPP_DEBUG_DEBUG("Creating PPPoS interface using thread-safe API...");
     g_lwip_ctx.ppp_pcb = pppapi_pppos_create(g_lwip_ctx.netif,
                                              ppp_lwip_output_callback,
                                              ppp_lwip_link_status_callback,
@@ -96,15 +96,15 @@ ppp_error_t ppp_lwip_init(const ppp_lwip_config_t *config)
     /* 设置认证信息 */
     if (config->username && config->password) {
         ppp_set_auth(g_lwip_ctx.ppp_pcb, PPPAUTHTYPE_PAP, config->username, config->password);
-        PPP_DEBUG_INFO("PPP authentication configured (PAP)");
+        PPP_DEBUG_DEBUG("PPP authentication configured (PAP)");
     } else {
         /* 如果没有用户名密码,设置为无认证 */
         ppp_set_auth(g_lwip_ctx.ppp_pcb, PPPAUTHTYPE_NONE, "", "");
-        PPP_DEBUG_INFO("PPP authentication disabled (NONE)");
+        PPP_DEBUG_DEBUG("PPP authentication disabled (NONE)");
     }
 
     /* 配置IPCP选项 - 启用IP地址协商 */
-    PPP_DEBUG_INFO("Configuring IPCP options...");
+    PPP_DEBUG_DEBUG("Configuring IPCP options...");
     
     /* 请求对端分配IP地址 (0.0.0.0表示请求分配) */
     ppp_set_ipcp_ouraddr(g_lwip_ctx.ppp_pcb, IP4_ADDR_ANY);
@@ -116,7 +116,7 @@ ppp_error_t ppp_lwip_init(const ppp_lwip_config_t *config)
     ppp_set_usepeerdns(g_lwip_ctx.ppp_pcb, 1);
     
     /* 使用标准IPCP协商选项 */
-    PPP_DEBUG_INFO("Setting standard IPCP negotiation options...");
+    PPP_DEBUG_DEBUG("Setting standard IPCP negotiation options...");
     
     /* 启用基本的IP地址协商 */
     g_lwip_ctx.ppp_pcb->ipcp_wantoptions.neg_addr = 1;
@@ -128,7 +128,7 @@ ppp_error_t ppp_lwip_init(const ppp_lwip_config_t *config)
     g_lwip_ctx.ppp_pcb->ipcp_wantoptions.req_dns2 = 1;
 #endif
     
-    PPP_DEBUG_INFO("IPCP configuration completed with standard options");
+    PPP_DEBUG_DEBUG("IPCP configuration completed with standard options");
 
     /* 设置状态回调 */
     ppp_set_notify_phase_callback(g_lwip_ctx.ppp_pcb, ppp_lwip_status_callback);
@@ -137,7 +137,7 @@ ppp_error_t ppp_lwip_init(const ppp_lwip_config_t *config)
     netif_set_status_callback(g_lwip_ctx.netif, ppp_lwip_netif_status_callback);
 
     /* 使用标准PPP/LCP配置 */
-    PPP_DEBUG_INFO("Using standard PPP/LCP configuration...");
+    PPP_DEBUG_DEBUG("Using standard PPP/LCP configuration...");
 
     /* 配置LCP Magic Number以避免loopback检测问题 */
     /* 使用简单的随机数生成唯一的Magic Number */
@@ -147,10 +147,10 @@ ppp_error_t ppp_lwip_init(const ppp_lwip_config_t *config)
     g_lwip_ctx.ppp_pcb->lcp_wantoptions.neg_magicnumber = 1;
     g_lwip_ctx.ppp_pcb->lcp_wantoptions.magicnumber = magic_number;
     g_lwip_ctx.ppp_pcb->lcp_allowoptions.neg_magicnumber = 1;
-    PPP_DEBUG_INFO("LCP Magic Number configured: 0x%08X", magic_number);
+    PPP_DEBUG_DEBUG("LCP Magic Number configured: 0x%08X", magic_number);
 
     /* 使用标准PPP/LCP配置 */
-    PPP_DEBUG_INFO("Using standard PPP/LCP configuration...");
+    PPP_DEBUG_DEBUG("Using standard PPP/LCP configuration...");
 
     /* 保存回调函数 */
     g_lwip_ctx.event_callback = config->event_callback;
@@ -182,39 +182,39 @@ void ppp_lwip_deinit(void)
 
     /* 清理网络接口 */
     if (g_lwip_ctx.netif) {
-        PPP_DEBUG_INFO("Cleaning up PPP network interface...");
+        PPP_DEBUG_DEBUG("Cleaning up PPP network interface...");
         
         /* 如果PPP接口是默认接口,清除默认接口设置 */
         if (netif_default == g_lwip_ctx.netif) {
-            PPP_DEBUG_INFO("Clearing PPP interface as default");
+            PPP_DEBUG_DEBUG("Clearing PPP interface as default");
             netif_set_default(NULL);
         }
         
         /* 设置接口为down状态 */
         if (netif_is_up(g_lwip_ctx.netif)) {
-            PPP_DEBUG_INFO("Setting PPP interface down");
+            PPP_DEBUG_DEBUG("Setting PPP interface down");
             netif_set_down(g_lwip_ctx.netif);
         }
         
         /* 设置链路为down状态 */
         if (netif_is_link_up(g_lwip_ctx.netif)) {
-            PPP_DEBUG_INFO("Setting PPP link down");
+            PPP_DEBUG_DEBUG("Setting PPP link down");
             netif_set_link_down(g_lwip_ctx.netif);
         }
         
         /* 从lwIP网络接口列表中移除 */
-        PPP_DEBUG_INFO("Removing PPP interface from lwIP interface list");
+        PPP_DEBUG_DEBUG("Removing PPP interface from lwIP interface list");
         netif_remove(g_lwip_ctx.netif);
         
         /* 释放网络接口内存 */
-        PPP_DEBUG_INFO("Freeing PPP interface memory");
+        PPP_DEBUG_DEBUG("Freeing PPP interface memory");
         osal_kfree(g_lwip_ctx.netif);
         g_lwip_ctx.netif = NULL;
     }
 
     /* 删除PPP控制块 */
     if (g_lwip_ctx.ppp_pcb) {
-        PPP_DEBUG_INFO("Freeing PPP control block");
+        PPP_DEBUG_DEBUG("Freeing PPP control block");
         pppapi_free(g_lwip_ctx.ppp_pcb);
         g_lwip_ctx.ppp_pcb = NULL;
     }
@@ -400,7 +400,7 @@ static void ppp_lwip_status_callback(ppp_pcb *pcb, int err_code, void *ctx)
     (void)pcb;
     (void)ctx;
 
-    PPP_DEBUG_INFO("PPP status callback: err_code=%d", err_code);
+    PPP_DEBUG_DEBUG("PPP status callback: err_code=%d", err_code);
 
     /* 这里只处理PPP阶段变化,不处理错误 */
     const char* phase_str = "UNKNOWN";
@@ -420,7 +420,7 @@ static void ppp_lwip_status_callback(ppp_pcb *pcb, int err_code, void *ctx)
         case PPP_PHASE_DISCONNECT: phase_str = "DISCONNECT"; break;
         default: phase_str = "OTHER"; break;
     }
-    PPP_DEBUG_INFO("PPP Phase: %s (%d)", phase_str, err_code);
+    PPP_DEBUG_DEBUG("PPP Phase: %s (%d)", phase_str, err_code);
 
     ppp_lwip_event_t event;
     memset_s(&event, sizeof(event), 0, sizeof(event));
@@ -433,11 +433,11 @@ static void ppp_lwip_status_callback(ppp_pcb *pcb, int err_code, void *ctx)
             PPP_DEBUG_CRITICAL("PPP connection established successfully");
             /* 获取IP地址信息 */
             if (g_lwip_ctx.netif) {
-                PPP_DEBUG_INFO("PPP netif available, checking IP addresses...");
-                PPP_DEBUG_INFO("netif->ip_addr: 0x%08x", ip4_addr_get_u32(&g_lwip_ctx.netif->ip_addr));
-                PPP_DEBUG_INFO("netif->gw: 0x%08x", ip4_addr_get_u32(&g_lwip_ctx.netif->gw));
-                PPP_DEBUG_INFO("netif->netmask: 0x%08x", ip4_addr_get_u32(&g_lwip_ctx.netif->netmask));
-                PPP_DEBUG_INFO("netif flags: 0x%02x", g_lwip_ctx.netif->flags);
+                            PPP_DEBUG_DEBUG("PPP netif available, checking IP addresses...");
+            PPP_DEBUG_DEBUG("netif->ip_addr: 0x%08x", ip4_addr_get_u32(&g_lwip_ctx.netif->ip_addr));
+            PPP_DEBUG_DEBUG("netif->gw: 0x%08x", ip4_addr_get_u32(&g_lwip_ctx.netif->gw));
+            PPP_DEBUG_DEBUG("netif->netmask: 0x%08x", ip4_addr_get_u32(&g_lwip_ctx.netif->netmask));
+            PPP_DEBUG_DEBUG("netif flags: 0x%02x", g_lwip_ctx.netif->flags);
 
                 g_lwip_ctx.local_ip = ip4_addr_get_u32(&g_lwip_ctx.netif->ip_addr);
                 g_lwip_ctx.remote_ip = ip4_addr_get_u32(&g_lwip_ctx.netif->gw);
@@ -447,11 +447,11 @@ static void ppp_lwip_status_callback(ppp_pcb *pcb, int err_code, void *ctx)
                 const ip_addr_t *dns2 = dns_getserver(1);
                 if (dns1) {
                     g_lwip_ctx.primary_dns = ip4_addr_get_u32(ip_2_ip4(dns1));
-                    PPP_DEBUG_INFO("DNS1: 0x%08x", g_lwip_ctx.primary_dns);
+                    PPP_DEBUG_DEBUG("DNS1: 0x%08x", g_lwip_ctx.primary_dns);
                 }
                 if (dns2) {
                     g_lwip_ctx.secondary_dns = ip4_addr_get_u32(ip_2_ip4(dns2));
-                    PPP_DEBUG_INFO("DNS2: 0x%08x", g_lwip_ctx.secondary_dns);
+                    PPP_DEBUG_DEBUG("DNS2: 0x%08x", g_lwip_ctx.secondary_dns);
                 }
 
                 PPP_DEBUG_INFO("PPP connected - Local IP: %u.%u.%u.%u", 
@@ -467,12 +467,12 @@ static void ppp_lwip_status_callback(ppp_pcb *pcb, int err_code, void *ctx)
 
                 /* 设置PPP接口为默认网络接口 */
                 if (g_lwip_ctx.netif->ip_addr.addr != 0) {
-                    PPP_DEBUG_INFO("Setting PPP interface as default...");
+                    PPP_DEBUG_DEBUG("Setting PPP interface as default...");
                     netif_set_default(g_lwip_ctx.netif);
                     PPP_DEBUG_INFO("PPP interface set as default network interface");
                 } else {
-                    PPP_DEBUG_INFO("PPP IP address is 0, IPCP negotiation may still be in progress");
-                    PPP_DEBUG_INFO("Network interface will be set as default when IP is assigned via netif callback");
+                    PPP_DEBUG_DEBUG("PPP IP address is 0, IPCP negotiation may still be in progress");
+                    PPP_DEBUG_DEBUG("Network interface will be set as default when IP is assigned via netif callback");
                     netif_set_up(g_lwip_ctx.netif);
                     netif_set_link_up(g_lwip_ctx.netif);
                 }
index 854fb3f..5eb0bb2 100644 (file)
@@ -30,7 +30,7 @@ static void ppp_lwip_receive_thread(void *arg)
 {
     (void)arg;
     
-    PPP_DEBUG_INFO("PPP lwIP receive thread started (slipif-style)");
+    PPP_DEBUG_DEBUG("PPP lwIP receive thread started (slipif-style)");
     
     /* 动态分配接收缓冲区以避免栈溢出 */
     uint8_t *rx_buffer = (uint8_t *)malloc(PPP_RX_BUFFER_SIZE);
@@ -57,11 +57,11 @@ static void ppp_lwip_receive_thread(void *arg)
     uint32_t frame_start = 0;         /* 当前帧开始位置 */
     uint32_t complete_frames = 0;     /* 完整帧计数 */
     
-    PPP_DEBUG_INFO("PPP lwIP thread: allocated %d bytes RX buffer + %d bytes stream buffer", 
+    PPP_DEBUG_DEBUG("PPP lwIP thread: allocated %d bytes RX buffer + %d bytes stream buffer", 
                    PPP_RX_BUFFER_SIZE, PPP_RX_BUFFER_SIZE * 2);
     
     PPP_DEBUG_CRITICAL("PPP receive thread started and entering main loop");
-    PPP_DEBUG_INFO("Thread will read from serial in PPP data mode");
+    PPP_DEBUG_DEBUG("Thread will read from serial in PPP data mode");
     
     /* 主接收循环 - 参考slipif的实现方式 */
     while (g_ppp_rx_thread_running) {
@@ -72,7 +72,7 @@ static void ppp_lwip_receive_thread(void *arg)
             total_packets++;
             total_bytes += bytes_read;
             
-            PPP_DEBUG_INFO("PPP RX: Got %u bytes (total: %u packets, %u bytes)", 
+            PPP_DEBUG_DEBUG("PPP RX: Got %u bytes (total: %u packets, %u bytes)", 
                           bytes_read, total_packets, total_bytes);
             
             /* 将接收到的数据添加到流缓冲区 - 加强边界检查 */
@@ -134,7 +134,7 @@ static void ppp_lwip_receive_thread(void *arg)
         } else if (ret != PPP_ERR_OK) {
             /* 检查是否是因为线程停止导致的错误 */
             if (!g_ppp_rx_thread_running) {
-                PPP_DEBUG_INFO("PPP thread stopping, ignoring read error");
+                PPP_DEBUG_DEBUG("PPP thread stopping, ignoring read error");
                 break;
             }
             PPP_DEBUG_ERROR("PPP serial read error: %d", ret);
@@ -156,7 +156,7 @@ static void ppp_lwip_receive_thread(void *arg)
         
         // 统计信息输出 - 每2000次循环输出一次
         if ((total_packets % 2000) == 0 && total_packets > 0) {
-            PPP_DEBUG_INFO("PPP lwIP RX: %u fragments, %u complete frames, %u total bytes", 
+            PPP_DEBUG_DEBUG("PPP lwIP RX: %u fragments, %u complete frames, %u total bytes", 
                           total_packets, complete_frames, total_bytes);
         }
         
@@ -229,7 +229,7 @@ ppp_error_t ppp_lwip_stop_receive_thread(void)
     }
     
     if (g_ppp_rx_thread_completed) {
-        PPP_DEBUG_INFO("PPP thread completed gracefully after %d ms", wait_count * 10);
+        PPP_DEBUG_DEBUG("PPP thread completed gracefully after %d ms", wait_count * 10);
     } else {
         PPP_DEBUG_WARN("PPP thread did not complete within timeout, forcing termination");
     }
index ff81172..d332c6b 100644 (file)
@@ -133,7 +133,7 @@ void ppp_api_gpio_init(void)
 /**
  * @brief PPP模块设置电源引脚状态
  */
-uint32_t ppp_api_cat1_power_on(uint32_t pwron)
+uint32_t ppp_api_cat1_power_pin(uint32_t pwron)
 {
     pin_t en_pin = g_ppp_cat1_ctl_pins.pwr_pin;
     uint8_t en_value = g_ppp_cat1_ctl_pins.pwr_pin_en_value;
@@ -168,7 +168,7 @@ uint32_t ppp_api_cat1_power_on(uint32_t pwron)
 /**
  * @brief PPP模块设置复位引脚状态
  */
-uint32_t ppp_api_cat1_reset(uint32_t pwron)
+uint32_t ppp_api_cat1_reset_pin(uint32_t pwron)
 {
     pin_t en_pin = g_ppp_cat1_ctl_pins.reset_pin;
     uint8_t en_value = g_ppp_cat1_ctl_pins.reset_pin_en_value;
@@ -205,7 +205,7 @@ uint32_t ppp_api_cat1_reset(uint32_t pwron)
 /**
  * @brief PPP模块设置电池引脚状态
  */
-uint32_t ppp_api_cat1_bat_on(uint32_t pwron)
+uint32_t ppp_api_cat1_bat_pin(uint32_t pwron)
 {
     pin_t en_pin = g_ppp_cat1_ctl_pins.bat_pin;
     uint8_t en_value = g_ppp_cat1_ctl_pins.bat_pin_en_value;
@@ -270,19 +270,19 @@ bool ppp_api_is_cat1_enabled(void)
 void ppp_power_on_cat1(void)
 {
 #if defined(BOARD_FD230)
-    ppp_api_cat1_power_on(1);    
-    ppp_api_cat1_reset(0);
+    ppp_api_cat1_power_pin(1);    
+    ppp_api_cat1_reset_pin(0);
 #elif (defined(BOARD_W9) || defined(BOARD_N9) )
-    ppp_api_cat1_power_on(1);  
-    ppp_api_cat1_bat_on(1);
+    ppp_api_cat1_power_pin(1);  
+    ppp_api_cat1_bat_pin(1);
     osal_msleep(900);  // 使用OSAL延时函数
-    ppp_api_cat1_power_on(0);  
+    ppp_api_cat1_power_pin(0);  
 #elif defined(BOARD_LEINIAO)
-    ppp_api_cat1_reset(0);
-    ppp_api_cat1_power_on(1);  
-    ppp_api_cat1_bat_on(1);
+    ppp_api_cat1_reset_pin(0);
+    ppp_api_cat1_power_pin(1);  
+    ppp_api_cat1_bat_pin(1);
     osal_msleep(900);  // 使用OSAL延时函数
-    ppp_api_cat1_power_on(0);  
+    ppp_api_cat1_power_pin(0);  
 #endif
     
     g_ppp_cat1_power_status = true;
@@ -295,21 +295,29 @@ void ppp_power_on_cat1(void)
 void ppp_power_off_cat1(void)
 {
 #if defined(BOARD_FD230)
-    ppp_api_cat1_reset(1);
-    ppp_api_cat1_power_on(0);
+    ppp_api_cat1_reset_pin(1);
+    ppp_api_cat1_power_pin(0);
 #elif (defined(BOARD_W9) || defined(BOARD_N9) )
-    ppp_api_cat1_power_on(0);
-    ppp_api_cat1_bat_on(0);
+    ppp_api_cat1_power_pin(0);
+    ppp_api_cat1_bat_pin(0);
 #elif defined(BOARD_LEINIAO)
-    ppp_api_cat1_reset(0);
-    ppp_api_cat1_power_on(0);
-    ppp_api_cat1_bat_on(0);
+    ppp_api_cat1_reset_pin(0);
+    ppp_api_cat1_power_pin(0);
+    ppp_api_cat1_bat_pin(0);
 #endif
     
     g_ppp_cat1_power_status = false;
     PPP_DEBUG_PRINT("PPP: Cat1 power off sequence completed\n");
 }
 
+
+void ppp_power_reset_cat1(void)
+{
+    ppp_api_cat1_reset_pin(1);
+    osal_msleep(50);
+    ppp_api_cat1_reset_pin(0);
+}
+
 /**
  * @brief PPP模块唤醒Cat1
  */
@@ -446,7 +454,7 @@ void ppp_api_deinit(void)
     PPP_DEBUG_PRINT("PPP: deinit\n");
     
     // 关闭电源
-    ppp_api_cat1_power_on(0);
+    ppp_api_cat1_power_pin(0);
     
     g_ppp_cat1_power_status = false;
 }
\ No newline at end of file
index 6c3cc91..d45a765 100644 (file)
@@ -86,18 +86,18 @@ ppp_error_t ppp_serial_init(const ppp_serial_config_t *config)
     }
 
     PPP_DEBUG_INFO("=== PPP Serial Initialization Start ===");
-    PPP_DEBUG_INFO("Initializing PPP serial with unified buffer management");
-
-    /* 打印配置参数 */
-    PPP_DEBUG_INFO("Configuration parameters:");
-    PPP_DEBUG_INFO("  - UART Bus: %u", config->uart_bus);
-    PPP_DEBUG_INFO("  - IRQ Num: %u", config->irq_num);
-    PPP_DEBUG_INFO("  - Baudrate: %u", config->baudrate);
-    PPP_DEBUG_INFO("  - TX Pin: %u", config->tx_pin);
-    PPP_DEBUG_INFO("  - RX Pin: %u", config->rx_pin);
-    PPP_DEBUG_INFO("  - RX Buffer Size: %u bytes", config->rx_buffer_size);
-    PPP_DEBUG_INFO("  - TX Buffer Size: %u bytes", config->tx_buffer_size);
-    PPP_DEBUG_INFO("  - RX Callback: %s", config->rx_callback ? "Set" : "NULL");
+    PPP_DEBUG_DEBUG("Initializing PPP serial with unified buffer management");
+    
+    /* 配置参数 - 降级为DEBUG级别 */
+    PPP_DEBUG_DEBUG("Configuration parameters:");
+    PPP_DEBUG_DEBUG("  - UART Bus: %u", config->uart_bus);
+    PPP_DEBUG_DEBUG("  - IRQ Num: %u", config->irq_num);
+    PPP_DEBUG_DEBUG("  - Baudrate: %u", config->baudrate);
+    PPP_DEBUG_DEBUG("  - TX Pin: %u", config->tx_pin);
+    PPP_DEBUG_DEBUG("  - RX Pin: %u", config->rx_pin);
+    PPP_DEBUG_DEBUG("  - RX Buffer Size: %u bytes", config->rx_buffer_size);
+    PPP_DEBUG_DEBUG("  - TX Buffer Size: %u bytes", config->tx_buffer_size);
+    PPP_DEBUG_DEBUG("  - RX Callback: %s", config->rx_callback ? "Set" : "NULL");
 
     /* 配置UART参数 */
     g_serial_ctx.uart_bus = config->uart_bus;
@@ -109,11 +109,11 @@ ppp_error_t ppp_serial_init(const ppp_serial_config_t *config)
     g_serial_ctx.uart_attr.stop_bits = UART_STOP_BIT_1;
     g_serial_ctx.uart_attr.parity = UART_PARITY_NONE;
 
-    PPP_DEBUG_INFO("UART attributes configured:");
-    PPP_DEBUG_INFO("  - Baud Rate: %u", g_serial_ctx.uart_attr.baud_rate);
-    PPP_DEBUG_INFO("  - Data Bits: %d", g_serial_ctx.uart_attr.data_bits);
-    PPP_DEBUG_INFO("  - Stop Bits: %d", g_serial_ctx.uart_attr.stop_bits);
-    PPP_DEBUG_INFO("  - Parity: %d", g_serial_ctx.uart_attr.parity);
+    PPP_DEBUG_DEBUG("UART attributes configured:");
+    PPP_DEBUG_DEBUG("  - Baud Rate: %u", g_serial_ctx.uart_attr.baud_rate);
+    PPP_DEBUG_DEBUG("  - Data Bits: %d", g_serial_ctx.uart_attr.data_bits);
+    PPP_DEBUG_DEBUG("  - Stop Bits: %d", g_serial_ctx.uart_attr.stop_bits);
+    PPP_DEBUG_DEBUG("  - Parity: %d", g_serial_ctx.uart_attr.parity);
 
     /* 动态分配统一的接收缓冲区 */
     g_serial_ctx.rx_buffer_size = config->rx_buffer_size;
@@ -122,7 +122,7 @@ ppp_error_t ppp_serial_init(const ppp_serial_config_t *config)
         PPP_DEBUG_ERROR("Failed to allocate RX buffer (%u bytes)", g_serial_ctx.rx_buffer_size);
         return PPP_ERR_MEMORY;
     }
-    PPP_DEBUG_INFO("RX buffer allocated: %u bytes at 0x%p", g_serial_ctx.rx_buffer_size, g_serial_ctx.rx_buffer);
+    PPP_DEBUG_DEBUG("RX buffer allocated: %u bytes at 0x%p", g_serial_ctx.rx_buffer_size, g_serial_ctx.rx_buffer);
 
     /* 动态分配发送缓冲区 */
     g_serial_ctx.tx_buffer_size = config->tx_buffer_size;
@@ -133,7 +133,7 @@ ppp_error_t ppp_serial_init(const ppp_serial_config_t *config)
         g_serial_ctx.rx_buffer = NULL;
         return PPP_ERR_MEMORY;
     }
-    PPP_DEBUG_INFO("TX buffer allocated: %u bytes at 0x%p", g_serial_ctx.tx_buffer_size, g_serial_ctx.tx_buffer);
+    PPP_DEBUG_DEBUG("TX buffer allocated: %u bytes at 0x%p", g_serial_ctx.tx_buffer_size, g_serial_ctx.tx_buffer);
 
     /* 创建发送缓冲区互斥锁 */
     if (osal_mutex_init(&g_serial_ctx.tx_mutex) != OSAL_SUCCESS) {
@@ -145,18 +145,18 @@ ppp_error_t ppp_serial_init(const ppp_serial_config_t *config)
         uapi_uart_deinit(g_serial_ctx.uart_bus);
         return PPP_ERR_MEMORY;
     }
-    PPP_DEBUG_INFO("TX mutex created successfully");
+    PPP_DEBUG_DEBUG("TX mutex created successfully");
 
     /* 配置UART使用我们分配的接收缓冲区 */
     g_serial_ctx.buffer_config.rx_buffer = g_serial_ctx.rx_buffer;
     g_serial_ctx.buffer_config.rx_buffer_size = g_serial_ctx.rx_buffer_size;
 
-    PPP_DEBUG_INFO("UART buffer config:");
-    PPP_DEBUG_INFO("  - RX Buffer Address: 0x%p", g_serial_ctx.buffer_config.rx_buffer);
-    PPP_DEBUG_INFO("  - RX Buffer Size: %u", g_serial_ctx.buffer_config.rx_buffer_size);
-    PPP_DEBUG_INFO("PPP TX buffer (software managed):");
-    PPP_DEBUG_INFO("  - TX Buffer Address: 0x%p", g_serial_ctx.tx_buffer);
-    PPP_DEBUG_INFO("  - TX Buffer Size: %u", g_serial_ctx.tx_buffer_size);
+    PPP_DEBUG_DEBUG("UART buffer config:");
+    PPP_DEBUG_DEBUG("  - RX Buffer Address: 0x%p", g_serial_ctx.buffer_config.rx_buffer);
+    PPP_DEBUG_DEBUG("  - RX Buffer Size: %u", g_serial_ctx.buffer_config.rx_buffer_size);
+    PPP_DEBUG_DEBUG("PPP TX buffer (software managed):");
+    PPP_DEBUG_DEBUG("  - TX Buffer Address: 0x%p", g_serial_ctx.tx_buffer);
+    PPP_DEBUG_DEBUG("  - TX Buffer Size: %u", g_serial_ctx.tx_buffer_size);
 
     // errcode_t rett = uapi_uart_deinit(g_serial_ctx.uart_bus);
     // if (rett != ERRCODE_SUCC) {
@@ -168,7 +168,7 @@ ppp_error_t ppp_serial_init(const ppp_serial_config_t *config)
     // PPP_DEBUG_INFO("UART deinitialized successfully");
 
     /* 初始化UART */
-    PPP_DEBUG_INFO("Calling uapi_uart_init...");
+    PPP_DEBUG_DEBUG("Calling uapi_uart_init...");
     errcode_t ret = uapi_uart_init(g_serial_ctx.uart_bus, 
                                    &g_serial_ctx.pin_config,
                                    &g_serial_ctx.uart_attr, 
@@ -188,7 +188,7 @@ ppp_error_t ppp_serial_init(const ppp_serial_config_t *config)
     PPP_DEBUG_INFO("UART initialized successfully (error code = %d)", ret);
 
     /* 创建同步对象 */
-    PPP_DEBUG_INFO("Creating synchronization objects...");
+    PPP_DEBUG_DEBUG("Creating synchronization objects...");
     if (osal_mutex_init(&g_serial_ctx.rx_mutex) != OSAL_SUCCESS) {
         PPP_DEBUG_ERROR("Failed to create RX mutex");
         osal_kfree(g_serial_ctx.rx_buffer);
@@ -199,7 +199,7 @@ ppp_error_t ppp_serial_init(const ppp_serial_config_t *config)
         osal_mutex_destroy(&g_serial_ctx.tx_mutex);
         return PPP_ERR_MEMORY;
     }
-    PPP_DEBUG_INFO("RX mutex created successfully");
+    PPP_DEBUG_DEBUG("RX mutex created successfully");
 
     if (osal_sem_init(&g_serial_ctx.rx_semaphore, 0) != OSAL_SUCCESS) {
         PPP_DEBUG_ERROR("Failed to create RX semaphore");
@@ -212,7 +212,7 @@ ppp_error_t ppp_serial_init(const ppp_serial_config_t *config)
         osal_mutex_destroy(&g_serial_ctx.tx_mutex);
         return PPP_ERR_MEMORY;
     }
-    PPP_DEBUG_INFO("RX semaphore created successfully");
+    PPP_DEBUG_DEBUG("RX semaphore created successfully");
 
     /* 初始化缓冲区状态 */
     g_serial_ctx.rx_head = 0;
@@ -238,11 +238,11 @@ ppp_error_t ppp_serial_init(const ppp_serial_config_t *config)
     g_serial_ctx.consecutive_small_packets = 0;
     g_serial_ctx.idle_flush_threshold = 10;  // 10ms空闲超时
 
-    PPP_DEBUG_INFO("Buffer state initialized:");
-    PPP_DEBUG_INFO("  - RX Head/Tail/Count: %u/%u/%u", g_serial_ctx.rx_head, g_serial_ctx.rx_tail, g_serial_ctx.rx_count);
-    PPP_DEBUG_INFO("  - TX Head/Tail/Count: %u/%u/%u", g_serial_ctx.tx_head, g_serial_ctx.tx_tail, g_serial_ctx.tx_count);
-    PPP_DEBUG_INFO("  - Current Mode: %d (AT)", g_serial_ctx.current_mode);
-    PPP_DEBUG_INFO("  - Initialized Flag: %s", g_serial_ctx.initialized ? "true" : "false");
+    PPP_DEBUG_DEBUG("Buffer state initialized:");
+    PPP_DEBUG_DEBUG("  - RX Head/Tail/Count: %u/%u/%u", g_serial_ctx.rx_head, g_serial_ctx.rx_tail, g_serial_ctx.rx_count);
+    PPP_DEBUG_DEBUG("  - TX Head/Tail/Count: %u/%u/%u", g_serial_ctx.tx_head, g_serial_ctx.tx_tail, g_serial_ctx.tx_count);
+    PPP_DEBUG_DEBUG("  - Current Mode: %d (AT)", g_serial_ctx.current_mode);
+    PPP_DEBUG_DEBUG("  - Initialized Flag: %s", g_serial_ctx.initialized ? "true" : "false");
 
     PPP_DEBUG_INFO("PPP serial initialized successfully with unified buffer (%u bytes)", g_serial_ctx.rx_buffer_size);
     PPP_DEBUG_INFO("=== PPP Serial Initialization Complete ===");
@@ -265,8 +265,8 @@ ppp_error_t ppp_serial_switch_to_ppp_mode(void)
     }
 
     PPP_DEBUG_INFO("=== Switching to PPP Data Mode ===");
-    PPP_DEBUG_INFO("Current mode: %d (AT) -> %d (PPP_DATA)", g_serial_ctx.current_mode, PPP_SERIAL_MODE_PPP_DATA);
-    PPP_DEBUG_INFO("UART Bus: %u", g_serial_ctx.uart_bus);
+    PPP_DEBUG_DEBUG("Current mode: %d (AT) -> %d (PPP_DATA)", g_serial_ctx.current_mode, PPP_SERIAL_MODE_PPP_DATA);
+    PPP_DEBUG_DEBUG("UART Bus: %u", g_serial_ctx.uart_bus);
 
     /* 清空接收缓冲区 */
     osal_mutex_lock(&g_serial_ctx.rx_mutex);
@@ -281,11 +281,11 @@ ppp_error_t ppp_serial_switch_to_ppp_mode(void)
     g_serial_ctx.tx_tail = 0;
     g_serial_ctx.tx_count = 0;
     osal_mutex_unlock(&g_serial_ctx.tx_mutex);
-    PPP_DEBUG_INFO("TX buffer cleared for mode switch");
+    PPP_DEBUG_DEBUG("TX buffer cleared for mode switch");
 
     /* PPP数据模式:使用优化的直接UART读取,增加超时时间获取完整数据 */
-    PPP_DEBUG_INFO("PPP Data Mode: Using optimized direct UART read with longer timeout");
-    PPP_DEBUG_INFO("This approach is more reliable than callback mechanism");
+    PPP_DEBUG_DEBUG("PPP Data Mode: Using optimized direct UART read with longer timeout");
+    PPP_DEBUG_DEBUG("This approach is more reliable than callback mechanism");
     
     g_serial_ctx.current_mode = PPP_SERIAL_MODE_PPP_DATA;
     PPP_DEBUG_CRITICAL("Serial mode switched to PPP_DATA (%d)", g_serial_ctx.current_mode);
@@ -310,11 +310,11 @@ ppp_error_t ppp_serial_switch_to_at_mode(void)
     }
 
     PPP_DEBUG_INFO("=== Switching to AT Mode ===");
-    PPP_DEBUG_INFO("Current mode: %d (PPP_DATA) -> %d (AT)", g_serial_ctx.current_mode, PPP_SERIAL_MODE_AT);
-    PPP_DEBUG_INFO("UART Bus: %u", g_serial_ctx.uart_bus);
+    PPP_DEBUG_DEBUG("Current mode: %d (PPP_DATA) -> %d (AT)", g_serial_ctx.current_mode, PPP_SERIAL_MODE_AT);
+    PPP_DEBUG_DEBUG("UART Bus: %u", g_serial_ctx.uart_bus);
 
     /* 清空接收缓冲区 */
-    PPP_DEBUG_INFO("Clearing RX buffer...");
+    PPP_DEBUG_DEBUG("Clearing RX buffer...");
     osal_mutex_lock(&g_serial_ctx.rx_mutex);
     uint32_t old_rx_count = g_serial_ctx.rx_count;
     g_serial_ctx.rx_head = 0;
@@ -324,7 +324,7 @@ ppp_error_t ppp_serial_switch_to_at_mode(void)
     PPP_DEBUG_INFO("RX buffer cleared (discarded %u bytes)", old_rx_count);
 
     /* 清空发送缓冲区 */
-    PPP_DEBUG_INFO("Clearing TX buffer...");
+    PPP_DEBUG_DEBUG("Clearing TX buffer...");
     osal_mutex_lock(&g_serial_ctx.tx_mutex);
     uint32_t old_tx_count = g_serial_ctx.tx_count;
     g_serial_ctx.tx_head = 0;
@@ -335,8 +335,8 @@ ppp_error_t ppp_serial_switch_to_at_mode(void)
 
     /* 从PPP数据模式切换回AT模式 */
     if (g_serial_ctx.current_mode == PPP_SERIAL_MODE_PPP_DATA) {
-        PPP_DEBUG_INFO("Switching from PPP data mode to AT mode");
-        PPP_DEBUG_INFO("No callback cleanup needed (using direct UART read)");
+        PPP_DEBUG_DEBUG("Switching from PPP data mode to AT mode");
+        PPP_DEBUG_DEBUG("No callback cleanup needed (using direct UART read)");
     }
 
     g_serial_ctx.current_mode = PPP_SERIAL_MODE_AT;
@@ -356,27 +356,27 @@ ppp_error_t ppp_serial_write(const uint8_t *data, uint32_t length)
         return PPP_ERR_INVALID_PARAM;
     }
 
-    PPP_DEBUG_INFO("=== PPP Serial Write Start ===");
+    PPP_DEBUG_DEBUG("=== PPP Serial Write Start ===");
     #ifdef PPP_LOW_POWER_MODE
     ppp_api_wakeup_cat1(true);
     #endif
     osal_msleep(1);
-    PPP_DEBUG_INFO("Write request: %u bytes in mode %d", length, g_serial_ctx.current_mode);
-    PPP_DEBUG_INFO("UART Bus: %u", g_serial_ctx.uart_bus);
+    PPP_DEBUG_DEBUG("Write request: %u bytes in mode %d", length, g_serial_ctx.current_mode);
+    PPP_DEBUG_DEBUG("UART Bus: %u", g_serial_ctx.uart_bus);
 
     ppp_error_t result = PPP_ERR_OK;
     int32_t write_result = 0;
     switch (g_serial_ctx.current_mode) {
         case PPP_SERIAL_MODE_AT:
             /* AT命令模式:直接使用UART发送 */
-            PPP_DEBUG_INFO("Sending %u bytes via UART (AT mode)", length);
+            PPP_DEBUG_DEBUG("Sending %u bytes via UART (AT mode)", length);
             // PPP_DEBUG_HEXDUMP(data, length);
             
-            PPP_DEBUG_INFO("Calling uapi_uart_write(bus=%u, data=%p, len=%u, timeout=1000)...", 
+            PPP_DEBUG_DEBUG("Calling uapi_uart_write(bus=%u, data=%p, len=%u, timeout=1000)...", 
                           g_serial_ctx.uart_bus, data, length);
             
             write_result = uapi_uart_write(g_serial_ctx.uart_bus, data, length, 1000);
-            PPP_DEBUG_INFO("uapi_uart_write returned: %d (expected: %u)", write_result, length);
+            PPP_DEBUG_DEBUG("uapi_uart_write returned: %d (expected: %u)", write_result, length);
             
             if (write_result != (int32_t)length) {
                 PPP_DEBUG_ERROR("UART write failed in AT mode: returned %d, expected %u", write_result, length);