LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

CANFD communication with vxlapi

Solved!
Go to solution

Thank you again!

 

I'll check it.

0 Kudos
Message 11 of 21
(3,107 Views)

Hello Troy

 

>5.5.2 XL_CAN_TX_MSG
>msgFlags

 

When I transmit the canfd standard message, the msgFlags should be  "1"?

 =>it's "XL_CAN_TXMSG_FLAG_BRS "?

 

And when the message is extended CAN FD, the msgFlags should be  "4"?

 =>it's "XL_CAN_TXMSG_FLAG_EDL"?

 

The vxlapi.dll seems to accept many numbers within 0 to 1000.

I tried to input the numbers as a msgFlags one by one in the For-loop.

The dll sometimes returned error, but sometimes returned no error..

 

Best regards

Amano@home

0 Kudos
Message 12 of 21
(3,087 Views)
Solution
Accepted by kojiamano

In the CAN-FD spec it identifies bits in the CAN-FD frame "control field".  Two of the bits in the control field are:

EDL - Extended Data Length (> 8 bytes)

BRS - Bit Rate Switch (data bit-rate > arbitration bit-rate)

 

They are also mentioned in section 5.5.4 of the XL Driver Library documentation.

 

These bits are only relevant in CAN-FD frames.  The msgFlags in the CAN-FD transmit event structure allow you to specify what these flags will be.

 

#define XL_CAN_TXMSG_FLAG_EDL          0x0001  // extended data length
#define XL_CAN_TXMSG_FLAG_BRS          0x0002  // baud rate switch
#define XL_CAN_TXMSG_FLAG_RTR          0x0010  // remote transmission request
#define XL_CAN_TXMSG_FLAG_HIGHPRIO     0x0080  // high priority message - clears all send buffers - then transmits
#define XL_CAN_TXMSG_FLAG_WAKEUP       0x0200  // generate a wakeup message

 

As you can see from this excerpt from the header file, no value for 4 is defined.

Classic CAN frame would have msgFlag = 0

CAN-FD frame with Extended Data Length and Bit Rate Switch would be sent with msgFlag = 3

Troy - CLD "If a hammer is the only tool you have, everything starts to look like a nail." ~ Maslow/Kaplan - Law of the instrument
Message 13 of 21
(3,074 Views)

Hi, I have been trying to transmit CanFD data from LabVIEW to CANape on the same computer via virtual CAN. I used your code and I am half way there.

 

I am only able to send 8 bytes of data. I have set the tag to x440 and the msg_flag to 0(I believe this is for extended CAN, other numbers don't work mostly). 

Have a look at my VI. I wish to send more than 8 bytes and read it in CANape. I configured a dbc file with standard CAN FD message with few signals for testing

 

LV.JPG

 

 

canape.JPG

 

AS you can see from the canape screenshot, the length remains 15 and if i change the dlc to 12, 12 bytes of data is transmitted, however only 8 contain the values.

 

0 Kudos
Message 14 of 21
(3,019 Views)

Please make sure you understand how the EDL and BRS flags work in a CAN-FD frame and when they need to be set. Also make sure you understand how to set those flags in the msgFlags parameter of transmit message.

The answer is in my response which has been marked as the solution in this thread (immediately above your question).

Troy - CLD "If a hammer is the only tool you have, everything starts to look like a nail." ~ Maslow/Kaplan - Law of the instrument
0 Kudos
Message 15 of 21
(2,991 Views)

Hello,

 

Can you attach the "CANFD.zip" for the Labview version 2017

thanks

regards

F.Garraud

0 Kudos
Message 16 of 21
(2,757 Views)

I saved in labview 2017. Please have a look.

0 Kudos
Message 17 of 21
(2,746 Views)

Hi guys, I have problems to transmit CAN FD message with vxlapi in LabVIEW. The function xlCanTransmitEx is transmitting successful but just the ID Request and not the data. Would you mind if you share your development in LabVIEW 2017, please? Just to look what is the format to send XLcanTxEvent by xlCanTransmitEx function.

 

I will appreciate your help.

 

Best

0 Kudos
Message 18 of 21
(2,195 Views)

Hello Carlos,

 

My development is on progress , I have the Same Problem I cannot send any CAN FD frames for the moment .

my status is the same as before

 

regards

Frederic

0 Kudos
Message 19 of 21
(2,134 Views)

Have you made sure that CANape is configured to receive CAN FD data?

0 Kudos
Message 20 of 21
(2,128 Views)