MCP2515 no Connect to the car

Hallo, with an XIAO RP2040 and MCP2515 maybe for i think 100 hours all possible to get it work - i become no messages from the Audi A3 8p 2006.

Connections:

Xiao RP2040 MCP2515

D10 MOSI MOSI
D9 MISO MISO
D8 SCK SCK
D7 CSn CS

D1 INT

I tryed this:

I tryed 3 different MCP2515, an ESP32, another Oscilator from 8MHz to 16 MHz,

network termination on the MCP2515 i bridged.

I used this code (and also other i tryed):

// CAN Receive Example



#include <mcp_can.h>
#include <SPI.h>

long unsigned int rxId;
unsigned char len = 0;
unsigned char rxBuf[8];
char msgString[128];                        // Array to store serial string

#define CAN0_INT D1                              // Set INT to pin 2
MCP_CAN CAN0(7);                               // Set CS to pin 10


void setup()
{
  Serial.begin(115200);
  
  // Initialize MCP2515 running at 16MHz with a baudrate of 500kb/s and the masks and filters disabled.
  if(CAN0.begin(MCP_ANY, CAN_500KBPS, MCP_16MHZ) == CAN_OK)
    Serial.println("MCP2515 Initialized Successfully!");
  else
    Serial.println("Error Initializing MCP2515...");
  
  CAN0.setMode(MCP_NORMAL);                     // Set operation mode to normal so the MCP2515 sends acks to received data.

  pinMode(CAN0_INT, INPUT);                            // Configuring pin for /INT input
  
  Serial.println("MCP2515 Library Receive Example...");
}

void loop()
{
  if(!digitalRead(CAN0_INT))                         // If CAN0_INT pin is low, read receive buffer
  {
    CAN0.readMsgBuf(&rxId, &len, rxBuf);      // Read data: len = data length, buf = data byte(s)
    
    if((rxId & 0x80000000) == 0x80000000)     // Determine if ID is standard (11 bits) or extended (29 bits)
      sprintf(msgString, "Extended ID: 0x%.8lX  DLC: %1d  Data:", (rxId & 0x1FFFFFFF), len);
    else
      sprintf(msgString, "Standard ID: 0x%.3lX       DLC: %1d  Data:", rxId, len);
  
    Serial.print(msgString);
  
    if((rxId & 0x40000000) == 0x40000000){    // Determine if message is a remote request frame.
      sprintf(msgString, " REMOTE REQUEST FRAME");
      Serial.print(msgString);
    } else {
      for(byte i = 0; i<len; i++){
        sprintf(msgString, " 0x%.2X", rxBuf[i]);
        Serial.print(msgString);
      }
    }
        
    Serial.println();
  }
}

I tryed to write the Pins with an "D" and without. For example D1 for INT.

The Can Speed on this car is 500Kbit on the PINS of the OBD: 3 + 11

No Idea what else i can try and where is here the issue. I am a "Beginner" but so stupid i think i am also not.

I Hope you can help me. I can later put some pictures from all this here into.

Blockzitat

My guess is that the OBD interface is waiting for your Arduino to send a request.

The behavior of every model of car is different so I would recommend that you find a CAN hacking forum that deals specifically with the Audi A3.

i just connected the CAN High and CAN Low connector from the MCP2515 direclty to the OBD Socket from the car.

An ELM327 works with that car, also Launch Tester...

I also connected the MCP2515 to the radios CAN Bus which works on 100 KBits.... i become no messages.

Maybe there are some issues with Xiao Seed and Xiao RP2040 ? I dont have any ideas anymore.

I Put the MCP2515 directly to a power supply adjusted on 5.0V, bought a new MCP2515, new cable, i changed the 8MHz Oscilator with an 16Mhz - all this creats no effect, nothing changed.

The internet is full of Arduino Projects with an Audi 8P... nobody had any problems...

My view is, that this MCP2515 makes too many problems and is too lagy.
Somebody can recommend me another CAN Board ? or maybe i use the internal from the ESP32 and connect it to a TJA1050 ?

Do you now have two MCP2515 boards?
If so you can test communication between them using a single Arduino using two different CS pins.

yes i have. i put both together. one as transceiver and the other one as receiver:

in the serial monitor the one show "message send successfully" but the other one receive nothing.

one have an 8MHz Osci, the other one 16 MHz. Bautrate on both 500 KBit.

the code one the receiver:

// CAN Receive Example
//

#include <mcp_can.h>
#include <SPI.h>

long unsigned int rxId;
unsigned char len = 0;
unsigned char rxBuf[8];
char msgString[128];                        // Array to store serial string

#define CAN0_INT 1                              // Set INT to pin 2
MCP_CAN CAN0(3);                               // Set CS to pin 10


