I'm trying to send a J1939 address claim message from a PCAN-Router and I'm having issues. So far I have the router flashed to send a message every half second, but I can't figure out what message to send. I've been pouring over the J1939 documentation and I haven't been able to solve what Message Id and info I am supposed to send.
I have figured out that I should be using the 29 bit address message or the CAN_MSG_EXTENDED Type, and I'm pretty confident that I have set the Message Length properly (8 bytes) but I can't figure out the Message Id field.
As far as 1939 documentation, it looks like I am supposed to send PGN 60929 (0xEE00) along with the source address I want to claim. However, that is still only 24 bits and I'm not sure what/where to place the remaining 5 that make up the 29 bit Id.
Some documentation seems to say that I need to include the priority, the extended data page bit and the data page bit, but I'm not sure exactly what to set them to (6 for the priority maybe?) and where to place them in the message Id for it work properly.
Here is the code I am using to send the message:
Code: Select all
static void send_message ( void)
{
CANMsg_t Msg;
// Set ID to include Source Address? (0x63 is 99)
//Msg.Id = 0x18FDC563;
//Msg.Id = 0b11000111011100000000001100011
Msg.Id = 0xEE000063;
//Msg.Id = 0x123;
Msg.Len = 8;
Msg.Type = CAN_MSG_EXTENDED;
// Send all zeros
Msg.Data32[0] = 0xFFFFFFFF;
Msg.Data32[1] = 0xFFFFFFFF;
// Send Msg
CAN_UserWrite ( CAN_BUS1, &Msg);
CAN_UserWrite ( CAN_BUS2, &Msg);
}
Thanks!