Automotive and Embedded Networks

cancel
Showing results for 
Search instead for 
Did you mean: 

CRIO 9853 : Why mask is required to send and receive Extended CAN Frame (J1939) ?

Solved!
Go to solution

I'm develloping RT application that communicate with CAN device with J1939 protocol and extended CAN frames through CRIO and 9853 CAN module.

I look at J1939 Protocol reference example to help me achieving my project.

All is working fine but i want to know why when i'm using the 9853 Module i need to use Bit mask (AND 0x1FFFFFFF for READ and OR 0x20000000 for WRITE)

As you could see on NI example ...(for WRITE)

Why we need to use this both mask to have the correct CAN Frame ID on the network ???

It doesn't blok me ... but i like to understand why i need to add this code ...

Hope someone will have the answer.

 

Romain

0 Kudos
Message 1 of 4
(7,704 Views)

That is how you indicate to the CAN controller that the ID is an extended (29-bit) ID instead of a standard (11-bit) ID.

 

Standard ID 10 would be  0x0000000A

Extended ID 10 would be 0x2000000A

 

0 Kudos
Message 2 of 4
(7,701 Views)

I was just suprised that FPGA Node "CAN Read" could give ID such as 0x38FF50D0 instead of  0x18FF50D0. 0x38..... contain more than 29 bits. Of course it need to be masked. I just though that ID will be automatically masked before receiving it as 32 bits number with FPGA Node.

But i had already understood that the mask used cover 29 bits of extended ID format 🙂

 

 

 

0 Kudos
Message 3 of 4
(7,699 Views)
Solution
Accepted by topic author Sil3nc3r

The read uses the 30th bit to indicate whether the ID is standard or extended. Otherwise, if you received ID 0x0000000A, you wouldn't know if it was std or extended. For higher numbers (> 11 bits) it is obvious, but the flag is set regardless so you don't need multiple branches.

0 Kudos
Message 4 of 4
(7,697 Views)