Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

USB Access violation Call Library Node AtUSBhid.dll Atmel XMega

Solved!
Go to solution

Hi Martin,

 

Thanks for the quick reply.  I'm uploading a picture of the vi that handles the HID communications for my program.  When I run this vi without the "close" block at the end, it consistently gives me the access violation error.  I have similar vi's to handle the RS-232 and GPIB communications.

 

Thanks,

Joe

0 Kudos
Message 21 of 27
(2,399 Views)

Ok, far as I recall you definitely need the close command at the end. If you don't you get the access violation. I can not exatly remember why,but you have to close the communication etc. etc. But I'am not sure what the problem is now, does it work with the close command at the end?

 

I have placed the detection, read, write and close in a case structure (see attachment) maybe that will help.

 

Kind regards,

Martin

 

0 Kudos
Message 22 of 27
(2,385 Views)

Hi Martin,

 

Yes, my vi works fine with the close node at the end.  By "fine", I mean that I am able to communicate with my HID device, but I still get random Access violation errors (usually when I close LabVIEW).  The reason I mentioned removing the close node, is because that is one way that I've been able to recreate the error.  By monitoring the vi outputs and stoping the execution at any point before the close node, everything seems fine until I close the LabVIEW window.  That is when the Access violation error pops up.

 

It looks like our case structures are similar in that they consistently follow the find node with the close node, regardless of if any I/O took place.  Still, I will attempt to communicate using a structure more similar to yours to see if that changes anything.

 

I noticed that all of your Call Library Nodes are embeded in sub-vi's, so I can't see them.  Do you call AtUSBhid.dll in the same way I do?  Can you post pictures/vi's of the find, write, read, and close function calls?

 

Many Thanks!

Joe

0 Kudos
Message 23 of 27
(2,380 Views)

right, that doesn't really help leaving the sub vi's out 😉

 

please find them in the zip file. 

 

I had the same problem, everything seemed to work until you close labview..........

 

Give my code a try see if it works for you, I have this running for about a year now

without any problems.

 

Martin 

0 Kudos
Message 24 of 27
(2,374 Views)

Ah, I see you used setFeature instead of writeData.  I'll have to try that to see if it makes a difference.  Also, your code waits in between each Call Library Node, while mine only waits between the write and the read.  I'll try these things out, as well as your case structure, and let you know what I find out.  Thank you!

 

-Joe

0 Kudos
Message 25 of 27
(2,371 Views)

Hi Martin,

 

Well, the setFeature function is not compatible with my application, perhaps because I'm sending a string.  So, I changed it back to a writeData call.

 

I added 100ms delays before each of the Call Library Nodes.  This seems to have corrected the problem when running on my Windows 7 machines, but not on my older XP machines.  Have you heard anything about compatibility issues when using AtUSBhid.dll with Windows XP?  What OS are you running your LabVIEW program on?  Did you ever notice a change in this error across different OS's?

 

Thanks,

Joe

0 Kudos
Message 26 of 27
(2,341 Views)

Hi Joe,

 

I have only run the code on windows7 machines, tried to setup a small test but I do not seem to have a windowsXP machine any more. Sorry I can't help you with that. It does not sound logical though, USbhid is a pretty old driver, I think from the XP days so i would expect problems with windows7 not with Xp. 

 

I recall that I also tried to add time delays and that it worked for some time but after 20 minuts or so I lost the communication and I got the error. Do not now if you are going to run the code/measurement for longer periodes of time, but if you do be sure to test this one.

 

Kind regards, Martin 

0 Kudos
Message 27 of 27
(2,325 Views)