Uno -> MCP2515 -> VW ECU Sending CAN Bus but not recieving

I'm not a complete idiot...but after the last 2 weeks of being stuck at the same spot I'm starting to wonder if I got that wrong too. I have a much more complicated project in mind but I'm just trying to eat this elephant one bite at a time. First step is to establish comms with Volkswagen ECU ( similar to a project I saw here that @turbozob was working on)

My set up:

Arduino Uno ( powered with 9V plug-in power supply)

HiLetgo 2pcs MCP2515 CAN Bus Module TJA1050 Receiver SPI Module for Arduino AVR

Connected like this:(alternating the CS wire between pin 9&10 for troubleshooting)

Using this library:

https://github.com/coryjfowler/MCP_CAN_lib

Trying to run the OBD_PID_Request Sketch from the examples with-in the library by @coryjfowler . Just changed the "MCP_16MHZ" to "MCP_8MHZ" (also played with MCP_CAN CAN0(9) to MCP_CAN CAN0(10) and making the changes to the CS wire connection in kind on Uno board as well with no difference)

/* CAN OBD & UDS Simple PID Request
 *
 *  Currently requests PID 0x00 at a 1 second interval and
 *  displays all received CAN traffic to the terminal at 115200.
 *
 *  Written By: Cory J. Fowler  April 5th, 2017
 *
 *  (Disclaimer: Standard IDs are currently UNTESTED against a vehicle)
 *
 */

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

#define standard 0
// 7E0/8 = Engine ECM
// 7E1/9 = Transmission ECM
#if standard == 1
  #define LISTEN_ID 0x7EA
  #define REPLY_ID 0x7E0
  #define FUNCTIONAL_ID 0x7DF
#else
  #define LISTEN_ID 0x98DAF101
  #define REPLY_ID 0x98DA01F1
  #define FUNCTIONAL_ID 0x98DB33F1
#endif

// CAN TX Variables
unsigned long prevTx = 0;
unsigned int invlTx = 1000;
byte txData[] = {0x02,0x01,0x00,0x55,0x55,0x55,0x55,0x55};

// CAN RX Variables
unsigned long rxID;
byte dlc;
byte rxBuf[8];
char msgString[128];                        // Array to store serial string

// CAN Interrupt and Chip Select Pins
#define CAN0_INT 2                              /* Set INT to pin 2 (This rarely changes)   */
MCP_CAN CAN0(9);                                /* Set CS to pin 9 (Old shields use pin 10) */


void setup(){

  Serial.begin(115200);
  while(!Serial);
 
  // Initialize MCP2515 running at 16MHz with a baudrate of 500kb/s and the masks and filters disabled.
  if(CAN0.begin(MCP_STDEXT, CAN_500KBPS, MCP_8MHZ) == CAN_OK)
    Serial.println("MCP2515 Initialized Successfully!");
  else{
    Serial.println("Error Initializing MCP2515... Permanent failure!  Check your code & connections");
    while(1);
  }

//
//  // Allow all Standard IDs
//  CAN0.init_Mask(0,0x00000000);                // Init first mask...
//  CAN0.init_Filt(0,0x00000000);                // Init first filter...
//  CAN0.init_Filt(1,0x00000000);                // Init second filter...
//  // Allow all Extended IDs
//  CAN0.init_Mask(1,0x80000000);                // Init second mask...
//  CAN0.init_Filt(2,0x80000000);                // Init third filter...
//  CAN0.init_Filt(3,0x80000000);                // Init fourth filter...
//  CAN0.init_Filt(4,0x80000000);                // Init fifth filter...
//  CAN0.init_Filt(5,0x80000000);                // Init sixth filter...

#if standard == 1
  // Standard ID Filters
  CAN0.init_Mask(0,0x7F00000);                // Init first mask...
  CAN0.init_Filt(0,0x7DF0000);                // Init first filter...
  CAN0.init_Filt(1,0x7E10000);                // Init second filter...

  CAN0.init_Mask(1,0x7F00000);                // Init second mask...
  CAN0.init_Filt(2,0x7DF0000);                // Init third filter...
  CAN0.init_Filt(3,0x7E10000);                // Init fourth filter...
  CAN0.init_Filt(4,0x7DF0000);                // Init fifth filter...
  CAN0.init_Filt(5,0x7E10000);                // Init sixth filter...

#else
  // Extended ID Filters
  CAN0.init_Mask(0,0x90FF0000);                // Init first mask...
  CAN0.init_Filt(0,0x90DA0000);                // Init first filter...
  CAN0.init_Filt(1,0x90DB0000);                // Init second filter...

  CAN0.init_Mask(1,0x90FF0000);                // Init second mask...
  CAN0.init_Filt(2,0x90DA0000);                // Init third filter...
  CAN0.init_Filt(3,0x90DB0000);                // Init fourth filter...
  CAN0.init_Filt(4,0x90DA0000);                // Init fifth filter...
  CAN0.init_Filt(5,0x90DB0000);                // Init sixth filter...
#endif

  CAN0.setMode(MCP_NORMAL);                      // Set operation mode to normal so the MCP2515 sends acks to received data.

  // Having problems?  ======================================================
  // If you are not receiving any messages, uncomment the setMode line below
  // to test the wiring between the Ardunio and the protocol controller.
  // The message that this sketch sends should be instantly received.
  // ========================================================================
  //CAN0.setMode(MCP_LOOPBACK);

  pinMode(CAN0_INT, INPUT);                          // Configuring pin for /INT input
 
  Serial.println("Simple CAN OBD-II PID Request");
}

