Skip to content

ArashEM/meta-canexp

Repository files navigation

Introduction

This layer helps you to add mcp2515 module into ASUS-Tinker board.

Getting started

  1. 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 ../
  1. Export template configuraiton path and initialize build envrionment
export TEMPLATECONF=${TEMPLATECONF:-meta-canexp/conf}
source poky/oe-init-build-env tinker-board/
  1. Start build process
bitbake core-image-full-cmdline

Connections

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 - -

View

Here is what it looks like :-)
Connectig rasppberypi and asus-tinker via CAN network. CAN

Here is what happend over SPI and CAN when I issued cansend can0 100#11223344deadbeef from rasppbery LOGIC

Notes

Please note that:

  1. dunfell branch of meta-rockchip use Linux version 5.4.205 by default. But for using isotp and socketcand you need at least Linux version 5.10.0 or later. I handled it by adding PREFERRED_PROVIDER_virtual/kernel ?= "linux-yocto-dev" to conf/local.conf.sample.
  2. 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)
  3. As you can see in 0001-add-can-interface.patch, I'm using 125Kbps bitrate
  4. In order to change SPI interface (e.g. using SPI0) or interrupt pin, you need to change 0001-add-mcp2515-interface.patch file.
  5. 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.

More

  1. This presentation explain SocketCAN in very good detail
  2. 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
  3. The book The Car Hacker's Handbook provide valuable information about CAN and car internel network

Releases

No releases published

Packages

No packages published