├── 3D └── BIGTREETECH IO2CAN V1.0_3D.pdf ├── Hardware ├── BIGTREETECH IO2CAN V1.0_IO.pdf ├── BIGTREETECH IO2CAN V1.0_SCH.pdf └── BIGTREETECH IO2CAN V1.0_SIZE.pdf ├── Images ├── BoardEnv.png ├── dtb.png ├── mcp2515.png ├── mcp2515_init.png └── mcp2515_switch.png ├── readme.md └── sun50i-h616-biqu.dtb /3D/BIGTREETECH IO2CAN V1.0_3D.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bigtreetech/IO2CAN/7aa11b6a57a8045f61f2dce20f2fa86bf3b65ec8/3D/BIGTREETECH IO2CAN V1.0_3D.pdf -------------------------------------------------------------------------------- /Hardware/BIGTREETECH IO2CAN V1.0_IO.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bigtreetech/IO2CAN/7aa11b6a57a8045f61f2dce20f2fa86bf3b65ec8/Hardware/BIGTREETECH IO2CAN V1.0_IO.pdf -------------------------------------------------------------------------------- /Hardware/BIGTREETECH IO2CAN V1.0_SCH.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bigtreetech/IO2CAN/7aa11b6a57a8045f61f2dce20f2fa86bf3b65ec8/Hardware/BIGTREETECH IO2CAN V1.0_SCH.pdf -------------------------------------------------------------------------------- /Hardware/BIGTREETECH IO2CAN V1.0_SIZE.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bigtreetech/IO2CAN/7aa11b6a57a8045f61f2dce20f2fa86bf3b65ec8/Hardware/BIGTREETECH IO2CAN V1.0_SIZE.pdf -------------------------------------------------------------------------------- /Images/BoardEnv.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bigtreetech/IO2CAN/7aa11b6a57a8045f61f2dce20f2fa86bf3b65ec8/Images/BoardEnv.png -------------------------------------------------------------------------------- /Images/dtb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bigtreetech/IO2CAN/7aa11b6a57a8045f61f2dce20f2fa86bf3b65ec8/Images/dtb.png -------------------------------------------------------------------------------- /Images/mcp2515.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bigtreetech/IO2CAN/7aa11b6a57a8045f61f2dce20f2fa86bf3b65ec8/Images/mcp2515.png -------------------------------------------------------------------------------- /Images/mcp2515_init.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bigtreetech/IO2CAN/7aa11b6a57a8045f61f2dce20f2fa86bf3b65ec8/Images/mcp2515_init.png -------------------------------------------------------------------------------- /Images/mcp2515_switch.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bigtreetech/IO2CAN/7aa11b6a57a8045f61f2dce20f2fa86bf3b65ec8/Images/mcp2515_switch.png -------------------------------------------------------------------------------- /readme.md: -------------------------------------------------------------------------------- 1 | # Hardware setting for MCP2515 SPI to CAN 2 | As shown in the figure below, when used with raspberry pi or CM4, we need to push the switch to the top, and when used with CB1, we need to pull the switch to the bottom. 3 |
4 | 5 | # Software Settings 6 | ## Work with raspberry pi 7 | * Add the following to the raspberry pi `/boot/config.txt` file 8 | ``` 9 | dtparam=spi=on 10 | dtoverlay=mcp2515-can0,oscillator=12000000,interrupt=24,spimaxfrequency=10000000 11 | ``` 12 | and restart raspberry pi 13 | 14 | ## Work with CB1 15 | 1. If the OS image of v2.2.1 version is used, the following dtb files need to be updated for stable use. If the OS image after V2.2.1 is used, this operation is unnecessary. 16 | * Download [sun50i-h616-biqu.dtb](./sun50i-h616-biqu.dtb) 17 | * Replace `/boot/dtb/allwinner/sun50i-h616-biqu.dtb` in the OS with the downloaded [sun50i-h616-biqu.dtb](./sun50i-h616-biqu.dtb).
18 | 2. Uncomment `overlays=mcp2515` in `/boot/BoardEnv.txt`.

19 | 20 | 21 | # Getting started 22 | * Input the `dmesg | grep -i '\(can\|spi\)'` command to test whether MCP2515 has been connected normally after the restart is completed.
23 | The normal response should be as follows 24 | ``` 25 | [ 8.680446] CAN device driver interface 26 | [ 8.697558] mcp251x spi0.0 can0: MCP2515 successfully initialized. 27 | [ 9.482332] IPv6: ADDRCONF(NETDEV_CHANGE): can0: link becomes ready 28 | ``` 29 |
30 | * Input `sudo nano /etc/network/interfaces.d/can0` command to create a new file named `can0`, and write the following content 31 | ``` 32 | auto can0 33 | iface can0 can static 34 | bitrate 500000 35 | up ifconfig $IFACE txqueuelen 1024 36 | ``` 37 | Set the Canbus speed to 500K (consistent with the speed set in klipper), and set the `txqueuelen` to 1024 bytes. Save(`Ctrl + S`) and Exit(`Ctrl + X`) after modification, input `sudo reboot`to restart host 38 | 39 | * Each micro-controller on the CAN bus is assigned a unique id based on the factory chip identifier encoded into each micro-controller. To find each micro-controller device id, make sure the hardware is powered and wired correctly, and then run:
40 | `~/klippy-env/bin/python ~/klipper/scripts/canbus_query.py can0`
41 | If uninitialized CAN devices are detected the above command will report lines like the following:
42 | `Found canbus_uuid=0e0d81e4210c`
43 | set the correct ID number in `printer.cfg`
44 | ``` 45 | [mcu EBB] 46 | canbus_uuid: 0e0d81e4210c 47 | ``` 48 | -------------------------------------------------------------------------------- /sun50i-h616-biqu.dtb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bigtreetech/IO2CAN/7aa11b6a57a8045f61f2dce20f2fa86bf3b65ec8/sun50i-h616-biqu.dtb --------------------------------------------------------------------------------