CAN/en: различия между версиями
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]».») Метки: правка с мобильного устройства правка из мобильной версии |
(Новая страница: «Configuring the interface») |
||
(не показано 17 промежуточных версий 3 участников) | |||
Строка 1: | Строка 1: | ||
<languages/> | <languages/> | ||
Can ports are available in the system as can0 or can1 network interfaces, depending on the controller model. | |||
The work takes place through the standard Linux SocketCAN subsystem. | |||
For easy work with CAN, you need to install the package 'apt-get install can-utils' | |||
Switch the RS-485/CAN port to CAN mode: On the Hardware Modules Configuration tab, select 'RS485-2/CAN interface config' settings, select 'Module type' '''CAN interface''', and click 'Save'. | |||
[[Special:MyLanguage/Файл:Can_enable.png|400px|right||Module type '''CAN interface''']] | |||
Configuring the interface | |||
<pre> | |||
ip link set can0 up type can bitrate 125000 | ip link set can0 up type can bitrate 125000 | ||
</ | </pre> | ||
отправка 4 байтов c адресом 123: | |||
<pre> | |||
cansend can0 123#DEADBEEF | cansend can0 123#DEADBEEF | ||
</ | </pre> | ||
показывать входящие пакеты: | |||
<pre> | |||
candump can0 | candump can0 | ||
</ | </pre> | ||
показать статистику: | |||
<pre> | |||
cat /proc/net/can/stats | cat /proc/net/can/stats | ||
</ | </pre> | ||
Обратите внимание, что в случае проблем на шине (нет терминатора, нет принимающего устройства, короткое замыкание), контроллер может прекратить работу. | |||
Для того, чтобы начать работу вновь, выполните | |||
< | |||
<pre> | |||
ifconfig can0 down && ip link set can0 up type can bitrate 125000 | ifconfig can0 down && ip link set can0 up type can bitrate 125000 | ||
</ | </pre> | ||
Больше информации смотрите в [http://www.armadeus.com/wiki/index.php?title=CAN_bus_Linux_driver статье]. |
Версия 19:47, 29 мая 2019
Can ports are available in the system as can0 or can1 network interfaces, depending on the controller model.
The work takes place through the standard Linux SocketCAN subsystem.
For easy work with CAN, you need to install the package 'apt-get install can-utils'
Switch the RS-485/CAN port to CAN mode: On the Hardware Modules Configuration tab, select 'RS485-2/CAN interface config' settings, select 'Module type' CAN interface, and click 'Save'. 400px|right||Module type CAN interface
Configuring the interface
ip link set can0 up type can bitrate 125000
отправка 4 байтов c адресом 123:
cansend can0 123#DEADBEEF
показывать входящие пакеты:
candump can0
показать статистику:
cat /proc/net/can/stats
Обратите внимание, что в случае проблем на шине (нет терминатора, нет принимающего устройства, короткое замыкание), контроллер может прекратить работу.
Для того, чтобы начать работу вновь, выполните
ifconfig can0 down && ip link set can0 up type can bitrate 125000
Больше информации смотрите в статье.