modify can parameter
authorkyz <kyz@kyz.pub>
Fri, 14 Nov 2025 01:38:47 +0000 (09:38 +0800)
committerkyz <kyz@kyz.pub>
Fri, 14 Nov 2025 01:38:47 +0000 (09:38 +0800)
src/user_can.c
src/user_pcs.c

index 686b5ff3e0026943eb3f515c9e6304c569c04291..e0f531a2c5f181e6928eeee727da9cd71a8eb8e0 100644 (file)
@@ -55,9 +55,12 @@ int can_bus_init(int bus_id) {
     const char *ifname = can_bus_configs[bus_id].interface_name;
     uint32_t bitrate = can_bus_configs[bus_id].bitrate;
 
-    // 设置CAN接口参数
     char command[256];
-    snprintf(command, sizeof(command), "ip link set %s type can bitrate %u", ifname, bitrate);
+
+    printf( "can bus init,  ifname:%s, bitrate:%d --- \n", ifname, bitrate );
+    // 设置CAN接口参数
+
+    snprintf(command, sizeof(command), "ip link set %s type can bitrate %u dbitrate %u fd on", ifname, bitrate, bitrate );
     if (execute_system_command(command) < 0) {
         return -1;
     }
index 22b053ca79ccab78b7675b6162f0b8be666ece48..194666c4a8597a105ad9e0f358c9f8d3f758f7ea 100644 (file)
@@ -739,7 +739,7 @@ static void* pcs_task_thread(void* arg)
     // 初始化Modbus总线
     if (mb_bus_init() != 0) {
         fprintf(stderr, "Failed to initialize modbus access module\n");
-        return NULL;
+        //return NULL;
     }
 
     // 定义寄存器区域