-
Notifications
You must be signed in to change notification settings - Fork 5.2k
2 MCP2515 dont work at the same time #1018
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
@msperl Any thoughts? |
I have a setup with 2 mcp2515 and it works fine for me (together with mmc-spi(with patch), fbtft and enc28j26) One thing that I had seen originally was: does it get detected properly after: |
There is an issue upstream that could be the root-cause... |
@petit-miner Which kernel are you using? The 3.18 tree is still using the bcm2708-spi driver, while the 4.0 tree has switched to the upstreamed bcm2835-spi driver. |
@msperl It would be very nice if you make a short tutorial for me and tell me which kernel version you are using. |
I am running my own build of the kernel based on the 4.0 (otherwise i can not create patches), so you will have to do that as well if you want to use the latest driver. Note that the foundation seems to be moving to 4.0 already, as their kernel default branch is 4.0.y now... Besides that you will also need to create a new overlay for can1 by copying: and replacing:
then compile it with dtc (say as mcp2515-can1-overlay) and then you can load it as well via /boot/config.txt... |
@petit-miner If you do this and can verify that it works (not that I'm doubting you, @msperl) then we can add the new overlay to the standard distributions. |
I am a little bit confused, there are 2 Kernels one for the PI B+ and the PI 2. |
The two kernels are built from the same source tree, using the same tools, but with a few differences in the configurations. For a Pi 1 we build using bcmrpi_defconfig, but for Pi 2 we use bcm2709_defconfig. See here for details.
Once this is done you just need to:
You can find more documentation about Device Tree on the Pi here. |
Thank you for the Information 👍 |
well with the interrupt line you are using for the second controller - maybe use 24 or 26 as the second interrupt line... (you can override it anyway in config.txt via additional parameters) |
I think I made a mistake while editing the file, |
@pelwell: one point maybe: Is it possible to include the SAME overlay twice (but with distinct parameters)? example usage could be:
Which would create 2 can interfaces: can0 and can1 based on chipselect 0 and 1. The downside obviously would be that you would need to add some code to the firmware parser to modify also the identifiers by some scheme (spidev0 translate to spidev1, can0 to can1, can0_osc to can1_osc, can0_pins to can1_pins...). |
That would be a great idea, but I am not a programmer. :/ |
@petit-miner There is no spi1 - that should still say spi0, but the 0s in reg = <0> and mcp2515@0 should be changed to 1s. @msperl There is nothing stopping an overlay being loaded twice, but as you have worked out the names of the nodes and properties can not be changed based on parameters. I understand that this can result in a proliferation of overlays, but I don't want to spend time on adding a slightly esoteric feature now when I could be working on dynamic Device Tree support. |
I am fine with that - I just wanted to let you know that this could also be an option... |
I understand, and suggestions are welcome. It sounds like something I could return to at a later date. |
Side-note: Actually there is also spi1 and spi2 - the issue is that the foundation kernel does not have a driver yet and a patch to upstream a working driver has just been posted today... |
I'll look forward to a PR... |
I am not at home, I can't test it out sorry. |
It works! 👍 |
I've pushed your patch to rpi-4.0.y and rpi-4.1.y. Thank you for your efforts. |
Ok, thanks for your help 👍 |
kernel: w1_therm: Back-port locking improvements from 4.2-rc1 See: raspberrypi/linux#1059 kernel: Added support for 2 mcp2515 CAN Bus IC See: raspberrypi/linux#1018 kernel: BCM270X_DT: Overlay for the Fen Logic VGA666 board (really added this time) firmware: di_adv: Add qpu shader code to implement deinterlace firmware: image_fx: Support YUV_UV as destination format if requested firmware: dmalib: Reduce default priority and burst size of 2d memcpy arm_loader: Ensure reserved qpus are freed and ISR blocks until interrupt cleared gpioman: If dt-blob.bin file is incompatible, use built-in See: https://www.raspberrypi.org/forums/viewtopic.php?f=29&t=113753&start=75#p788079
kernel: w1_therm: Back-port locking improvements from 4.2-rc1 See: raspberrypi/linux#1059 kernel: Added support for 2 mcp2515 CAN Bus IC See: raspberrypi/linux#1018 kernel: BCM270X_DT: Overlay for the Fen Logic VGA666 board (really added this time) firmware: di_adv: Add qpu shader code to implement deinterlace firmware: image_fx: Support YUV_UV as destination format if requested firmware: dmalib: Reduce default priority and burst size of 2d memcpy arm_loader: Ensure reserved qpus are freed and ISR blocks until interrupt cleared gpioman: If dt-blob.bin file is incompatible, use built-in See: https://www.raspberrypi.org/forums/viewtopic.php?f=29&t=113753&start=75#p788079
commit 784daf2 upstream. The fstests test case generic/475 creates a dm-linear device that gets changed to a dm-error device. This leads to errors in loading the block group's zone information when running on a zoned file system, ultimately resulting in a list corruption. When running on a kernel with list debugging enabled this leads to the following crash. BTRFS: error (device dm-2) in cleanup_transaction:1953: errno=-5 IO failure kernel BUG at lib/list_debug.c:54! invalid opcode: 0000 [#1] SMP PTI CPU: 1 PID: 2433 Comm: umount Tainted: G W 5.12.0+ #1018 RIP: 0010:__list_del_entry_valid.cold+0x1d/0x47 RSP: 0018:ffffc90001473df0 EFLAGS: 00010296 RAX: 0000000000000054 RBX: ffff8881038fd000 RCX: ffffc90001473c90 RDX: 0000000100001a31 RSI: 0000000000000003 RDI: 0000000000000003 RBP: ffff888308871108 R08: 0000000000000003 R09: 0000000000000001 R10: 3961373532383838 R11: 6666666620736177 R12: ffff888308871000 R13: ffff8881038fd088 R14: ffff8881038fdc78 R15: dead000000000100 FS: 00007f353c9b1540(0000) GS:ffff888627d00000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007f353cc2c710 CR3: 000000018e13c000 CR4: 00000000000006a0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Call Trace: btrfs_free_block_groups+0xc9/0x310 [btrfs] close_ctree+0x2ee/0x31a [btrfs] ? call_rcu+0x8f/0x270 ? mutex_lock+0x1c/0x40 generic_shutdown_super+0x67/0x100 kill_anon_super+0x14/0x30 btrfs_kill_super+0x12/0x20 [btrfs] deactivate_locked_super+0x31/0x90 cleanup_mnt+0x13e/0x1b0 task_work_run+0x63/0xb0 exit_to_user_mode_loop+0xd9/0xe0 exit_to_user_mode_prepare+0x3e/0x60 syscall_exit_to_user_mode+0x1d/0x50 entry_SYSCALL_64_after_hwframe+0x44/0xae As dm-error has no support for zones, btrfs will run it's zone emulation mode on this device. The zone emulation mode emulates conventional zones, so bail out if the zone bitmap that gets populated on mount sees the zone as sequential while we're thinking it's a conventional zone when creating a block group. Note: this scenario is unlikely in a real wold application and can only happen by this (ab)use of device-mapper targets. CC: [email protected] # 5.12+ Signed-off-by: Naohiro Aota <[email protected]> Signed-off-by: Johannes Thumshirn <[email protected]> Signed-off-by: David Sterba <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
Two MCP2515 Can Bus Controller IC dont work at the same time.
The PI has two SPI CE Pins so this shouldnt a problem.
The text was updated successfully, but these errors were encountered: