CAN SDK

From ElectroDragon Wiki
Revision as of 16:54, 28 October 2024 by Chao (talk | contribs) (→‎EDCAN Test)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Our Boards Test Link

  • Arduino + MCP2551 CAN Module <-> Raspberry CAN RS485 Shield <-> USB-CAN sLCAN Board
  • Any of these two will work.

Monitor List

Header text Protocol Header text
USBtin SLCAN https://www.fischl.de/usbtin/
cantact-app SLCAN https://github.com/linklayer/cantact-app/releases
UCCBviewer SLCAN https://github.com/UsbCANConverter-UCCbasic/uCCBViewer/releases
Cangaroo CandleLight https://canable.io/utilities/cangaroo-win32-0363ce7.zip
Linux CAN / CAN utilis -

Firmware

SLCAN

CAN UCCB Commands

UCCB examples

000005: C  (send close command) 
000006: v  (ask for firmware version)
000007: v0102 (get version number from device)
000008: V   (ask for hardware version)
000009: V0101
000010: N   
000011: N16000000
000012: W2D00
000013:
000014: S8  (set speed to 1000000 b/s)
000015: 
000016: O   (open CAN for frame transmission and reception)
000017: 
000018: t00181122334455667788 (transmit frame type standard id = 1 length 8 bytes)
000019: z
000020: t0890
000021: M00007000000010000000010    (set id filter for ID=1 and ID=1)

data command: t00181122334455667788 = t / 001 / 8 / 11 22 33 44 55 66 77 88

  • 001 is identifier, length = 8bytes

CandleLight w/GS_USB

Linux | RPI

config SPI CAN: edit in file /boot/config.txt, and add following line

dtparam=spi=on
dtoverlay=mcp2515-can0,oscillator=12000000,interrupt=25,spimaxfrequency=2000000

Reboot and check if installed: dmesg | grep -i '\(can\|spi\)'

[    3.443582] CAN device driver interface
[    3.469391] mcp251x spi0.0 can0: MCP2515 successfully initialized.

Python

  • first install library sudo pip install python-can
msg = bus.recv(10.0) #timeout 10 seconds
  • Test send from USB CAN C = close port, S3 = set to 100K speed, O = open port, t00181122334455667788 = send data
  • Test receive: root@work:/home/pi/rpi/interface/CAN/python# python receive.py
Timestamp: 1576078751.049400        ID: 0001    S                DLC:  8    11 22 33 44 55 66 77 88     Channel: can0
  • Bitrate - 100000 (100K S3), 1000 000(1M S8)

Documents

arduino MCP2515 library demo

Arduino SLCAN

USB serial SLCAN

firmware

Reference Tutorial