Go Down

Topic: Arduino DUE and Vector CAN analyzer (Read 580 times) previous topic - next topic


Apr 22, 2016, 09:22 pm Last Edit: Apr 22, 2016, 09:29 pm by rupok99
Hello Everyone

I am having trouble with Arduino Due CAN and Vector CAN analyzer.
I am using codes from

And I have got Arduino CAN shield of V1.2 from togglebit.

I am trying the following code--

// Arduino Due - CAN Sample 1
// Brief CAN example for Arduino Due
// Test the transmission from CAN0 Mailbox 0 to CAN1 Mailbox 0

#include <Arduino.h>
#include "variant.h"
#include "due_can.h"

#define TEST1_CAN_TRANSFER_ID    0x11AE756A //random 29 bits
#define TEST1_CAN0_TX_PRIO       15
#define CAN_MSG_DUMMY_DATA       0x11BFFA4E

// CAN frame max data length

// Message variable to be send
uint32_t CAN_MSG_1 = 0;

void setup()
 // start serial port at 9600 bps:A
 Serial.println("Program Started");

void loop(){
 CAN_FRAME frame1, frame2;
 // say what you got:
 Serial.print("Sent Value: ");
 Serial.println(CAN_MSG_1, DEC);
 // Initialize CAN0 and CAN1, baudrate is 250kb/s
 //Initialize the definitions for the frames we'll be sending.
 //This can be done here because the frame never changes
 frame1.id = TEST1_CAN_TRANSFER_ID;
 frame1.length = MAX_CAN_FRAME_DATA_LEN;
 //Below we set the 8 data bytes in 32 bit (4 byte) chunks
 //Bytes can be set individually with frame1.data.bytes[which] = something
 frame1.data.low = CAN_MSG_1;
 frame1.data.high = CAN_MSG_DUMMY_DATA;
 //We are using extended frames so mark that here. Otherwise it will just use
 //the first 11 bits of the ID set
 frame1.extended = 1;
 Serial.print("Sent f1: ");
 while (1) {

I have connected CAN_H, CAN_L and GROUND of Due CAN shield with Vector CAN Analyzer 2Y cables  with the following settings-

Pin 2 for CAN_L,
pin 7 for CAN_H and
Pin 3 for GROUND

but I am not getting what I am sending. Also, from vector CANanalyzer software, I can see that Channel not becomes active all the time. If I connect and disconnect the Pin 2 then channel becomes active but the CANanalyzer software receive Error data. I have also attached the screenshot here. you can see ID from screenshot which is not that is sent from Code. In addition there is no data.

Can anyone Please help me with the problem... I have also read the other posting but could not figured out where I am mistaking... :smiley-sad:

Thanks & Regards

Go Up