translator, wb_editors
4285
правок
Matveevrj (обсуждение | вклад) (Новая страница: «The CAN interface will rise by itself when: * system boot - service <code>wb-hwconf-manager</code> is responsible for this, * change the RS-485/2 port mode to «CAN».») |
Matveevrj (обсуждение | вклад) (Новая страница: «For more information see the «AmadeuS» wiki article «[http://www.armadeus.com/wiki/index.php?title=CAN_bus_Linux_driver CAN bus Linux driver]».») Метки: правка с мобильного устройства правка из мобильной версии |
||
(не показано 5 промежуточных версий этого же участника) | |||
Строка 16: | Строка 16: | ||
* change the RS-485/2 port mode to «CAN». | * change the RS-485/2 port mode to «CAN». | ||
==== | ==== Using standard linux tools (automatically) ==== | ||
The '''Network Interfaces''' section of the web interface is a wrapper around the <code>/etc/network/interfaces</code> file, so CAN configuration can be done using the debian network management service. For this you need: | |||
# | # Add to <code>/etc/network/interfaces</code> an entry like this: | ||
#:<syntaxhighlight lang="bash"> | #:<syntaxhighlight lang="bash"> | ||
allow-hotplug can0 | allow-hotplug can0 | ||
Строка 24: | Строка 24: | ||
bitrate 125000 | bitrate 125000 | ||
</syntaxhighlight> | </syntaxhighlight> | ||
# | # Switch RS-485-2 port to CAN mode | ||
We will get a result similar to setting through the web-interface. | |||
==== | ==== Using standard linux tools (manually) ==== | ||
After switching the port to CAN mode, you need to do: | |||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
ip link set can0 up type can bitrate 125000 | ip link set can0 up type can bitrate 125000 | ||
</syntaxhighlight> | </syntaxhighlight> | ||
== | == Working with CAN == | ||
The <code>cansend</code> and <code>candump</code> utilities are included in the controller's standard software package. If for some reason they are not there, you can install the <code>can-utils</code> package: | |||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
apt update && apt install can-utils | apt update && apt install can-utils | ||
</syntaxhighlight> | </syntaxhighlight> | ||
Command examples: | |||
* | * Sending four bytes with address 123: | ||
*:<syntaxhighlight lang="bash"> | *:<syntaxhighlight lang="bash"> | ||
cansend can0 123#DEADBEEF | cansend can0 123#DEADBEEF | ||
</syntaxhighlight> | </syntaxhighlight> | ||
* | * Show incoming packets: | ||
*:<syntaxhighlight lang="bash"> | *:<syntaxhighlight lang="bash"> | ||
candump can0 | candump can0 | ||
</syntaxhighlight> | </syntaxhighlight> | ||
* | * Show statistics: | ||
*:<syntaxhighlight lang="bash"> | *:<syntaxhighlight lang="bash"> | ||
cat /proc/net/can/stats | cat /proc/net/can/stats | ||
Строка 58: | Строка 58: | ||
Please note that in case of problems on the bus (no terminator, no receiving device, short circuit), the controller may stop working. | |||
To start working again, run: | |||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
ifconfig can0 down && ip link set can0 up type can bitrate 125000 | ifconfig can0 down && ip link set can0 up type can bitrate 125000 | ||
</syntaxhighlight> | </syntaxhighlight> | ||
For more information see the «AmadeuS» wiki article «[http://www.armadeus.com/wiki/index.php?title=CAN_bus_Linux_driver CAN bus Linux driver]». |