MCP2515 init Fail
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
Hello,
I'm very sorry to have kept you waiting so long.
Do you still have this problem now?
Hello,
I'm going to close this issue, feel free to re-open it if you have any other questions.
[Autocommentary]