I think the first thing I need to do is set this code up not as a pass through for all messages, but rather to filter out certain messages. It seems all the good stuff I need (tach, oil pressure, coolant, idiot lights, etc) is on 4 or so frames from the GM ECU, and received by the same number on the Porsche side. I’m trying to find examples of people using the due_can setup to better understand the functionality or how to properly set it up.
So what I did was setup a filter.
//By default there are 7 mailboxes for each device that are RX boxes
//This sets up filtering to look for the messages needed to run a gauge cluster Can0 is the Engine side, Can1 is the Porsche side
int filter;
//extended
for (filter = 0; filter < 3; filter++) {
Can0.setRXFilter(filter, 0xFF, 0, true);//At this time, no messages going from Porsche to GM so comment out
//Can1.setRXFilter(filter, 0, 0, true);
}//If Standard frames, enter below
//standard
//for (int filter = 3; filter < 7; filter++) {
//Can0.setRXFilter(filter, 0, 0, false);
//Can1.setRXFilter(filter, 0, 0, false);
So now only frame FF is passing through. I have nothing going from Porsche to GM right now, I think I will end up passing a few items though in the end (vehicle speed, sport mode? - it would be sweet to get active rev matching functional).
The later section of code I think should be setup differently now. No need for an if statement I guess.
CAN_FRAME incoming;
if (Can0.available() > 0) {
Can0.read(incoming);
if (incoming.id == 0xFF) {
printFrame(incoming);
RPM = incoming.data.bytes[1]};
}
myFrame.id = 0x105;
myFrame.length = 8
myFrame.data[2] = RPM;
Can1.sendFrame(myFrame);
}
Sorry, I’m very new to messing with Arduino. My job (calibrator for one of the Big Three) has me reading lots of code, never writing.
Also, as I look at my DBC files, I realize engine speed is on two frames in both. So I need to set that up. I believe one is little endian and one is big endian. That stuff I can sort out later.