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

MCP2515 doesnt init #130

Open
zigagazaziga opened this issue Nov 3, 2021 · 2 comments
Open

MCP2515 doesnt init #130

zigagazaziga opened this issue Nov 3, 2021 · 2 comments
Assignees
Labels
Seeed_Arduino_CAN Label for Seeed_Arduino_CAN UAY Unassigned yet

Comments

@zigagazaziga
Copy link

zigagazaziga commented Nov 3, 2021

#include <can-serial.h>
#include <mcp2515_can.h>
#include <mcp2515_can_dfs.h>
#include <mcp_can.h>
#include <SPI.h>

#define CAN_2515

const int SPI_CS_PIN = 9;
const int CAN_INT_PIN = 2;

mcp2515_can CAN(SPI_CS_PIN);


void setup() {
   
   SERIAL_PORT_MONITOR.begin(115200);
    
    while (CAN_OK != CAN.begin(CAN_500KBPS)) {             // init can bus : baudrate = 500k
        SERIAL_PORT_MONITOR.println("CAN init fail, retry...");
        delay(100);
    }
    SERIAL_PORT_MONITOR.println("CAN init ok!");
}
void loop() {
//...
}

MCP2515 doesnt complete init and I have no clue why, serial monitor just outputs "CAN init fail, retry...".
Using Arduino UNO + CAN-BUS Shield V1.2 10/10/2013 by Elecfreaks.
Doesnt work if I change CS to 10 either.

I dont have anything connected to CANH CANL, but it should finish initialisation either way right?

When I do apply a signal to CANH CANL, it is a signal from DEWESOFT's DS CAN2 on address 0x0A5. This doesnt change the result obviously, but the point is, I'd like to read it.

Would appreciate any help, ty.

@RufusVS
Copy link

RufusVS commented Sep 24, 2022

You should do a better job checking the return code from CAN.begin(). It will give you a clue about why can init is failing. For example: SERIAL_PORT_MONITOR.println(CAN.begin(CAN_500KBPS));

@MatthewJeffson MatthewJeffson added UAY Unassigned yet Seeed_Arduino_CAN Label for Seeed_Arduino_CAN labels Oct 9, 2024
@Lesords Lesords self-assigned this Oct 14, 2024
@Lesords
Copy link

Lesords commented Oct 16, 2024

Hello,

I'm very sorry to have kept you waiting so long.

Do you still have this problem now?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Seeed_Arduino_CAN Label for Seeed_Arduino_CAN UAY Unassigned yet
Projects
Status: Todo
Development

No branches or pull requests

4 participants