Skip to content
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

Does the library support 2x 2518FD chips on same board? #53

Open
dalathegreat opened this issue Nov 28, 2024 · 3 comments
Open

Does the library support 2x 2518FD chips on same board? #53

dalathegreat opened this issue Nov 28, 2024 · 3 comments

Comments

@dalathegreat
Copy link

Working with some custom PCBs that have 2x MCP2518 chips on the same SPI

// CAN_FD the first defines
#define MCP2517_SCK 17  // SCK input of MCP2517
#define MCP2517_SDI 23  // SDI input of MCP2517
#define MCP2517_SDO 39  // SDO output of MCP2517
#define MCP2517_CS 21   // CS input of MCP2517 //21 or 22
#define MCP2517_INT 34  // INT output of MCP2517 //34 or 35

// CAN_FD the 2nd defines
#define 2nd_MCP2517_SCK 17  // SCK input of MCP2517
#define 2nd_MCP2517_SDI 23  // SDI input of MCP2517
#define 2nd_MCP2517_SDO 39  // SDO output of MCP2517
#define 2nd_MCP2517_CS 22   // CS input of MCP2517 //21 or 22
#define 2nd_MCP2517_INT 35  // INT output of MCP2517 //34 or 35

Has anyone been able to use this library with two chips at the same time? One of the chips start, but the second fails to start with errorCode 1

@dalathegreat
Copy link
Author

Some update on this, I got the boards to initialize properly, but after running for a few seconds I get send_ok going bad, and buffer overflows.

@tomtom0707
Copy link

If you do this with an ESP32, pay attention to the selection of the INT pins. Two edge-triggered pins in the same group can cause problems here (in your example 34 and 35).
see: https://docs.espressif.com/projects/esp-chip-errata/en/latest/esp32/03-errata-description/esp32/gpio-edge-interrupts.html

I tested it with ESP32 and two MCP2518.
Test InternalLoopBack, also different settings - ok.
Test Normal20B same settings one CAN bus - ok.
Test Normal20B different settings two CAN buses (only send) - ok.
So I think it works with two MCP2518, but I haven't tested all the variants.
I'm from Germany, I use the loop without speed limit (delay), no errors occur.
General note: If you really want to send quickly on the bus, you have to increase the send buffer (mControllerTransmitFIFOSize).

@pierremolinaro
Copy link
Owner

pierremolinaro commented Jan 27, 2025 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants