I am trying to send information to extended address for GM SW can. If I add the address to the line:
byte sndStat4 = CAN0.sendMsgBuf(0x810EC4040, 8, data4);
byte sndStat5 = CAN0.sendMsgBuf(0x810EC8040, 8, data5);
I get
Standard ID: 0x040 DLC: 8 Data: 0x47 0x36 0x52 0x53 0x31 0x45 0x34 0x33
Standard ID: 0x040 DLC: 8 Data: 0x45 0x55 0x36 0x30 0x30 0x32 0x36 0x30
This is the data I sent but the wrong ID.
If I send byte sndStat6 = CAN0.sendMsgBuf(0x812CA040, 8, data6); // Engine_Information_1_LS
I get
Extended ID: 0x012CC040 DLC: 8 Data: 0x01 0x01 0xCF 0x8D 0x00 0x55 0x06 0x6D
also, I am trying to send around 12 different can signals but only see maybe 4 sent back.
/* CAN Loopback Example
This example sends a message once a second and receives that message
no CAN bus is required. This example will test the functionality
of the protocol controller, and connections to it.
Written By: Cory J. Fowler - October 5th 2016
*/
include
include
// CAN TX Variables
unsigned long prevTX = 0; // Variable to store last execution time
unsigned long prevTX1 = 0; // Variable to store last execution time
const unsigned int invlTX = 1000; // One second interval constant
const unsigned int invlTX1 = 1000; // One second interval constant
unsigned long prevTX2 = 0; // Variable to store last execution time
unsigned long prevTX3 = 0; // Variable to store last execution time
const unsigned int invlTX2 = 1000; // One second interval constant
const unsigned int invlTX3 = 1000; // One second interval constant
unsigned long prevTX4 = 0; // Variable to store last execution time
unsigned long prevTX5 = 0; // Variable to store last execution time
const unsigned int invlTX4 = 1000; // One second interval constant
const unsigned int invlTX5 = 1000; // One second interval constant
// CAN RX Variables
long unsigned int rxId;
unsigned char len;
unsigned char rxBuf[128];
// Serial Output String Buffer
char msgString[128];
// CAN0 INT and CS
define CAN0_INT 2 // Set INT to pin 2
MCP_CAN CAN0(10); // Set CS to pin 10
void setup()
{
Serial.begin(115200); // CAN is running at 500,000BPS; 115,200BPS is SLOW, not FAST, thus 9600 is crippling.
// Initialize MCP2515 running at 16MHz with a baudrate of 500kb/s and the masks and filters disabled.
if(CAN0.begin(MCP_ANY, CAN_33K3BPS, MCP_16MHZ) == CAN_OK)
Serial.println("MCP2515 Initialized Successfully!");
else
Serial.println("Error Initializing MCP2515...");
// Since we do not set NORMAL mode, we are in loopback mode by default.//Changed from example JJ
//CAN0.setMode(MCP_NORMAL);
pinMode(CAN0_INT, INPUT); // Configuring pin for /INT input
Serial.println("Bosch CAN test...");
}
void loop()
{
if(millis() - prevTX >= invlTX)
{ // Send this at a one second interval.
prevTX = millis();
byte sndStat0 = CAN0.sendMsgBuf(0x1101, 8, data0); // 101 command
byte sndStat1 = CAN0.sendMsgBuf(0x1621, 8, data1); //VNMF_LS_621_BCM
if(millis() - prevTX1 >= invlTX1)
{ // Send this at a one second interval.
prevTX1 = millis();
byte sndStat2 = CAN0.sendMsgBuf(0x1624, 8, data2); //SW CAN $624
byte sndStat3 = CAN0.sendMsgBuf(0x162C, 8, data3); //VNMF_LS_62C_IPC CGM_LS IPC_LS
}
if(millis() - prevTX2 >= invlTX2)
{ // Send this at a one second interval.
prevTX2 = millis();
byte sndStat4 = CAN0.sendMsgBuf(0x80EC4040, 8, data4); // vin 2 0to 9 hex to accii G6RS1E43
byte sndStat5 = CAN0.sendMsgBuf(0x80EC8040, 8, data5); // vin 10 to 17 hex to accii EU600260
}
if(millis() - prevTX3 >= invlTX3)
{ // Send this at a one second interval.
prevTX3 = millis();
I am trying to send information to extended address for GM SW can. If I add the address to the line: byte sndStat4 = CAN0.sendMsgBuf(0x810EC4040, 8, data4); byte sndStat5 = CAN0.sendMsgBuf(0x810EC8040, 8, data5); I get Standard ID: 0x040 DLC: 8 Data: 0x47 0x36 0x52 0x53 0x31 0x45 0x34 0x33 Standard ID: 0x040 DLC: 8 Data: 0x45 0x55 0x36 0x30 0x30 0x32 0x36 0x30 This is the data I sent but the wrong ID.
If I send byte sndStat6 = CAN0.sendMsgBuf(0x812CA040, 8, data6); // Engine_Information_1_LS I get Extended ID: 0x012CC040 DLC: 8 Data: 0x01 0x01 0xCF 0x8D 0x00 0x55 0x06 0x6D
also, I am trying to send around 12 different can signals but only see maybe 4 sent back. /* CAN Loopback Example
include
include
// CAN TX Variables unsigned long prevTX = 0; // Variable to store last execution time unsigned long prevTX1 = 0; // Variable to store last execution time const unsigned int invlTX = 1000; // One second interval constant const unsigned int invlTX1 = 1000; // One second interval constant unsigned long prevTX2 = 0; // Variable to store last execution time unsigned long prevTX3 = 0; // Variable to store last execution time const unsigned int invlTX2 = 1000; // One second interval constant const unsigned int invlTX3 = 1000; // One second interval constant unsigned long prevTX4 = 0; // Variable to store last execution time unsigned long prevTX5 = 0; // Variable to store last execution time const unsigned int invlTX4 = 1000; // One second interval constant const unsigned int invlTX5 = 1000; // One second interval constant
byte data0[] = {0xFE, 0x02, 0x10, 0x02, 0x00, 0x00, 0x00, 0x00}; // 101 command byte data1[] = {0x00, 0x52, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; // VNMF_LS_621_BCM byte data2[] = {0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; // SW CAN $624 byte data3[] = {0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; // VNMF_LS_62C_IPC CGM_LS IPC_LS byte data4[] = {0x47, 0x36, 0x52, 0x53, 0x31, 0x45, 0x34, 0x33}; // vin 2 0to 9 hex to accii G6RS1E43 byte data5[] = {0x45, 0x55, 0x36, 0x30, 0x30, 0x32, 0x36, 0x30}; // vin 10 to 17 hex to accii EU600260 byte data6[] = {0x00, 0x00, 0x00, 0x00, 0x35, 0x00, 0xA3, 0x01}; // Engine_Information_1_LS byte data7[] = {0x01, 0x01, 0xCF, 0x8D, 0x00, 0x55, 0x06, 0x6D}; // Engine_Information_2_LS byte data8[] = {0x50, 0x00, 0x79, 0x00, 0x00, 0x00, 0x06, 0xA5}; // Engine_Information_3_LS byte data9[] = {0x60, 0x60, 0x01, 0xF4}; // Wheel_Pulses byte data10[] = {0x02}; // System_Power_mode byte data11[] = {0x00, 0x2B, 0x00, 0x2B, 0x00, 0x2A, 0x00, 0x2A}; // Wheel_Grnd_Velocity_LS Power_Mode_Info_LS byte data12[] = {0x04, 0x03, 0x00}; // Power_Mode_info
// CAN RX Variables long unsigned int rxId; unsigned char len; unsigned char rxBuf[128];
// Serial Output String Buffer char msgString[128];
// CAN0 INT and CS
define CAN0_INT 2 // Set INT to pin 2
MCP_CAN CAN0(10); // Set CS to pin 10
void setup() { Serial.begin(115200); // CAN is running at 500,000BPS; 115,200BPS is SLOW, not FAST, thus 9600 is crippling.
// Initialize MCP2515 running at 16MHz with a baudrate of 500kb/s and the masks and filters disabled. if(CAN0.begin(MCP_ANY, CAN_33K3BPS, MCP_16MHZ) == CAN_OK) Serial.println("MCP2515 Initialized Successfully!"); else Serial.println("Error Initializing MCP2515...");
// Since we do not set NORMAL mode, we are in loopback mode by default.//Changed from example JJ //CAN0.setMode(MCP_NORMAL);
pinMode(CAN0_INT, INPUT); // Configuring pin for /INT input
Serial.println("Bosch CAN test..."); }
void loop() { if(millis() - prevTX >= invlTX) { // Send this at a one second interval. prevTX = millis();
byte sndStat0 = CAN0.sendMsgBuf(0x1101, 8, data0); // 101 command
byte sndStat1 = CAN0.sendMsgBuf(0x1621, 8, data1); //VNMF_LS_621_BCM
if(millis() - prevTX1 >= invlTX1) { // Send this at a one second interval. prevTX1 = millis();
byte sndStat2 = CAN0.sendMsgBuf(0x1624, 8, data2); //SW CAN $624 byte sndStat3 = CAN0.sendMsgBuf(0x162C, 8, data3); //VNMF_LS_62C_IPC CGM_LS IPC_LS } if(millis() - prevTX2 >= invlTX2) { // Send this at a one second interval. prevTX2 = millis();
}
if(millis() - prevTX3 >= invlTX3) { // Send this at a one second interval. prevTX3 = millis();
}
if(millis() - prevTX4 >= invlTX4) { // Send this at a one second interval. prevTX4 = millis();
} if(millis() - prevTX5 >= invlTX5) { // Send this at a one second interval. prevTX5 = millis();
}
} if(!digitalRead(CAN0_INT)) // If CAN0_INT pin is low, read receive buffer { CAN0.readMsgBuf(&rxId, &len, rxBuf); // Read data: len = data length, buf = data byte(s)
}
}
/***** this is what I see in play back Standard ID: 0x101 DLC: 8 Data: 0xFE 0x02 0x10 0x02 0x00 0x00 0x00 0x00 Standard ID: 0x624 DLC: 8 Data: 0x00 0x20 0x00 0x00 0x00 0x00 0x00 0x00 Extended ID: 0x006B8040 DLC: 8 Data: 0x00 0x2B 0x00 0x2B 0x00 0x2A 0x00 0x2A Standard ID: 0x62C DLC: 8 Data: 0x00 0x40 0x00 0x00 0x00 0x00 0x00 0x00 Extended ID: 0x00242040 DLC: 3 Data: 0x04 0x03 0x00 Standard ID: 0x101 DLC: 8 Data: 0xFE 0x02 0x10 0x02 0x00 0x00 0x00 0x00 Standard ID: 0x624 DLC: 8 Data: 0x00 0x20 0x00 0x00 0x00 0x00 0x00 0x00 Extended ID: 0x00EC4040 DLC: 8 Data: 0x47 0x36 0x52 0x53 0x31 0x45 0x34 0x33 Standard ID: 0x62C DLC: 8 Data: 0x00 0x40 0x00 0x00 0x00 0x00 0x00 0x00 Extended ID: 0x00EC8040 DLC: 8 Data: 0x45 0x55 0x36 0x30 0x30 0x32 0x36 0x30 Standard ID: 0x101 DLC: 8 Data: 0xFE 0x02 0x10 0x02 0x00 0x00 0x00 0x00 Standard ID: 0x624 DLC: 8 Data: 0x00 0x20 0x00 0x00 0x00 0x00 0x00 0x00 Extended ID: 0x006B8040 DLC: 8 Data: 0x00 0x2B 0x00 0x2B 0x00 0x2A 0x00 0x2A Standard ID: 0x62C DLC: 8 Data: 0x00 0x40 0x00 0x00 0x00 0x00 0x00 0x00 Extended ID: 0x00242040 DLC: 3 Data: 0x04 0x03 0x00 Standard ID: 0x101 DLC: 8 Data: 0xFE 0x02 0x10 0x02 0x00 0x00 0x00 0x00 Standard ID: 0x624 DLC: 8 Data: 0x00 0x20 0x00 0x00 0x00 0x00 0x00 0x00 Extended ID: 0x012CA040 DLC: 8 Data: 0x00 0x00 0x00 0x00 0x35 0x00 0xA3 0x01 Standard ID: 0x62C DLC: 8 Data: 0x00 0x40 0x00 0x00 0x00 0x00 0x00 0x00 Extended ID: 0x012CC040 DLC: 8 Data: 0x01 0x01 0xCF 0x8D 0x00 0x55 0x06 0x6D Standard ID: 0x101 DLC: 8 Data: 0xFE 0x02 0x10 0x02 0x00 0x00 0x00 0x00 Standard ID: 0x624 DLC: 8 Data: 0x00 0x20 0x00 0x00 0x00 0x00 0x00 0x00 Extended ID: 0x006B8040 DLC: 8 Data: 0x00 0x2B 0x00 0x2B 0x00 0x2A 0x00 0x2A Standard ID: 0x62C DLC: 8 Data: 0x00 0x40 0x00 0x00 0x00 0x00 0x00 0x00 Extended ID: 0x00242040 DLC: 3 Data: 0x04 0x03 0x00 Standard ID: 0x101 DLC: 8 Data: 0xFE 0x02 0x10 0x02 0x00 0x00 0x00 0x00 Standard ID: 0x624 DLC: 8 Data: 0x00 0x20 0x00 0x00 0x00 0x00 0x00 0x00 Extended ID: 0x012CA040 DLC: 8 Data: 0x00 0x00 0x00 0x00 0x35 0x00 0xA3 0x01 Standard ID: 0x62C DLC: 8 Data: 0x00 0x40 0x00 0x00 0x00 0x00 0x00 0x00 Extended ID: 0x012CC040 DLC: 8 Data: 0x01 0x01 0xCF 0x8D 0x00 0x55 0x06 0x6D Standard ID: 0x101 DLC: 8 Data: 0xFE 0x02 0x10 0x02 0x00 0x00 0x00 0x00 Standard ID: 0x624 DLC: 8 Data: 0x00 0x20 0x00 0x00 0x00 0x00 0x00 0x00 Extended ID: 0x006B8040 DLC: 8 Data: 0x00 0x2B 0x00 0x2B 0x00 0x2A 0x00 0x2A Standard ID: 0x62C DLC: 8 Data: 0x00 0x40 0x00 0x00 0x00 0x00 0x00 0x00 Extended ID: 0x00242040 DLC: 3 Data: 0x04 0x03 0x00 Standard ID: 0x101 DLC: 8 Data: 0xFE 0x02 0x10 0x02 0x00 0x00 0x00 0x00 Standard ID: 0x624 DLC: 8 Data: 0x00 0x20 0x00 0x00 0x00 0x00 0x00 0x00 Extended ID: 0x006B8040 DLC: 8 Data: 0x00 0x2B 0x00 0x2B 0x00 0x2A 0x00 0x2A Standard ID: 0x62C DLC: 8 Data: 0x00 0x40 0x00 0x00 0x00 0x00 0x00 0x00