Disable DTR on Serial port

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

Disable DTR on Serial port

ben.sutcliffe
Hi,
I am in the process of writing a Device Adapter for a new custom motor which requires DTR being fully disabled for its serial connection in order to function correctly.
 
I can connect to the motor using the FreeSerialPort Device Adapter and set Handshaking Off, but cannot properly control the motor using BeanShell scripting. However, when monitoring the Com port using Free Serial Port Monitor I see that setting Handshaking Off during Hardware Configuration in MM is not disabling DTR, I get this:
IOCTL_SERIAL_SET_HANDFLOW: Set handshake information
∑ Control lines = SERIAL_DTR_CONTROL (0x1)
∑ Flow control = SERIAL_RTS_CONTROL | SERIAL_XOFF_CONTINUE (0x80000040)
∑ Xon Limit     = 2048
∑ Xoff Limit   = 512

When I use the simple RS232 terminal Termite and turn Flow Control/hHandshaking to none, I am able to control the motor just fine. Monitoring the Com port with Free Serial Port Monitor, I see that Flow Control/Handshaking and DTR are all off, I get this:
 IOCTL_SERIAL_SET_HANDFLOW: Set handshake information
∑ Control lines = 0
∑ Flow control = SERIAL_XOFF_CONTINUE (0x80000000)
∑ Xon Limit     = 2048
∑ Xoff Limit   = 512

Can someone tell me how I can completely disable DTR for a serial port so that I can control my custom motor correctly with MM?

I look forward to hearing from you, thanks.

Best,
Ben
--
Dr Ben Sutcliffe
Cell Biology Division / Light Microscopy
MRC Laboratory of Molecular Biology
Francis Crick Avenue
Cambridge Biomedical Campus
Cambridge CB2 0QH, UK


------------------------------------------------------------------------------
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: Disable DTR on Serial port

ben.sutcliffe
Hi, 
Is anyone there that can lend me a hand with this?
I need to set Flow Control to OFF and the Control lines to 0 on one serial port.
Best, 
Ben

On 1 Jun 2018, at 19:26, Ben Sutcliffe <[hidden email]> wrote:

Hi,
I am in the process of writing a Device Adapter for a new custom motor which requires DTR being fully disabled for its serial connection in order to function correctly.
 
I can connect to the motor using the FreeSerialPort Device Adapter and set Handshaking Off, but cannot properly control the motor using BeanShell scripting. However, when monitoring the Com port using Free Serial Port Monitor I see that setting Handshaking Off during Hardware Configuration in MM is not disabling DTR, I get this:
IOCTL_SERIAL_SET_HANDFLOW: Set handshake information
∑ Control lines = SERIAL_DTR_CONTROL (0x1)
∑ Flow control = SERIAL_RTS_CONTROL | SERIAL_XOFF_CONTINUE (0x80000040)
∑ Xon Limit     = 2048
∑ Xoff Limit   = 512

When I use the simple RS232 terminal Termite and turn Flow Control/hHandshaking to none, I am able to control the motor just fine. Monitoring the Com port with Free Serial Port Monitor, I see that Flow Control/Handshaking and DTR are all off, I get this:
 IOCTL_SERIAL_SET_HANDFLOW: Set handshake information
∑ Control lines = 0
∑ Flow control = SERIAL_XOFF_CONTINUE (0x80000000)
∑ Xon Limit     = 2048
∑ Xoff Limit   = 512

Can someone tell me how I can completely disable DTR for a serial port so that I can control my custom motor correctly with MM?

I look forward to hearing from you, thanks.

Best,
Ben
--
Dr Ben Sutcliffe
Cell Biology Division / Light Microscopy
MRC Laboratory of Molecular Biology
Francis Crick Avenue
Cambridge Biomedical Campus
Cambridge CB2 0QH, UK


--
Dr Ben Sutcliffe
Cell Biology Division / Light Microscopy
MRC Laboratory of Molecular Biology
Francis Crick Avenue
Cambridge Biomedical Campus
Cambridge CB2 0QH, UK


------------------------------------------------------------------------------
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: Disable DTR on Serial port

Nico Stuurman-2
Hi Ben,

On 6/5/2018 3:33 AM, Ben Sutcliffe wrote:
On 1 Jun 2018, at 19:26, Ben Sutcliffe <[hidden email]> wrote:

I am in the process of writing a Device Adapter for a new custom motor which requires DTR being fully disabled for its serial connection in order to function correctly.
 
I can connect to the motor using the FreeSerialPort Device Adapter and set Handshaking Off, but cannot properly control the motor using BeanShell scripting. However, when monitoring the Com port using Free Serial Port Monitor I see that setting Handshaking Off during Hardware Configuration in MM is not disabling DTR

Serial port settings that are not exposed in the Device Adapter are platform specific.  So, which platform (Windows, Mac, Linux) are you using?

The relevant code is in DeviceAdapters/SerialManager/SerialManager.cpp.  Searching that code shows that there is a (commented out) property that can set DTR on Windows.  If you can compile C++ code yourself, you can uncomment that code and see if it fixes your problem.  If you can not easily compile C++, let me know, and I can create a build with that property.

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: Disable DTR on Serial port

ben.sutcliffe
Hi Nico,

Thanks for the reply. I’m using a Windows system (Win 7 64bit). 
I spotted that commented out code in SerialManager.cpp that in theory should allow me to do what I need. 
I wonder do I need to compile an entire MM build or just simply the SerialMannger device adapter and my new device adapter and drop them into the MM folder? So far this has not worked but this could be my code. I’ll try a complete build, see if that works and let you know.

Thanks,
Ben

On 5 Jun 2018, at 23:15, Nico Stuurman <[hidden email]> wrote:

Hi Ben,

On 6/5/2018 3:33 AM, Ben Sutcliffe wrote:
On 1 Jun 2018, at 19:26, Ben Sutcliffe <[hidden email]> wrote:

I am in the process of writing a Device Adapter for a new custom motor which requires DTR being fully disabled for its serial connection in order to function correctly.
 
I can connect to the motor using the FreeSerialPort Device Adapter and set Handshaking Off, but cannot properly control the motor using BeanShell scripting. However, when monitoring the Com port using Free Serial Port Monitor I see that setting Handshaking Off during Hardware Configuration in MM is not disabling DTR

Serial port settings that are not exposed in the Device Adapter are platform specific.  So, which platform (Windows, Mac, Linux) are you using?

The relevant code is in DeviceAdapters/SerialManager/SerialManager.cpp.  Searching that code shows that there is a (commented out) property that can set DTR on Windows.  If you can compile C++ code yourself, you can uncomment that code and see if it fixes your problem.  If you can not easily compile C++, let me know, and I can create a build with that property.

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

--
Dr Ben Sutcliffe
Cell Biology Division / Light Microscopy
MRC Laboratory of Molecular Biology
Francis Crick Avenue
Cambridge Biomedical Campus
Cambridge CB2 0QH, UK


------------------------------------------------------------------------------
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: Disable DTR on Serial port

Nico Stuurman-2
Hi Ben,

> Thanks for the reply. I’m using a Windows system (Win 7 64bit).
> I spotted that commented out code in SerialManager.cpp that in theory
> should allow me to do what I need.
> I wonder do I need to compile an entire MM build or just simply the
> SerialMannger device adapter and my new device adapter and drop them
> into the MM folder? So far this has not worked but this could be my
> code. I’ll try a complete build, see if that works and let you know.

Just the SerialManager should be fine.  Make sure that you uncommented
all the relevant code (especially the place where the variable is used
to set the DTR in the port variable).  Replace the existing
mmgr_dal_SerialManager.dll with yours, and change the DTR property. 
Then try to communicate with your device and use your tools to see if
DTR is unset as expected.

Good luck!


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