Chridster1 0 Posted July 27, 2022 Morning Forum! I have the Tinkerboard 2S and am running Tinker OS v2.0.4. We have a Microchip MCP2515 SPI ( https://ww1.microchip.com/downloads/en/DeviceDoc/MCP2515-Stand-Alone-CAN-Controller-with-SPI-20001801J.pdf ). I've recompiled the kernel and enabled CAN over SPI linaro@linaro-alip:~$ dmesg | grep -i can: [ 2.368374] vcan: Virtual CAN interface driver [ 4.476074] can: controller area network core (rev 20120528 abi 9) [ 4.486845] can: raw protocol (rev 20120528) [ 4.491137] can: broadcast manager protocol (rev 20120528 t) [ 4.496819] can: netlink gateway (rev 20130117) max_hops=1 Has anyone got this working? Everything I see seems to be for the Raspberry pi and doesn't work on TB2S Many thanks Share this post Link to post Share on other sites
tooz 53 Posted July 28, 2022 hello @Chridster1, i'm a little confused with the title -- i2c is not supported for the mcp2515. are you trying to enable mcp2515 with spi interface? Share this post Link to post Share on other sites
Chridster1 0 Posted July 28, 2022 Hiya, sorry yeah the title is wrong, It mentions SPI in the actual body. Can I ammend the title? Cheers Share this post Link to post Share on other sites
tooz 53 Posted July 29, 2022 hello @Chridster1, got it, the overlay.dts can be downloaded here: https://www.asuswebstorage.com/navigate/a/#/s/725148C84DAD433198389FD8685713564 please use the 4 SPI1 pins and one GPIO pin (GP3D4) for interrupts and and follow along: 1. sudo vi /boot/config.txt intf:spi1=on overlay=mcp2515-can0 2. dtc -O dtb -o mcp2515-can0.dtbo -b 0 -@ mcp2515-can0-overlay.dts sudo cp mcp2515-can0.dtbo /boot/overlays/mcp2515-can0.dtbo 3. Make kernel modules and add the below kernel configs, and then reboot the device CONFIG_CAN=y CONFIG_CAN_MCP251X=y Share this post Link to post Share on other sites
Chridster1 0 Posted July 29, 2022 Fantastic tooz, Sorry for the confusion. I'll give the above a go now. I2C does work fine on the TB so if I can get SPI then you've made my weekend. Share this post Link to post Share on other sites
Chridster1 0 Posted July 29, 2022 Hi @tooz, It's done something cause when I run the following linaro@linaro-alip:/sys/bus$ dmesg|egrep -i 'can0|can1|mcp' [ 2.381288] mcp251x spi1.0: Looking up vdd-supply from device tree [ 2.381301] mcp251x spi1.0: Looking up vdd-supply property in node /spi@ff1d0000/mcp2515@0 failed [ 2.381328] mcp251x spi1.0: Looking up xceiver-supply from device tree [ 2.381339] mcp251x spi1.0: Looking up xceiver-supply property in node /spi@ff1d0000/mcp2515@0 failed I can see the mcp251x output which it hasn't done before. I'll ask our hardware guys to check the pins are wired as above and let you know. Thanks again for the help Chris Share this post Link to post Share on other sites
Chridster1 0 Posted August 24, 2022 Hi @tooz Sorry for the late reply, I've been on holiday and only just got back to this now. I've noticed that the new version of Tinker OS https://dlcdnets.asus.com/pub/ASUS/Embedded_IPC/Tinker Board 2/Tinker_Board_2-Debian-Buster-v2.1.6-20220503.zip won't boot once we've made the changes to the kernel as above and flashed. I haven't tried compiling on the Tinkerboard which is my next move. The older version of Tinker OS https://dlcdnets.asus.com/pub/ASUS/Embedded_IPC/Tinker Board 2/Tinker_Board_2-Debian-Buster-v2.0.4-20211222.zip will allow me to update the kernel. I'll let you know how compiling on the TB works out Thanks Share this post Link to post Share on other sites
Chridster1 0 Posted August 24, 2022 It failed to compile on the TB /bin/sh: 1 : lz4c: not found so done sudo apt-get install lz4 and that error went away, might be an idea to add that as a requirement on https://github.com/TinkerBoard/TinkerBoard/wiki/Developer-Guide#kernel-44 Cheers Share this post Link to post Share on other sites
Chridster1 0 Posted August 25, 2022 Morning all, I tried to compile on the TB and it failed to boot again. Share this post Link to post Share on other sites
M@riusz 0 Posted December 23, 2022 Hello, Did you manage to prepare the os to communicate with mcp2515? I tried to configure the os for mcp2515 on kernel version 4.4.194 but the system does not boot after uploading mcp2515-can0.dtbo to /boot/overlays/ Share this post Link to post Share on other sites
tooz 53 Posted December 30, 2022 hello @M@riusz, please check if you can configure mcp2515 with the os: Tinker_Board_2-Debian-Buster-v2.0.18-20221207.zip Share this post Link to post Share on other sites
M@riusz 0 Posted January 2, 2023 Hello @tooz Thank you for answer but the downloaded image is not boot on my Tb. Is the shared image for the TinkerBoard S R2.0 model? I try burn to SD Card and eMMC. Share this post Link to post Share on other sites
tooz 53 Posted January 3, 2023 hello @M@riusz, it's for tinker board 2s Share this post Link to post Share on other sites
M@riusz 0 Posted January 3, 2023 @tooz there is a solution for the Tinker Board S R2.0 model? Share this post Link to post Share on other sites
tooz 53 Posted January 5, 2023 hello @M@riusz, for tinker board s r2.0 debian os (kernel 4.4, debian 10) v.3.0.18, can related modules are included by default, all you need to do to get waveshare can working is to modify the dts and /boot/config.txt i've uploaded the dtbo and dts, along with config.txt here: https://www.asuswebstorage.com/navigate/a/#/s/077D58B319314CA9AB298E8F012540C04 -- Step 0: # dtc -@ -b 0 -Wno-unit_address_vs_reg -I dts -O dtb -o mcp2515-can0.dtbo mcp2515-can0.dts # cp mcp2515-can0.dtbo /boot/overlay/ Step 1: Change the file “/boot/config.txt” in the Debian OS as below: < #intf:spi1=off --- > intf:spi2=on 60c60 < overlay= --- > overlay=mcp2515-can0 Step 2: reboot $ sudo reboot Step 3: CAN Loopback Self-Test $ sudo apt-get update $ sudo apt-get install can-utils linaro@linaro-alip:~$ sudo ip link set can0 up type can bitrate 125000 loopback on linaro@linaro-alip:~$ sudo candump can0 & [1] 2500 linaro@linaro-alip:~$ sudo cansend can0 abc#1122334455 can0 2BC [5] 11 22 33 44 55 can0 2BC [5] 11 22 33 44 55 -- Share this post Link to post Share on other sites
M@riusz 0 Posted January 5, 2023 hello @tooz It works, thanks a lot for your help ? I suppose I had a bad dtbo file. linaro@linaro-alip:~$ sudo ip link set can0 up type can bitrate 125000 loopback on linaro@linaro-alip:~$ sudo candump can0 & [1] 1822 linaro@linaro-alip:~$ sudo cansend can0 abc#1122334455 can0 2BC [5] 11 22 33 44 55 can0 2BC [5] 11 22 33 44 55 Running on the version: Linux version 4.4.194 (leslie_yu@asus-docker-env) (gcc version 6.3.1 20170404 (Linaro GCC 6.3-2017.05) ) #52 SMP Tue Oct 26 08:35:58 Share this post Link to post Share on other sites