start/stop device io

mhisted's Avatar

mhisted

02 Dec, 2019 04:31 PM

Hi Chris,

In some cases, with our labjack plugin, we only call start_device_io() on the first trial after experiment load. Occasionally when we do that, stopping the experiment and restarting will leave one of the hardware FIO inputs lines stuck high.

Any immediate thoughts on why that might happen? Is it generally ok to make those start/stop_device_io() calls only once per expt load and expect MWorks to deal with it appropriately on experiment stop/restart?

thanks and happy thanksgiving!
Mark

  1. Support Staff 1 Posted by Christopher Sta... on 02 Dec, 2019 04:43 PM

    Christopher Stawarz's Avatar

    Hi Mark,

    Is it generally ok to make those start/stop_device_io() calls only once per expt load and expect MWorks to deal with it appropriately on experiment stop/restart?

    The behavior of start/stop_device_io is entirely up to the device itself. All the actions do is call a corresponding method (startDeviceIO or stopDeviceIO) on an instance of a subclass of IODevice. What happens in those methods isn't under MWorks' control.

    Any immediate thoughts on why that might happen?

    Not really. Are you explicitly calling stop_device_io at the end of the protocol, or are you letting MWorks call it implicitly when the experiment stops?

    Chris

  2. 2 Posted by mhisted on 02 Dec, 2019 04:56 PM

    mhisted's Avatar

    >
    > Not really. Are you explicitly calling stop_device_io at the end of the protocol, or are you letting MWorks call it implicitly when the experiment stops?
    >

    Does stop_device_io() always get called when the experiment is stopped?

    Also, if there are actions that should be run every time an experiment is stopped for any reason (like the finally block of a try...finally statement in Python), where should they be put?

    thanks,
    Mark

  3. Support Staff 3 Posted by Christopher Sta... on 02 Dec, 2019 05:10 PM

    Christopher Stawarz's Avatar

    Hi Mark,

    Does stop_device_io() always get called when the experiment is stopped?

    Yes, even if the device was already stopped or was never started. Your implementation of stopDeviceIO needs to handle those scenarios and only stop things that are actually running.

    Also, if there are actions that should be run every time an experiment is stopped for any reason (like the finally block of a try...finally statement in Python), where should they be put?

    At present, there isn't any place to put them. Adding support for this has been on my to-do list for a long time but has yet to rise to the top.

    Chris

  4. 4 Posted by mhisted on 02 Dec, 2019 05:21 PM

    mhisted's Avatar

    OK, this is the info I needed - thank you. We'll check it out.

    Re: try..finally, that's fine just keep us posted.
    Mark

  5. Christopher Stawarz closed this discussion on 03 Dec, 2019 07:14 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac