PCAN-Router J1939 Address Claim

Universal CAN Converter
Post Reply
DevlinJunker
Posts: 2
Joined: Fri 14. Jun 2013, 20:47

PCAN-Router J1939 Address Claim

Post by DevlinJunker » Fri 14. Jun 2013, 20:55

Hi,

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);

}
I can add the code that calls this method if you think that's important, just let me know.

Thanks!

DevlinJunker
Posts: 2
Joined: Fri 14. Jun 2013, 20:47

Re: PCAN-Router J1939 Address Claim

Post by DevlinJunker » Sat 15. Jun 2013, 01:16

Just want to update anyone who stumbles upon this:

The baudrate needed to be changed to 250 kb/s in order to transmit properly. The default for the PCAN-Router is 500 kb/s

Also, the proper Message Id is: 0x18EEFF@@ where @@ is the source Address you want to claim. The last two bits of the PGN are the destination address (in this case the global address so it is broadcast to everyone).

The 5 bits (3 priority, 1 data page and 1 extended datapage) are placed before the PGN so the 0x18 = 0b11000. The first 3 are the priority (default of 6), followed by the extended and datapage bits (set to 0).

Hope this helps anyone else who has issues.

More information on address claiming can be found in SAE J1939/81 section 4.5 around pg 20 and SAE J1939/21 section 5.2 around pg 19.

User avatar
PEAK-Support
Sales & Support
Sales & Support
Posts: 1646
Joined: Fri 10. Sep 2010, 19:34

Re: PCAN-Router J1939 Address Claim

Post by PEAK-Support » Wed 26. Jun 2013, 09:23

This is more a J1939 related problem, as a PCAN-Router Problem. But many thanks for the information.
--------------------------------
PEAK-System Technik
Technical Support Team
support[at]peak-system.com
-------------------------------

Xinbles

Re: PCAN-Router J1939 Address Claim

Post by Xinbles » Fri 18. Dec 2015, 14:21

DevlinJunker wrote:Just want to update anyone who stumbles upon this:

The baudrate needed to be changed to 250 kb/s in order to transmit properly. The default for the PCAN-Router is 500 kb/s
I tried setting it to 250/kbs but it wouldn't let me. It just reverts back to 500. Did this not happen to you? I think if I can get past this small problem then everything should run smoothly so any help would be cool.
Last edited by Xinbles on Mon 21. Mar 2016, 16:32, edited 2 times in total.

User avatar
PEAK-Support
Sales & Support
Sales & Support
Posts: 1646
Joined: Fri 10. Sep 2010, 19:34

Re: PCAN-Router J1939 Address Claim

Post by PEAK-Support » Mon 21. Dec 2015, 13:21

For the PCAN-Router you simply need to edit the can_user.c

Code: Select all

	// init CAN1 and CAN2 with Values above

	CAN_InitChannel ( CAN_BUS1, CAN_BAUD_250K);
	CAN_InitChannel ( CAN_BUS2, CAN_BAUD_250K);
--------------------------------
PEAK-System Technik
Technical Support Team
support[at]peak-system.com
-------------------------------

Post Reply