Jesus Alva Posted May 31, 2023 Report Share Posted May 31, 2023 Hi, I'm using the TroyK Vector XL Drivers but sometimes there is an error message window stating "Invalid access". This error is fixed by disconnecting and reconnecting the Vector hardware USB cable. Is there a programattically solution to confirm if the channel I'm trying to use is already in use, then close it and then try to reopen again? Thanks! Quote Link to comment
hooovahh Posted May 31, 2023 Report Share Posted May 31, 2023 Write code that detects if the error is thrown, and if it is then close and reconnect. Honestly that shouldn't happen under normal use so I'm wondering if a reference is closed or lost somehow. Quote Link to comment
Troy K Posted August 28, 2023 Report Share Posted August 28, 2023 Not really enough information in the question to give a definitive answer, but here is some useful info... This error message is usually only seen when trying to open or access a LIN channel. Only one app can open a LIN channel successfully because it must have 'init' access. If you forget to close the port (or an error prevents the close port function from executing), you can't open it again without encountering this error. For CAN channels it just opens a new port incrementing the porthandle. You then have to either unplug the hardware (as you stated) or close the app which is holding the port open (LabVIEW, your compiled app or whichever app has it) forcing the open handle to release. (The port ref handle seems to be a simple incrementing integer starting at 1. You could maybe try to cycle through a few port handle ref ids incrementing from 1, executing the close port function on the imaginary ref numbers hoping to get lucky, but that seems messy.) It's best to make sure you are always closing the port, and in the case of LIN, make sure no other app has claimed init access on the channel. Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.