My first SOCKETCAN + WireShark session!

SOCKETCAN capturing random generate frames on a virtual CAN network...


1. Firstly, you need to install some SocketCAN utilities and tools: 
               
https://github.com/linux-can/can-utils

 $ sudo apt-get install can-utils

2. Create a virtual CAN node (vcan0, for example):

$ sudo modprobe vcan
$ sudo ip link add vcan0 type vcan
$ sudo ip link set vcan0 up
 

3. Now, you must call at the random CAN frames generator: 

$ sudo cangen vcan0




3. Then you can open a second ubuntu terminal and run the next command:

 $ candump -cae vcan0,0:0,#FFFFFFFF


But all these can bus packages are better framed on WireShark:






With this you can too already send and receive CAN packets on your virtual CAN network. Try this by running candump in one terminal and sending CAN data with cansend in another:

  

   
 

and the result of this virtual communication...


  
 
In the next link you can find also a very simple implementation of CAN FD 
support for Virtual CAN on SocketCAN:
 
 
https://stackoverflow.com/questions/36568167/can-fd-support-for-virtual-can-vcan-on-socketcan
 


Comments