void loop(){

  if(!digitalRead(CAN0_INT)){                         // If CAN0_INT pin is low, read receive buffer
 
    CAN0.readMsgBuf(&rxID, &dlc, rxBuf);             // Get CAN data
  
    // Display received CAN data as we receive it.
    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), dlc);
    else
      sprintf(msgString, "Standard ID: 0x%.3lX       DLC: %1d  Data:", rxID, dlc);
 
    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<dlc; i++){
        sprintf(msgString, " 0x%.2X", rxBuf[i]);
        Serial.print(msgString);
      }
    }
      
    Serial.println();
  }
 
  /* Every 1000ms (One Second) send a request for PID 00           *
   * This PID responds back with 4 data bytes indicating the PIDs  *
   * between 0x01 and 0x20 that are supported by the vehicle.      */
  if((millis() - prevTx) >= invlTx){
    prevTx = millis();
    if(CAN0.sendMsgBuf(FUNCTIONAL_ID, 8, txData) == CAN_OK){
      Serial.println("Message Sent Successfully!");
    } else {
      Serial.println("Error Sending Message...");
    }
  }
}

This is the result:

Starting to Set Filter!
Setting Filter Successful!
Starting to Set Filter!
Setting Filter Successful!
Starting to Set Mask!
Setting Mask Successful!
Starting to Set Filter!
Setting Filter Successful!
Starting to Set Filter!
Setting Filter Successful!
Starting to Set Filter!
Setting Filter Successful!
Starting to Set Filter!
Setting Filter Successful!
Simple CAN OBD-II PID Request
Message Sent Successfully!
Message Sent Successfully!
Message Sent Successfully!
Message Sent Successfully!
Message Sent Successfully!
Message Sent Successfully!
Message Sent Successfully!

Also ran the sketch with the "CAN0.setMode(MCP_LOOPBACK);" as described in the sketch notes.

The result:

Starting to Set Filter!
Setting Filter Successful!
Starting to Set Filter!
Setting Filter Successful!
Starting to Set Mask!
Setting Mask Successful!
Starting to Set Filter!
Setting Filter Successful!
Starting to Set Filter!
Setting Filter Successful!
Starting to Set Filter!
Setting Filter Successful!
Starting to Set Filter!
Setting Filter Successful!
Simple CAN OBD-II PID Request
Message Sent Successfully!
Extended ID: 0x18DB33F1 DLC: 8 Data: 0x02 0x01 0x00 0x55 0x55 0x55 0x55 0x55
Message Sent Successfully!
Extended ID: 0x18DB33F1 DLC: 8 Data: 0x02 0x01 0x00 0x55 0x55 0x55 0x55 0x55
Message Sent Successfully!
Extended ID: 0x18DB33F1 DLC: 8 Data: 0x02 0x01 0x00 0x55 0x55 0x55 0x55 0x55
Message Sent Successfully!

I've tried:
-replacing all wires
-different power supplies (just because)
-another MCP2515 board (i bought 2 so why not)
-deleting all arduino libraries and re-downloading only the one mentioned above so that there were no possible conflicts
-in case it was and ECU issue, i hooked up the CAN to VW radio. Changed the CAN_500KBPS to CAN_100KBPS and got the same result as above.
-swapped CAN H&L ( has sending errors immediately when hooked up incorrectly)

What am I missing???!!

Load the listening demo sketch from the library and connect to an active CAN bus.
Do you see any messages?

If I run the CAN_receive sketch it does seem to give some results. This is my first time working with CAN bus and it seems like there is a steep learning curve. Gotta do some more Google-ing to see what these received messages mean...