void setup()
{
  Serial.begin(115200);
  
  // Initialize MCP2515 running at 16MHz with a baudrate of 500kb/s and the masks and filters disabled.
  if(CAN0.begin(MCP_ANY, CAN_500KBPS, MCP_16MHZ) == CAN_OK)
    Serial.println("MCP2515 Initialized Successfully!");
  else
    Serial.println("Error Initializing MCP2515...");
  
  CAN0.setMode(MCP_NORMAL);                     // Set operation mode to normal so the MCP2515 sends acks to received data.

  pinMode(CAN0_INT, INPUT);                            // Configuring pin for /INT input
  
  Serial.println("MCP2515 Library Receive Example...");
}

void loop()
{
  if(!digitalRead(CAN0_INT))                         // If CAN0_INT pin is low, read receive buffer
  {
    CAN0.readMsgBuf(&rxId, &len, rxBuf);      // Read data: len = data length, buf = data byte(s)
    
    if((rxId & 0x80000000) == 0x80000000)     // Determine if ID is standard (11 bits) or extended (29 bits)
      sprintf(msgString, "Extended ID: 0x%.8lX  DLC: %1d  Data:", (rxId & 0x1FFFFFFF), len);
    else
      sprintf(msgString, "Standard ID: 0x%.3lX       DLC: %1d  Data:", rxId, len);
  
    Serial.print(msgString);
  
    if((rxId & 0x40000000) == 0x40000000){    // Determine if message is a remote request frame.
      sprintf(msgString, " REMOTE REQUEST FRAME");
      Serial.print(msgString);
    } else {
      for(byte i = 0; i<len; i++){
        sprintf(msgString, " 0x%.2X", rxBuf[i]);
        Serial.print(msgString);
      }
    }
        
    Serial.println();
  }
}

/*********************************************************************************************************
  END FILE
*********************************************************************************************************/

the code on the Sender

// CAN Send Example
//

#include <mcp_can.h>
#include <SPI.h>

#define CAN0_INT 3;                         // Set INT to pin 2
MCP_CAN CAN0(7);     // Set CS to pin 10

void setup()
{
  Serial.begin(115200);

  // Initialize MCP2515 running at 16MHz with a baudrate of 500kb/s and the masks and filters disabled.
  if(CAN0.begin(MCP_ANY, CAN_500KBPS, MCP_8MHZ) == CAN_OK) Serial.println("MCP2515 Initialized Successfully!");
  else Serial.println("Error Initializing MCP2515...");

  CAN0.setMode(MCP_NORMAL);   // Change to normal mode to allow messages to be transmitted
}

byte data[8] = {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07};

void loop()
{
  // send data:  ID = 0x100, Standard CAN Frame, Data length = 8 bytes, 'data' = array of data bytes to send
  byte sndStat = CAN0.sendMsgBuf(0x100, 0, 8, data);
  if(sndStat == CAN_OK){
    Serial.println("Message Sent Successfully!");
  } else {
    Serial.println("Error Sending Message...");
  }
  delay(100);   // send data per 100ms
}

/*********************************************************************************************************
  END FILE
*********************************************************************************************************/

The Xiao RP2040 have 7 Pins on each side.

0 SV
1 GND
2 3V3
3 10 MOSI
4 9 MISO
5 8 SCK
6 7 CSn

I used:
Sender:

INT = (3)
CS = (7)

Receiver:

INT = (1)
CS = (3)

Maybe i upload 2 Pictures, how i build all ?

pictures:





I uploaded again the same code... and it works now. maybe the xiao is broken ???
I found out, that sometimes the Xiao disappear and i must reflash it in the Windows Explorer that the Port comes back.... I really did not changed the code !

But there is still another problem: the serial Monitor is flickering the CAN Messages. When i put my finger under the PIN connector under the MCP2515 OR the Xiao from the SENDER, the messages are clear to read. dont care, where i touch the mcp. what could be the problem ?

And again: the Receiver disappear and i must reflash the Xiao... Windows says: unknown USB Device.. what is the problem ? There is definitly a problem with one Xiao/mcp. The code is the same, but there are again no messages... tomorrow i will change all and then i see if the problem will appear on the other xiao then. when it dont will be, then the problem is that the receive function have a problem with the xiao.

Now the Receiver receives Messages but i disconnected the Sender... what the hell ????

If you look at the MCP2515 boards with a magnifying glass you will probably find that both have a number 8 on the top of the metal can.

image

That means the board is operating at 8MHz and therefore your code needs that setting for the sender and receiver.

i know that one have a 8 Mhz and the other one a 16 Mzh and I CHANGED IT IN THE CODE BUT NOW, THE RECEIVER SHOWS MESSAGES BUT THE SECOND XIAO IS

NOT

CONNECTED

Is ther another variant ?? I dont want to use this MCP anymore. Its Trash. nothing else.

IT WORKS ONLY WHEN YOU ARE LUCKY. NO CHANGES TO THE CODE. DID NOT TOUCHED THE HARDWARE. I EVEN DID NOT TOUCHED THE CABLES.

the problem is not logical to reproduce.

i think i will try this: MKR Vidor 4000. This MCP is absolutly trash. no wounder it cost only some euros. Or use the ESP32 and i will use the internal CAN with an transeiver chip. I am sitting here 2 weeks. each day around 4-5 hours. its WASTED time. tomorrow in the morning i will take a hammer and help myselfe that i can sleep again well. Dont care what Xiao, when you flash the Receive code, then it sucks. it starts with the flashing process. it takes double time. later the xiao stops working, dont care what xiao you use. it means the mcp dont work with the xiao certain.

the night is again over and the result is f**** s*****. tomorrow i will destroy all with a hammer. finish

Did you replace the physical 8Mhz crystal with a 16MHz crystal on one of the boards?
If so, did you change the C1 and C2 capacitors as per page 56 of the datasheet?

image

i connected back the 3rd MCP with the original 8Mzh Osci - NO CHANGE

I restarted this trash Windows 11 Machine - now in the IDE Serial Monitor you can not see anymore any Serial Output. Tomorrow i install again on this f**** Surface Linux KDE ! It will be THE VERY FIRST !

Again: dont care what you try: data output depends on luck. 95% you are NOT able to see ANY messages.

Why i am wasting my time ? I drive a ferrari 360 and i want cut out from the expansive Texa Tester the PIS sequence copy it on a microcontroller that i can change the PIS Value in the car on a little display - who can do this for me ? i pay this.

makes no sence burn hours over hours for NOTHING. how much ? 1000 euro ? this money i do in 2-3 days by trading and i will watch a film in the evening.

And the best result it seems to me is to create all this on a STM32. Its really professional this microcontrollers with QT. really amazing.

its a dream. but i think to difficult for me

all goes in the trash box this cheap chinese shit. 3 time use it - connection problems

Sir, now i can with big pride


present you the issue:

there is your 8Mhz Osci.

Sir, 8MHz you sayed? is this correct ?

Dont buy this Xiao types. ist nothing else then experimental boards.

today i tryed again all the same with 2 ESP32 - works clear. No issues, no luck, nothing.

On that trash MCP are 2 8Mhz original specs. i tryed this variant also yesterday.

DONT BUY THIS XIAO. i have different sorts here - makes NO SENCE. They always brick, another one was broken after i played on the OLED a little video for over the night. Only problems you have with this xiao. i put them today all in the rubish.

i wanted to use these Xiao for a project for a sensor, to switch on to digital / optical sensor calculation. Wasted time, money and nerves.

and these Xiao are NOT compatible with the mcp2515 library. After flash the code, you will be NOT able anymore to boot these Xiao anymore. ALWAYS. Dont care that MCP is connected or not... i hope this could help some other users, who have the same issue.

This Xiao is ABSOLUTLY full of issues. You can flash the example file for Send CAN Messages... in the Serial Monitor you can read "Message Sent Successfully" but no MCP is connected !

How is this possible ? The check in the code

"if(CAN0.begin(MCP_ANY, CAN_500KBPS, MCP_8MHZ) == CAN_OK) Serial.println("MCP2515 Initialized Successfully!");
else Serial.println("Error Initializing MCP2515...");"

dont care this Board. When i upload to these boards the firmware file "Blinking" after reboot, the lights does not blink. How i allready many times sayed: its totally trash. In my case, i can not do something serious with this trash. it was a waste of money and more then this TIME + NERVES

I tryed it again to flash the receiver file ^^very funny. after this you dont have any access anymore to the board ^^ you can again ask you what you did wrong. nothing. all depends on these Xiao on Luck

the receiver disappear after 30 seconds from alone. then you can again reflash the board, because you dont have any access anymore to it. you can change the boards Send/receive, then you have with the other board the same problem. Incompatible. thats the point.

i would like to know what is the problem. on monday i go to a very good friend who have an osciloscope. he will tell me, what is the problem.

Somewhere in Internet i was reading that somebody hat the same problem. he had to change something on the code then all was working. the receiver makes makes problems when you start it. but i have forgotten what you have to change in the code.

now the receiver find messages, but there is no sender on the bus ^^

Extended ID: 0x143EA347  DLC: 0  Data: REMOTE REQUEST FRAME
Extended ID: 0x143EA347  DLC: 0  Data: REMOTE REQUEST FRAME
Extended ID: 0x143EA347  DLC: 0  Data: REMOTE REQUEST FRAME
Extended ID: 0x143EA347  DLC: 0  Data: REMOTE REQUEST FRAME
Extended ID: 0x143EA347  DLC: 0  Data: REMOTE REQUEST FRAME
Extended ID: 0x143EA347  DLC: 0  Data: REMOTE REQUEST FRAME
Extended ID: 0x0C4FF7EF  DLC: 0  Data:
Extended ID: 0x1E616E80  DLC: 11  Data: REMOTE REQUEST FRAME
Extended ID: 0x1E616E80  DLC: 11  Data: REMOTE REQUEST FRAME
Extended ID: 0x1EDC8087  DLC: 8  Data: 0x6D 0x5D 0x8F 0xD3 0x4E 0x72 0x80 0x87

I ask me from where he get this messages ?

another guy who had this problem without a solution

For all people who have this little trash xiao. all people have problems. i had an xiao samd21 then xiao rp2040

DONT BUY THIS. Flash it depends on luck. here you can read more:

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.