User Tools

Site Tools


can_interfaces

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
can_interfaces [2024/03/09 19:31] – [CANable] rivercan_interfaces [2025/02/02 15:30] (current) river
Line 1: Line 1:
 ====== CAN Interfaces ====== ====== CAN Interfaces ======
  
-USB CAN adapters can show as follows on Linux.+USB CAN adapters can appear as follows on Linux. 
 + 
 +===== SocketCAN ===== 
 + 
 +A can network device appears. e.g. can0, shown by ifconfig. 
 + 
 +Set bitrate for NMEA2000 and bring up CAN interface: 
 + 
 +''ip link set can0 up type can bitrate 250000'' 
 + 
 +It seems SignalK doesn't do this itself. 
 + 
 +[[https://www.kernel.org/doc/html/v5.11/networking/can.html|Kernel SocketCAN docs]]  
  
 ===== Serial Line CAN ===== ===== Serial Line CAN =====
  
-serial port appears. slcand can talk to it.+Some USB to CAN adapters may run a firmware that presents as a CDC-ACM serial port, e.g. CANable devices. **slcand** can talk to the devices over the virtual serial port and create a standard SocketCAN device, at which point you can continue the same as with a native SocketCAN adapter.
  
-===== SocketCAN =====+''slcand -o -s5 /dev/ttyACMx''
  
-A can network device appears. e.g. can0, shown by ifconfig.+The -s arguments sets the CAN bus speed: 
 +<file> 
 +    -s0 = 10k 
 +    -s1 = 20k 
 +    -s2 = 50k 
 +    -s3 = 100k 
 +    -s4 = 125k 
 +    -s5 = 250k 
 +    -s6 = 500k 
 +    -s7 = 750k 
 +    -s8 = 1M 
 +</file>
  
-Manually set bitrate for NMEA2000 (prob not normally needed):+===== Analysers =====
  
 +==== Canboat ====
 +
 +Install Linux SocketCAN tools:
 +''sudo apt install can-utils''
 +
 +Configure SocketCAN interface:
 ''ip link set can0 up type can bitrate 250000'' ''ip link set can0 up type can bitrate 250000''
  
-Might be useful for running wireshark though if not otherwise configured by something.+Use canboat analyzer tool: 
 +''candump can0 | candump2analyzer | analyzer''
  
-===== Wireshark =====+==== Wireshark ====
  
 Can open SocketCAN interfaces, like ''can0''. Select ''Analyze -> Decode As'', and in the last column of the table you can click to set it to ''J1939''. This will decode as far as giving you PGNs. I didn't find an NMEA2000 decoder, but this at least tells you data is flowing. Can open SocketCAN interfaces, like ''can0''. Select ''Analyze -> Decode As'', and in the last column of the table you can click to set it to ''J1939''. This will decode as far as giving you PGNs. I didn't find an NMEA2000 decoder, but this at least tells you data is flowing.
- 
-[[https://www.kernel.org/doc/html/v5.11/networking/can.html]] 
  
 ===== Hardware ===== ===== Hardware =====
Line 28: Line 56:
  
 CANable is a USB - CAN interface using an STM32F072. CANable firmware does slcan. The same device can be flashed with candleLight firmware which does Linux native / SocketCAN. I bought a device from Aliexpress which came with candleLight. CANable is a USB - CAN interface using an STM32F072. CANable firmware does slcan. The same device can be flashed with candleLight firmware which does Linux native / SocketCAN. I bought a device from Aliexpress which came with candleLight.
 +
 +[[https://www.aliexpress.com/item/1005006032351087.html]]
 +
 +==== Waveshare Pico CAN ====
 +
 +[[waveshare_pico_can|Waveshare Pico CAN]]
 +
 +==== NMEA2000 - USB Interface ====
 +
 +[[ngt-1|Actisense NGT-1]]
 +
can_interfaces.1710012700.txt.gz · Last modified: 2024/03/09 19:31 by river

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki