Personal tools

Log in

Changes

From IGEP - ISEE Wiki

Jump to: navigation, search

How to use CAN bus

1,202 bytes added, 12:54, 10 September 2012
m
IGEPv2 EXPANSION
=== IGEPv2 EXPANSION ===
The IGEPv2 EXPANSION provides a CAN interface using MCP2515.<br>
*canplayer: send CAN frames from a file to a CAN interface.
In order to test the CAN interface you can connect IGEPv2 EXPANSION to a CAN device or network or to another IGEPv2 EXPANSION. <section begin=IGEPv2 EXPANSION />You have to connect the two boards like this:<br>
In the last case, you have to connect the two boards like this:<br>   Board IGEPv2 1 Board IGEPv2 2
.--- .---
| 1 |-X X-| 1 |
If you want to send CAN data, use:
cansend can0 123#AABBCCDD cansend can0 123#R cansend can0 1F334455#1122334455667788 cansend can0 1F334455#R-i 0x123 0xaa 0xbb 0xcc 0xdd
On the receiver side, you must see the following messages:
can0 123 [4] AA BB CC DDaa bb cc dd Switch roles and try it again <section end=IGEPv2 EXPANSION /> === IGEP BERLIN === The IGEP BERLIN provides a CAN interface using MCP2515.<br>  Several tools are provided by socketCAN to use this controller:  *candump: dump traffic on a CAN network. *cansend: simple command line tool to send CAN-frames via CAN_RAW sockets. *cangen: CAN frames generator for testing purpose. *canplayer: send CAN frames from a file to a CAN interface. In order to test the CAN interface you can connect IGEP BERLIN to a CAN device or network or to another IGEP BERLIN.You have to connect the two boards like this:<br>   Board 1 Board 2 .--- .--- can0 | 1 |------------------| 1 | 123 | 2 |------------------| 2 | [0] remote request| 3 |------------------| 3 | can0 | 4 |-X X-| 4 | 1F334455 | 5 |-X X-| 5 | [8] 11 22 33 44 55 66 77 88.--- .--- Now you can set up the interface (on all boards when using multiple IGEP BERLIN <span lang="en" id="result_box" class="short_text"><span title="Click for alternate translations" class="hps">connected to a CAN network simultaneously)</span></span>:<br>   /bin/ip link set can0 up type can bitrate 125000 If you want to receive CAN data, use:   1F334455 candump can0 If you want to send CAN data, use:   [0] remote requestcansend can0 -i 0x123 0xaa 0xbb 0xcc 0xdd On the receiver side, you must see the following messages:
Switch roles and try it again can0 123 [4] aa bb cc dd
<br> Switch roles and try it again
[[Category:CAN_busCAN bus]]
4,199
edits