I have a problem with clock regarding the log:
wlad@ubuntu:/media/wlad/Copy/CAN/jetson-mcp2515$ dmesg | grep can
[ 0.000000] OF: fdt:memory scan node memory@80000000, reg size 32,
[ 1.055723] tegra-pwm 7000a000.pwm: PWM clk cannot sleep in ops
[ 1.086079] of_fixed_clk: probe of can_clock failed with error -17
[ 3.792045] mcp251x spi1.0 can0: MCP2515 successfully initialized.
[ 440.627905] can: controller area network core (rev 20120528 abi 9)
[ 440.666726] can: raw protocol (rev 20120528)
what can I do against the problem with the clock?
hello waldemar.friesen,
please see-also this thread,
The MCP2515 CAN module is currently not officially supported on the Jetson Nano 2GB and does not work out of the box using the current Jetpack 46. This might change in the future. I have only tested this with this 16MHz can module by JOY-IT. For 8MHz can modules you have to change the can clock in the .dts file.
1. Wiring
Wire the two can modules to the 40pin header according to this table.
Name
CAN module 1
CAN module 2
INT
31
32
SCK
23
13
SI
19
37
SO
22
21
CS
24
18
GND
GND
…
may I also know which JetPack release you’re currently working with?
thanks
32.7.2 (JetPack 4.6.2). It seems to be the problem with the driver “Microchip,mcp2515”, because with “tegra-spidev” it is working somehow. The node with “microchip,mcp2515” will not activated
hdr40_spi1: spi@7000d400 { /* SPI 0 to 40 pin header */
status = "okay";
spi@0 {
compatible = "tegra-spidev";
reg = <0x0>;
spi-max-frequency = <33000000>;
controller-data {
nvidia,enable-hw-based-cs;
nvidia,rx-clk-tap-delay = <7>;
};
};
spi@1 {
compatible = "tegra-spidev";
reg = <0x1>;
spi-max-frequency = <33000000>;
controller-data {
nvidia,enable-hw-based-cs;
nvidia,rx-clk-tap-delay = <7>;
};
};
};
can_clock: can_clock {
status = "okay";
compatible = "fixed-clock";
#clock-cells = <0>;
clock-frequency = <16000000>;
clock-accuracy = <100>;
};
hdr40_spi2: spi@7000d600 { /* SPI 1 to 40 pin header */
status = "okay";
spi@0 {
compatible = "tegra-spidev";
reg = <0x0>;
spi-max-frequency = <33000000>;
nvidia,enable-hw-based-cs;
nvidia,rx-clk-tap-delay = <0x6>;
clocks = <&can_clock>;
interrupts = <&gpio TEGRA_GPIO(H, 7) 0x1>; // GPIO pin chosen from 40 pin header
controller-data {
nvidia,enable-hw-based-cs;
nvidia,rx-clk-tap-delay = <6>;
};
};
spi@1 {
compatible = "tegra-spidev";
reg = <0x1>;
spi-max-frequency = <33000000>;
nvidia,enable-hw-based-cs;
nvidia,rx-clk-tap-delay = <0x6>;
clocks = <&can_clock>;
interrupts = <&gpio TEGRA_GPIO(H, 7) 0x1>; // GPIO pin chosen from 40 pin header
controller-data {
nvidia,enable-hw-based-cs;
nvidia,rx-clk-tap-delay = <6>;
};
};
};
spi@7000d800 { SPI 2 to 40 pin header
status = "okay";
spi@0 {
status = "okay";
compatible = "microchip,mcp2515";
reg = <0x0>;
spi-max-frequency = <10000000>;
nvidia,enable-hw-based-cs;
nvidia,rx-clk-tap-delay = <0x6>;
clocks = <&can_clock>;
interrupts = <&gpio TEGRA_GPIO(H, 7) 0x1>; // GPIO pin chosen from 40 pin header
};
spi@1 {
status = "disabled";
};
};
as log message will generated in kernel:
wlad@ubuntu:/media/wlad/Copy/CAN$ make driver
# http://www.armadeus.org/wiki/index.php?title=CAN_bus_Linux_driver
sudo modprobe spidev
[sudo] password for wlad:
ls /dev/spi*
/dev/spidev0.0 /dev/spidev0.1 /dev/spidev1.0 /dev/spidev1.1
sudo modprobe can
sudo modprobe can-dev
sudo modprobe can-raw
sudo modprobe mcp251x
sudo modprobe mttcan
# ip link set can0 up type can bitrate 125000
sudo ip link set can0 up type can bitrate 125000 dbitrate 1000000 berr-reporting on fd on
Cannot find device "can0"
Makefile:5: recipe for target 'driver' failed
make: *** [driver] Error 1
wlad@ubuntu:/media/wlad/Copy/CAN$ make dmesg
# https://developer.ridgerun.com/wiki/index.php/How_to_configure_and_use_CAN_bus
ls -d /sys/bus/spi/drivers/mcp251x
/sys/bus/spi/drivers/mcp251x
ls /sys/class/net/
docker0 dummy0 eth0 l4tbr0 lo rndis0 usb0 usb1
dmesg | grep -i mcp
[ 4.791389] mcp251x spi2.0: MCP251x didn't enter in conf mode after reset
[ 4.799280] mcp251x spi2.0: Probe failed, err=16
[ 4.819201] mcp251x: probe of spi2.0 failed with error -16
dmesg | fgrep -i can
[ 0.000000] OF: fdt:memory scan node memory@80000000, reg size 32,
[ 1.048652] tegra-pwm 7000a000.pwm: PWM clk cannot sleep in ops
[ 1.079320] of_fixed_clk: probe of can_clock failed with error -17
[ 3.759878] CAN device driver interface
[ 308.775518] can: controller area network core (rev 20120528 abi 9)
[ 308.813820] can: raw protocol (rev 20120528)
when can we expect to get fixed version?
I have found followed aliases:
spi0 = "/spi@7000d400";
spi1 = "/spi@7000d600";
spi2 = "/spi@7000d800";
spi3 = "/spi@7000da00";
Can it be used in JetPack4.6.2 ?
hello waldemar.friesen,
it’s tested on Jetson-Nano, SPI to CAN communication using MCP2515 chip is working successfully.
there are 2 SPI controllers present on Jetson-Nano. MCP is connected under SPI controller SPI 0 and SPI 1
please see-also. Jetson nano and mcp2515 can module - #24 by shgarg for the steps.
system
Closed
October 26, 2022, 6:13am
9
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.