Entering Configuration Mode Successful!
Setting Baudrate Successful!
MCP2515 Initialized Successfully!
MCP2515 Library Receive Example...
Standard ID: 0x280 DLC: 8 Data: 0xD2 0x00 0x00 0x00 0x00 0xFF 0x3E 0x00
Standard ID: 0x388 DLC: 3 Data: 0x07 0x02 0x05
Standard ID: 0x588 DLC: 2 Data: 0xE1 0x00
Standard ID: 0x288 DLC: 8 Data: 0x51 0xFF 0x37 0x00 0x00 0x67 0x00 0x00
Standard ID: 0x280 DLC: 8 Data: 0xD2 0x00 0x00 0x00 0x00 0xFF 0x3E 0x00
Standard ID: 0x488 DLC: 8 Data: 0x00 0x00 0x00 0x7C 0x00 0x00 0x00 0x00
Standard ID: 0x588 DLC: 2 Data: 0xE1 0x00
Standard ID: 0x280 DLC: 8 Data: 0xD2 0x00 0x00 0x00 0x00 0xFF 0x3E 0x00
Standard ID: 0x388 DLC: 3 Data: 0x09 0x02 0x0B
Standard ID: 0x588 DLC: 2 Data: 0xE1 0x00
Standard ID: 0x288 DLC: 8 Data: 0x8F 0xFF 0x37 0x00 0x00 0x67 0x00 0x00
Standard ID: 0x280 DLC: 8 Data: 0xD2 0x00 0x00 0x00 0x00 0xFF 0x3E 0x00
Standard ID: 0x580 DLC: 3 Data: 0x00 0xFE 0xFE
Standard ID: 0x588 DLC: 2 Data: 0xE1 0x00
Standard ID: 0x280 DLC: 8 Data: 0xD2 0x00 0x00 0x00 0x00 0xFF 0x3E 0x00
Standard ID: 0x380 DLC: 8 Data: 0x10 0xFF 0x00 0x00 0x00 0x7F 0x28 0x00
Standard ID: 0x588 DLC: 2 Data: 0xE1 0x00
Standard ID: 0x288 DLC: 8 Data: 0x8F 0xFF 0x37 0x00 0x00 0x67 0x00 0x00
Standard ID: 0x280 DLC: 8 Data: 0xD2 0x00 0x00 0x00 0x00 0xFF 0x3E 0x00
Standard ID: 0x488 DLC: 8 Data: 0x00 0x00 0x00 0x7C 0x00 0x00 0x00 0x00
Standard ID: 0x588 DLC: 2 Data: 0xE1 0x00
Standard ID: 0x280 DLC: 8 Data: 0xD2 0x00 0x00 0x00 0x00 0xFF 0x3E 0x00

That shows you can receive messages OK.
Unfortunately to test the transmit capability you either need an oscilloscope, a CAN bus analyzer or another Arduino and MCP2515.

My recommendation would be to seek out a Volkswagen forum that deals with CAN bus hacking as the people there are more likely to have the specialist knowledge you need to get your OBD working.

It's some time ago this thread.

But what are you trying to achieve?
Because certrain models just broadcast on the CAN network on the VAG vehicles and if it's gets ACK I sees that the module is present.

Keep in mind that diagnostics are not the same as CAN messages and for some ECU's diagnostic doesnt go over CANBUS.

I am working with an ME7 ECU right now, and I use a PMU from Ecumaster and it sends canID for the KOMBI, and since its gets ACK sig. the Engine Control Unit thinks the KOMBI is present.

To give you some information, the canID 0x280 (Motor1) is coming from Engine and holds various varaibles such as RPM and throttle. It is presented at a speed of 10msec.
0x288 = Motor2 @ 10msec
0x388 = GRA (cruise control) @ 25ms
0x488 = Motor6
0x588 = Motor7

From this I am assuming you are working on something like ME7, MED9, EDC15 or EDC16 ECU.
Also keep in mind PT-CAN != Comfort-CAN

Do not feel bad, CAN although simple has several subtleties that can get you. Nice picture but not of much use, all the hardware information is missing such as power source, units on the bus, etc.. All CAN messages on the bus have to be acknowledged by a receiver or the transmission will fail. There is no definition as to which module will acknowledge the transmission. The software can force a response that acknowledges its presence. The Acknowledge is actually one bit asserted on the bus by a receiving module during the transmission from another module. No acknowledge it becomes an invalid message.

When working with CAN , I have a bus that has two modules on it with termination on each one. one just shows what is being received the other just sends a packet with a sequence number about every 5 seconds. When testing I have known messages available and a good receiver that can acknowledge any message sent.

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