I develop software with PCAN-USB and PCANBasic.
Sometimes, sofware crashes (normal while developping). But PCAN-USB is not correctly disconnected because when I try to Initialize (CAN_Initialize()), I have error status.
Problem can be seen too in PCAN-View where there is a warning: "This hardware is already in use by another software!" and it is not possible to connect.
The only solution is to reboot computer.
How reset this state of "already in use" with a call to function of PCANBasic?
Please check within the task manager, that visual studio is not keep running after you close it (you can have several instances of it, and maybe one is not completely closed). Please be sure you are using latest version for driver and API, you can see the current versions and history of changes here. You should also check for Visual Studio updates.
Technical Support Team
Technical Support Team
I need to find a work around for this issue. How can I find additional information about what this "another software!" is? It would be nice if the error message included the PID for the "another software". How can I completely remove any settings related to PCAN-USB on my machine so that it will return to its state before anything related to PCAN-USB was ever installed?
Your prompt help will be much appreciated! Please let me know if you need any additional information from me. I have attached a screen capture of PCAN-View with the warning.
please contact our support team by email. There are tools available, which we can send to you to check your system.
When using Windows 7, please also check your USB3 chipset drivers. The issue could also be caused by a bad USB3 chipset driver.
A coworker who develops using a different machine than mine (but also Windows 10), has also experienced similar issues.
I am going to be providing this information to the support team, along with other information, and I will post back here if we find anything else that would be helpful.
What do you mean with resetting? you shut-off and shut-on the computer? or you goes over Windows menu and click "re start your PC"? Note that with any WIndows 10 installation, the option for fast startup is set to on. If this is so, the PCAN-Basic connections are kept in memory so that after shutting off and on your PC you will still have the problem. Check if this is your case and disable it. Here are some struction how to do this.paulh3030 wrote:Even after resetting the computer, I would still see the warning.
Please note that the architecture of our drivers allow to work even without having an adaptor attached (for instance our Virtual drivers). Disconnecting a device from the computer doesn't means an automatic "software disconnection".paulh3030 wrote:While I am now able to avoid this issue most of the time and have a way to recover from it, it doesn't seem right that PCAN-View displays this warning even after the USB connection is reset.
As in other post commented, it was possible to solve this problem over the options in Visual Studio (CAN_Initialize failing after stop debugging). Starting with VS2017 this was no possible anymore. This behavior was enhanced as part of Windows and included in the Version 1803 of Windows 10. Tests with older versions (Windows 1709) shows that the problem was not there. Microsoft changed back this behavior again in the last update, 1809. Here, the PCAN-Basic connection is removed as expected. Please check which version of Windows 10 you are using and update your system if needed.paulh3030 wrote: I have found a way to reproduce this issue which involves running our software from the Visual Studio Debugger, and then pausing the software while it is running, and then stopping the software from the debugger. This causes our software to not run through its normal termination (where the PCAN library is unitialized) leaving PCAN thinking there is still an active connection.
Nevertheless, we are preparing an update in our drivers to catch this problem and to enhance finalization of connections on environments like Visual Studio
Very good advice. I completely forgot about the fast start up option introduced in Windows 10. I always wondered what it was about exactly, and now I have a much better idea. Disabling the Fast Start-up option now allows the PCAN to drop its connection following power cycling the computer (by resetting, I did mean to shut-off the computer and then turn it back on). This explains the caching I was observing.K.Wagner wrote:Note that with any WIndows 10 installation, the option for fast startup is set to on. If this is so, the PCAN-Basic connections are kept in memory so that after shutting off and on your PC you will still have the problem
Okay that's fair. It would be nice if there was a convenient utility allowing one to forcibly free up a connection from "another device". One could write a script to do this, but it would be nice if there was something readily available. Such a feature could be added to PCAN-View, for instance, to force a device to be released. A button could be added to the warning message titled something like "Release Connection".K.Wagner wrote:Please note that the architecture of our drivers allow to work even without having an adaptor attached (for instance our Virtual drivers). Disconnecting a device from the computer doesn't means an automatic "software disconnection".
If I understand everything correctly, my system is now working as expected. Thank you for your help.