How to configure mcp2515 CAN module on khadas edge v platfrom

@ramesh
Have you directly replaced your original device tree file with the one I gave you?

@ramesh hi,
kedge_defconfig and rk3399-khadas-edge.dtsiThe dtsi file is exactly the same as the one I gave you.
then,Test it.

ls /sys/firmware/devicetree/base/spi@ff350000

Send me the viewed information

yes,my dtsi is replace with your dtsi

khadas@Khadas:~$ ls /sys/firmware/devicetree/base/spi@ff350000
#address-cells’ clocks max-freq pinctrl-0 ‘#size-cells
can@0 compatible name pinctrl-names status
clock-names interrupts phandle reg

@ramesh hi,
Please try my firmware:
https://dl.khadas.com/.test/Edge_Ubuntu-server-focal_Linux-4.4_arm64_EMMC_V1.0.10-220613-develop.img

please send emmc image flashing commands.

ls /sys/firmware/devicetree/base/spi@ff350000

in this folder can@0 is presented what it means…

@ramesh
Burning method:

my firmware:
https://dl.khadas.com/.test/Edge_Ubuntu-server-focal_Linux-4.4_arm64_EMMC_V1.0.10-220613-develop.img

@ramesh
Has my firmware been tested?
Do you recognize can0?

yes just i was tested your image…
rampgroup@rampgroup-HP:~/utils$ rk-burn-tool -i …/Downloads/Edge_Ubuntu-server-focal_Linux-4.4_arm64_EMMC_V1.0.10-220613-develop.img
Burn to eMMC…
Rockchip Android image (or linux image compatible with AndroidTool one image burning) found!
Try to burn Rockchip image…
Program Data in /home/rampgroup/.config/upgrade_tool
Loading firmware…
Support Type:RK330C FW Ver:fd.c1.a779 FW Time:2022-06-13 09:53:00
Loader ver:1.24 Loader Time:2022-06-13 09:37:52
Upgrade firmware ok.
Time elapsed: 1 minute(s).
Done!
Mon Jun 13 15:15:39 IST 2022

serial log:

Relocation Offset: f5bd3000, fdt: f3dbbc68
I2c4 speed: 400000Hz
PMIC: RK808
vdd_center 900000 uV
vdd_cpu_l 900000 uV
vdd_log init 950000 uV
MMC: dwmmc@fe320000: 1, sdhci@fe330000: 0
Using default environment

Model: Khadas Edge
Bootdev(atags): mmc 0
MMC0: HS400, 150Mhz
PartType: EFI
SARADC: 1023
boot mode: normal
512 bytes read in 219 ms (2 KiB/s)
1080138 bytes read in 227 ms (4.5 MiB/s)
Rockchip UBOOT DRM driver version: v1.0.1
Using display timing dts
Detailed mode clock 120000 kHz, flags[a]
H: 1080 1184 1188 1315
V: 1920 1924 1926 1929
bus_format: 100e
final DSI-Link bandwidth: 996 Mbps x 4
CLK: (uboot. arml: enter 816000 KHz, init 816000 KHz, kernel 0N/A)
CLK: (uboot. armb: enter 24000 KHz, init 24000 KHz, kernel 0N/A)
aplll 816000 KHz
apllb 24000 KHz
dpll 856000 KHz
cpll 24000 KHz
gpll 800000 KHz
npll 600000 KHz
vpll 120000 KHz
aclk_perihp 133333 KHz
hclk_perihp 66666 KHz
pclk_perihp 33333 KHz
aclk_perilp0 266666 KHz
hclk_perilp0 88888 KHz
pclk_perilp0 44444 KHz
hclk_perilp1 100000 KHz
pclk_perilp1 50000 KHz
Net: eth0: ethernet@fe300000
Setting bus to 8
I2c8 speed: 100000Hz
Setting bus to 8
set_wol: 1
normal power off
boot wol: enable
Hit any key to stop autoboot: 0
Card did not respond to voltage select!
mmc_init: -95, time 9
switch to partitions #0, OK
mmc0(part 0) is current device
Failed to mount ext2 filesystem…
** Unrecognized filesystem type **
Scanning mmc 0:7…
Found U-Boot script /boot/boot.scr
6225 bytes read in 58 ms (104.5 KiB/s)

Executing script at 00500000

Run Khadas boot script
board type = Edge-V (2)
Uboot loaded from eMMC.
1474 bytes read in 63 ms (22.5 KiB/s)
Import env.txt
DTB: /boot/dtb/rk3399-khadas-edgev-linux.dtb
mac address: c8:63:14:71:19:b3
Scanning mmc 0:6…
Failed to mount ext2 filesystem…
** Unrecognized filesystem type **
Scanning mmc 0:7…
8484668 bytes read in 151 ms (53.6 MiB/s)
20156424 bytes read in 221 ms (87 MiB/s)
99327 bytes read in 81 ms (1.2 MiB/s)
Apply dtbo i2c2
223 bytes read in 95 ms (2 KiB/s)
Apply dtbo spi3
223 bytes read in 102 ms (2 KiB/s)
Apply dtbo i2s0
223 bytes read in 97 ms (2 KiB/s)
Apply dtbo onewire
226 bytes read in 100 ms (2 KiB/s)

Loading init Ramdisk from Legacy Image at 0a200000 …

Image Name: uInitrd
Image Type: AArch64 Linux RAMDisk Image (uncompressed)
Data Size: 8484604 Bytes = 8.1 MiB
Load Address: 00000000
Entry Point: 00000000
Verifying Checksum … OK

Flattened Device Tree blob at 08300000

Booting using the fdt blob at 0x8300000
reserving fdt memory region: addr=8300000 size=7e000
‘reserved-memory’ region@110000: addr=110000 size=f0000
Loading Ramdisk to f35a1000, end f3db86fc … OK
Loading Device Tree to 00000000f3520000, end 00000000f35a0fff … OK
512 bytes read in 219 ms (2 KiB/s)
1080138 bytes read in 227 ms (4.5 MiB/s)
Adding bank: 0x00200000 - 0x08400000 (size: 0x08200000)
Adding bank: 0x0a200000 - 0xf8000000 (size: 0xede00000)
Total: 5609.376 ms

Starting kernel …

[ 2.195496] rockchip-pcie f8000000.pcie: PCIe link training gen1 timeout!
[ 2.196119] rockchip-pcie f8000000.pcie: deferred probe failed
[ 2.199370] rk-vcodec ff650000.vpu_service: could not find power_model node
[ 2.201303] rk-vcodec ff660000.rkvdec: could not find power_model node
[ 2.214631] mali ff9a0000.gpu: Failed to get regulator
[ 2.215092] mali ff9a0000.gpu: Power control initialization failed
[ 2.236730] rk_gmac-dwmac fe300000.ethernet: cannot get clock clk_mac_speed
[ 2.385796] rockchip-dwc3 usb0: failed to get drvdata dwc3
[ 2.391048] rockchip-dwc3 usb1: fail to get drvdata hcd
[ 2.481990] rockchip-pinctrl pinctrl: pin gpio1-18 already requested by ff350000.spi; cannot claim for 4-001b
[ 2.482866] rockchip-pinctrl pinctrl: pin-50 (4-001b) status -22
[ 2.483408] rockchip-pinctrl pinctrl: could not request pin 50 (gpio1-18) from group pmic-dvs2 on device rockchip-pinctrl
[ 2.484406] rk808 4-001b: Error applying setting, reverse things back
[ 4.063557] cw201x 8-0062: design_capacity missing!
[ 4.064185] cw_bat_probe cw_init error
[ 4.065612] bq25700-charger 8-006b: Cannot read chip ID.
[ 4.070794] rk_tsadcv2_temp_to_code: Invalid conversion table: code=1023, temperature=2147483647
[ 4.103413] cpu cpu0: failed to find power_model node
[ 4.107325] cpu cpu4: failed to find power_model node
[ 4.112655] vccio_sd: unsupportable voltage range: 3300000-3000000uV
[ 4.172237] rockchip-dmc dmc: unable to get devfreq-event device : dfi
[ 4.191337] Error: Driver ‘ov4689’ is already registered, aborting…
[ 4.191966] Error: Driver ‘ov7750’ is already registered, aborting…
[ 4.192546] Error: Driver ‘ov13850’ is already registered, aborting…
[ 4.193314] Error: Driver ‘sc031gs’ is already registered, aborting…
[ 4.204488] zswap: default zpool zbud not available
[ 4.204936] zswap: pool creation failed
[ 4.214092] rockchip-vop ff900000.vop: missing rockchip,grf property
[ 4.214965] rockchip-vop ff8f0000.vop: missing rockchip,grf property
[ 4.216825] i2c i2c-9: of_i2c: modalias failure on /hdmi@ff940000/ports
[ 4.222123] i2c i2c-10: of_i2c: modalias failure on /dp@fec00000/ports
[ 4.224406] rockchip-drm display-subsystem: connector[HDMI-A-1] can’t found any modes
[ 4.225241] rockchip-drm display-subsystem: failed to show loader logo
[ 4.445072] rockchip-dmc dmc: Failed to get leakage
[ 4.445707] rockchip-dmc dmc: Failed to get pvtm
[ 4.446766] rockchip-dmc dmc: failed to get vop pn to msch rl
[ 4.447891] rockchip-dmc dmc: could not find power_model node
[ 4.453791] rk-hdmi-dp-sound hdmi-dp-sound: control 3:0:0:ELD:0 is already present
[ 4.454517] hdmi-audio-codec hdmi-audio-codec.7.auto: ASoC: Failed to add ELD: -16
[ 5.314246] systemd[1]: Failed to find module ‘autofs4’
[ 5.319847] cgroup: cgroup2: unknown option “nsdelegate”
[ 14.344486] CONFIG-ERROR) dhd_conf_set_intiovar: txbf setting failed -23

Ubuntu 20.04.3 LTS Khadas ttyFIQ0

Khadas login: khadas
Password:

Welcome to Fenix 1.0.10 Ubuntu 20.04.3 LTS Linux 4.4.194


| |/ / |__ __ _ | | __ _ ___ | ____|| | __ _ ___ \ \ / /
| ’ /| '_ \ / |/ _ |/ / __| | _| / _ |/ ` |/ _ _\ \ / /
| . | | | | (| | (| | (| _ \ | || (| | (| | /\ V /
||__| ||_,|_,|_,|
/ |_,|__, |_| _/
|
__/

To run a command as administrator (user “root”), use "sudo ".
See “man sudo_root” for details.

khadas@Khadas:~$ uname -a
Linux Khadas 4.4.194 #12 SMP Mon Jun 13 09:39:10 CST 2022 aarch64 aarch64 aarch64 GNU/Linux
khadas@Khadas:~$ ifconfig -a
dummy0: flags=130<BROADCAST,NOARP> mtu 1500
ether ca:62:d7:5e:6a:bc txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

eth0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
ether c8:63:14:71:19:b3 txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 4 bytes 584 (584.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
device interrupt 24

lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10
loop txqueuelen 1 (Local Loopback)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

wlan0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
ether d4:9c:dd:36:0c:ec txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

khadas@Khadas:~$

can0 is not showing

@ramesh
Again, I suggest you, check whether the DuPont cable connector is loose.

@ramesh
In addition, did you test whether the spidev communication is normal?

connections are proper.

in
ls /sys/firmware/devicetree/base/spi@ff350000

in this folder can@0 is presented what it means…?

@ramesh
it is the equipment tree node information.

Not only check the wire connection, but also check whether the connector is loose.

Because looseness will cause can not recognize.

The firmware I gave you is stable and can run and recognize can0.

I suggest you check again! ! !

can you please send mcp25 driver
mcp251x.c
+++ /linux/drivers/net/can/spi
from this location.

@ramesh
ok,
please,

git clone https://github.com/aiguo-zhao/mcp251x.git

what is the frequecy of your mcp2515 ?