Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minimal example of a shot? #80

Closed
jondoesntgit opened this issue Aug 19, 2021 · 13 comments
Closed

Minimal example of a shot? #80

jondoesntgit opened this issue Aug 19, 2021 · 13 comments

Comments

@jondoesntgit
Copy link

Hello all,

I'm trying to get my feet wet with a minimal working example:

from labscript import start, stop
from labscript_devices.PineBlaster import PineBlaster
from labscript_devices.NI_DAQmx.models.NI.PCIe_6363 import NI_PCIe6363

PineBlaster(name='pb', usbport='COM4)
NI_PCIe_6363(name='ni6363', parent_device=pb.clockline, clock_terminal='PXI1Slot18/PFIO', MAX_name='PXI1Slot18', acquisition_rate=1e3)

start()
stop(1)

When I load this up in blacs and run it, right above the shot queue, I get a bit of text that says "Running (program time: 0.081s)... 2021-08-19_0040_connection_table_0.h5" that never updates.

On Blacs, I have a green checkmark next to the my NI 6363 window, and on the Pineblaster window I get an alternating green check mark and hourglass sign. The status at the bottom of the pine blaster window alternates between "Buffered mode - State: status_monitor (main_worker)" and "Buffered mode - State: idle"

It doesn't seem like the shot ever completes... I expected it to complete after doing nothing for one second, and then for me to be able to look at some output file in RunViewer. Does anyone have any advice on what the actual behavior should be?

Is it a problem if there is no physical clockline connecting the PineBlaster and the NI 6363?

@philipstarkey
Copy link
Member

Hi Jonathan, I suspect you will need at least one output on the NI card and to actually do something with the channel between start and stop (e.g. go high, then low for a digital channel)

The failure mode you are seeing suggests no instructions have been programmed into the pineblaster and it probably doesn't report end of experiment status correctly under those circumstances - thus getting stuck indefinitely.

@jondoesntgit
Copy link
Author

jondoesntgit commented Aug 20, 2021 via email

@dihm
Copy link
Contributor

dihm commented Aug 20, 2021

Jonathan,

As a quick side note, you'll actually need to use two DAQ channels due to how the DAQmx labscript class works. Luckily that is described fairly well via an error when the script is compiled.

@jondoesntgit
Copy link
Author

Ok, here is the updated connection table and code:

from labscript import start, stop, AnalogOut, DigitalOut
from labscript_devices.PineBlaster import PineBlaster
from labscript_devices.NI_DAQmx.models.NI_PCIe_6363 import NI_PCIe_6363

PineBlaster(name='pb', usbport='COM4')
NI_PCIe_6363(name='ni6363', parent_device=pb.clockline, 
    clock_terminal='/PXI1Slot18/PFI0', MAX_name='PXI1Slot18', acquisition_rate=1e3)

DigitalOut(name='pin_a', parent_device=ni6363, connection='port0/line9')
DigitalOut(name='pin_b', parent_device=ni6363, connection='port0/line10')

start()
t=0
pin_a.go_high(1)
pin_a.go_low(2)
stop(3)

I still get the same problem. The only difference now is that it hangs at "Running (program time: 5.098s)..." above the shot queue.

Note that there is currently no wire connecting the pine blaster to the NI 6363 PFI0 port. Please advise if this is a problem.

@chrisjbillington
Copy link
Member

chrisjbillington commented Aug 23, 2021 via email

@jondoesntgit
Copy link
Author

Does BLACS automatically program the PineBlaster? Or do I need to download shot instructions to the PineBlaster manually using something like MPIDE?

@jondoesntgit
Copy link
Author

jondoesntgit commented Aug 23, 2021

I see the code where BLACS automatically programs the PineBlaster. It looks like those commands are making it to the device.

I opened up the Arduino serial monitor and entered this example program to the device:

set 0 4 3
set 1 10 1
set 2 0 0

After each instruction gets programmed, the PineBlaster responds with ok. When I type start it says ok and then nothing else.

The PineBlaster then becomes unresponsive. I have been able to get it to be responsive again by closing the serial monitor, reopening it, typing reset, and waiting. Sometimes this doesn't work, and I try a random combination of start, reset, hello, return, and reopening the serial monitor, and eventually it works.

Both of these programs work:

set 0 0 0
set 0 4 1
set 1 0 0

but this program does not

set 0 4 2
set 1 0 0

@jondoesntgit
Copy link
Author

This program also does not work

set 0 4 1
set 1 4 1
set 2 0 0

it starts with "ok" and then hangs.

@jondoesntgit
Copy link
Author

I can manually toggle the Pineblaster’s output on pin 5 by clicking on the BLACS interface.

@chrisjbillington
Copy link
Member

Great, thanks for the debugging.

Pretty clear that the PineBlaster is at fault. Remaining issues could be a hardware fault, or the PineBlaster's firmware.

Could you verify that the correct MPIDE version was used to program it, and that compiler optimisations were disabled, both as described in the REAMDE?

I don't have a PineBlaster at hand, but perhaps someone with one could verify whether the current setup instructions and available MPIDE downloads still work (I see you added a bug report about a broken link to MPIDE).

If you've followed all the instructions correctly, then the remaining explanations are a) hardware failure or b) MPIDE has been updated without a version number bump, or behaves differently on your system compared to those others are using (or have used in the past) in a way that breaks the PineBlaster's firmware.

Long shot but it could also be a hardware failure of something else, like the USB controller. But not many other possibilities!

@philipstarkey
Copy link
Member

In case you don't want to debug why the PineBlaster isn't working, you might want to consider purchasing a $4 raspberry pi pico board instead and using it as a PrawnBlaster instead. We haven't done much in the way of maintenance for keeping up with the compilation of the PineBlaster code and the PrawnBlaster should be superior to the PineBlaster due to it's newer hardware.

@jondoesntgit
Copy link
Author

@chrisjbillington I wasn't the one who flashed this device originally, so I can't speak to how it was done. If someone can point me to a suggested version of MPIDE (current link is broken), I can try to re-flash the device.

@philipstarkey I've ordered a Pico, and it should arrive later this week. Thanks for the tip.

@jondoesntgit
Copy link
Author

Using the Raspberry Pi Pico solved the problem. The only issue that I encountered is that the PrawnBlaster code isn't included in the conda channel yet, so I grabbed it from a Github clone.

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants