CAN/en: различия между версиями

Материал из Wiren Board
(Новая страница: «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.»)
Строка 2: Строка 2:
Can ports are available in the system as can0 or can1 network interfaces, depending on the controller model.  
Can ports are available in the system as can0 or can1 network interfaces, depending on the controller model.  


Работа происходит через стандартную подсистему Linux SocketCAN.
The work takes place through the standard Linux SocketCAN subsystem.


Для удобной работы с CAN, нужно поставить пакет apt-get install can-utils
Для удобной работы с CAN, нужно поставить пакет apt-get install can-utils

Версия 19:46, 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.

Для удобной работы с CAN, нужно поставить пакет apt-get install can-utils

Переключите порт RS-485/CAN в режим CAN: На вкладке Hardware Modules Configuration выберите настройки RS485-2/CAN interface config, выберите Module type CAN interface и нажмите кнопку Save. 400px|right||Module type CAN 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


Больше информации смотрите в статье.