{"id":5123,"date":"2023-09-15T14:53:57","date_gmt":"2023-09-15T06:53:57","guid":{"rendered":"https:\/\/www.tosunai.com\/?p=5123"},"modified":"2024-09-02T12:26:11","modified_gmt":"2024-09-02T04:26:11","slug":"tosun-hardware-use-socketcan-to-send-and-receive-messages","status":"publish","type":"post","link":"https:\/\/www.tosunai.com\/tosun-hardware-use-socketcan-to-send-and-receive-messages\/","title":{"rendered":"\u5e72\u8d27\u5206\u4eab|\u540c\u661f\u786c\u4ef6\u5982\u4f55\u4f7f\u7528SocketCAN\u8fdb\u884c\u62a5\u6587\u6536\u53d1"},"content":{"rendered":"\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t
\n\t\t\t
Catalogue<\/h5>\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t
\n\t\t\t\t
\n\t\t\t

\u76ee\u5f55<\/h4>\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t
\n\t\t\t\t
\n\t\t\t

\u4e00\u3001\u524d\u8a00<\/b>\n

1.1 Socket CAN

\n\u4e8c\u3001Socket CAN\u4f7f\u7528\u6559\u7a0b<\/b>

2.1 \u7cfb\u7edf\u73af\u5883\u914d\u7f6e

2.2 \u5e93\u6587\u4ef6\u4e0a\u4f20

2.3 \u4f7f\u80fdvcan

2.4 \u6d4b\u8bd5\u8bbe\u5907\u53cc\u901a\u9053\u4e92\u76f8\u901a\u4fe1


\u4e09\u3001\u95ee\u9898Q&A<\/b>

3.1 sudo: .\/sockettscan: command not found

3.2  cannot open shared object file<\/h4>\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t
\n\t\t\t

\u4e00\u3001\u524d\u8a00<\/h4>\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t
\n\t\t\t\t
\n\t\t\t
Preface introduction<\/h5>\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t
\n\t\t\t\t\t\t\t

1.1\u3001Socket CAN<\/b><\/p>

SocketCAN\u662f\u7531Linux\u5185\u6838\u7ef4\u62a4\u7684CAN\u534f\u8bae\u6808\uff0c\u53ef\u4ee5\u4f7f\u7528Linux\u5185\u6838\u63d0\u4f9b\u7684Socket API\u8fdb\u884cCAN\u603b\u7ebf\u7684\u8bfb\u5199\u64cd\u4f5c\uff0c\u7528\u6237\u53ea\u9700\u8981\u4f7f\u7528C\u8bed\u8a00\u5b9e\u73b0\u4e0eSocket API\u901a\u8baf\uff0c\u5c31\u53ef\u4ee5\u63a7\u5236CAN\u603b\u7ebf\u4e0a\u7684\u8282\u70b9\uff0c\u5b9e\u73b0\u6570\u636e\u7684\u53d1\u9001\u4e0e\u63a5\u6536\u3002<\/span><\/span><\/p>

\u5982\u679c\u60f3\u8981\u5229\u7528SocketCAN\u63a7\u5236TSCAN\u7684\u8bbe\u5907\uff0c\u6709\u4e00\u4e2a\u89e3\u51b3\u65b9\u6cd5\u662f\u5229\u7528Linux\u81ea\u5e26\u7684\u865a\u62dfSocketCAN\u3002\u6211\u4eec\u5229\u7528\u540c\u661f\u63d0\u4f9b\u7684Linux\u5e93libTSCANApiOnLinux.so\uff0c\u5b8c\u6210\u4e00\u4e2avcan\u5728\u672c\u673a\u7684server\u7a0b\u5e8f\uff0c\u7528\u4e8e\u628aSocketCAN\u7684\u62a5\u6587\u548clibTSCAN\u8fdb\u884c\u4e92\u8f6c\u3002<\/span><\/p>

\u8fd9\u79cd\u65b9\u5f0f\u914d\u7f6e\u540c\u661f\u786c\u4ef6\u7684\u6ce2\u7279\u7387\uff0c\u4ee5\u53ca\u67e5\u770b\u4fe1\u606f\u90fd\u9700\u8981\u5728sockettscan\u7a0b\u5e8f\u4e2d\u3002\u56e0\u4e3avcan\u672c\u8eab\u4e0d\u652f\u6301\u6ce2\u7279\u7387\u914d\u7f6e\uff0c\u6211\u4eec\u4e5f\u65e0\u6cd5\u628a\u7edf\u8ba1\u4fe1\u606f\u544a\u77e5vcan\u3002<\/span><\/p>

\u903b\u8f91\u56fe\u5982\u4e0b\uff1a<\/span><\/span><\/p>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t

\n\t\t\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t
\n\t\t\t\t\t\t\t\t\t\t\t\t\t\"\u540c\u661f\u786c\u4ef6\u5982\u4f55\u4f7f\u7528SocketCAN\u8fdb\u884c\u62a5\u6587\u6536\u53d1\"\t\t\t\t\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t
\n\t\t\t

\u4e8c\u3001Socket CAN\u4f7f\u7528\u6559\u7a0b<\/h4>\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t
\n\t\t\t\t
\n\t\t\t
Socket CAN Using Toturials<\/h5>\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t
\n\t\t\t\t\t\t\t

2.1\u3001\u7cfb\u7edf\u73af\u5883\u914d\u7f6e<\/b><\/p>

\u5982\u679c\u7535\u8111\u672c\u8eab\u7684\u7cfb\u7edf\u5c31\u662fLinux\u7cfb\u7edf\uff0c\u5219\u8fd9\u4e2a\u6b65\u9aa4\u53ef\u4ee5\u5ffd\u7565\u3002<\/span><\/span><\/p>

1) \u901a\u8fc7http:\/\/releases.ubuntu.com\/18.04\/\u53ef\u4ee5\u4e0b\u8f7dUbuntu\u7cfb\u7edf\u955c\u50cf\u3002<\/span><\/span><\/p>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t

\n\t\t\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t
\n\t\t\t\t\t\t\t\t\t\t\t\t\t\"\u540c\u661f\u786c\u4ef6\u5982\u4f55\u4f7f\u7528SocketCAN\u8fdb\u884c\u62a5\u6587\u6536\u53d1\"\t\t\t\t\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t
\n\t\t\t\t\t\t\t


<\/p>\n

2\uff09\u5728\u865a\u62df\u673a\u4e2d\u5bfc\u5165\u6620\u5c04\u6587\u4ef6\uff1a\u865a\u62df\u673a ->\u7f16\u8f91\u865a\u62df\u673a\u8bbe\u7f6e -> CD\/DVD ->\u4f7f\u7528ISO \u6620\u5c04\u6587\u4ef6\u3002<\/span><\/font>
<\/p>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t

\n\t\t\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t
\n\t\t\t\t\t\t\t\t\t\t\t\t\t\"\u540c\u661f\u786c\u4ef6\u5982\u4f55\u4f7f\u7528SocketCAN\u8fdb\u884c\u62a5\u6587\u6536\u53d1\"\t\t\t\t\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t
\n\t\t\t\t\t\t\t

2.2\u3001\u5e93\u6587\u4ef6\u4e0a\u4f20<\/b><\/p>\n

1\uff09\u5728\u684c\u9762\u65b0\u5efa\u4e00\u4e2a\u6587\u4ef6\u5939vcan\u3002<\/span><\/font>
<\/p>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t

\n\t\t\t\t
\n\t\t\t\t\t\t\t
\n\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\u4e0b\u8f7d vcan \u6a94\u6848<\/span>\n\t\t\t\t\t<\/span>\n\t\t\t\t\t<\/a>\n\t\t\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t
\n\t\t\t\t\t\t\t\t\t\t\t\t\t\"\u540c\u661f\u786c\u4ef6\u5982\u4f55\u4f7f\u7528SocketCAN\u8fdb\u884c\u62a5\u6587\u6536\u53d1\"\t\t\t\t\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t
\n\t\t\t\t\t\t\t

\u00a0<\/p>

2\uff09\u901a\u8fc7U\u76d8\u5c06\u6587\u4ef6\u5939\u91cc\u7684\u6587\u4ef6\u4e0a\u4f20\u5230\u5f53\u524d\u6587\u4ef6\u5939\u3002<\/span><\/span><\/p>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t

\n\t\t\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t
\n\t\t\t\t\t\t\t\t\t\t\t\t\t\"\u540c\u661f\u786c\u4ef6\u5982\u4f55\u4f7f\u7528SocketCAN\u8fdb\u884c\u62a5\u6587\u6536\u53d1\"\t\t\t\t\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t
\n\t\t\t\t\t\t\t

3\uff09\u5c06libTSCANApiOnLinux.so\u3001libTSH.so\u3001sockettscan\u3001sockettscan.cpp\u3001TSCANDef.hpp\u8fd95\u4e2a\u6587\u4ef6\u7684\u5c5e\u6027\u4fee\u6539\u4e3a\uff1aPermissions\u5904\u7684Access\u5168\u90e8\u9009\u62e9Read and write\uff0cGroup\u9009\u62e9sudo\uff0c\u52fe\u9009Execute\u3002<\/p>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t

\n\t\t\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t
\n\t\t\t\t\t\t\t\t\t\t\t\t\t\"\u540c\u661f\u786c\u4ef6\u5982\u4f55\u4f7f\u7528SocketCAN\u8fdb\u884c\u62a5\u6587\u6536\u53d1\"\t\t\t\t\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t
\n\t\t\t\t\t\t\t\t\t\t\t\t\t\"\u540c\u661f\u786c\u4ef6\u5982\u4f55\u4f7f\u7528SocketCAN\u8fdb\u884c\u62a5\u6587\u6536\u53d1\"\t\t\t\t\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t
\n\t\t\t\t\t\t\t

4\uff09\u5728vcan\u6587\u4ef6\u5939\u4e0b\uff0c\u5c06libTSCANApiOnLinux.so\u548clibTSH.so\u8fd9\u4e24\u4e2a\u5e93\u6587\u4ef6\u590d\u5236\u5230\/usr\/lib\/\u8def\u5f84\u4e0b\u3002
<\/p>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t

\n\t\t\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t
\n\t\t\t\t\t\t\t\t\t\t\t\t\t\"\u540c\u661f\u786c\u4ef6\u5982\u4f55\u4f7f\u7528SocketCAN\u8fdb\u884c\u62a5\u6587\u6536\u53d1\"\t\t\t\t\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t
\n\t\t\t\t\t\t\t

2.3\u3001\u4f7f\u80fdvcan<\/b><\/p>

1\uff09vcan\u6307\u4ee4\u5b89\u88c5\u6b65\u9aa4\u3002<\/span><\/span><\/p>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t

\n\t\t\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t
\n\t\t\t\t\t\t\t\t\t\t\t\t\t\"\u540c\u661f\u786c\u4ef6\u5982\u4f55\u4f7f\u7528SocketCAN\u8fdb\u884c\u62a5\u6587\u6536\u53d1\"\t\t\t\t\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t
\n\t\t\t\t\t\t\t\t\t\t\t\t\t\"\u540c\u661f\u786c\u4ef6\u5982\u4f55\u4f7f\u7528SocketCAN\u8fdb\u884c\u62a5\u6587\u6536\u53d1\"\t\t\t\t\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t
\n\t\t\t\t\t\t\t

2\uff09\u6d4b\u8bd5vcan\u662f\u5426\u5b89\u88c5\u6210\u529f\uff0c\u7528\u6307\u4ee4ifconfig -a\u67e5\u770b\u4fe1\u606f\uff0c\u770b\u5230\u5e26\u6709vcan0\u7684\u4fe1\u606f\u5c31\u4ee3\u8868\u5b89\u88c5\u6210\u529f\u3002<\/p>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t

\n\t\t\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t
\n\t\t\t\t\t\t\t\t\t\t\t\t\t\"\u540c\u661f\u786c\u4ef6\u5982\u4f55\u4f7f\u7528SocketCAN\u8fdb\u884c\u62a5\u6587\u6536\u53d1\"\t\t\t\t\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t
\n\t\t\t\t\t\t\t

3\uff09\u5b89\u88c5can\u8c03\u8bd5\u5de5\u5177\uff0csudo install can-utils \u3002<\/p>

4\uff09\u8fd0\u884csockettscan\u7a0b\u5e8f\u3002<\/p>

\u7ed1\u5b9a\u5230\u8bbe\u59070\u76841\u901a\u9053\uff0c\u6ce2\u7279\u7387500k-2M\uff0c\u4f7f\u80fd\u7ec8\u7aef\u7535\u963b\u3002\u8fd9\u6837\u901a\u8fc7socketcan\u8c03\u7528vcan0\u5c31\u53ef\u4ee5\u628a\u62a5\u6587\u540c\u6b65\u5230TSCAN\u8bbe\u5907\u4e2d\u4e86\u3002-b\u8868\u793a\u4ef2\u88c1\u6ce2\u7279\u7387\uff0c-d\u8868\u793a\u6570\u636e\u6ce2\u7279\u7387\uff0c-v\u8868\u793a\u786c\u4ef6\u7684\u4e0b\u6807\uff08\u4e0b\u6807\u4ece0\u5f00\u59cb\uff09\uff0c-c\u8868\u793a\u901a\u9053\u7684\u4e0b\u6807\uff08\u4e0b\u6807\u4ece1\u5f00\u59cb\uff09\u3002<\/p>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t

\n\t\t\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t
\n\t\t\t\t\t\t\t\t\t\t\t\t\t\"\u540c\u661f\u786c\u4ef6\u5982\u4f55\u4f7f\u7528SocketCAN\u8fdb\u884c\u62a5\u6587\u6536\u53d1\"\t\t\t\t\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t
\n\t\t\t\t\t\t\t\t\t\t\t\t\t\"\u540c\u661f\u786c\u4ef6\u5982\u4f55\u4f7f\u7528SocketCAN\u8fdb\u884c\u62a5\u6587\u6536\u53d1\"\t\t\t\t\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t
\n\t\t\t\t\t\t\t

\u53ef\u4ee5\u901a\u8fc7sudo .\/sockettscan -h\u663e\u793a\u5e2e\u52a9\u4fe1\u606f
<\/p>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t

\n\t\t\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t
\n\t\t\t\t\t\t\t\t\t\t\t\t\t\"\u540c\u661f\u786c\u4ef6\u5982\u4f55\u4f7f\u7528SocketCAN\u8fdb\u884c\u62a5\u6587\u6536\u53d1\"\t\t\t\t\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t
\n\t\t\t\t\t\t\t

2.4\u3001\u6d4b\u8bd5\u8bbe\u5907\u53cc\u901a\u9053\u4e92\u76f8\u901a\u4fe1<\/b><\/p>\n

1\uff09\u786c\u4ef6TC1034<\/span><\/font><\/p>

1-1\u3001\u9700\u8981\u5c06TC1034\u7684CAN1\u548cCAN2\u901a\u8fc7\u675c\u90a6\u7ebf\u8fdb\u884c\u8fde\u63a5\uff0c\u901a\u8fc7\u4e0a\u8ff0\u65b9\u6cd5\u5efa\u7acbvcan0\u548cvcan1\u4e24\u4e2a\u901a\u9053\u3002<\/span><\/font><\/p>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t

\n\t\t\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t
\n\t\t\t\t\t\t\t\t\t\t\t\t\t\"\u540c\u661f\u786c\u4ef6\u5982\u4f55\u4f7f\u7528SocketCAN\u8fdb\u884c\u62a5\u6587\u6536\u53d1\"\t\t\t\t\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t
\n\t\t\t\t\t\t\t

\u5229\u7528sockettscan\u7ed1\u5b9a\u4e24\u4e2a\u901a\u9053\uff1a\u5173\u4e8e\u591a\u901a\u9053\u4f7f\u7528\u9700\u8981\u6ce8\u610f\uff0c\u6bcf\u4e00\u4e2asockettscan\u7528\u6765\u8fde\u63a5\u5355\u4e2aTSCAN\u786c\u4ef6\u3002\u591a\u4e2a\u901a\u9053\u53ef\u4ee5\u5199\u591a\u6b21\uff08vcan0\u540d\u79f0\u9700\u8981\u5728\u6700\u524d\u9762\uff09\uff0c\u591a\u4e2a\u786c\u4ef6\u8bbe\u5907\uff0c\u53ef\u4ee5\u5728\u591a\u4e2a\u7ec8\u7aef\u8c03\u7528sockettscan\u5b9e\u73b0\u3002<\/p>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t

\n\t\t\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t
\n\t\t\t\t\t\t\t\t\t\t\t\t\t\"\u540c\u661f\u786c\u4ef6\u5982\u4f55\u4f7f\u7528SocketCAN\u8fdb\u884c\u62a5\u6587\u6536\u53d1\"\t\t\t\t\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t
\n\t\t\t\t\t\t\t\t\t\t\t\t\t\"\u540c\u661f\u786c\u4ef6\u5982\u4f55\u4f7f\u7528SocketCAN\u8fdb\u884c\u62a5\u6587\u6536\u53d1\"\t\t\t\t\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t
\n\t\t\t\t\t\t\t

1-2\u3001\u901a\u8fc7cansend\u548ccandump\u6d4b\u8bd5\u865a\u62dfcan\u6570\u636e\u6536\u53d1\u3002\u5206\u522b\u6253\u5f00\u4e24\u4e2a\u7ec8\u7aef\uff0c\u5206\u522b\u8d1f\u8d23\u6570\u636e\u63a5\u6536\u548c\u53d1\u9001\u3002<\/p>

\u5148\u542f\u52a8\u63a5\u6536\u6307\u4ee4candump\uff0c\u5b83\u4f1a\u963b\u585e\u7b49\u5f85\u6570\u636e\u3002\u7136\u540ecansend\u53d1\u9001\u6570\u636e\uff0c\u6548\u679c\u5982\u4e0b\uff1a<\/p>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t

\n\t\t\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t
\n\t\t\t\t\t\t\t\t\t\t\t\t\t\"\u540c\u661f\u786c\u4ef6\u5982\u4f55\u4f7f\u7528SocketCAN\u8fdb\u884c\u62a5\u6587\u6536\u53d1\"\t\t\t\t\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t
\n\t\t\t\t\t\t\t

2\uff09\u786c\u4ef6TC1034\u548cTC1016P<\/p>

2-1\u3001\u9700\u8981\u5c06TC1034\u7684CAN1\u548cTC1016P\u7684CAN1\u901a\u8fc7\u675c\u90a6\u7ebf\u8fdb\u884c\u8fde\u63a5\u3002<\/p>

\u5229\u7528sockettscan\u7ed1\u5b9a\u4e24\u4e2a\u901a\u9053\u3002<\/p>

\u7ed1\u5b9a\u901a\u90531\u3002<\/p>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t

\n\t\t\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t
\n\t\t\t\t\t\t\t\t\t\t\t\t\t\"\u540c\u661f\u786c\u4ef6\u5982\u4f55\u4f7f\u7528SocketCAN\u8fdb\u884c\u62a5\u6587\u6536\u53d1\"\t\t\t\t\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t
\n\t\t\t\t\t\t\t\t\t\t\t\t\t\"\u540c\u661f\u786c\u4ef6\u5982\u4f55\u4f7f\u7528SocketCAN\u8fdb\u884c\u62a5\u6587\u6536\u53d1\"\t\t\t\t\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t
\n\t\t\t\t\t\t\t

\u7ed1\u5b9a\u901a\u90532\u3002<\/p>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t

\n\t\t\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t
\n\t\t\t\t\t\t\t\t\t\t\t\t\t\"\u540c\u661f\u786c\u4ef6\u5982\u4f55\u4f7f\u7528SocketCAN\u8fdb\u884c\u62a5\u6587\u6536\u53d1\"\t\t\t\t\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t
\n\t\t\t\t\t\t\t\t\t\t\t\t\t\"\u540c\u661f\u786c\u4ef6\u5982\u4f55\u4f7f\u7528SocketCAN\u8fdb\u884c\u62a5\u6587\u6536\u53d1\"\t\t\t\t\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t
\n\t\t\t\t\t\t\t

2-2\u3001\u901a\u8fc7cansend\u548ccandump\u6d4b\u8bd5\u865a\u62dfcan\u6570\u636e\u6536\u53d1\u3002\u5206\u522b\u6253\u5f00\u4e24\u4e2a\u7ec8\u7aef\uff0c\u5206\u522b\u8d1f\u8d23\u6570\u636e\u63a5\u6536\u548c\u53d1\u9001\u3002<\/p>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t

\n\t\t\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t
\n\t\t\t\t\t\t\t\t\t\t\t\t\t\"\u540c\u661f\u786c\u4ef6\u5982\u4f55\u4f7f\u7528SocketCAN\u8fdb\u884c\u62a5\u6587\u6536\u53d1\"\t\t\t\t\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t
\n\t\t\t

\u4e09\u3001\u95ee\u9898 Q&A <\/h4>\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t
\n\t\t\t\t\t\t\t

3.1 sudo: .\/sockettscan: command not found<\/b><\/p>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t

\n\t\t\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t
\n\t\t\t\t\t\t\t\t\t\t\t\t\t\"\u540c\u661f\u786c\u4ef6\u5982\u4f55\u4f7f\u7528SocketCAN\u8fdb\u884c\u62a5\u6587\u6536\u53d1\"\t\t\t\t\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t
\n\t\t\t\t\t\t\t

1\uff09\u9009\u62e9sockettscan\u6587\u4ef6\uff0c\u6253\u5f00Properties\u7a97\u53e3\u3002<\/p>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t

\n\t\t\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t
\n\t\t\t\t\t\t\t\t\t\t\t\t\t\"\u540c\u661f\u786c\u4ef6\u5982\u4f55\u4f7f\u7528SocketCAN\u8fdb\u884c\u62a5\u6587\u6536\u53d1\"\t\t\t\t\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t
\n\t\t\t\t\t\t\t

2\uff09\u5728Permissions\u5904\u7684Access\u5168\u90e8\u9009\u62e9Read and write\uff0cGroup\u9009\u62e9sudo\uff0c\u52fe\u9009Execute\u3002<\/p>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t

\n\t\t\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t
\n\t\t\t\t\t\t\t\t\t\t\t\t\t\"\u540c\u661f\u786c\u4ef6\u5982\u4f55\u4f7f\u7528SocketCAN\u8fdb\u884c\u62a5\u6587\u6536\u53d1\"\t\t\t\t\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t
\n\t\t\t\t\t\t\t

3.2 cannot open shared object file<\/b><\/p>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t

\n\t\t\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t
\n\t\t\t\t\t\t\t\t\t\t\t\t\t\"\u540c\u661f\u786c\u4ef6\u5982\u4f55\u4f7f\u7528SocketCAN\u8fdb\u884c\u62a5\u6587\u6536\u53d1\"\t\t\t\t\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t
\n\t\t\t\t\t\t\t

\u5728vcan\u6587\u4ef6\u5939\u4e0b\uff0c\u5c06libTSCANApiOnLinux.so\u548clibTSH.so\u8fd9\u4e24\u4e2a\u5e93\u6587\u4ef6\u590d\u5236\u5230\/usr\/lib\/\u8def\u5f84\u4e0b\u3002<\/p>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t

\n\t\t\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t
\n\t\t\t\t\t\t\t\t\t\t\t\t\t\"\u540c\u661f\u786c\u4ef6\u5982\u4f55\u4f7f\u7528SocketCAN\u8fdb\u884c\u62a5\u6587\u6536\u53d1\"\t\t\t\t\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t
\n\t\t\t\t\t\t\t

\u518d\u6b21\u8fd0\u884c\u8fde\u63a5\u786c\u4ef6\u7684\u547d\u4ee4\u3002<\/p>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t

\n\t\t\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t
\n\t\t\t\t\t\t\t\t\t\t\t\t\t\"\u540c\u661f\u786c\u4ef6\u5982\u4f55\u4f7f\u7528SocketCAN\u8fdb\u884c\u62a5\u6587\u6536\u53d1\"\t\t\t\t\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t\n\t\t\t\t\t\t<\/span>\n\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t
\n\t\t\t\t\t\t\t\u5982\u60a8\u9700\u8981demo\u6216\u54a8\u8be2\u5176\u4ed6\u6280\u672f\u95ee\u9898\uff0c\u53ef\u4ee5\u5728\u5b98\u7f51\u7559\u8a00\u3002\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t
\n\t\t\t\t
\n\t\t\t\t\t