From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Automotive and Embedded Networks

cancel
Showing results for 
Search instead for 
Did you mean: 

XNET "CAN Frame Stream Output" example: How to define the Id type to extended (29 Bit Id)?

Solved!
Go to solution

Hay,

 

I try to implement the "CAN Frame Stream Output" example in my project.

The Id type of the frames is appear to be "STD".

 

I hope It's not to simple question, But how can I change it to EXT (29-bit id)?

 

Regard,

Aviad

0 Kudos
Message 1 of 4
(6,789 Views)

you just need to set the Extended? Flag to TRUE

 

let me know if that doesnt help

 

 

0 Kudos
Message 2 of 4
(6,787 Views)

Wow! It was Fast!

 

If u mean to change:

nxFrameVar_t * l_MyFramePtr;
l_MyFramePtr=(nxFrameVar_t*)l_MyBuffer;
l_MyFramePtr->Timestamp=0;
l_MyFramePtr->Flags=0;

 To: 

l_MyFramePtr->Flags= TRUE;

 It's do not work.

 

Anyway - I find a "manually" solution (And maybe this the straightforward way to do it?):

I manually add the 29Bit to the Identifier. For example:

u32 l_ext_id_bit = 0x1;
l_ext_id_bit = l_ext_id_bit << 29;

u32 l_id = 0xA;
l_id =| ext_id_bit;
.
.
.

l_MyFramePtr->Identifier= l_id;

 

Thank u very much for the replay.

(If there is another way to do it, I be glad to know about)

Aviad

 

 

0 Kudos
Message 3 of 4
(6,783 Views)
Solution
Accepted by topic author aviadCielo

ok for the C API you are correct. I was under the wrong assumption you are using LabVIEW

 

As the NI-XNET manual states in Table 5-3: you need to modify the frame identifier.
....When Type specifies a CAN frame, bit 29 (hex 20000000)
indicates the CAN identifier format: set for extended, clear for
standard. If bit 29 is clear, the lower 11 bits (0–10) contain the
CAN frame identifier. If bit 29 is set, the lower 29 bits (0–28)
contain the CAN frame identifier.

0 Kudos
Message 4 of 4
(6,780 Views)