10-11-2019 01:39 PM - last edited on 12-05-2022 01:05 PM by markwni
I'm looking for a VI that will give me the 64 bit custom code for CAN and CAN FD baud rates given a set of inputs. By that I mean I want to give a VI a desired baud rate, and sample point, and it returns the custom hex code that is valid for the custom Baud Rate property:
https://www.ni.com/docs/en-US/bundle/ni-xnet/page/nixnet/nxpropsession_intfbaudrate64.html
and CAN FD property:
https://www.ni.com/docs/en-US/bundle/ni-xnet/page/nixnet/propertyclustercan64bitfdbaudrate.html
Yes I know you can just type in the baud rate and sample point into the dialog in the XNet Database Editor, or Bus Monitor in MAX. But I work with a variety of hardware and don't want the user of my software to have to calculate the hex code, I just want them to give a baud rate and sample point and have the software figure it out.
I found a VI posted here which does generate a 32 bit valid custom hex for the interface, which appears to work in the 64 bit property too. But I'm also looking to do this with the CAN FD baud. I'll try editing that VI to support my needs but if that doesn't work out does someone have code, or know of code buried in the vi.lib or something that does this calculation? Thanks.
Unofficial Forum Rules and Guidelines
Get going with G! - LabVIEW Wiki.
17 Part Blog on Automotive CAN bus. - Hooovahh - LabVIEW Overlord
Solved! Go to Solution.
10-11-2019 04:10 PM
I feel a little silly because again I think I came up with my own solution. I looked at the VI I linked to and I think I made all the needed changes for it to be applied to the 32 bit CAN FD custom baud settings. My quick test with my hardware appears to work. If anyone has another solution or a similar set of code for the 64 bit settings feel free to reply here.
Unofficial Forum Rules and Guidelines
Get going with G! - LabVIEW Wiki.
17 Part Blog on Automotive CAN bus. - Hooovahh - LabVIEW Overlord
10-14-2019 07:36 AM
Here is a copy of what I have for the CAN FD baud rates. I highly recommend reviewing it as it is 5 years old and I haven't looked at it since I made it.
I think finessing it into a 64-bit is probably doable, but I am not very familiar withe the 64-bit version as I haven't thought much about it in the last 5 years.
10-16-2019 09:35 PM
Hi Hooovahh,
I have a VI that converts 32-bit custom baud rate to 64-bit and vice versa. It does some bit shifting based on the information from the XNET Help. Hope that it is helpful to you.
DISCLAIMER: The attached Code is provided As Is. It has not been tested or validated as a product, for use in a deployed application or system, or for use in hazardous environments. You assume all risks for use of the Code and use of the Code is subject to the Sample Code License Terms which can be found at: http://ni.com/samplecodelicense
12-01-2022 01:02 PM
I always try to "Engineer Ambitiously", but NI often gets in the way and breaks links on their own website.
The first 2 links now only go to help files.
12-01-2022 01:29 PM - edited 12-01-2022 01:29 PM
It is hard to know, but I think this link is one of them. I also can't edit my first post.
Unofficial Forum Rules and Guidelines
Get going with G! - LabVIEW Wiki.
17 Part Blog on Automotive CAN bus. - Hooovahh - LabVIEW Overlord
12-02-2022 05:09 AM
Thanks Hooovahh
06-05-2024 03:14 AM
Hello Hooovahh,
I've the same problem, but the attached vis don't give the same solution as XNET Bus Monitor... I work with XNET on a CAN-FD bus. I've 2 baudrates to configure: 500k and 2M. My goal is a sample point of 75%. Playing with only Baudrate value and sample point I obtain 0x800F00A0032D43 fo 2M/75% and 0x32A0041C09 for 500k/75%.
I'm looking for a vi to convert 64-bits baudrate and sample point into a custom baudrate, exactly like the screenshots of xnet bus monitor. Do you know if this king of tool exists? I've tested all the vis of this discussion without success...
It will be clearlier for the final user to configure directly baudrate and sample point instead of use other tool to obtain custom badrate and report it in the final application...
Thank you per advance!
06-05-2024 07:46 AM
Because of how the timing parameters work, there will often be multiple correct answers to a single baud and sample point. Using the VI NI posted here I put in 500k and a 75% sample point. It found 11 combinations of the timing parameters that meet those requirements. If you use the Show Only Max SJW then you still have 4 different timing parameters that meet that requirement. Keep in mind this is for the 40MHz frequency. I think most or all NI hardware use this.
My point is that The XNet window you show will only show you one valid solution, and it might not be one of them that the tool came up with. If you have only a few known rate, and sample points you use, then maybe it would be best to just hard code those. When the user wants 500k at 75% just use the constant the XNet tool gives you. If you want to have a UI where the user picks the baud rate and sample point, then you can use NI's tool.
Unofficial Forum Rules and Guidelines
Get going with G! - LabVIEW Wiki.
17 Part Blog on Automotive CAN bus. - Hooovahh - LabVIEW Overlord
06-06-2024 09:03 AM
Thank you for your feedback !
I understand there is a lot of combinations, the custom baudrate depends on some others parameters.
BUT I don't understand why the CustomBaudrate proposed by XNET Bus Monitor doesn't appear in the list populed by the vi... I would imaginate that the "NI default" value" should be in the list... In my example, I use a CAN HS/FD Interface USB-8502.
Why the lis is not complete?