-
Notifications
You must be signed in to change notification settings - Fork 5.2k
mcp2515 on spi1 can0 not working #5346
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
Is that your bug report? Please explain clearly what is not working. |
The Bug: candump can0 is not producing any output. and of course a can signal is applied to can0 I'm not sure about the linking of spi1.1 to can 0 and spi1.0 to can1 it's an observation maybe a clue to find the bug |
Without this board and some CAN hardware my support is going to be limited. |
will check tomorow thx |
|
Yes, the bus is terminated when I connect the same CAN lines to CAN1 --candump can1-- is OK |
@pelwell
with both overlays can1 is OK and can0 not OK ad 2. dtoverlay=t-sp1-can0,oscillator=16000000,interrupt=5
ad 2. dtoverlay=t-sp1-can1,oscillator=16000000,interrupt=6
ad 2. with both overlays:
Strange isnt it? More playing around with the overlays (maybe this information helps)
but can0 and can1 not OK |
I haven't had a chance to digest all of that information yet, but are those results repeatable? |
Yes they are |
For some reason, spi1.1 is not getting any interrupts. Does this change if you momentarily ground GPIO6/pin 29?
By the way, the overlay fragments disabling |
ad 5. using J9 on the Board ad 6-7. Time to get the osziloscope: int5 (asociated with can0) gets the interupt I suspected that the fragments were misguided but my understanding of the dt was/is not good enough to know what I'm doing just for the record 1: just for the record2: |
It's important to distinguish between the bus numbers on the board and the labels that Linux gives the network interfaces. To make sure I've understood you correctly, please do the following:
|
ad 8. CAN on CAN0 connector candump can0 no output dmesg|grep spi grep spi1 /proc/interrupts ad 9. CAN on CAN1 connector dmesg|grep spi grep spi1 /proc/interrupts |
In both cases the driver can communicate with both instances of the MCP2515. If one of them was responding on both chip selects then the results would have been the same for 8 & 9, but they weren't. From that I conclude that the SPI communication is working. There's still a slight question mark over the status of the sp1.1 interrupt on GPIO 6. Do you ever see it high? Could a stuck interrupt line appear to show a working controller but with no devices? Whether the interrupt line is the cause of the problem, or whether it's just a symptom of fault on the CAN side of the MCP2515, it definitely smells like a hardware problem on the CAN board. Have you tried using it on SPI0 (with J9 moved)? |
I repeated the whole procedure with an identical board. Same results I'll try to move J9 to SPI0 or should I try to move int6 to another pin? |
Either, or both - the aim is to try different combinations to help to pinpoint the problem. |
I put our converation on stackoverflow Now I'll will head over to the lab and try some combinations. @pelwell : Thank you for the support!! I hope we can corner this bug. |
connected the 2-ch-can-hat to SPI0 INT1 --- Pin 22 GPIO 25 /boot/config.txt: mcp2515-can0.dtbo compiles from:
mcp2515-can1.dtbo compiles from
dmesg | grep spi [ 8.132198] mcp251x spi0.1: prop pinctrl-0 index 0 invalid phandle So I got a fresh copy of mcp2515-can0.dtbo and mcp2515-can1.dtbo from https://github.com/raspberrypi/firmware/tree/master/boot/overlays and got the same [ 7.856228] mcp251x spi0.1: prop pinctrl-0 index 0 invalid phandle |
How old is your firmware ( |
SystemRaspberry Pi reference 2021-01-11 Oct 29 2021 10:49:08 Linux raspberrypi 5.10.63-v7+ #1459 SMP Wed Oct 6 16:41:10 BST 2021 armv7l GNU/Linux |
Don't worry, I've found it -
Try grabbing the overlays from the same release as the firmware: https://github.com/raspberrypi/rpi-firmware/tree/d5edc6af1ef48f97b525da88ff6c510c2d4231c3/overlays |
Grabed it loaded it --- |
New SystemRaspberry Pi reference 2022-09-22 Copyright (c) 2012 Broadcom Linux raspberrypi 5.15.61-v8+ #1579 SMP PREEMPT Fri Aug 26 11:16:44 BST 2022 aarch64 GNU/Linux /boot/config.txt: dtoverlay=mcp2515-can0,oscillator=16000000,interrupt=23 no Board attached --> [ 11.540216] mcp251x spi0.1: MCP251x didn't enter in conf mode after reset Board attached to spi0 --> [ 10.532899] mcp251x spi0.1 can0: MCP2515 successfully initialized. Still the mixup CAN0 and CAN1 but both channels working on SPI0 Next Step ---> move to SPI1 I'll keep you posted |
one Overlay: [ 11.608247] mcp251x spi1.0: Cannot initialize MCP2515. Wrong wiring? dt-overlay=t-spi1-can1,oscillator=16000000,interrupt=6 [ 10.718563] mcp251x spi1.1: Cannot initialize MCP2515. Wrong wiring? both Overlays [ 10.797097] mcp251x spi1.1 can0: MCP2515 successfully initialized. candump can0 (asociated with spi1.1) not OK cat /proc/interrupts GPIO 5 (int0) HIGH and gets Interrupts looks like we are back on square one - but we verrified the board is working on spi0 (with crosover between can0 and can1) and the new system makes a more stable impression |
changing the order of the loading of the overlays took care of the crosover on spi0 both channels ar working so we could change the issue to mcp2515 on spi1 only one can channel working |
I think this is a hardware problem, one that few people have encountered because most would use it on SPI0. |
Shure? One last thing tomorow I'll try to change from GPIO 6 maybe this is the issue |
Moving the interrupt vrom pin 31 (GPIO 6) to pin 33 (GPIO 13) solved the problem. So either it is just my rpi where GPIO 6 in this combination is faulty or .... Any way -- hardware |
Uh oh!
There was an error while loading. Please reload this page.
Describe the bug
mcp2515 on spi1 - candump can0 not generating output
Steps to reproduce the behaviour
waveshare 2-ch-can-hat connected to raspberry B3+
INT1 --- Pin 29 GPIO 5
INT0 --- Pin 31 GPIO 6
CS1 ---- Pin 11 GPIO 17 (SPI1 CE1)
CS2 ---- Pin 12 GPIO 18 (SPI1 CE0)
SCK ---- Pin 40 GPIO21 (SPI1 SCLK)
MOSI -- Pin 38 GPIO20 (SPI1 MOSI)
MISO -- Pin 35 GPIO19 (SPI1 MISO)
GND --- Pin 6 GND
5V ----- Pin 1 5V
/boot/config.txt:
dtoverlay=spi1-2cs,cs0_spidev=off,cs1_spidev=off
dtoverlay=t-sp1-can0,oscillator=16000000,interrupt=5
dtoverlay=t-sp1-can1,oscillator=16000000,interrupt=6
t-sp1-can0.dtbo compiles from:
t-sp1-can1.dtbo compiles from:
dmesg|grep spi
[ 8.232885] mcp251x spi1.1 can0: MCP2515 successfully initialized.
[ 8.245989] mcp251x spi1.0 can1: MCP2515 successfully initialized.
spi1.1 linked to can0 !
spi1.0 linked to can1 !
Device (s)
Raspberry Pi 1 Mod. B+
System
Raspberry Pi reference 2021-01-11
Generated using pi-gen, https://github.com/RPi-Distro/pi-gen, 21090519d85bdaa1615d5d5057d37b09368ea5d2, stage2
Oct 29 2021 10:49:08
Copyright (c) 2012 Broadcom
version b8a114e5a9877e91ca8f26d1a5ce904b2ad3cf13 (clean) (release) (start)
Linux raspberrypi 5.10.63-v7+ #1459 SMP Wed Oct 6 16:41:10 BST 2021 armv7l GNU/Linux
Logs
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: