configuring CANbus on C4 with 5.13-kernel

Post Reply
specs
Posts: 93
Joined: Sun Nov 24, 2019 12:14 pm
languages_spoken: english
ODROIDs: odroid n2/n2+
odroid c4
Has thanked: 29 times
Been thanked: 11 times
Contact:

configuring CANbus on C4 with 5.13-kernel

Post by specs »

The system: C4 with the tobetter Ubuntu version 21.04.
The canhat: inno maker canhat+485

Connections: MOSI/MISO/SCLK (pin 19/21/23) + CE1 (pin26) + pin22 (IRQ)
Note: MOSI/MISO/SCLK (pin 19/21/23) + CE0 (pin24) is used for RS485 (+ pin28 + pin18) sometimes later.

In terms of the C4 we are talking for the canbus about the standard SPI ports + CE1 => GPIOH_6 and GPIOX_2.
(For the N2 that would be GPIOA_4 and GPIOX_2).
In absence of pictures I refer to the C4 header pinout https://wiki.odroid.com/odroid-c4/hardw ... connectors

I can find the spi overlay for the C4 in the sources and I think I should add spi1 to the definition in the overlay.
I can't find the dts for the can-adapter. Has it not been implemented yet or am I looking at the wrong place?

(Sorry in advance that my other message was added to a thread for the 4.9-kernel)

User avatar
tobetter
Posts: 8147
Joined: Mon Feb 25, 2013 10:55 am
languages_spoken: Korean, English
ODROIDs: Many
Location: Paju, South Korea
Has thanked: 474 times
Been thanked: 1275 times
Contact:

Re: configuring CANbus on C4 with 5.13-kernel

Post by tobetter »

Back from 4.9 thread regarding to CAN.

As of now, I realize that can0.dtbo is missing in the 5.x kerne tree but the driver of MCP2515 is enabled. So I think by adding can0.dtbo will help to enable CAN bus on 5.x kernel. Can we start from here?

The attachment can0.dtbo.txt is encoded can0.dtbo in 5.x Linux kernel tree, convert it using uuencode.

Code: Select all

uuencode -o can0.dtbo can0.dtbo.txt
sudo cp can0.dtbo /boot/dtbs/$(uname -r)/amlogic/overlays/odroidc4/
Please make sure its hash value before adding it to /boot/config in the line overlays="spi0 i2c0 i2c1".

Code: Select all

$ md5sum can0.dtbo
43c37e5e9826ea77c681c93c9ae83688  can0.dtbo
These users thanked the author tobetter for the post:
specs (Mon Jul 19, 2021 3:49 am)

specs
Posts: 93
Joined: Sun Nov 24, 2019 12:14 pm
languages_spoken: english
ODROIDs: odroid n2/n2+
odroid c4
Has thanked: 29 times
Been thanked: 11 times
Contact:

Re: configuring CANbus on C4 with 5.13-kernel

Post by specs »

It explains why I could not connect the dots ;-)

The standard MCP2515 will probably work with spi0 and can0.
I think I will need spi1 and can0 (while the can0.dtbo would be a lot of work to figure out I guess the spi1 will be copy-paste-edit from spi0).
I would very much appreciate it if you could find time to attach the can0.dtbo to your message.

I'll have to continu tomorrow anyhow, but I might start testing with a waveshare canhat (can0 + spi0).

Post Reply

Return to “Hardware and peripherals”

Who is online

Users browsing this forum: No registered users and 1 guest