View: 2405|Reply: 25

OrangePI CM4 with MCP2515 freeze after 1st frame. Schematic, dtb file

[Copy link]

1

threads

1

posts

9

credits

Novice

Rank: 1

credits
9
Published in 2025-1-21 19:23:23 | Show all floors |Read mode
This post was finally edited by expertup at 2025-1-21 19:25

Hello :-)
I need to add CAN-BUS transmission to the Orange Pi CM4. I found an MCP2515 module and connected it to the Orange Pi. I also found the DTB file configuration to enable the MCP2515 module.
The MCP2515 has an 8MHz crystal.
The transmission seems to be working, but I don't have data transfer between the second device, an RP2040-Zero with an MCP2515.
I have a logic level analyzer, and the transmission seems fine.
The RP2040 sends data to the Orange Pi:
  • When I had set a 12MHz crystal for the MCP2515 in the DTB (wrong configuration), the RP2040 sent frames nonstop on the main line. However, when I set it to 8MHz, the RP2040 sent only one frame.
  • A single frame is sent, which suggests that the MCP2515 on the Orange Pi is acknowledging the received packet. However, I don’t see any data in candump can0
The Orange Pi sends data to the RP2040:
  • When I send data to the RP2040 using cansend can0 030#1122334455667788, I can see the received data on the RP2040. However, after sending a second frame with cansend can0 030#1122334455667788, I don’t receive anything. After many attempts, I get an error indicating that the buffer is full.





This suggests that the Orange Pi isn’t receiving a confirmation of the data from the RP2040.
I have the rk356x-mcp2515-overlay-v2.dts file in /boot/dtb/rockchip/overlay, compiled to a dtbo. In /boot/orangepiEnv.txt, I have added overlays=watchdog mcp2515-overlay-v2.
I got the source for rk356x-mcp2515-overlay-v2.dts from this post: [color=var(--theme-link-color, var(--theme-secondary-400))]https://forum.radxa.com/t/spi-delay-between-radxa-cm3s-and-mcp2515/17008
Where is the problem?
My rk356x-mcp2515-overlay-v2.dts source:
  1. /dts-v1/;

  2. /{

  3.         metadata {
  4.                 title = "Enable MCP2515 SPI3M0 to CAN";
  5.                 compatible = "rockchip,rk3566\0rockchip,rk3568";
  6.                 category = "misc";
  7.                 description = "Enable MCP2515 SPI3M0 to CAN With 8M Crystal Oscillator.";
  8.         };

  9.         fragment@0 {
  10.                 target = <0xffffffff>;

  11.                 __overlay__ {

  12.                         mcp2515_int_pin {

  13.                                 mcp2515_int_pin {
  14.                                         rockchip,pins = <0x03 0x1d 0x00 0xffffffff>;
  15.                                         phandle = <0x02>;
  16.                                 };
  17.                         };
  18.                 };
  19.         };

  20.         fragment@1 {
  21.                 target-path = [2f 00];

  22.                 __overlay__ {

  23.                         can-mcp2515-osc {
  24.                                 compatible = "fixed-clock";
  25.                                 clock-frequency = <0x7A1200>;
  26.                                 #clock-cells = <0x00>;
  27.                                 phandle = <0x01>;
  28.                         };
  29.                 };
  30.         };

  31.         fragment@2 {
  32.                 target = <0xffffffff>;

  33.                 __overlay__ {
  34.                         status = "okay";
  35.                         max-freq = <0x7735940>;
  36.                         #address-cells = <0x01>;
  37.                         #size-cells = <0x00>;
  38.                         pinctrl-0 = <0xffffffff 0xffffffff>;
  39.                         pinctrl-1 = <0xffffffff 0xffffffff>;

  40.                         can-mcp2515@0 {
  41.                                 status = "okay";
  42.                                 compatible = "microchip,mcp2515";
  43.                                 reg = <0x00>;
  44.                                 interrupt-parent = <0xffffffff>;
  45.                                 interrupts = <0 132 2>;//<0x10 0x08>;
  46.                                 spi-max-frequency = <0x989680>;
  47.                                 clocks = <0x01>;
  48.                                 vdd-supply = <0xffffffff>;
  49.                                 xceiver-supply = <0xffffffff>;
  50.                                 pinctrl-names = "default";
  51.                                 pinctrl-0 = <0x02>;
  52.                                 phandle = <0x03>;
  53.                         };
  54.                 };
  55.         };

  56.         __symbols__ {
  57.                 mcp2515_int_pin = "/fragment@0/__overlay__/mcp2515_int_pin/mcp2515_int_pin";
  58.                 can_mcp2515_osc = "/fragment@1/__overlay__/can-mcp2515-osc";
  59.                 can_mcp2515 = "/fragment@2/__overlay__/can-mcp2515@0";
  60.         };

  61.         __fixups__ {
  62.                 pinctrl = "/fragment@0:target:0";
  63.                 pcfg_pull_none = "/fragment@0/__overlay__/mcp2515_int_pin/mcp2515_int_pin:rockchip,pins:12";
  64.                 spi3 = "/fragment@2:target:0";
  65.                 spi3m0_cs0 = "/fragment@2/__overlay__:pinctrl-0:0\0/fragment@2/__overlay__:pinctrl-1:0";
  66.                 spi3m0_pins = "/fragment@2/__overlay__:pinctrl-0:4";
  67.                 spi3m0_pins_hs = "/fragment@2/__overlay__:pinctrl-1:4";
  68.                 gpio4 = "/fragment@2/__overlay__/can-mcp2515@0:interrupt-parent:0";
  69.                 vcc3v3_sys = "/fragment@2/__overlay__/can-mcp2515@0:vdd-supply:0\0/fragment@2/__overlay__/can-mcp2515@0:xceiver-supply:0";
  70.         };

  71.         __local_fixups__ {

  72.                 fragment@2 {

  73.                         __overlay__ {

  74.                                 can-mcp2515@0 {
  75.                                         clocks = <0x00>;
  76.                                         pinctrl-0 = <0x00>;
  77.                                 };
  78.                         };
  79.                 };
  80.         };
  81. };
Copy code
Wiring:


OrangePi CM4 Pin
MCP2515 Pin
TJA1050 Pin
1 (3.3V)
VCC
-
2, 4 (5V)
-
VCC
9 (GND)
GND
GND
19 (GPIO138 - SPI3_MOSI_M0)
SI
-
21 (GPIO136 - SPI3_MISO_M0)
SO
-
22 (GPIO132 - GPIO4_A4)
INT
-
23 (GPIO139 - SPI3_CLK_M0)
SCK
-
24 (GPIO134 - SPI3_CS0_M0)
CS
-


This thread contains more resources

You need to Log in to download or view,No account?    Register

x

0

threads

176

posts

572

credits

Senior member

Rank: 4

credits
572
Published in 2025-3-9 16:19:51 | Show all floors
Thanks for the blog loaded with so many information. Stopping by your blog helped me to get what I was looking for.lcctoto

0

threads

20

posts

84

credits

Registered member

Rank: 2

credits
84
Published in 2025-4-2 20:16:37 | Show all floors
The Curve Rush game is deceptively simple, but once you start aiming for those high scores, it gets pretty intense.

0

threads

176

posts

572

credits

Senior member

Rank: 4

credits
572
Published in 2025-4-16 14:45:32 | Show all floors
Thanks for a wonderful share. Your article has proved your hard work and experience you have got in this field. Brilliant .i love it reading.togeldulu

0

threads

176

posts

572

credits

Senior member

Rank: 4

credits
572
Published in 2025-4-20 13:05:24 | Show all floors
I really loved reading your blog. It was very well authored and easy to undertand. Unlike additional blogs I have read which are really not tht good. I also found your posts very interesting. In fact after reading, I had to go show it to my friend and he ejoyed it as well!lele4d

0

threads

176

posts

572

credits

Senior member

Rank: 4

credits
572
Published in 2025-5-7 10:59:51 | Show all floors
Thank you so much for the post you do. I like your post and all you share with us is up to date and quite informative, i would like to bookmark the page so i can come here again to read you, as you have done a wonderful job.แชมพูลดผมร่วง

0

threads

176

posts

572

credits

Senior member

Rank: 4

credits
572
Published in 2025-5-8 18:35:25 | Show all floors
Just admiring your work and wondering how you managed this blog so well. It’s so remarkable that I can't afford to not go through this valuable information whenever I surf the internet!https://caldwells.com/

0

threads

176

posts

572

credits

Senior member

Rank: 4

credits
572
Published in 2025-5-11 12:30:08 | Show all floors
Hello, I have browsed most of your posts. This post is probably where I got the most useful information for my research. Thanks for posting, maybe we can see more on this. Are you aware of any other websites on this subject.เว็บแทงวัวชน

0

threads

176

posts

572

credits

Senior member

Rank: 4

credits
572
Published in 2025-5-11 18:13:39 | Show all floors
I’ve been searching for some decent stuff on the subject and haven't had any luck up until this point, You just got a new biggest fan!..بت فوروارد

0

threads

176

posts

572

credits

Senior member

Rank: 4

credits
572
Published in 2025-5-14 23:28:33 | Show all floors
Excellent .. Amazing .. I’ll bookmark your blog and take the feeds also…I’m happy to find so many useful info here in the post, we need work out more techniques in this regard, thanks for sharing.هتریک بت
You need to log in before you can reply login | Register

Points Rule

Quick reply Top Return list