06-07-2023 09:49 AM
Hi everyone,
I’ve been working on an FPGA project on a cRIO for a while now. For the initial prototype we decided to go for an object-oriented approach to leverage code re-usability in the future. In this prototype the FPGA IO was hard coded in the class methods, for example:
Now I want to modify this prototype to reuse the code over multiple instances of the device connected to the cRIO.
The devices are all connected to the same module types, but over multiple modules and multiple devices to 1 module.
My idea was to create some empty FPGA I/O name controls as attributes to the class and assign the right IO channels:
Initially I though this approach worked well. I was able to create the main VI where I make multiple instances of the class and assign different IO for each instance of the devices.
Now I want to continuously read the data but when I place a while loop around the read VI I get an error when I configure the shift registers: “Shift Register: Possibility of Dynamic Refnum not supported for current target”:
The objective is not to dynamically switch the IO but configure It once per device at the beginning of the program.
Does anybody have an idea on how to approach this issue?
Solved! Go to Solution.
06-07-2023 10:32 AM
Hi,
IO references going through a shift register are automatically considered "dynamic" by the compiler because it might change from one iteration to the other, even if you don't actually change them in the loop. This is simply due to the compiler not being smart enough (I guess because it would be very complex to implement and impact the editor's performance).
There is a similar situation with auto-indexing in a ForLoop: https://forums.ni.com/t5/LabVIEW/FPGA-Array-of-I-O-References/td-p/2090974
2 options I would suggest:
1. Replace the shift register with a plain tunnel;
2. Or take the IO references out of the class and input them in the Read directly.
Regards,
Raphaël.
06-07-2023 12:08 PM
@raphschru wrote:
Hi,
IO references going through a shift register are automatically considered "dynamic" by the compiler because it might change from one iteration to the other, even if you don't actually change them in the loop. This is simply due to the compiler not being smart enough (I guess because it would be very complex to implement and impact the editor's performance).
There is a similar situation with auto-indexing in a ForLoop: https://forums.ni.com/t5/LabVIEW/FPGA-Array-of-I-O-References/td-p/2090974
2 options I would suggest:
1. Replace the shift register with a plain tunnel;
2. Or take the IO references out of the class and input them in the Read directly.
Regards,
Raphaël.
One way to accomplish getting the IO refs out of the class wire while still allowing them to be changed between implementations is to use inheritance to define them in a dynamic dispatch VI in a way that the compiler will detect as constant.
So, the IO names are defined by the type of the class wire rather than the value on it. If you create a new IODevice it has a different type and can define a different set of IO, as long as you don't try to switch between them at runtime it should compile.
06-07-2023 03:02 PM
@raphschru wrote:
Hi,
IO references going through a shift register are automatically considered "dynamic" by the compiler because it might change from one iteration to the other, even if you don't actually change them in the loop. This is simply due to the compiler not being smart enough (I guess because it would be very complex to implement and impact the editor's performance).
There is a similar situation with auto-indexing in a ForLoop: https://forums.ni.com/t5/LabVIEW/FPGA-Array-of-I-O-References/td-p/2090974
2 options I would suggest:
1. Replace the shift register with a plain tunnel;
2. Or take the IO references out of the class and input them in the Read directly.
Regards,
Raphaël.
Yes, just get rid of the shift registers. Wire statically.