Sagi Posted May 8, 2015 Report Share Posted May 8, 2015 Hi Guys, I really need some help with reading/writing defined data over the USB-8473 module. I am not really familiar with CAN at all, so maybe it is just a small thing I am missing to fix my problem. What do I want: I want to write/read defined signals from my .dbc-file In this case for example i want to write a specific value to the can signal "ISw_Stat", also I want to read some values like "CSC_val_01" to "CSC_val_12" What do I have right now: I managed to get a working communication up and running, also I can read/write data (but not a defined one, for now I just do all data) What is missing: I have struggle to do the right formatting of my data I have attached my program so far. thanks Test CAN.zip Quote Link to comment
hooovahh Posted May 8, 2015 Report Share Posted May 8, 2015 So the good news is it looks like you are on the right track. You already realize you can't use the channel API with that low cost hardware. So you have to do the conversion your self and it seems you found the old conversion library. It is recommended that you use the XNet conversion library instead. The old library has some known bugs and is several years old. I'm guessing since XNet can do the same conversion that they won't be releasing new versions of it. So if you want you can try out my conversion library, which wraps the XNet conversion API. https://decibel.ni.com/content/docs/DOC-39793 In the example it shows how to take a DBC, and create frames from signals, and then take those signals and turn them back into frames. Also know that NI has a subforum for automotive questions like CAN, you may get more help there. http://forums.ni.com/t5/Automotive-and-Embedded-Networks/bd-p/30 Quote Link to comment
Sagi Posted May 11, 2015 Author Report Share Posted May 11, 2015 (edited) Hi hoovahh, thank you for your answer. I have stumbled over your solution before but didnt try it yet. I will do this today If I am right i just have to use your "Get TX RX Signals From DBC" Example to get all of my Signals. Then I can just use your Convert vis to get a valid Frame and send this Frame via the original XNET Send_Frame vi? If its really that easy I have to thank you 10000 times in advance! br Sagi €: sry, was on a wrong way... xnet isnt working on the usb device so have to use the old can drivers Edited May 11, 2015 by Sagi Quote Link to comment
hooovahh Posted May 11, 2015 Report Share Posted May 11, 2015 €: sry, was on a wrong way... xnet isnt working on the usb device so have to use the old can drivers If you read my link I mention that the XNet conversion library works on non XNet hardware, and can be used to convert an array of frames to signals and signals to an array of frame without needing any hardware. This library can work with your hardware when used properly. Oh and the example is just meant to show that you can get all TX and RX signals from a DBC, but you can also replace it with a constant of the signals you want to be able to convert. Quote Link to comment
Sagi Posted May 11, 2015 Author Report Share Posted May 11, 2015 Hi, thanks for watching this thread again I didnt really meant your VIs (they work just fine!), I meant the normal XNET communication VIs (like send/receive) they dont work on the USB module. http://www.ni.com/product-documentation/5859/en/ So i have to use the old NI-CAN vis, like "ncReadNetMult.vi". And as I can see by now I have to reformat your XNET Cluster to the old format (if thats all). I can try this in about 2-3 hours, right now I dont have the HW available. br Quote Link to comment
hooovahh Posted May 11, 2015 Report Share Posted May 11, 2015 I didnt really meant your VIs (they work just fine!), I meant the normal XNET communication VIs (like send/receive) they dont work on the USB module. http://www.ni.com/product-documentation/5859/en/ Yes sorry if that wasn't clear. The API I wrote is just intended to facilitate the conversion, but the actual communication is done by what ever your hardware has available for you. In the past I've used some cheap CAN devices like a RS-232 to CAN converter. Here there were a set of VIs to get and set frames and they worked fine. Using the conversion API meant there was some option to convert to signals, from a database, that the user could load from a file on disk instead of hard coding it. Quote Link to comment
Sagi Posted May 12, 2015 Author Report Share Posted May 12, 2015 Hi, nono it was totally clear I tried to fix my problem yesterday but still have some troubles to get valid data out of the can frames I receive... I have attached my actual test project with your XNET API. I try to convert my received data, which I get from the "ncReadNetMult.vi", into scaled data. but its allways "NaN". I have also saved my last received data in the test.vi as standard values for the output arrays. br Sagi Test CAN.zip Quote Link to comment
hooovahh Posted May 12, 2015 Report Share Posted May 12, 2015 Looks like you attached a lot of information, luckily by including the database, and saving the frames as default I can tell you a bit about why you are getting NaN. You told the API that the tester's ECU name is "BMS" I suspect this is incorrect because there is a second ECU in the database and it is "Tester" If you change this constant from BMS to Tester the conversion will take place and get some results. Now why is giving the ECU name important? Well it doesn't have to be. If you remove the Get TX and RX Signals VI and replace it with a constant 1D array of string with the signals you want to convert everything should be fine. But what is happening right now is you are telling the API that you want to convert all the signals that the BMS expects to receive. The problem is you are actually getting BSM data and you want to convert all the signals it transmits instead. Another way of looking at it is you are asking to convert frames with ID 0x520, but in the frames to convert that frame is never seen, so when you say what is the value for BMU_Alive_Hil, the conversion says that there is no value for that signal. Also you are forgetting the Close Conversion VI at the end after the while loop which cleans up the opened references. And you can remove the old and busted way of doing frame conversion. Quote Link to comment
Sagi Posted May 12, 2015 Author Report Share Posted May 12, 2015 Thank you again! Sorry, I attached the wrong project (but at least with some data). It was the "dirty" version without closing anything and old stuff packed in it :/ sorry for that. And even more big thanks from my side for still watching this garbage! you are right, now as I added only signals I really want to read and changed the ECU I get some values. But I have to ask some other guys (the guys who developed the other side of the CAN) what values I have to expect, for now they dont really look familiar to me. br Sagi Quote Link to comment
carl078 Posted December 12 Report Share Posted December 12 Hello to everybody, I still don't have any hardware to send out CAN BUS frames but I would like to verify that I can write a proper CAN BUS frame and display it just one step before phisically transmit it. Using the hooovahh's wrapped library is it possibile to: 1) load a specific .dbc file 2) write a float value in the data payload 3) display the CAN BUS frame just before trasmitting it Thank you in advance for your help! Quote Link to comment
hooovahh Posted December 12 Report Share Posted December 12 45 minutes ago, carl078 said: Using the hooovahh's wrapped library is it possibile to: 1) load a specific .dbc file 2) write a float value in the data payload 3) display the CAN BUS frame just before trasmitting it Yes this is the purpose of the Frame Signal conversion library. Development and discussion has primarily been taking place over on the dark side here. A more polished (but older) version can be found on my CAN blog here. Quote Link to comment
carl078 Posted yesterday at 09:12 AM Report Share Posted yesterday at 09:12 AM (edited) On 12/12/2024 at 3:48 PM, hooovahh said: Yes this is the purpose of the Frame Signal conversion library. Development and discussion has primarily been taking place over on the dark side here. A more polished (but older) version can be found on my CAN blog here. Thank you for your answer. Is there any way to use your XNet conversion library without openG libraries? My environment (Labview 2017) is offline. Is there any way to install openG libraries offline? I also tried to load your "Basic Frame Signal Conversion Example.vi" but it looks it is developed with Labview 20.0 and I have 17.0. Is there a way to solve this conflict? Edited yesterday at 10:21 AM by carl078 Quote Link to comment
carl078 Posted yesterday at 12:56 PM Report Share Posted yesterday at 12:56 PM 3 hours ago, carl078 said: Thank you for your answer. Is there any way to use your XNet conversion library without openG libraries? My environment (Labview 2017) is offline. Is there any way to install openG libraries offline? I also tried to load your "Basic Frame Signal Conversion Example.vi" but it looks it is developed with Labview 20.0 and I have 17.0. Is there a way to solve this conflict? I quote myself.. I copied openG libraries in from one PC where they were installed to the offline PC and it worked. Therefore, i used "Save for previous version" option of another newer Labview installation to save for 2017 version and now your conversion library works! Quote Link to comment
hooovahh Posted yesterday at 05:52 PM Report Share Posted yesterday at 05:52 PM Glad you got it working. In the future you can get the packages from a computer that is online and copy them to the other. These are usually found in the folder here: C:\ProgramData\JKI\VIPM\cache Finding all dependencies from that can be a pain. Oh and VIPM has a Package Configuration feature that lets you pick a set of packages, then save it as a configuration, and even store the package files in a single file. This VIPC file can be copied over to the offline PC and installed through VIPM without the internet. This used to be a premium feature but I think it is include with the community edition now. Quote Link to comment
carl078 Posted 15 hours ago Report Share Posted 15 hours ago 13 hours ago, hooovahh said: Glad you got it working. In the future you can get the packages from a computer that is online and copy them to the other. These are usually found in the folder here: C:\ProgramData\JKI\VIPM\cache Finding all dependencies from that can be a pain. Oh and VIPM has a Package Configuration feature that lets you pick a set of packages, then save it as a configuration, and even store the package files in a single file. This VIPC file can be copied over to the offline PC and installed through VIPM without the internet. This used to be a premium feature but I think it is include with the community edition now. Thank you for your answer! Now that the example works.. how can I "attach" the real interface of USB-8473 to your example? Quote Link to comment
hooovahh Posted 9 hours ago Report Share Posted 9 hours ago With the XNet drivers installed there will be a new palette under the Measurement I/O for XNet functions. Also in the Help >> Find Examples there are several thing showing how to read and write frames on the hardware. Additionally I have two CAN blogs that might help out with Part 3 talking about XNet code for doing basic frame functions, and Part 6 which talks about the different XNet session types. But also if you are just dealing with CAN signals, and not frames you don't need my conversion library to work with XNet hardware. You can create the signal sessions and do the writing as single point session types which the hardware will then retransmit at the rate defined in the database. My conversion library is primarily used for situations when you don't have a Signal API and just have the raw frames. Quote Link to comment
carl078 Posted 8 hours ago Report Share Posted 8 hours ago I would like to send CAN data using USB-8473. If I try to execute "CAN Fram Output Single Single Point.vi" the error described says that there is no "valid and existing interface" while the USB interface is visible in MAX. I think that the USB-8473 is not compatible with XNET... Quote Link to comment
hooovahh Posted 8 hours ago Report Share Posted 8 hours ago Oh I'm sorry I did a quick google search and of course the first search result shows a picture of an XNet device but when you click on it it shows the correct one. Well in that case you need to use the NI-CAN drivers which also appear on the Measurement IO palette. Note that you can't do the Signal API in NI-CAN with that hardware and can only use Frame API. But that's okay my conversion library returns frames. Part 3 of the CAN blog also goes over NI-CAN hardware. And again there are examples in the Help >> Find Examples. NI-CAN hardware is old and not getting updates. It also is only 32 bit binaries so it only works in LabVIEW 32 bit, but can run on 64 bit OSs. Quote Link to comment
carl078 Posted 7 hours ago Report Share Posted 7 hours ago You are right. I tried but I receive the same error "The interface name given does not specify a valid and existing interface. Solution: Use a valid and existing interface. On Windows, these may be found in MAX". I set CAN0 because I can read CAN0 in NI MAX under USB-8473. Any idea about why I receive the error even if I set (apparently) the right interface name? Quote Link to comment
hooovahh Posted 5 hours ago Report Share Posted 5 hours ago I'd need to see some code. For NI-CAN I usually start with the example provided by NI. Get that working first. Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.