LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Writing Values from a file in RT to FPGA Memory

Hi.
 
This is my first post and I must say that this forum provides an indispensible resource for LV enthausiats, thanks to all its members.  I'm new to the FPGA/RT  and am using RT/FPGA 7.1 with 1M gates PXI7831R .
 
I have defined a block in FPGA memory and want to write values from a external spreadsheet/ text file to the memory. I know the values have to converted to binary before writing to FPGA. I have searched and found some posts on this topic but unfortunately, could not follow them. Some of the code shown in these posts relates to LV 8.0 or higher and I have LV 7.1.
There is some talk of DMA, or hardware interrupts since RT is much slower than FPGA. However, I still can't figure it out.
I want to initialize the memory before the actual code executes so there is no time constraint for this process as such. What I would like to know is that once I have defined a control to write to the memory in the FPGA, what steps I must go through to ensure that the values read from the file in the RT are written to the FPGA memory.
Any help in this regard will be highly appreciated.
 
 
0 Kudos
Message 1 of 6
(6,813 Views)
It has been a while since I looked at LabVIEW 7.1, but you should be able to create a custom initialization vi for the memory blocks. If you drop a memory block and go to the properties, there's an option for doing custom initialization. From there, you can add code to the labview template that is generated to read your file in and generate the appropriate initialization array.
0 Kudos
Message 2 of 6
(6,767 Views)
Thank you for your reply. You can do custom initialization but that is limited to the FPGA resources and a file cannot be accessed directly from the FPGA code. What I've understood after looking at several posts is that you can write to memory block before the start of your main code by reading a file in the RT code and then writing it through  indicators defined in the FPGA. However, the issue then becomes synchronizing the FPGA and the RT since they operate in different time domains. Hence, the requirements for the FPGA and RT handshaking, use of interrupts etc.
I hope this makes the problem more clear.
Thanks 
0 Kudos
Message 3 of 6
(6,762 Views)
I've worked a way out. I read the file in RT, then sent the address and the data to the FPGA code. The FPGA code is in a 'while' loop and only writes to the memory when there is a change in the address. The loop then terminates and the main FPGA code starts in another 'while' loop. Although its not an efficient way, I did manage to write the 3600 values from the file to the memory block and then read them back from the main FPGA loop.
I guess, using the interrupts would be neat and efficient but for now, this solution works. If anybody can shed light on the handshaking, interupt stuff, that will be good.


0 Kudos
Message 4 of 6
(6,742 Views)
Hi Mani's World,
 
Using interrupts for synchronization would be a very good implementation for this application. I would suggest taking a look at the "Interrupt Method For Synchronization - R Series.lvproj" example found in NI Example Finder. Although it does not write data to memory on the FPGA, it is still a very good example to demonstrate synchronization with interrupts. You may also want to take a look at "Polling Method For Synchronization - R Series.lvproj" for some good practices for synchronizing by polling. I hope this helps!
0 Kudos
Message 5 of 6
(6,629 Views)
Thanks Mike . I'd definitely check out the example code . Synchronization should help to optimize the process. Thanks again
0 Kudos
Message 6 of 6
(6,170 Views)