J1939 Message Transmission via MCP2515

Hi,

I am working on a project where I need to send a command message to Eaton's smart fuse box mVEC from my Arduino+MCP2515 board. Using this command, I want to turn relay 1 on and leave the rest relays unchanged. I need your help with developing code for this task.

According to the product specification of this Eaton fusebox mVEC, I need to send a message called 0X80 to command the fuse box to turn on/off the relays. While declaring the msg in my program, should I declare it as 0X80 or its parameter group number ? What should be data length 6 bytes or 8 bytes ?

#include <SPI.h>
#include "mcp2515.h"

struct can_frame canMsg1;
struct can_frame canMsg2;
MCP2515 mcp2515(10);
int i;

void setup()
{
while (!Serial);
Serial.begin(115200);
SPI.begin();

mcp2515.reset();
mcp2515.setBitrate(CAN_125KBPS);
mcp2515.setNormalMode();
Serial.println("Example: Write to CAN");

canMsg1.can_id = 0x80;
canMsg1.can_dlc = 6;

}

void loop()
{
canMsg1.data[0] = 0x80;
canMsg1.data[1] = 0x00;
canMsg1.data[2] = 0xFD; //Turn on Relay 1 and leave relays 2,3,4 unchanged
canMsg1.data[3] = 0xFF;
canMsg1.data[4] = 0xFF;
canMsg1.data[5] = 0xFF;

mcp2515.sendMessage(&canMsg1);
mcp2515.sendMessage(&canMsg1);
mcp2515.sendMessage(&canMsg1);
mcp2515.sendMessage(&canMsg1);
mcp2515.sendMessage(&canMsg1);
Serial.println("Messages sent");
}

The description is bytes zero through 5, so that seems to add up to 6 bytes for the message.

Should the data size for this msg be 6 or 8 bytes? Should the CAN msg ID be 0X80 or 18EF00EF ?

where EF is the default source address where the source is Arduino
EF00 is the hex equivalent of PGN 61184
18 is the hex equivalent of Priority + 2 Reserved bits

Please read the sticky topics in Uncategorized - Arduino Forum. Your topic has been moved.

Please read (again?) How to get the best out of this forum

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.