> Why do you have so many errors on can1? The device event went into bus-off. The device was not freshly started, and I just intended to share the setup. No errors when the problem appeared this night. > Can you share your "scselftest" program? Sure, attached as extracted from the build system for my test tools. Hope this is not the bad guy. Included my ancient copy of libsocketcan. > Do you get the same error if the test is only running on a single mcp2518fd? I'm pretty sure I had cases where I started the test on both, one failed sooner and one failed later. However, currently the second test is still running (after 9h). > Do you get the same error if only a single mcp2518fd is attached to the raspi? Only tested this with the CM4 > Can you share your kernel, including the modifications? Yes if it turns out to be necessary, but I just cloned it from here: git clone --depth=1 --branch https://github.com/raspberrypi/linux Following these instructions: https://www.raspberrypi.com/documentation/computers/linux_kernel.html#kernel-headers Now this nights error log: Loop 4429 2022-12-23T03:07:45 last+4s total:4h299m + ./sctestself -b -n 4 -l 999 -t 2 -v cmperr,logmsg -F refilldata,leastdots,allowintloopb,stoponerror -d 8 can1 CAN selftest can1 .......idx 2 tx:2A5#00 02 6A 8F 6C 81 C3 B0 rx:2A5#00 00 85 9A EF 54 34 5D idx 3 tx:2A5#00 03 4F 8F 85 59 8E DA rx:2A5#00 00 85 9A EF 54 34 5D .c (700) fail 0: RX (004/003) 2A5#00 00 85 9A EF 54 34 5D 0: RX (004/002) 2A5#00 00 85 9A EF 54 34 5D 0: TX (003/002) 2A5#00 03 4F 8F 85 59 8E DA 0: RX (003/001) 2A5#00 01 7C 30 5C 7A 2D 1C 0: TX (002/001) 2A5#00 02 6A 8F 6C 81 C3 B0 0: RX (002/000) 2A5#00 00 AC AF 70 9B 32 03 0: TX (001/000) 2A5#00 01 7C 30 5C 7A 2D 1C 0: TX (000/000) 2A5#00 00 AC AF 70 9B 32 03 0: RX (004/003) 2A5#00 03 65 32 F8 E7 E6 F5 0: RX (004/002) 2A5#00 02 CC D5 09 FE 55 99 0: TX (003/002) 2A5#00 03 65 32 F8 E7 E6 F5 0: RX (003/001) 2A5#00 01 62 4F 17 34 44 CE 0: TX (002/001) 2A5#00 02 CC D5 09 FE 55 99 0: RX (002/000) 2A5#00 00 FE 58 FE FD C0 EF 0: TX (001/000) 2A5#00 01 62 4F 17 34 44 CE 0: TX (000/000) 2A5#00 00 FE 58 FE FD C0 EF 0: RX (004/003) 2A5#00 03 C9 7B EF 83 93 E0 0: RX (004/002) 2A5#00 02 DD 5E 82 B4 FD C4 0: TX (003/002) 2A5#00 03 C9 7B EF 83 93 E0 0: RX (003/001) 2A5#00 01 90 3B 32 80 90 67 0: TX (002/001) 2A5#00 02 DD 5E 82 B4 FD C4 0: RX (002/000) 2A5#00 00 8F 28 D2 F5 B6 98 0: TX (001/000) 2A5#00 01 90 3B 32 80 90 67 0: TX (000/000) 2A5#00 00 8F 28 D2 F5 B6 98 0: RX (004/003) 2A5#00 03 C5 1E FE 68 F1 65 0: RX (004/002) 2A5#00 02 7E 2B BA 18 F1 7B 0: TX (003/002) 2A5#00 03 C5 1E FE 68 F1 65 0: RX (003/001) 2A5#00 01 CE 1B D7 9E 42 15 0: TX (002/001) 2A5#00 02 7E 2B BA 18 F1 7B 0: RX (002/000) 2A5#00 00 85 9A EF 54 34 5D 0: TX (001/000) 2A5#00 01 CE 1B D7 9E 42 15 0: TX (000/000) 2A5#00 00 85 9A EF 54 34 5D 0: RX (004/003) 2A5#00 03 37 6D 66 8E C6 9B 0: RX (004/002) 2A5#00 02 2D 83 A3 D3 66 27 0: TX (003/002) 2A5#00 03 37 6D 66 8E C6 9B 0: RX (003/001) 2A5#00 01 E8 A5 9A C6 C1 AC 0: TX (002/001) 2A5#00 02 2D 83 A3 D3 66 27 0: RX (002/000) 2A5#00 00 E6 7A D0 27 3E DF 0: TX (001/000) 2A5#00 01 E8 A5 9A C6 C1 AC 0: TX (000/000) 2A5#00 00 E6 7A D0 27 3E DF 0: RX (004/003) 2A5#00 03 D4 54 CF 9A 6D 7A 0: RX (004/002) 2A5#00 02 06 3F 57 59 35 F6 0: TX (003/002) 2A5#00 03 D4 54 CF 9A 6D 7A 0: RX (003/001) 2A5#00 01 C1 F6 A6 E3 84 64 0: TX (002/001) 2A5#00 02 06 3F 57 59 35 F6 Stopped. Ctrl-C to exit. And the register dump 000: 05ab0760 004: 001e0705 008: 00060101 00c: 00020700 010: dcd75c83 014: 00010000 018: 40400040 01c: bf1a0004 020: 00000000 024: 00000000 028: 00000000 02c: 00000000 030: 00000000 034: 00000000 038: 00000000 03c: 00000af4 040: 03000029 044: 00000000 048: 00000000 04c: 00000000 050: 00600080 054: 00000005 058: 00000030 05c: ef000029 060: 00000400 064: 00000160 068: e3000029 06c: 00000000 070: 000004f0 074: e3600090 078: 00000007 07c: 00000620 080: 00600000 084: 00000000 088: 00000740 08c: 00600000 090: 00000000 094: 00000750 098: 00600000 09c: 00000000 0a0: 00000760 0a4: 00600000 0a8: 00000000 0ac: 00000770 0b0: 00600000 0b4: 00000000 0b8: 00000780 0bc: 00600000 0c0: 00000000 0c4: 00000790 0c8: 00600000 0cc: 00000000 0d0: 000007a0 0d4: 00600000 0d8: 00000000 0dc: 000007b0 0e0: 00600000 0e4: 00000000 0e8: 000007c0 0ec: 00600000 0f0: 00000000 0f4: 000007d0 0f8: 00600000 0fc: 00000000 100: 000007e0 104: 00600000 108: 00000000 10c: 000007f0 110: 00600000 114: 00000000 118: 00000800 11c: 00600000 120: 00000000 124: 00000810 128: 00600000 12c: 00000000 130: 00000820 134: 00600000 138: 00000000 13c: 00000830 140: 00600000 144: 00000000 148: 00000840 14c: 00600000 150: 00000000 154: 00000850 158: 00600000 15c: 00000000 160: 00000860 164: 00600000 168: 00000000 16c: 00000870 170: 00600000 174: 00000000 178: 00000880 17c: 00600000 180: 00000000 184: 00000890 188: 00600000 18c: 00000000 190: 000008a0 194: 00600000 198: 00000000 19c: 000008b0 1a0: 00600000 1a4: 00000000 1a8: 000008c0 1ac: 00600000 1b0: 00000000 1b4: 000008d0 1b8: 00600000 1bc: 00000000 1c0: 000008e0 1c4: 00600000 1c8: 00000000 1cc: 000008f0 1d0: 00008281 1d4: 00000000 1d8: 00000000 1dc: 00000000 1e0: 00000000 1e4: 00000000 1e8: 00000000 1ec: 00000000 1f0: 00000000 1f4: 00000000 1f8: 00000000 1fc: 00000000 200: 00000000 204: 00000000 208: 00000000 20c: 00000000 210: 00000000 214: 00000000 218: 00000000 21c: 00000000 220: 00000000 224: 00000000 228: 00000000 22c: 00000000 230: 00000000 234: 00000000 238: 00000000 23c: 00000000 240: 00000000 244: 00000000 248: 00000000 24c: 00000000 250: 00000000 254: 00000000 258: 00000000 25c: 00000000 260: 00000000 264: 00000000 268: 00000000 26c: 00000000 270: 00000000 274: 00000000 278: 00000000 27c: 00000000 280: 00000000 284: 00000000 288: 00000000 28c: 00000000 290: 00000000 294: 00000000 298: 00000000 29c: 00000000 2a0: 00000000 2a4: 00000000 2a8: 00000000 2ac: 00000000 2b0: 00000000 2b4: 00000000 2b8: 00000000 2bc: 00000000 2c0: 00000000 2c4: 00000000 2c8: 00000000 2cc: 00000000 2d0: 00000000 2d4: 00000000 2d8: 00000000 2dc: 00000000 2e0: 00000000 2e4: 00000000 2e8: 00000000 2ec: 00000000 400: 000002a5 404: 0015e0c8 408: 018add13 40c: 000002a5 410: 0015e2c8 414: 018ae58d 418: 000002a5 41c: 0015e4c8 420: 018b2543 424: 000002a5 428: 0015e6c8 42c: 018b2efd 430: 000002a5 434: 000000c8 438: 018add13 43c: afac0000 440: 03329b70 444: 00000000 448: 00000000 44c: 00000000 450: 00000000 454: 00000000 458: 00000000 45c: 00000000 460: 00000000 464: 00000000 468: 00000000 46c: 00000000 470: 00000000 474: 00000000 478: 00000000 47c: 000002a5 480: 000000c8 484: 018ae58d 488: 307c0100 48c: 1c2d7a5c 490: 00000000 494: 00000000 498: 00000000 49c: 00000000 4a0: 00000000 4a4: 00000000 4a8: 00000000 4ac: 00000000 4b0: 00000000 4b4: 00000000 4b8: 00000000 4bc: 00000000 4c0: 00000000 4c4: 00000000 4c8: 000002a5 4cc: 000000c8 4d0: 018b2543 4d4: 8f6a0200 4d8: b0c3816c 4dc: 00000000 4e0: 00000000 4e4: 00000000 4e8: 00000000 4ec: 00000000 4f0: 00000000 4f4: 00000000 4f8: 00000000 4fc: 00000000 500: 00000000 504: 00000000 508: 00000000 50c: 00000000 510: 00000000 514: 000002a5 518: 000000c8 51c: 018b2efd 520: 8f4f0300 524: da8e5985 528: 00000000 52c: 00000000 530: 00000000 534: 00000000 538: 00000000 53c: 00000000 540: 00000000 544: 00000000 548: 00000000 54c: 00000000 550: 00000000 554: 00000000 558: 00000000 55c: 00000000 560: 000002a5 564: 000000c8 568: 01890d0d 56c: 9a850000 570: 5d3454ef 574: 00000000 578: 00000000 57c: 00000000 580: 00000000 584: 00000000 588: 00000000 58c: 00000000 590: 00000000 594: 00000000 598: 00000000 59c: 00000000 5a0: 00000000 5a4: 00000000 5a8: 00000000 5ac: 000002a5 5b0: 000000c8 5b4: 0189157d 5b8: 1bce0100 5bc: 15429ed7 5c0: 00000000 5c4: 00000000 5c8: 00000000 5cc: 00000000 5d0: 00000000 5d4: 00000000 5d8: 00000000 5dc: 00000000 5e0: 00000000 5e4: 00000000 5e8: 00000000 5ec: 00000000 5f0: 00000000 5f4: 00000000 5f8: 000002a5 5fc: 000000c8 600: 0189562d 604: 2b7e0200 608: 7bf118ba 60c: 00000000 610: 00000000 614: 00000000 618: 00000000 61c: 00000000 620: 00000000 624: 00000000 628: 00000000 62c: 00000000 630: 00000000 634: 00000000 638: 00000000 63c: 00000000 640: 00000000 644: 000002a5 648: 000000c8 64c: 01895f97 650: 1ec50300 654: 65f168fe 658: 00000000 65c: 00000000 660: 00000000 664: 00000000 668: 00000000 66c: 00000000 670: 00000000 674: 00000000 678: 00000000 67c: 00000000 680: 00000000 684: 00000000 688: 00000000 68c: 00000000 690: 000002a5 694: 000000c8 698: 0189a529 69c: 288f0000 6a0: 98b6f5d2 6a4: 00000000 6a8: 00000000 6ac: 00000000 6b0: 00000000 6b4: 00000000 6b8: 00000000 6bc: 00000000 6c0: 00000000 6c4: 00000000 6c8: 00000000 6cc: 00000000 6d0: 00000000 6d4: 00000000 6d8: 00000000 6dc: 000002a5 6e0: 000000c8 6e4: 0189ae61 6e8: 3b900100 6ec: 67908032 6f0: 00000000 6f4: 00000000 6f8: 00000000 6fc: 00000000 700: 00000000 704: 00000000 708: 00000000 70c: 00000000 710: 00000000 714: 00000000 718: 00000000 71c: 00000000 720: 00000000 724: 00000000 728: 000002a5 72c: 000000c8 730: 0189f1d7 734: 5edd0200 738: c4fdb482 73c: 00000000 740: 00000000 744: 00000000 748: 00000000 74c: 00000000 750: 00000000 754: 00000000 758: 00000000 75c: 00000000 760: 00000000 764: 00000000 768: 00000000 76c: 00000000 770: 00000000 774: 000002a5 778: 000000c8 77c: 0189fb73 780: 7bc90300 784: e09383ef 788: 00000000 78c: 00000000 790: 00000000 794: 00000000 798: 00000000 79c: 00000000 7a0: 00000000 7a4: 00000000 7a8: 00000000 7ac: 00000000 7b0: 00000000 7b4: 00000000 7b8: 00000000 7bc: 00000000 7c0: 000002a5 7c4: 000000c8 7c8: 018a40dd 7cc: 58fe0000 7d0: efc0fdfe 7d4: 00000000 7d8: 00000000 7dc: 00000000 7e0: 00000000 7e4: 00000000 7e8: 00000000 7ec: 00000000 7f0: 00000000 7f4: 00000000 7f8: 00000000 7fc: 00000000 800: 00000000 804: 00000000 808: 00000000 80c: 000002a5 810: 000000c8 814: 018a4bcd 818: 4f620100 81c: ce443417 820: 00000000 824: 00000000 828: 00000000 82c: 00000000 830: 00000000 834: 00000000 838: 00000000 83c: 00000000 840: 00000000 844: 00000000 848: 00000000 84c: 00000000 850: 00000000 854: 00000000 858: 000002a5 85c: 000000c8 860: 018a8bb5 864: d5cc0200 868: 9955fe09 86c: 00000000 870: 00000000 874: 00000000 878: 00000000 87c: 00000000 880: 00000000 884: 00000000 888: 00000000 88c: 00000000 890: 00000000 894: 00000000 898: 00000000 89c: 00000000 8a0: 00000000 8a4: 000002a5 8a8: 000000c8 8ac: 018a9547 8b0: 32650300 8b4: f5e6e7f8 8b8: 00000000 8bc: 00000000 8c0: 00000000 8c4: 00000000 8c8: 00000000 8cc: 00000000 8d0: 00000000 8d4: 00000000 8d8: 00000000 8dc: 00000000 8e0: 00000000 8e4: 00000000 8e8: 00000000 8ec: 00000000 8f0: 00000000 8f4: 00000000 8f8: 00000000 8fc: 00000000 900: 00000000 904: 00000000 908: 00000000 90c: 00000000 910: 00000000 914: 00000000 918: 00000000 91c: 00000000 920: 00000000 924: 00000000 928: 00000000 92c: 00000000 930: 00000000 934: 00000000 938: 00000000 93c: 00000000 940: 00000000 944: 00000000 948: 00000000 94c: 00000000 950: 00000000 954: 00000000 958: 00000000 95c: 00000000 960: 00000000 964: 00000000 968: 00000000 96c: 00000000 970: 00000000 974: 00000000 978: 00000000 97c: 00000000 980: 00000000 984: 00000000 988: 00000000 98c: 00000000 990: 00000000 994: 00000000 998: 00000000 99c: 00000000 9a0: 00000000 9a4: 00000000 9a8: 00000000 9ac: 00000000 9b0: 00000000 9b4: 00000000 9b8: 00000000 9bc: 00000000 9c0: 00000000 9c4: 00000000 9c8: 00000000 9cc: 00000000 9d0: 00000000 9d4: 00000000 9d8: 00000000 9dc: 00000000 9e0: 00000000 9e4: 00000000 9e8: 00000000 9ec: 00000000 9f0: 00000000 9f4: 00000000 9f8: 00000000 9fc: 00000000 a00: 00000000 a04: 00000000 a08: 00000000 a0c: 00000000 a10: 00000000 a14: 00000000 a18: 00000000 a1c: 00000000 a20: 000002a5 a24: 0015e0c8 a28: afac0000 a2c: 03329b70 a30: 00000000 a34: 00000000 a38: 00000000 a3c: 00000000 a40: 00000000 a44: 00000000 a48: 00000000 a4c: 00000000 a50: 00000000 a54: 00000000 a58: 00000000 a5c: 00000000 a60: 00000000 a64: 00000000 a68: 000002a5 a6c: 0015e2c8 a70: 307c0100 a74: 1c2d7a5c a78: 00000000 a7c: 00000000 a80: 00000000 a84: 00000000 a88: 00000000 a8c: 00000000 a90: 00000000 a94: 00000000 a98: 00000000 a9c: 00000000 aa0: 00000000 aa4: 00000000 aa8: 00000000 aac: 00000000 ab0: 000002a5 ab4: 0015e4c8 ab8: 8f6a0200 abc: b0c3816c ac0: 00000000 ac4: 00000000 ac8: 00000000 acc: 00000000 ad0: 00000000 ad4: 00000000 ad8: 00000000 adc: 00000000 ae0: 00000000 ae4: 00000000 ae8: 00000000 aec: 00000000 af0: 00000000 af4: 00000000 af8: 000002a5 afc: 0015e6c8 b00: 8f4f0300 b04: da8e5985 b08: 00000000 b0c: 00000000 b10: 00000000 b14: 00000000 b18: 00000000 b1c: 00000000 b20: 00000000 b24: 00000000 b28: 00000000 b2c: 00000000 b30: 00000000 b34: 00000000 b38: 00000000 b3c: 00000000 b40: 00000000 b44: 00000000 b48: 00000000 b4c: 00000000 b50: 00000000 b54: 00000000 b58: 00000000 b5c: 00000000 b60: 00000000 b64: 00000000 b68: 00000000 b6c: 00000000 b70: 00000000 b74: 00000000 b78: 00000000 b7c: 00000000 b80: 00000000 b84: 00000000 b88: 00000000 b8c: 00000000 b90: 00000000 b94: 00000000 b98: 00000000 b9c: 00000000 ba0: 00000000 ba4: 00000000 ba8: 00000000 bac: 00000000 bb0: 00000000 bb4: 00000000 bb8: 00000000 bbc: 00000000 bc0: 00000000 bc4: 00000000 bc8: 00000000 bcc: 00000000 bd0: 00000000 bd4: 00000000 bd8: 00000000 bdc: 00000000 be0: 00000000 be4: 00000000 be8: 00000000 bec: 00000000 bf0: 00000000 bf4: 00000000 bf8: 00000000 bfc: 00000000 e00: 00000468 e04: 03030003 e08: 030082b6 e0c: 00000007 e10: 00000000 e14: 00000000 mcp251xfd-dump did not work for me, but It looks as if the correct data is in the rx fifo. Mfg Stefan -----Ursprüngliche Nachricht----- Von: Marc Kleine-Budde Gesendet: Donnerstag, 22. Dezember 2022 14:02 An: Stefan Althöfer Cc: Thomas.Kopp@microchip.com; linux-can@vger.kernel.org Betreff: Re: AW: mcp251xfd: Bad message receiption On 22.12.2022 10:30:22, Stefan Althöfer wrote: > Hi Thomas, > > > Do I read the pdf correctly (based on the /var/log stuff) that you > > have two MCP2518FD connected to a Pi4B and both of them are running in internal/external loopback mode no interaction between them and the SPIs are separate? > > Yes. For the loopback test the CANs are separate. Errors also occur > when sending messages between the controllers, but I think that is more difficult to analyze. > > root@raspberrypi:~# ip -d -s a s can0 > 4: can0: mtu 72 qdisc pfifo_fast state UP group default qlen 1000 > link/can promiscuity 0 minmtu 0 maxmtu 0 > can state ERROR-ACTIVE (berr-counter tx 0 rx 0) restart-ms 0 > bitrate 1000000 sample-point 0.800 > tq 25 prop-seg 15 phase-seg1 16 phase-seg2 8 sjw 6 > mcp251xfd: tseg1 2..256 tseg2 1..128 sjw 1..128 brp 1..256 brp-inc 1 > dbitrate 4000000 dsample-point 0.800 > dtq 25 dprop-seg 3 dphase-seg1 4 dphase-seg2 2 dsjw 2 > mcp251xfd: dtseg1 1..32 dtseg2 1..16 dsjw 1..16 dbrp 1..256 dbrp-inc 1 > clock 40000000 > re-started bus-errors arbit-lost error-warn error-pass bus-off > 0 0 0 0 0 0 numtxqueues 1 numrxqueues 1 gso_max_size 65536 gso_max_segs 65535 > RX: bytes packets errors dropped missed mcast > 3097429872 2517466658 0 0 0 0 > TX: bytes packets errors dropped carrier collsns > 3696197680 1258733264 0 0 0 0 > root@raspberrypi:~# ip -d -s a s can1 > 5: can1: mtu 72 qdisc pfifo_fast state UP group default qlen 1000 > link/can promiscuity 0 minmtu 0 maxmtu 0 > can state ERROR-ACTIVE (berr-counter tx 0 rx 0) restart-ms 0 > bitrate 1000000 sample-point 0.800 > tq 25 prop-seg 15 phase-seg1 16 phase-seg2 8 sjw 6 > mcp251xfd: tseg1 2..256 tseg2 1..128 sjw 1..128 brp 1..256 brp-inc 1 > dbitrate 4000000 dsample-point 0.800 > dtq 25 dprop-seg 3 dphase-seg1 4 dphase-seg2 2 dsjw 2 > mcp251xfd: dtseg1 1..32 dtseg2 1..16 dsjw 1..16 dbrp 1..256 dbrp-inc 1 > clock 40000000 > re-started bus-errors arbit-lost error-warn error-pass bus-off > 0 112256 0 1 3 1 numtxqueues 1 numrxqueues 1 gso_max_size 65536 gso_max_segs 65535 ^^^^^^ ^ ^ ^ > RX: bytes packets errors dropped missed mcasta > 2590649888 773910314 3 0 0 0 > TX: bytes packets errors dropped carrier collsns > 3442619696 386944310 112254 12 0 0 Why do you have so many errors on can1? The device event went into bus-off. > This is the SPI setup for the dual CAN PI: > > dtparam=spi=on > dtoverlay=spi6-1cs > # mcp251xfd DTS for RPI4 default CAN on SPI6.0 > dtoverlay=mcp251xfd-spi6-0,interrupt_pin=25,oscillator=40000000 > # mcp251xfd DTS for RPI4 CAN extension on SPI0.0 > dtoverlay=mcp251xfd,spi0-0,interrupt=16,oscillator=40000000 > > Or did you mean something else with "script"? Can you share your "scselftest" program? > I'll try the register dump when I suffer the next error ;-) Marc -- Pengutronix e.K. | Marc Kleine-Budde | Embedded Linux | https://www.pengutronix.de | Vertretung West/Dortmund | Phone: +49-231-2826-924 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |