Skip to content

MCP2515 doesnt init #130

Closed
Closed
@zigagazaziga

Description

@zigagazaziga
#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.

Metadata

Metadata

Assignees

Labels

Seeed_Arduino_CANLabel for Seeed_Arduino_CANUAYUnassigned yet

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions