04-09-2020 03:42 AM
Dear Mr. TroyK
I have used your Labview wrapper in CAN communication so far.
Thank you very much for your great job. It has helped me a lot for long time.
Now, I'm trying to make CANFD communication with vxlapi (it's XL-Driver-Library_V11.0.14 released by Vector in March 2019).
But I couldn't succeed to make CANFD communication with "Vector VN1610" hardware and the above version xl-Driver-library.
(I configured VIs with watching the "XL_Driver_Library_Manual_EN.pdf" to trace the specification)
Please see the attached "CANFD.zip" if you have time.. The file is my try.
If possible, would you please point out the bad points?
Best regards,
K.Amano
Solved! Go to Solution.
04-14-2020 03:29 AM
Your XLcanFdConf struct doesn't look quite right. It is missing the 'options' item.
I'm pretty sure xlCanReceive can only get 1 event at a time, not an array.
04-14-2020 04:11 AM
Hello Super man Troy
Thanks to your advice, my VIs works better!
Thank you very much!
By the way, in the "xl Can Receive.vi", struct/cluster is messed..
Is the struct appropriate?
It doesn't look smart..
Best regards
Amano
04-14-2020 07:18 PM
@kojiamano wrote: By the way, in the "xl Can Receive.vi", struct/cluster is messed..
Yes you're right, it looks messed.
I think you have misunderstood how a UNION type works.
Each event received is 128 bytes. You can just allocate a 128 byte array to get the event then extract the data from that.
Don't forget that the receive level returned by the v4 interface is a byte count, not an event count.
04-15-2020 09:08 PM
Hello TroyK
>Each event received is 128 bytes. You can just allocate a 128 byte array to get the event then extract the data from that.
>Don't forget that the receive level returned by the v4 interface is a byte count, not an event count.
>I'm pretty sure xlCanReceive can only get 1 event at a time, not an array.
Thanks to your advice, I succeeded to make CANFD communication normaly!
I quit to connect array as input/output.
Instead, I connected the cluster which contained over 128bytes size.(The cluster doesn't contain any array) Then I succeeded.
Thank you very much!
*But when the cluster contains the array, labview crashes every time I run the VI.
Do you know why?
04-15-2020 09:23 PM
@kojiamano wrote: ...when the cluster contains the array, labview crashes every time I run the VI. Do you know why?
If the size of the array in the cluster isn't exactly what the function needs to be allocated then memory corruption or access violation will occur. LabVIEW will crash. I'm not sure, but it may also have something to do with the way LabVIEW allocates memory in complex clusters that contain arrays. They don't get passed as function parameters to a CLFN very well.
04-17-2020 05:59 AM
Hello TroyK
I tried to send a message in CANFD communication while receiving CANFD data from my DUT.
I had no problem in receiving, but I failed to send message in CANFD. (it's not DUT problem because the Canalyzer could send the same message)
I tried to make the "xlCanTransmitEx" function with viewing the specification "XL_Driver_Library_Manual_EN.pdf" I also attached.
But the "xlCanTransmitEx" function returned error "vector xl driver error 132 XL_ERR_INVALID_TAG"..
Could you figure out the bad point in my VIs attached?
(Sorry for taking your time again..)
Best regards
K.Amano
04-19-2020 08:54 PM - edited 04-19-2020 08:58 PM
See XL Driver Library document section 5.5.1 XLcanTxEvent.
For a CAN-FD transmit (using xlCanTransmitEx) the tag parameter needs to be set to XL_CAN_EV_TAG_TX_MSG (0x440).
You will also need to make sure the msgFlags parameter is set correctly:
5.5.2 XL_CAN_TX_MSG
msgFlags
Set to 0 to transmit a CAN 2.0 frame.
XL_CAN_TXMSG_FLAG_BRS - Baudrate switch.
XL_CAN_TXMSG_FLAG_HIGHPRIO - High priority message. Clears all send buffers then transmits.
XL_CAN_TXMSG_FLAG_WAKEUP - Generates a wake up message.
XL_CAN_TXMSG_FLAG_EDL - This flag is used to indicate an extended CAN FD data length according to the table below.
XL_CAN_TXMSG_FLAG_RTR - This flag is used for Remote-Transmission-Request. (Only useable for Standard CAN messages.)
04-21-2020 12:05 AM
Hello Troy
>For a CAN-FD transmit (using xlCanTransmitEx) the tag parameter needs to be set to XL_CAN_EV_TAG_TX_MSG (0x440).
Thanks to your advice, I could also send the can message in canfd communication normaly!
By the way, where does the value "XL_CAN_EV_TAG_TX_MSG (0x440)" come from?
I retrieved in the specification with the word "XL_CAN_EV_TAG_TX_MSG" or "440" , but they are not found..
Are they in another Vector's document?
K.Amano
04-21-2020 12:15 AM - edited 04-21-2020 12:18 AM
The Vector XL Driver Library installs with examples. In the bin folder there is vxlapi.h
[C:\Users\Public\Documents\Vector XL Driver Library\bin]
In this .h file you will find all the #defines for constants with their values.
If I search the XL Driver Library document for XL_CAN_EV_TAG_TX_MSG it takes me straight to section 5.5.1.
But the actual value for that constant is in the header file.