Hey Guys/Gals,
I am trying to read/send CanBus messages using a Arduino Due.
As of now I have used GitHub - collin80/due_can: Object oriented canbus library for Arduino Due compatible boards library to setup my Can Bus interface.
I am using Vector Software CanAylzer to see what CAN message are being received.
This is where I have my issue.
Although the CanAylzer software is being able to detect Can Messages on the line it gives be a Bit error on bit position 119. All the fields of relevance for me ID,Data etc seem to be reported fine.
Attached is a snapshot of the CanAylzer Error Frame. Below is my Arduino code . Any help would be awesome.
// 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
#define MAX_CAN_FRAME_DATA_LEN 8
// Message variable to be send
uint32_t CAN_MSG_1 = 0;
void setup()
{
// start serial port at 9600 bps:A
Serial.begin(115200);
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
CAN.init(CAN_BPS_250K);
CAN2.init(CAN_BPS_250K);
//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;
CAN.sendFrame(frame1);
while (1) {
}
}