This layer helps you to add mcp2515
module into ASUS-Tinker board.
- Clone required layers:
git clone git://git.yoctoproject.org/poky -b dunfell
cd poky/
git clone git://git.yoctoproject.org/meta-rockchip -b dunfell
git clone https://github.com/openembedded/meta-openembedded.git -b dunfell
git clone https://github.com/ArashEM/meta-canexp.git -b dunfell
cd ../
- Export template configuraiton path and initialize build envrionment
export TEMPLATECONF=${TEMPLATECONF:-meta-canexp/conf}
source poky/oe-init-build-env tinker-board/
- Start build process
bitbake core-image-full-cmdline
This is top view of AUSU-Tinker 40 pin header.
mcp2515 |
Tinker pinout |
Number |
Number |
Tinker pinout |
mcp2515 |
---|---|---|---|---|---|
3v3 | 3v3 | 1 | 2 | 5v0 | 5v0 |
- | - | 3 | 4 | - | - |
- | - | 5 | 6 | GND | GND |
INT | GP0C1 | 7 | 8 | - | - |
- | - | 9 | 10 | - | - |
- | - | 11 | 12 | - | - |
- | - | 13 | 14 | - | - |
- | - | 15 | 16 | - | - |
- | - | 17 | 18 | - | - |
SI | SPI2TX | 19 | 20 | - | - |
SO | SPI2RX | 21 | 22 | - | - |
SCK | SPI2CLK | 23 | 24 | SPI2CSN0 | CS |
- | - | 25 | 26 | - | - |
- | - | 27 | 28 | - | - |
- | - | 29 | 30 | - | - |
- | - | 31 | 32 | - | - |
- | - | 33 | 34 | - | - |
- | - | 35 | 36 | - | - |
- | - | 37 | 38 | - | - |
- | - | 39 | 40 | - | - |
Here is what it looks like :-)
Connectig rasppberypi
and asus-tinker
via CAN network.
Here is what happend over SPI
and CAN
when I issued cansend can0 100#11223344deadbeef
from rasppbery
Please note that:
dunfell
branch ofmeta-rockchip
use Linux version 5.4.205 by default. But for usingisotp
andsocketcand
you need at least Linux version 5.10.0 or later. I handled it by addingPREFERRED_PROVIDER_virtual/kernel ?= "linux-yocto-dev"
toconf/local.conf.sample
.- You need to provide 5v0 supply for CAN transceiver (
tja1050
) because it won't work with 3v3 supply from ASUS-Tinker. (this link is very good instruction about fixning this issue) - As you can see in 0001-add-can-interface.patch, I'm using 125Kbps bitrate
- In order to change
SPI
interface (e.g. usingSPI0
) or interrupt pin, you need to change 0001-add-mcp2515-interface.patch file. - Becarefule about interrupt pin! It MUST be and unclaimed GPIO pin. you can check
/sys/kernel/debug/pinctrl/pinctrl-rockchip-pinctrl/pinmux-pins
to see status of each pin.
- This presentation explain SocketCAN in very good detail
- You can use SavvyCAN with socketcand. This way you have full access to
can0
interface of ASUS-Tinker over ethernet and great GUI of SavvyCAN - The book The Car Hacker's Handbook provide valuable information about CAN and car internel network