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 init Fail #148

Open
Obili69 opened this issue Dec 5, 2023 · 1 comment
Open

MCP2515 init Fail #148

Obili69 opened this issue Dec 5, 2023 · 1 comment
Assignees
Labels
Seeed_Arduino_CAN Label for Seeed_Arduino_CAN UAY Unassigned yet

Comments

@Obili69
Copy link

Obili69 commented Dec 5, 2023

Hello
I bought a MCP2515 CAN shield and tried it with an arduino. But then i changed to an esp32 s3 because of power limitations on the arduino, it worked on the bench and i used the standard SPI pins of the esp32s3.

Now i have a mirkoe MCP2515 transceiver on a compatible esp32s3 dev board but this doesn't use the standard SPI pins
I also tried it with the Seeduino shield and dupont wires. So im pretty sure my SPI bus doesn't get initialised on the correct pins.

I know that you probably aren't interested in helping as its not with the intended Hardware. But if you are Thanks a lot even for reading this.

I used this simple code to demonstrate my issue I also watched the Can Bus with PCAN view but obviously nothing happened.
In the Serialcon i got a 1 for this line: Serial.println(CAN.begin(CAN_500KBPS));
and a lot of CAN init fail, retry...

Can you guys please help me as i wrote my whole VCU code with this library because it seemed intuitive to me.

Best regards

// demo: CAN-BUS Shield, send data
// [email protected]

#include <SPI.h>

#include "mcp2515_can.h"
//Pinout
#define SCK 4
#define MOSI 6
#define MISO 5
const int SPI_CS_PIN = 36;
const int CAN_INT_PIN = 11;
mcp2515_can CAN(SPI_CS_PIN); // Set CS pin
#define MAX_DATA_SIZE 8

void setup() {

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

unsigned char stmp[8] = {0, 0, 0, 0, 0, 0, 0, 0};
void loop() {
// send data: id = 0x00, standrad frame, data len = 8, stmp: data buf
stmp[7] = stmp[7] + 1;
if (stmp[7] == 100) {
stmp[7] = 0;
stmp[6] = stmp[6] + 1;

    if (stmp[6] == 100) {
        stmp[6] = 0;
        stmp[5] = stmp[5] + 1;
    }
}

CAN.sendMsgBuf(0x00, 0, 8, stmp);
delay(100);                       // send data per 100ms
Serial.println("CAN BUS sendMsgBuf ok!");

}

// END FILE

@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

3 participants