Jump to content
OMRON Forums

Brick/Clipper via USB is hanging


caslen

Recommended Posts

Our systems use either a brick or clipper via the USB connection and send commands with the PmacGetResponseEx() command. Recently I had a problem with a bad USB cable which caused my software to hang, on restarting the software I had no comms (or at least appeared to have no comms) with the brick/clipper. Rebooting the controlling PC cured the problem until the next USB glitch. I've replicated this problem on the bench by briefly disconnecting the USB cable but what I don't see any way of doing is safely getting round this problem - it appears that PmacGetResponseEx() never returns so I have no way of checking the return value for error. Is there any way I can either check that the USB connection is good before issuing the PmacGetResponseEx() command or otherwise returning from it in a controlled manner?
Link to comment
Share on other sites

  • Replies 8
  • Created
  • Last Reply

Top Posters In This Topic

[quote='steve.milici' pid='549' dateline='1279825974'] The hang-up could be the PcommServer. Try briefly removing the USB cable and then use the Windows Task Manager to manually end the PcommServer process. This should keep you from having to re-boot the computer. A power cycle to the UMAC may also be required. [/quote] I already figured out that if you switch the USB connection on the PC to a different slot it 'resets' itself and all is ok again but this is a fix not a solution, I can't ask the customer to restart his machine every time PCommServer hangs! Does PCommServer not have some sort of watchdog function that can be monitored? Or do I have to set up a timeout timer at my end and if I do how do I restart everything programatically?
Link to comment
Share on other sites

When you plug a PMAC through USB to a Windows PC, the Windows device manage will detect the PMAC as PMAC USB0 and the PCommServer will talk to it, lets say as device0. When the USB connection drops for a split second, may be gets disconnected and connected again, device manage detects it again, but since the previous device (PMAC USB0) is still not dropped from the list of devices conncetd (device manager hasn't timed out on that unit yet), it will install the device as PMAC USB1 which is different than what PCommServer knows as device0. You can double check this by looking up under unregistered PMAC devices accessible through Setup menu of PEWIN32PRO2. The correct fix is to figure out why the USB connection is dropping. However you can patch it by adding a timeout functionality to your software.
Link to comment
Share on other sites

[quote='Sina' pid='558' dateline='1279922925'] [i]"When you plug a PMAC through USB to a Windows PC, the Windows device manage will detect the PMAC as PMAC USB0 and the PCommServer will talk to it, lets say as device0. When the USB connection drops for a split second, may be gets disconnected and connected again, device manage detects it again, but since the previous device (PMAC USB0) is still not dropped from the list of devices conncetd (device manager hasn't timed out on that unit yet), it will install the device as PMAC USB1 which is different than what PCommServer knows as device0. You can double check this by looking up under unregistered PMAC devices accessible through Setup menu of PEWIN32PRO2."[/i] [i]The correct fix is to figure out why the USB connection is dropping. However you can patch it by adding a timeout functionality to your software.[/i] [/quote] Yeah I can see how that might happen. The USB is dropping because I have a dodgy cable which is easy to fix - I've just fitted a new cable. What I want to avoid is an unsafe situation, for I example I command the machine to start moving then it hangs before I can issue a 'stop moving' command. If a timeout at my end is the only way to do it then thats what I'll have to do!! Thanks for your help.
Link to comment
Share on other sites

I have spent many hours working on this exact issue. I have created a demo application using VS2010 C# that fully documents exactly how to make your application robust and handle the case where comms with the PMAC are lost. It will handle USB, Ethernet or Serial type comms all the same. It demonstrates how to periodacally check for communications with the PMAC, if it is lost it shows how to recover. What I have found with testing (I unplug the USB cable and plug it back in) is that most of the time it can recover on it's own. There are a couple ways it can recover, often when you plug it back in Windows sees the USB again and it is fine, if not the application will automatically KILL the PcommServer Process, restart it and connect to the PMAC. The application also shows how to make your app more robust by properly checking the status response from the PMAC after a call. Also it shows how to setup and work with software EVENTS in the PcommServer. Please download the attached example, it is fully commented in the source. Even though this is VS2010 C# the logic will work with older IDE's and VB or C++ as well. Let me know if you need more details. I tried to attach the example but for some reason the forum would let it show up... simply email or call me to get the code and more help as needed... [attachment=1370:name] mesposito@deltatau.com 919.374.3002
Link to comment
Share on other sites

Unit101, thanks for that - glad to know I'm not the only one looking at this problem! I don't have VS2010 C# or any way of compiling your example but I'll have a look through it and see if I can't figure out what you have done, I'll email you directly with more questions if thats OK... Cheers!
Link to comment
Share on other sites

[quote='caslen' pid='567' dateline='1280134848'] Unit101, thanks for that - glad to know I'm not the only one looking at this problem! I don't have VS2010 C# or any way of compiling your example but I'll have a look through it and see if I can't figure out what you have done, I'll email you directly with more questions if thats OK... Cheers! [/quote] What Programming enviroment are you using ? You should be able to look thru the code and see what is going on I went to extra effort to comment it thouroughly. Feel free to email or give me a call to discuss, a 5 min phone call I can more completely explain what I have seen, tested and worked on.
Link to comment
Share on other sites

[quote='Unit101' pid='568' dateline='1280146729'] What Programming enviroment are you using ? You should be able to look thru the code and see what is going on I went to extra effort to comment it thouroughly. Feel free to email or give me a call to discuss, a 5 min phone call I can more completely explain what I have seen, tested and worked on. [/quote] I'm using VC++6 at the moment, this problem is an issue with software that has been around for 5-6 years already and this problem has only just come to light. At the moment I'm working on another project so I will only get to work on this in my spare time (whatever tht is!) or if it happens again, I've also got holidays coming up next week. I'll read through what you've sent and next time I get chance I'll get in touch to work it through. Once again thanks for the support
Link to comment
Share on other sites

Guest
This topic is now closed to further replies.

×
×
  • Create New...