12-09-2024 06:19 AM
I have tried the following code on NI RT:
import pyvisa
import pyvisa.constants
pyvisa.log_to_screen()
address = 'PXI0::1::BACKPLANE'
rm = pyvisa.ResourceManager()
backplane = rm.open_resource(address)
src_bus = 1
dest_bus = 2
trigger = pyvisa.constants.VI_TRIG_TTL0 # i.e. PXI_Trig0
print("Connection go backplane")
#print(backplane.manufacturer_name)
#print(backplane.model_name)
print("BUS setup up before:")
print(backplane.get_visa_attribute(pyvisa.constants.VI_ATTR_PXI_SRC_TRIG_BUS))
print(backplane.get_visa_attribute(pyvisa.constants.VI_ATTR_PXI_DEST_TRIG_BUS))
backplane.set_visa_attribute(pyvisa.constants.VI_ATTR_PXI_SRC_TRIG_BUS, src_bus)
backplane.set_visa_attribute(pyvisa.constants.VI_ATTR_PXI_DEST_TRIG_BUS, dest_bus)
print("BUS setup up after:")
print(backplane.get_visa_attribute(pyvisa.constants.VI_ATTR_PXI_SRC_TRIG_BUS))
print(backplane.get_visa_attribute(pyvisa.constants.VI_ATTR_PXI_DEST_TRIG_BUS))
# route trigger 0 from source bus to destination bus
print(backplane.session)
trigger_sw = pyvisa.constants.VI_TRIG_SW # i.e. PXI_Trig0
#backplane.set_visa_attribute(pyvisa.constants.VI_ATTR_TRIG_ID, trigger_sw)
for x in range (0,7):
trigger = x
backplane.visalib.map_trigger(backplane.session, trigger, trigger, pyvisa.constants.VI_NULL)
# backplane.set_visa_attribute(pyvisa.constants.VI_ATTR_TRIG_ID, trigger)
# backplane.visalib.assert_trigger(backplane.session, pyvisa.constants.VI_TRIG_PROT_RESERVE)
input("Press Enter to continue...")
rm.close()
and it works, I even verified in hardware the triggers are mapping through.
However, running the same code* in Ubuntu on the same machine (PXIe-8881 with a PXIe-1092 backplane) throws unknown error:
VI_ERROR_SYSTEM_ERROR | BFFF0000h | Unknown system error (miscellaneous error). |
I tried the same code in C and C# and get the same error message. I also note that running NI hardware configuration manager (there is no NI MAX for Ubuntu) does not have a triggers setting tab. Anyone know what is going on? Did NI not implement triggers in Ubuntu? All I need is a mapping from segment 1 to segment 2 but because I have other Compact PCI express cards in the rack, I need Ubuntu as I do not have drivers that work in NI RT OS.
Thanks
* interestingly I had to comment out code in RT that works in Linux. This is because the pyvisa library in RT is incomplete and does not have constants etc that _are_ defined in the open source version!
Solved! Go to Solution.
12-10-2024 05:45 AM
Try How to Reserve or Route PXI Trigger in Linux Desktop?
12-10-2024 08:07 AM
As the link clearly says; this is no longer supported. Which is a shame. Is there an updated version of this?
12-10-2024 09:33 AM
OK it looks like the issue is that the controller I am using is not supported by Ubuntu. When I run the same code in RT Linux it works. This is a bit frustrating to say the least.