LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Can you save to an SD card 9802 without a RT controller on a cRIO 9074

Dear All, 

 

I am attempting to write some FPGA code, for a cRIO 9074, to act as a data logger for 50 sensors that I am fitting to a small lifeboat. I hope to save all the data to the 9802 SD card module. From my understanding, it should be possible to take the sensor input signals into the FPGA chip, compile them into an interleaved data group and then output them straight on to the SD card from the FPGA. This means there is no RT controller required; making the system more reliable and quicker. Is this correct? Or is my knowledge wrong?

 

I have tried to look for some example of this on the web but I am struggling to find any which do NOT use a RT control. Can anyone point me in the direction of some examples?

 

Few extra details: Sampling frequency  = aiming for 10 KHz (will be reduce if system cannot handle it), Input modules include; 9236 strain gauges, 9234 accelerometers, 9205 analogue voltage inputs, anymore questions fire away.

 

Thanks in advance!

Pete

 

0 Kudos
Message 1 of 8
(3,778 Views)

I am very new to LabView so I hope these questions are not to stupid or basic. Any help will be very very appreciated!! Smiley Happy

 

I have had no luck with finding any examples of saving to a SD card 9802 withOUT a RT controller so I have had a go myself and it is attached to this post. I am having a few problems with it because I don't think I full understand the background to the FPGA I/O node and the write to SD card node. 

 

The idea is that when the VI is run, the data is saved straight to the SD card for X number of loop. (The final data logger will start when the cRIO is powered up and run for 5 mins). I am keeping it really simple to start with; only save the data from 1 sensor with no timpstamp.

The first problem I am having is that the VI is not stopping! It should read & save the data every 10 ms for 100 loops, therefore a total of 1 sec; however, the VI is not stopping and I am not sure why. When excuted on the host computer it runs fine. Any suggestions? 

I think that I am missing something between the I/O node and the write to SD card node. Do I need to transfer the data using a DMA FIFO or should be it fine going straight from 1 to the other?

 

I am also having problems opening the BIN file, so if anyone can explain how to do this it would be very helpful. 

 

Thank you!

Pete

 

 

 

 

0 Kudos
Message 2 of 8
(3,774 Views)

Hi Pete,

 

The FPGA code you have posted so far looks okay. However, I think it would be useful to see the rest of the project code, especially the RT Host VI.

If you could package the project up as a ZIP file and post it that would be great. You can do this by right clicking Build Specifications (in the Project Window) and then selecting New » Zip.

 

Thanks,

0 Kudos
Message 3 of 8
(3,760 Views)

Hi Laurence, 

 

Thank you for your reply!

 

I cannot ZIP the project but I have attached a picture of it to show you. It also shows where I am trying to Zip the project from, so if I am doing it wrong please say, then I can send you the whole project. 🙂

 

My intention is not to use a RT host VI. I hope that I can program the whole thing using only the FPGA VI. I believe this is possible because the SD card module can only achieve is 2MB/s transfer rate if it is run from the FPGA VI. BUT this is where I am not sure if it is possible!?!? Have you heard of applications that only run with a FPGA (i.e no RT host VI)??

 

I have made a few alteration to the VI, see FPGA VI ver4.vi, after seeing a few example (although they all still contain a RT VI!). Reasoning for the alterations:

- Addition flat sequence structure - this means that the FPGA LED can be turned off at the end. Before it stayed on making me believe the VI was still running. 

- Mod1/AI0 addition frame in strcture - I had seen other example with this in and it feels right :s

- For Loop for the SD card write - again I had seen example with this in. From my understanding, the SD card write node will only write the number of bytes that are wire to the data terminal. But if you wire an array to the data terminal it will only write the 1st data set in the array and not the rest. (I will have an array of 50 data sets in the final VI so I hope to get this right first time). This is the reason why the for loop iteration count is controlled to one (only one set of data wired to the terminal and will be 50 in the final VI)

 

Currently the VI is working although I cannot check the results because I cannot access the BIN file. DIAdem does not seem to produce realistic results and I am struggling to write a VI to convert it into text or TDMS. Any advice on this would also be highly useful.

 

Thank agains!

Pete

 

 

Download All
0 Kudos
Message 4 of 8
(3,745 Views)

Hi Pete,

 

I noticed the LED stayed on and thought that might have been misleading 🙂

 

The additional frame in the structure for the data acquisition is not required as the dataflow in LabVIEW is determined by the wiring, and until all the data is available at the next node, it will not execute. This means that until the analog measurements have been made, the SD card write function will not be performed.

 

If your analogue acquisitions are all built into an array, then when you wire the array into the SD Write for loop, the loop will auto-index the array and write each piece of data sequentially. In other words, there is no need to wire the N termainal.

 

As for the DIAdem problem, you might want to create a new forum post on the DIAdem page, which would have a greater chance of finding the best solution. I will keep looking into this and follow it over there, but you may find other users in that forum that have previous experience with importing BIN files from SD cards.

 

http://forums.ni.com/t5/DIAdem/bd-p/60

 

0 Kudos
Message 5 of 8
(3,735 Views)

Hi Laurence, 

 

Great, thank you for that information! 

 

So the loop I added are not needed, I'll try removing them and it should still hopefully run smoothly! Although, when I change the loop to auto-index it then cannot be wired to the SD Card Close function. I think I need to convert the wire to another format. I'll have a play today but if you know what I need to do please let me know. Thanks 🙂

 

I will set up another post on the DIAdem page. I am speaking to technical support because the info on the SD card is minimal... It does not state whether a header is placed in the binary file, and i'm not even sure if you can acces the SD from a PC or whether you have to do it through the cRIO. I'll set up another post soon.

 

Thanks for all your help!

Pete

 

0 Kudos
Message 6 of 8
(3,728 Views)

Hi Pete,

 

Just to finish up here, I have talked to a colleague and he has told me that the SD data should not have a header if written by the FPGA IO node. To import it into DIAdem you will either need to write a DataPlugin or use a LabVIEW vi to convert the binary file into a TDMS file or similar. You can find the appropriate help (and an example, "Binary File with 4 Channels") on DataPlugins, by visiting the Help file in DIAdem, and navigating to:

 

Programming Reference » Object Oriented Script Interfaces » DataPlugin

 

If you are unsure about writing the DataPlugin yourself, then there are certainly some users on the DIAdem forum who can help you with it, or even give you some code.

 

As for the loop, you should right click on the output tunnel and disable auto-indexing for the reference, as at the moment it is trying to build an array of the file references!

 

When you try to implement this with 50 sensors, you may want to explore writing the file data in a parallel loop, employing a DMA FIFO to transfer the data between the loops. This will help if you have timing issues.

You should be able to write/read the whole array to/from the DMA FIFO, and then write to the SD using a for loop as before.

 

Hope this has helped solve your issue,

0 Kudos
Message 7 of 8
(3,725 Views)

Hi Laurence,

 

Just to let you know that I have now got it to work as expected! Thanks again for all your help.

 

The issue with the reading binary files was simply but stupid. It asks how many bytes each data point is, so I inputed 2. However, I did not realise that you have to change the respentation of the number of bytes to match the data points (i.e. I16). Simply but silly....

 

I have attached the FPGA code and Read Bin File code for anyone who may read this in the future.

 

Thanks

Pete

Download All
0 Kudos
Message 8 of 8
(3,706 Views)