ThorlabsAPTStage 64-bit works on MM1.4 but not MM2.0

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

ThorlabsAPTStage 64-bit works on MM1.4 but not MM2.0

Seamus Holden
Hi all,

Bit of a head scratcher here.

I'm trying to get the 64-bit ThorlabsAPTStage device adaptor to work.
Just dropping the 64-bit APT.dll into micromanager 1.4 makes it work out of the box.
Also recompiling the device adaptor for MM1.4 works fine.

When I try to get exactly the same adaptor to work under MM2.0 - ie I (or use the shipped 2.0 adaptor or recompile the identical adaptor code against the MM2.0 code - MM crashes with a seg fault as soon as I load the device in the add hardware wizard.

As far as I can see, the device adaptor API has not changed between 1.4 and 2.0 , so I am a bit at a loss as to the cause of this version specific crash.

After a bit of Vis Studio debugging, the bit of code that causes the 2.0 crash is a call to a Thorlabs hardware initialization function ( InitHWDevice(serialNumber_);) which is called identically and successfully in 1.4.

Before we get into the nitty gritty, can anyone advise me on any obvious changes to MM2.0 that I could use as a starting point for figuring out how device adaptors might be called differently between the two versions of MM?
Has anyone else noticed any other device adaptors failing when switching MM versions 1.4 to 2.0? (And figured out why?)

Many thanks
Seamus Holden

------------------------------------------------------------------------------
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: ThorlabsAPTStage 64-bit works on MM1.4 but not MM2.0

Seamus Holden
Hi all,

I fixed this, and added a pull request in the MM github.
As far as I can tell, the APT utility is initiliazed in the InitializeModuleData() call. In MM1.4 this works fine, but this initialization does not persist in MM2.0 for some reason - maybe there is some garbage collection happening after InitializeModuleData() in MM 2.0?
So when the adaptor starts making calls to the device in MM2.0, you get a seg fault.

Forcing reinitialization of the APT utility in the device adaptor Initialize function fixes the bug.

Best wishes
Seamus

On Wed, 12 Jul 2017 at 17:41 Seamus Holden <[hidden email]> wrote:
Hi all,

Bit of a head scratcher here.

I'm trying to get the 64-bit ThorlabsAPTStage device adaptor to work.
Just dropping the 64-bit APT.dll into micromanager 1.4 makes it work out of the box.
Also recompiling the device adaptor for MM1.4 works fine.

When I try to get exactly the same adaptor to work under MM2.0 - ie I (or use the shipped 2.0 adaptor or recompile the identical adaptor code against the MM2.0 code - MM crashes with a seg fault as soon as I load the device in the add hardware wizard.

As far as I can see, the device adaptor API has not changed between 1.4 and 2.0 , so I am a bit at a loss as to the cause of this version specific crash.

After a bit of Vis Studio debugging, the bit of code that causes the 2.0 crash is a call to a Thorlabs hardware initialization function ( InitHWDevice(serialNumber_);) which is called identically and successfully in 1.4.

Before we get into the nitty gritty, can anyone advise me on any obvious changes to MM2.0 that I could use as a starting point for figuring out how device adaptors might be called differently between the two versions of MM?
Has anyone else noticed any other device adaptors failing when switching MM versions 1.4 to 2.0? (And figured out why?)

Many thanks
Seamus Holden

------------------------------------------------------------------------------
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