Android application layer CAN bus test program

1. CAN device description
   The operation of CAN device is based on the network socket programming mode. In the Linux command line mode, use the following command to set it:
   ip link set can0 type can bitrate 125000 triple-sampling
   on One CAN (CAN0) device sets its baud rate, 125000 means to set the baud rate to 125K. If set to 1Mbps, this parameter is 1000000.
   triple-sampling on: Indicates that three samplings are turned on. It is recommended to use this parameter at a lower baud rate. If the baud rate is high, such as 500Kbps, it is recommended to turn it off:
   after triple-sampling off is set, you can use:
   ifconfig can0 up
   to turn on the first CAN. Note that the CAN device must be turned off when setting the baud rate:
   ifconfig can0 down
2. For the specific program code of the programming method,
   please refer to the relevant program code examples in the test program directory cansend and canrecv directory. You can compile the sending and receiving programs and do a test. Take the cansend command as an example:
   cansend can0 123#1122334455667788 10
   The first parameter is the CAN device number, and
   the second parameter of can0/can1 is: can_id + # + 8 bytes The data, id can be SFF standard frame mode or EFF extended frame mode.

   The third parameter is: the time interval sent between each frame, in milliseconds, 10 means 10 milliseconds.

Self-test OK

Code https://download.csdn.net/download/ldinvicible/10370593



Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324773458&siteId=291194637