Here's what I used. Bear in mind that I had tapped into the can lines feeding the dash so did not need to send a request to the can gateway to start receiving data. I was also specifically looking for byte 1 in 0x288.
Code:
// -------------------------------------------------------------
// Development sketch to read VW marine can bus and filter relevant data
// using polling
//
// by Collin Kidder, Based on CANTest by Pawelsky (based on CANtest by teachop)
//
// This sketch uses interrupt driven Rx. Rx frames
// are internally saved to a software buffer by the interrupt handler.
//
#include <FlexCAN.h>
//#ifndef __MK66FX1M0__
// #error "Teensy 3.6 with dual CAN bus is required to run this example"
//#endif
static CAN_message_t msg;
static uint8_t hex[17] = "0123456789abcdef";
/*might need int not uint8_t
uint8_t coolant; //unsigned integer coolant temp
uint16_t rpm; //unsigned integer rpm
uint8_t boost; //unsigned integer boost pressure
uint8_t iat; //unsigned integer intake air temp*/
// -------------------------------------------------------------
void setup(void)
{
delay(1000);
Serial.println(F("Hello Teensy 3.6 dual CAN Test."));
Can0.begin(500000); //set baud. Change to Can1 for use on T3.6
Can0.setListenOnly (true); //hopefully set listen only mode. Set after begin()
//if using enable pins on a transceiver they need to be set on
//pinMode(2, OUTPUT);
//pinMode(35, OUTPUT);
//digitalWrite(2, HIGH);
//digitalWrite(35, HIGH);
}
// -------------------------------------------------------------
void loop(void)
{
CAN_message_t inMsg;
while (Can0.available())
{
Can0.read(inMsg); //read message into inMsg
if (inMsg.id == 0x288)
{
Serial.print("CAN bus 0: ");
Serial.print(inMsg.id, HEX);
Serial.print(", ");
Serial.print (inMsg.buf[1], HEX);
Serial.write('\r');
Serial.write('\n');
}
}
}