Reputation: 364
I am making a research about CAN bus, and I need to see how it works. Is there a way to simulate simple CAN bus instructions? What hardware I must have for this purpose?
P.S: I am very new to topic.
Upvotes: 0
Views: 509
Reputation: 657
To simulate can
instructions you don't need any hardware. You can use socketcan
under Linux and setup a virtual can-interface.
After you have setup the virtual can-interface vcan0
, to try first things install can-utils
:
sudo apt install can-utils
Then listen on the virtual can interface vcan0
by executing
candump vcan0
On another terminal send for example a can frame (with identifier 123
) with 3 bytes of data 0x123456
to the interface vcan0
via
cansend vcan0 123#123456
You should also see the sent can-frame on the other terminal, where you executed candump vcan0
.
In case you really want to "talk" to a real CAN-network you need hardware. One good and cost-effective way, would be to use a Raspberry Pi with a CAN-extension shield. Also there you can use socketcan
+ can-utils
.
Upvotes: 2