USB manager & user defined serial

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

USB manager & user defined serial

Avi.Ring
The "User defined serial device adapter"( https://micro-manager.org/wiki/UserDefinedSerial ) sends ASCII / 8 bit binary commands to a device via a COM port. Since many devices today communicate only via USB ports it would be VERY convenient if the USB -serial manager ( https://micro-manager.org/wiki/USBManager ) also supported this serial adapter (E.g. controlling a  LabJAck DIO AIO, with low level commands).

What would it take to achieve this (VB.net is, roughly, my limit)?

Avi Ring, Norway



------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
micro-manager-general mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/micro-manager-general
Reply | Threaded
Open this post in threaded view
|

Re: USB manager & user defined serial

Nico Stuurman-2
Hi Avi,

On 1/28/2018 5:05 AM, [hidden email] wrote:
The "User defined serial device adapter"( https://micro-manager.org/wiki/UserDefinedSerial ) sends ASCII / 8 bit binary commands to a device via a COM port. Since many devices today communicate only via USB ports it would be VERY convenient if the USB -serial manager ( https://micro-manager.org/wiki/USBManager ) also supported this serial adapter (E.g. controlling a  LabJAck DIO AIO, with low level commands).

That is exactly the idea behind the USB manager.  However, the USB protocol is fundamentally different from a serial interface, and whether or not the USBManager can interface with a device depends on how the device uses the USB implementation.  For starters, USB devices can communicate on multiple "ports", and the USBManager therefore has to know about the device ID, the vendor ID (these are required by the USB protocol), and needs a port to send and one to receive data.  Also, for the USBManager to work, you will need a libusb driver for the device and your OS of choice.  There are many situations in which this will simply not work, and then it will be much better to use the driver and api made available by the vendor.  I don't know the particulars of your labjack, but you can see if there is a libsub driver for it, or if you can create one yourself.  You will still need to write a Micro-Manager device adapter in C++ to make full use of the device (or make use of  the UserDefinedSerial adapter).

A more useful protocol is HID, and the is a HIDManager in Micro-Manager as well. A subset of USB devices use the HID protocol, which simplifies things quite a bit.  There are  few devices supported through the HIDManager (most notably the Spectral/Andor LMM5 laser combiner), and I think that it makes a lot of sense as serial replacement since it does not need drivers, works on WIndows, Mac, and Linux, and is great for sending commands and reading state of a device.  So if your labjack supports that, I would go that route.


Best,

Nico


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
micro-manager-general mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/micro-manager-general
Reply | Threaded
Open this post in threaded view
|

Re: USB manager & user defined serial

Avi.Ring

Thanks for the clarifications and pointer to HID, indeed the LabJAck supports it! I tried the VB.net HID examples at http://janaxelson.com/hidpage.htm but got stuck. The low level LabJack programming requires an 8 byte stream and I’m not sure the “user defined serial” single char outputs can be done within the timeout of the read. I didn’t succeed  with pairs of byte outputs (although it does respond and the device gets detected). Bottom line, easier to write a device adapter and I see your point.

Avi

 

 

From: Nico Stuurman [mailto:[hidden email]]
Sent: 29. januar 2018 03:18
To: Micro-Manager General
Subject: Re: [micro-manager-general] USB manager & user defined serial

 

Hi Avi,

On 1/28/2018 5:05 AM, [hidden email] wrote:

The "User defined serial device adapter"( https://micro-manager.org/wiki/UserDefinedSerial ) sends ASCII / 8 bit binary commands to a device via a COM port. Since many devices today communicate only via USB ports it would be VERY convenient if the USB -serial manager ( https://micro-manager.org/wiki/USBManager ) also supported this serial adapter (E.g. controlling a  LabJAck DIO AIO, with low level commands).


That is exactly the idea behind the USB manager.  However, the USB protocol is fundamentally different from a serial interface, and whether or not the USBManager can interface with a device depends on how the device uses the USB implementation.  For starters, USB devices can communicate on multiple "ports", and the USBManager therefore has to know about the device ID, the vendor ID (these are required by the USB protocol), and needs a port to send and one to receive data.  Also, for the USBManager to work, you will need a libusb driver for the device and your OS of choice.  There are many situations in which this will simply not work, and then it will be much better to use the driver and api made available by the vendor.  I don't know the particulars of your labjack, but you can see if there is a libsub driver for it, or if you can create one yourself.  You will still need to write a Micro-Manager device adapter in C++ to make full use of the device (or make use of  the UserDefinedSerial adapter).

A more useful protocol is HID, and the is a HIDManager in Micro-Manager as well. A subset of USB devices use the HID protocol, which simplifies things quite a bit.  There are  few devices supported through the HIDManager (most notably the Spectral/Andor LMM5 laser combiner), and I think that it makes a lot of sense as serial replacement since it does not need drivers, works on WIndows, Mac, and Linux, and is great for sending commands and reading state of a device.  So if your labjack supports that, I would go that route.


Best,

Nico


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
micro-manager-general mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/micro-manager-general