'모종의 음모/CAN'에 해당되는 글 16건

  1. 2025.02.18 can-utils(cansend, candump)
  2. 2024.01.09 can invader
  3. 2023.10.31 CAN(controller area network)
  4. 2023.10.31 MCP2515 on rpi
  5. 2023.10.30 mcp2515 can
  6. 2015.01.23 CAN 통신 우선순위
모종의 음모/CAN2025. 2. 18. 16:43

cansend는 보내고

candump는 받는 녀석이다.

 

$ cansend can0 canid#userdata

로 하면 특정 canid로 보낼 수 있고

$ cansend --help
cansend - send CAN-frames via CAN_RAW sockets.

Usage: cansend <device> <can_frame>.

<can_frame>:
 <can_id>#{data}          for 'classic' CAN 2.0 data frames
 <can_id>#R{len}          for 'classic' CAN 2.0 data frames
 <can_id>##<flags>{data}  for CAN FD frames

<can_id>:
 3 (SFF) or 8 (EFF) hex chars
{data}:
 0..8 (0..64 CAN FD) ASCII hex-values (optionally separated by '.')
{len}:
 an optional 0..8 value as RTR frames can contain a valid dlc field
<flags>:
 a single ASCII Hex value (0 .. F) which defines canfd_frame.flags

Examples:
  5A1#11.2233.44556677.88 / 123#DEADBEEF / 5AA# / 123##1 / 213##311223344 /
  1F334455#1122334455667788 / 123#R / 00000123#R3

 

candump 에서는 아래와 같이 하면 특정 id로만 확인할 수 있다.

$ candump can0,canid 

$ candump --help
candump: invalid option -- '-'
candump - dump CAN bus traffic.

Usage: candump [options] <CAN interface>+
  (use CTRL-C to terminate candump)

Options:
         -t <type>   (timestamp: (a)bsolute/(d)elta/(z)ero/(A)bsolute w date)
         -H          (read hardware timestamps instead of system timestamps)
         -c          (increment color mode level)
         -i          (binary output - may exceed 80 chars/line)
         -a          (enable additional ASCII output)
         -S          (swap byte order in printed CAN data[] - marked with '`' )
         -s <level>  (silent mode - 0: off (default) 1: animation 2: silent)
         -l          (log CAN-frames into file. Sets '-s 2' by default)
         -L          (use log file format on stdout)
         -n <count>  (terminate after reception of <count> CAN frames)
         -r <size>   (set socket receive buffer to <size>)
         -D          (Don't exit if a "detected" can device goes down.
         -d          (monitor dropped CAN frames)
         -e          (dump CAN error frames in human-readable format)
         -x          (print extra message infos, rx/tx brs esi)
         -T <msecs>  (terminate after <msecs> without any reception)

Up to 16 CAN interfaces with optional filter sets can be specified
on the commandline in the form: <ifname>[,filter]*

Filters:
  Comma separated filters can be specified for each given CAN interface:
    <can_id>:<can_mask>
         (matches when <received_can_id> & mask == can_id & mask)
    <can_id>~<can_mask>
         (matches when <received_can_id> & mask != can_id & mask)
    #<error_mask>
         (set error frame filter, see include/linux/can/error.h)
    [j|J]
         (join the given CAN filters - logical AND semantic)

CAN IDs, masks and data content are given and expected in hexadecimal values.
When the can_id is 8 digits long the CAN_EFF_FLAG is set for 29 bit EFF format.
Without any given filter all data frames are received ('0:0' default filter).

Use interface name 'any' to receive from all CAN interfaces.

Examples:
candump -c -c -ta can0,123:7FF,400:700,#000000FF can2,400~7F0 can3 can8

candump -l any,0~0,#FFFFFFFF
         (log only error frames but no(!) data frames)
candump -l any,0:0,#FFFFFFFF
         (log error frames and also all data frames)
candump vcan2,12345678:DFFFFFFF
         (match only for extended CAN ID 12345678)
candump vcan2,123:7FF
         (matches CAN ID 123 - including EFF and RTR frames)
candump vcan2,123:C00007FF
         (matches CAN ID 123 - only SFF and non-RTR frames)

 

'모종의 음모 > CAN' 카테고리의 다른 글

candump, cansend와 vcan  (0) 2025.02.19
linux can 테스트(가상 CAN IF)  (0) 2025.02.18
can invader  (0) 2024.01.09
CAN(controller area network)  (0) 2023.10.31
MCP2515 on rpi  (0) 2023.10.31
Posted by 구차니
모종의 음모/CAN2024. 1. 9. 11:29

렉서스랑 토요타 차량 두가지 종류가 타이어 옆으로 해서 헤드라이트의 커넥터에 접근이 가능하도록

물리보안적인 측면에서 허술하게 만들어져 발생한 사건으로 보인다.

can이라서 접근성이 좋지 않아 이정도인데

현재~근미래에 can에서 ethernet으로 전환하게 되면 너무 손쉽게 뚫리지 않을까 걱정된다.

기본적으로 통신은 보안채널로 하게 되려나?

 

렉서스 차량 99대와 토요타 랜드크루저 92대가 도난

[링크 : https://v.daum.net/v/1OAq5WD7kL]

 

 

+

BroadR-Reach

 

BroadR-Reach technology is an Ethernet physical layer standard designed for automotive connectivity applications

[링크 : https://en.wikipedia.org/wiki/BroadR-Reach]

 

 

[링크 : https://m.blog.naver.com/lecroykorea/221105708892]

[링크 : https://m.blog.naver.com/lecroykorea/221065291291]

[링크 : https://m.blog.naver.com/lecroykorea/221069260339]

'모종의 음모 > CAN' 카테고리의 다른 글

linux can 테스트(가상 CAN IF)  (0) 2025.02.18
can-utils(cansend, candump)  (0) 2025.02.18
CAN(controller area network)  (0) 2023.10.31
MCP2515 on rpi  (0) 2023.10.31
mcp2515 can  (0) 2023.10.30
Posted by 구차니
모종의 음모/CAN2023. 10. 31. 23:15

TJA1050 입력 전압을 보는데  dominant / recessive란게 나와서 보니

[링크 : https://www.nxp.com/docs/en/data-sheet/TJA1050.pdf]

 

CAN은 H 와 L 라인의 전위차로 0과 1을 구분한다고 한다.

0이  dominant 라는데 어째 0과 1이 반대인 느낌이다?

아무튼 3.3V면 bus state가 recessive로 잡힌다는건가?

[링크 : https://m.blog.naver.com/lagrange0115/221941482740]

 

[링크 : https://ww1.microchip.com/downloads/en/DeviceDoc/MCP2515-Stand-Alone-CAN-Controller-with-SPI-20001801J.pdf]

'모종의 음모 > CAN' 카테고리의 다른 글

can-utils(cansend, candump)  (0) 2025.02.18
can invader  (0) 2024.01.09
MCP2515 on rpi  (0) 2023.10.31
mcp2515 can  (0) 2023.10.30
CAN 통신 우선순위  (0) 2015.01.23
Posted by 구차니
모종의 음모/CAN2023. 10. 31. 23:05

MCP2515를 라즈베리에서 쓰려면 개조가 필요하다는데

아두이노가 5V IO 레벨이고 라즈베리가 3.3V 레벨이라 그런가? 왜 저렇게 복잡하게 개조하는건진 찾아봐야겠고

집에 16MHz OSC가 있나도 찾아봐야겠다.(12MHz 24MHz는 있는데 16MHz 만 없네 -_-)

[링크 : https://blog.naver.com/mts90/221644429413]

 

반대로 SPI 를 위한 레벨시프터가 있으면 해결되려나?

[링크 : https://www.devicemart.co.kr/goods/view?no=1384307] 2채널 3.3V<->5V 레벨 시프터 / 1000원

 

구매시 16MHz 인지 확인하는것도 방법이려나

[링크 : https://m.blog.naver.com/kimhj9/221790064284]

 

트랜시버의 전압을 바꾸어 주는거라면 라즈베리 끼리 테스트 할때 그냥 3.3V 넣어서

양쪽다 동일 전압레벨로 맞추면 통신이 안되려나?

 

설정 내용을 보니 spi를 통해서 can 통신 장치 추가 까지 문제 없어 보인다.

$ vi /boot/config.txt
dtoverlay=mcp2515-can0,oscillator=8000000,interrupt=12
dtoverlay=spi-bcm2835-overlay

$ sudo apt-get install can-utils

$ ls /sys/bus/spi/devices/spi0.0/net
can0

$ ls /sys/bus/spi/devices/spi0.0
driver  modalias  net  of_node  subsystem  uevent

$ ls /sys/bus/spi/devices/spi0.0/net/
can0

$ ls /sys/bus/spi/devices/spi0.0/net/can0/
addr_assign_type  carrier_changes  duplex             iflink            operstate       speed         uevent
address           device           flags              link_mode         phys_port_id    statistics
addr_len          dev_id           gro_flush_timeout  mtu               phys_port_name  subsystem
broadcast         dev_port         ifalias            name_assign_type  phys_switch_id  tx_queue_len
carrier           dormant          ifindex            netdev_group      queues          type

// 5. Setup CAN interface, I use 125k baudrate.
$ sudo ip link set can0 up type can bitrate 125000
$ sudo ifconfig
can0      Link encap:UNSPEC  HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
          UP RUNNING NOARP  MTU:16  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:10
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

[링크 : https://forums.raspberrypi.com/viewtopic.php?t=141052]

 

TJA1050 - High speed CAN tranceiver

[링크 : https://www.nxp.com/docs/en/data-sheet/TJA1050.pdf]

 

'모종의 음모 > CAN' 카테고리의 다른 글

can-utils(cansend, candump)  (0) 2025.02.18
can invader  (0) 2024.01.09
CAN(controller area network)  (0) 2023.10.31
mcp2515 can  (0) 2023.10.30
CAN 통신 우선순위  (0) 2015.01.23
Posted by 구차니
모종의 음모/CAN2023. 10. 30. 19:11

아두이노나 라즈베리 CAN HAT 은 3~4만원은 해서 구매하기 부담스러웠는데

MCP2515 라는 녀석은 CAN to SPI 라고 해야하나?

CAN 통신을 독립적으로 수행해주는 원칩 솔루션이 있으니 다음에 사봐야겠다.

 

[링크 : http://itempage3.auction.co.kr/DetailView.aspx?itemno=B509249430] 3700

[링크 : http://itempage3.auction.co.kr/DetailView.aspx?itemno=C297097222] 2700

 

차량에 OBD 연결하기도 한다는데 의외로 2.54mm 핀 헤더와 잘 맞는듯?

[링크 : https://clemencyking.tistory.com/26]

 

보드가 8MHz와 16Mhz가 있다는데

크리스탈은 4 / 8 / 20 MHz 권장인가?

HS SPI의 경우 10Mbps 라는데 아무래도 클럭 멀티플라이어가 없다면

20MHz를 넣어줘야 HS SPI 로 작동하게 될 것 같긴하네.

[링크 : https://ww1.microchip.com/downloads/en/DeviceDoc/MCP2515-Stand-Alone-CAN-Controller-with-SPI-20001801J.pdf]

'모종의 음모 > CAN' 카테고리의 다른 글

can-utils(cansend, candump)  (0) 2025.02.18
can invader  (0) 2024.01.09
CAN(controller area network)  (0) 2023.10.31
MCP2515 on rpi  (0) 2023.10.31
CAN 통신 우선순위  (0) 2015.01.23
Posted by 구차니
모종의 음모/CAN2015. 1. 23. 08:48

dominant - logical 0 / actively driven to a voltage

recessive - logical 1/ passively return


왜이리 어려운 단어를 썼나 했더니

전기적으로 신호를 설계해서

0과 1이 충돌되면 0이 우세(우성)하게 판결되어 1을 씹어먹는다.

그래서 0 이 우선권을 가지고 데이터를 전송하여 "실시간 전송" 성격에 적합하다는 말씀(?)


CAN data transmission uses a lossless bit-wise arbitration method of contention resolution. This arbitration method requires all nodes on the CAN network to be synchronized to sample every bit on the CAN network at the same time. This is why some call CAN synchronous. Unfortunately the term synchronous is imprecise since the data is transmitted without a clock signal in an asynchronous format.
The CAN specifications use the terms "dominant" bits and "recessive" bits where dominant is a logical 0 (actively driven to a voltage by the transmitter) and recessive is a logical 1 (passively returned to a voltage by a resistor). The idle state is represented by the recessive level (Logical 1). If one node transmits a dominant bit and another node transmits a recessive bit then there is a collision and the dominant bit "wins". The means there is no delay to the higher priority message, and the node transmitting the lower priority message automatically attempts to re-transmit six bit clocks after the end of the dominant message. This makes CAN very suitable as a real time prioritized communications system.

[링크 : http://en.wikipedia.org/wiki/CAN_bus#Data_transmission]


dominant / 우성의

[링크 : http://endic.naver.com/enkrEntry.nhn?sLn=kr&entryId=7371ab1c34a84fab8bc699af491763d4&query=dominant]


recessive / 열성의

[링크 : http://endic.naver.com/enkrEntry.nhn?sLn=kr&entryId=087f00309f264a60ab6d787e5792a02a&query=recessive]

'모종의 음모 > CAN' 카테고리의 다른 글

can-utils(cansend, candump)  (0) 2025.02.18
can invader  (0) 2024.01.09
CAN(controller area network)  (0) 2023.10.31
MCP2515 on rpi  (0) 2023.10.31
mcp2515 can  (0) 2023.10.30
Posted by 구차니