Which system do you use? Android, Ubuntu, OOWOW or others?
Ubuntu 22.04
Which version of system do you use? Khadas official images, self built images, or others?
Khadas official image
Please describe your issue below:
Hi everyone,
I want to connect the Khadas VIM4 to a MCP2515 chip for CAN bus communication.
The only documentation I have found is a forum page, but it is about the VIM3 board:
Does anyone have any information to do the same thing for the VIM4?
In the default configuration of the kernel the CAN modules and the MCP251x drivers are already activated, I can use modprobe to activate them in the stock image. So do I have to use fenix to rebuild the image or can I just compile a dts file into a dts in a stock image and get it working? What should be exact content of the dts file?
I have managed to compile the file and make the system read it. The steps I followed are below, they are a bit different from what I read online, I write them here so you can correct me if I did something wrong, or they can just be useful for other people:
The directory to which I added the can.dts file is /fenix/build/linux/arch/arm64/boot/dts/amlogic
I added the line “dtb-y += can.dtb” to the Makefile in the same directory.
I compiled the whole linux kernel and created deb files using the command “NO_GIT_UPDATE=1 make kernel-deb” as I couldn’t find a Makefile rule for ‘kernel-dtb’.
Installing the deb package was not sufficient, the dtb file is not in the right directory and with the right name. So I had to copy it to the ‘/boot/overlays/kvim4.dtb.overlays/’ and modify the extension to dtbo instead of just dtb. Then I added can to the ‘/boot/overlays/kvim4.dtb.overlay.env’ file.
Some more information I would need:
I guess that the 183 interrupt number is the reference to a specific pin of the GPIO, but I do not know which one, so I didn’t know to which pin I have to connect the interrupt pin of the mcp2515.
I tried to enable the overlay and boot the system without the mcp2515 connected, and I got the following error in the dmesg log: mcp251x: probe of spi1.0 failed with error -34
Which seems to be related to a frequency error. What I would expect from a system booting without anything connected is the following (from other working boards):
mcp251x spi0.0: MCP251x didn't enter in conf mode after reset
mcp251x spi0.0: Probe failed, err=110
mcp251x: probe of spi0.0 failed with error -110
Is the error I am getting normal?
Also, my final goal would be to have 2 MCP2515 chips connected to the same SPI with different Chip Select and Interrupt pins, is it possible to do it?
Thank you very much in advance.
PS
in your code there’s a missing } parenthesis at the end
@grilloandrea6 the interrupt pin is essentially the SPI MISO pin, are you sure your wiring is correct ?
If you are sure your wiring is proper, then please check if you are able to detect the device node from your intended application.
I do not know to which pin do I have to connect the interrupt pin of the MCP2515, which should be a “normal” GPIO pin chosen by the configuration of the interrupt in the dts file.