Bridge 1046 disconnecting/Gain going wild

Supporting Visual Studio on Windows
nm17
Phidgetsian
Posts: 11
Joined: Mon Nov 27, 2017 3:29 am
Contact:

Bridge 1046 disconnecting/Gain going wild

Postby nm17 » Thu Mar 22, 2018 2:14 pm

Hi

I have Bridge 1046 disconnecting from USB (Using latest Phidget22 from 7 Mar 2018 and c#). I can't pin why is it disconnecting, I suspect it gets flooded with events and just decide to reset itself.

When it reset itself it goes to gain 128x (I use 1x gain) and reports " OutOfRange Overrange condition detected on input, try lowering the gain." I tried lowering gain in code (ie in the OnError event) the code appears to be doing what it should but then the gain goes back to 128x (and the OnError kicks in again, and the code, etc etc). So it goes into a form of infinite loop.

Any suggestions as to what is happening?

The Phidgets log says is below:

Code: Select all


INFO [phidget22usb][2018-03-22T20:19:25]:Opened USB Device: 0xdc4
INFO [phidget22][2018-03-22T20:19:25 usb.c+397 PhidgetUSBReadThreadFunction()]: PhidgetStepper Bipolar HC(1067) (422532) [X]: ReadThread starting
INFO [phidget22usb][2018-03-22T20:19:25]:Opened USB Device: 0x63c
INFO [phidget22][2018-03-22T20:19:25 usb.c+397 PhidgetUSBReadThreadFunction()]: PhidgetStepper Bipolar HC(1067) (423525) [X]: ReadThread starting
INFO [phidget22usb][2018-03-22T20:19:25]:Opened USB Device: 0x8bc
INFO [phidget22][2018-03-22T20:19:25 usb.c+397 PhidgetUSBReadThreadFunction()]: PhidgetMotorControl HC(1064) (393208): ReadThread starting
DEBUG [phidget22][2018-03-22T20:19:45 dispatch.c+161 entryDispatched()]: creating dispatcher
DEBUG [phidget22][2018-03-22T20:19:45 dispatch.c+163 entryDispatched()]: created dispatcher
DEBUG [phidget22][2018-03-22T20:19:45 dispatch.c+161 entryDispatched()]: creating dispatcher
DEBUG [phidget22][2018-03-22T20:19:45 dispatch.c+163 entryDispatched()]: created dispatcher
WARN [phidget22usb][2018-03-22T20:20:41]:GetOverlappedResult() failed with error: ERROR_DEVICE_NOT_CONNECTED
INFO [phidget22][2018-03-22T20:20:41 usb.c+424 PhidgetUSBReadThreadFunction()]: PhidgetBridge 4-Input(1046) (410338): ReadThread exiting normally (Phidget detach detected in PhidgetDevice_read)
DEBUG [phidget22][2018-03-22T20:20:41 manager.c+273 deviceDetach()]: PhidgetBridge 4-Input(1046) (410338)
DEBUG [phidget22net][2018-03-22T20:20:41 server.c+346 sendNetDeviceDetached()]: 0xb40c910 (null)
INFO [phidget22usb][2018-03-22T20:20:41]:Closing USB Device: 0x718
DEBUG [phidget22usb][2018-03-22T20:20:42]:Wait on asyncRead/closeReadEvent timed out.
ERR [phidget22][2018-03-22T20:20:42 usb.c+450 PhidgetUSBReadThreadFunction()]: PhidgetMotorControl HC(1064) (393208): ReadThread exiting - unexpected timeout (could be an ESD event)
WARN [phidget22][2018-03-22T20:20:42 usb.c+315 PhidgetUSBError()]: Detaching device because of USB error.
DEBUG [phidget22][2018-03-22T20:20:42 manager.c+273 deviceDetach()]: PhidgetMotorControl HC(1064) (393208)
DEBUG [phidget22net][2018-03-22T20:20:42 server.c+346 sendNetDeviceDetached()]: 0xb3e0c48 (null)
INFO [phidget22usb][2018-03-22T20:20:42]:Closing USB Device: 0x8bc
DEBUG [phidget22usb][2018-03-22T20:20:42]:Wait on asyncRead/closeReadEvent timed out.
DEBUG [phidget22usb][2018-03-22T20:20:42]:Wait on asyncRead/closeReadEvent timed out.
ERR [phidget22][2018-03-22T20:20:42 usb.c+450 PhidgetUSBReadThreadFunction()]: PhidgetStepper Bipolar HC(1067) (422532) [X]: ReadThread exiting - unexpected timeout (could be an ESD event)
ERR [phidget22][2018-03-22T20:20:42 usb.c+450 PhidgetUSBReadThreadFunction()]: PhidgetStepper Bipolar HC(1067) (423525) [X]: ReadThread exiting - unexpected timeout (could be an ESD event)
WARN [phidget22][2018-03-22T20:20:42 usb.c+315 PhidgetUSBError()]: Detaching device because of USB error.
WARN [phidget22][2018-03-22T20:20:42 usb.c+303 PhidgetUSBError()]: Ignoring USB error because Devices list is locked.
DEBUG [phidget22][2018-03-22T20:20:42 manager.c+273 deviceDetach()]: PhidgetStepper Bipolar HC(1067) (422532) [X]
DEBUG [phidget22net][2018-03-22T20:20:42 server.c+346 sendNetDeviceDetached()]: 0xb3d8420 (null)
INFO [phidget22usb][2018-03-22T20:20:42]:Closing USB Device: 0xdc4
INFO [phidget22usb][2018-03-22T20:20:42]:Attaching Phidget: \\?\hid#vid_06c2&pid_007b#7&19d93ee8&5&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}
ERR [phidget22usb][2018-03-22T20:20:42]:HidD_GetSerialNumberString failed: 0x00000002
INFO [phidget22usb][2018-03-22T20:20:42]:Attaching Phidget: \\?\hid#vid_06c2&pid_0059#8&20516f5c&6&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}
ERR [phidget22usb][2018-03-22T20:20:42]:HidD_GetSerialNumberString failed: 0x00000002
INFO [phidget22usb][2018-03-22T20:20:42]:Attaching Phidget: \\?\hid#vid_06c2&pid_007b#7&19d93ee8&5&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}
ERR [phidget22usb][2018-03-22T20:20:42]:HidD_GetSerialNumberString failed: 0x00000002
INFO [phidget22usb][2018-03-22T20:20:42]:Attaching Phidget: \\?\hid#vid_06c2&pid_0059#8&20516f5c&6&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}
ERR [phidget22usb][2018-03-22T20:20:42]:HidD_GetSerialNumberString failed: 0x00000002
INFO [phidget22usb][2018-03-22T20:20:42]:Attaching Phidget: \\?\hid#vid_06c2&pid_007b#7&19d93ee8&5&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}
ERR [phidget22usb][2018-03-22T20:20:42]:HidD_GetSerialNumberString failed: 0x00000002
INFO [phidget22usb][2018-03-22T20:20:42]:Attaching Phidget: \\?\hid#vid_06c2&pid_0059#8&20516f5c&6&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}
ERR [phidget22usb][2018-03-22T20:20:42]:HidD_GetSerialNumberString failed: 0x00000002
INFO [phidget22usb][2018-03-22T20:20:43]:Attaching Phidget: \\?\hid#vid_06c2&pid_007b#7&19d93ee8&5&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}
ERR [phidget22usb][2018-03-22T20:20:43]:HidD_GetSerialNumberString failed: 0x00000002
INFO [phidget22usb][2018-03-22T20:20:43]:Attaching Phidget: \\?\hid#vid_06c2&pid_0059#8&20516f5c&6&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}
ERR [phidget22usb][2018-03-22T20:20:43]:HidD_GetSerialNumberString failed: 0x00000002
INFO [phidget22usb][2018-03-22T20:20:43]:Attaching Phidget: \\?\hid#vid_06c2&pid_007b#7&19d93ee8&5&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}
ERR [phidget22usb][2018-03-22T20:20:43]:HidD_GetSerialNumberString failed: 0x00000002
INFO [phidget22usb][2018-03-22T20:20:43]:Attaching Phidget: \\?\hid#vid_06c2&pid_0059#8&20516f5c&6&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}
ERR [phidget22usb][2018-03-22T20:20:43]:HidD_GetSerialNumberString failed: 0x00000002
INFO [phidget22usb][2018-03-22T20:20:43]:Attaching Phidget: \\?\hid#vid_06c2&pid_007b#7&19d93ee8&5&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}
ERR [phidget22usb][2018-03-22T20:20:43]:HidD_GetSerialNumberString failed: 0x00000002
INFO [phidget22usb][2018-03-22T20:20:43]:Attaching Phidget: \\?\hid#vid_06c2&pid_0059#8&20516f5c&6&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}
ERR [phidget22usb][2018-03-22T20:20:43]:HidD_GetSerialNumberString failed: 0x00000002
INFO [phidget22usb][2018-03-22T20:20:43]:Attaching Phidget: \\?\hid#vid_06c2&pid_007b#7&19d93ee8&5&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}
ERR [phidget22usb][2018-03-22T20:20:43]:HidD_GetSerialNumberString failed: 0x00000002
INFO [phidget22usb][2018-03-22T20:20:43]:Attaching Phidget: \\?\hid#vid_06c2&pid_0059#8&20516f5c&6&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}
ERR [phidget22usb][2018-03-22T20:20:43]:HidD_GetSerialNumberString failed: 0x00000002
INFO [phidget22usb][2018-03-22T20:20:44]:Attaching Phidget: \\?\hid#vid_06c2&pid_007b#7&19d93ee8&5&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}
ERR [phidget22usb][2018-03-22T20:20:44]:HidD_GetSerialNumberString failed: 0x00000002
INFO [phidget22usb][2018-03-22T20:20:44]:Attaching Phidget: \\?\hid#vid_06c2&pid_0059#8&20516f5c&6&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}
ERR [phidget22usb][2018-03-22T20:20:44]:HidD_GetSerialNumberString failed: 0x00000002
DEBUG [phidget22][2018-03-22T20:20:44 manager.c+273 deviceDetach()]: PhidgetInterfaceKit 8/8/8(1010/1018/1019) (378219)
DEBUG [phidget22net][2018-03-22T20:20:44 server.c+346 sendNetDeviceDetached()]: 0xb40bee0 (null)
DEBUG [phidget22][2018-03-22T20:20:44 manager.c+273 deviceDetach()]: PhidgetStepper Bipolar HC(1067) (423525) [X]
DEBUG [phidget22net][2018-03-22T20:20:44 server.c+346 sendNetDeviceDetached()]: 0xb3c7e58 (null)
INFO [phidget22usb][2018-03-22T20:20:44]:Closing USB Device: 0x63c
INFO [phidget22usb][2018-03-22T20:20:45]:Attaching Phidget: \\?\hid#vid_06c2&pid_007b#7&19d93ee8&5&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}
DEBUG [phidget22][2018-03-22T20:20:45 phidget.c+1459 _addDevice()]: PhidgetStepper Bipolar HC(1067) (422532) [X]
INFO [phidget22usb][2018-03-22T20:20:45]:Attaching Phidget: \\?\hid#vid_06c2&pid_007b#7&1842e91&5&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}
DEBUG [phidget22][2018-03-22T20:20:45 phidget.c+1459 _addDevice()]: PhidgetStepper Bipolar HC(1067) (423525) [X]
INFO [phidget22usb][2018-03-22T20:20:45]:Opened USB Device: 0x1788
INFO [phidget22][2018-03-22T20:20:45 usb.c+397 PhidgetUSBReadThreadFunction()]: PhidgetStepper Bipolar HC(1067) (423525) [X]: ReadThread starting
INFO [phidget22usb][2018-03-22T20:20:45]:Opened USB Device: 0x1234
INFO [phidget22][2018-03-22T20:20:45 usb.c+397 PhidgetUSBReadThreadFunction()]: PhidgetStepper Bipolar HC(1067) (422532) [X]: ReadThread starting
INFO [phidget22usb][2018-03-22T20:20:45]:Attaching Phidget: \\?\hid#vid_06c2&pid_0045#8&1d5475dc&6&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}
DEBUG [phidget22][2018-03-22T20:20:45 phidget.c+1459 _addDevice()]: PhidgetInterfaceKit 8/8/8(1010/1018/1019) (378219)
INFO [phidget22usb][2018-03-22T20:20:45]:Attaching Phidget: \\?\hid#vid_06c2&pid_003b#8&b83fe0f&6&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}
DEBUG [phidget22][2018-03-22T20:20:45 phidget.c+1459 _addDevice()]: PhidgetBridge 4-Input(1046) (410338)
INFO [phidget22usb][2018-03-22T20:20:45]:Opened USB Device: 0x11dc
INFO [phidget22][2018-03-22T20:20:45 usb.c+397 PhidgetUSBReadThreadFunction()]: PhidgetBridge 4-Input(1046) (410338): ReadThread starting
INFO [phidget22usb][2018-03-22T20:20:45]:Attaching Phidget: \\?\hid#vid_06c2&pid_0059#8&20516f5c&6&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}
DEBUG [phidget22][2018-03-22T20:20:45 phidget.c+1459 _addDevice()]: PhidgetMotorControl HC(1064) (393208)
INFO [phidget22usb][2018-03-22T20:20:45]:Opened USB Device: 0x7b8
INFO [phidget22][2018-03-22T20:20:45 usb.c+397 PhidgetUSBReadThreadFunction()]: PhidgetMotorControl HC(1064) (393208): ReadThread starting
WARN [phidget22][2018-03-22T20:20:52 dispatch.c+511 insertDispatchEntry()]: Bridge Input (410338/0/3): too many dispatch entries queued (soft):200 dropping entry (type=14)
WARN [phidget22][2018-03-22T20:20:52 dispatch.c+511 insertDispatchEntry()]: Bridge Input (410338/0/3): too many dispatch entries queued (soft):200 dropping entry (type=14)
last message repeated 778 times
WARN [phidget22][2018-03-22T20:21:17 dispatch.c+511 insertDispatchEntry()]: Bridge Input (410338/0/2): too many dispatch entries queued (soft):200 dropping entry (type=14)
WARN [phidget22][2018-03-22T20:21:17 dispatch.c+511 insertDispatchEntry()]: Bridge Input (410338/0/3): too many dispatch entries queued (soft):200 dropping entry (type=14)
WARN [phidget22][2018-03-22T20:21:17 dispatch.c+511 insertDispatchEntry()]: Bridge Input (410338/0/2): too many dispatch entries queued (soft):200 dropping entry (type=14)
WARN [phidget22][2018-03-22T20:21:17 dispatch.c+511 insertDispatchEntry()]: Bridge Input (410338/0/3): too many dispatch entries queued (soft):200 dropping entry (type=14)
WARN [phidget22][2018-03-22T20:21:17 dispatch.c+511 insertDispatchEntry()]: Bridge Input (410338/0/2): too many dispatch entries queued (soft):200 dropping entry (type=14)
WARN [phidget22][2018-03-22T20:21:17 dispatch.c+511 insertDispatchEntry()]: Bridge Input (410338/0/3): too many dispatch entries queued (soft):200 dropping entry (type=14)
WARN [phidget22][2018-03-22T20:21:17 dispatch.c+511 insertDispatchEntry()]: Bridge Input (410338/0/2): too many dispatch entries queued (soft):200 dropping entry (type=14)

fraser
Engineering
Posts: 211
Joined: Thu Nov 19, 2009 4:41 pm
Contact:

Re: Bridge 1046 disconnecting/Gain going wild

Postby fraser » Fri Mar 23, 2018 8:26 am

The error is telling you that the ratio you're trying to measure is larger than what it can measure at that gain (128x is pretty high), so you're right, you want to use a lower gain, just set it in the attach handler (like i mentioned in your other post) .

However the real problem is the detaches you're seeing. Can you share some of the code? Are you doing anything in particular with the attached stepper motors/DCmotor?

nm17
Phidgetsian
Posts: 11
Joined: Mon Nov 27, 2017 3:29 am
Contact:

Re: Bridge 1046 disconnecting/Gain going wild

Postby nm17 » Wed Mar 28, 2018 2:37 am

Hi Fraser

You are correct, the detaches are worrying.

What I think happens is:
0) Bridge is attached to a linear encoder which works fine and values are within range that is usual (ie there are no spikes or out-of-range values)

1) The software is reading the encoder using VoltageRatio property of Bridge every e.g. 15-30ms (from memory I think it's 30 or even 50ms).

2) The Bridge gets overwhelmed by number of requests to read a VoltageRatio (eg every 15ms but continuously and possibly from multiple threads so likely to be far less than 15ms datarate on Bride).

3) The Bridge decides to disconnect itself. I can connect it straight back on (ie I catch an error and then try re-connect). However, when I reconnect it is at 128x gain and I can't instruct it to set gain to 1x.

So the worrying bit is not only the detach but the fact I can't set it to 1x gain after I re-attach it. If the Bridge gets overwhelmed with read requests I would expect it either ignores some requests or raises an "Please increase your DataRate error, I'm struggling".

Unfortunately the software is family complex multi-threaded app so I can't easily share code it would have to be written specifically to for the purpose of replicating this issue.

Thanks

User avatar
Patrick
Lead Developer
Posts: 2988
Joined: Mon Jun 20, 2005 8:46 am
Location: Canada
Contact:

Re: Bridge 1046 disconnecting/Gain going wild

Postby Patrick » Wed Mar 28, 2018 8:51 am

Detaches won't be a software issue. Detaches are usually a power issue, or an EMI issue.

-Patrick

nm17
Phidgetsian
Posts: 11
Joined: Mon Nov 27, 2017 3:29 am
Contact:

Re: Bridge 1046 disconnecting/Gain going wild

Postby nm17 » Thu Mar 29, 2018 3:57 am

Hm, well there are no EMI changes in the setup. The entire environment is comprised of several Phidgets boards (few stepper boards and a bridge) in metal casing so I guess external interference would be minimal even if there was something to interfere.

Same for power, there are no changes in other boards etc that would warrant changes in power supply. Unless Bridge starts drawing more then the usb can provide??

What would you see as power or EMI changes that would make bridge disconnect given it has no external power source and is in metal enclosure?

fraser
Engineering
Posts: 211
Joined: Thu Nov 19, 2009 4:41 pm
Contact:

Re: Bridge 1046 disconnecting/Gain going wild

Postby fraser » Thu Mar 29, 2018 8:36 am

The 1046 will handle any number of polls, it can't get overwhelmed unless you use asynchronous functions, in which case it will warn you about them when it happens.

What is it that prevents you from setting 1x gain when it re-attaches?

How are you powering the stepper motors? Have you tried running it without running the stepper motors? (they are a big source of EMI)

User avatar
Patrick
Lead Developer
Posts: 2988
Joined: Mon Jun 20, 2005 8:46 am
Location: Canada
Contact:

Re: Bridge 1046 disconnecting/Gain going wild

Postby Patrick » Thu Mar 29, 2018 9:40 am

I can see from your log the unexpected detaches / USB errors. These are most likely EMI. Especially with motors, this isn't that surprising. You Can help by using shorter USB cables. Make sure any USB hubs are powered. Make sure USB cables have ferrites. Could also be a grounding issue related to motor power. Have a look here as well: https://www.phidgets.com/docs/Addressin ... h_Phidgets

-Patrick

fitchett
Site Admin
Posts: 256
Joined: Fri Dec 05, 2003 3:45 pm
Location: Canada
Contact:

Re: Bridge 1046 disconnecting/Gain going wild

Postby fitchett » Thu Mar 29, 2018 9:11 pm

Try measuring the voltage on the 5V / Ground for your load cell. Use a different USB Cable, or particularly a shorter USB Cable. There is a chance that USB Voltage is low - and when the 1046 turns on the load cell, voltage drops a little lower, and the 1046 will hit it's internal Low Voltage Reset.

nm17
Phidgetsian
Posts: 11
Joined: Mon Nov 27, 2017 3:29 am
Contact:

Re: Bridge 1046 disconnecting/Gain going wild

Postby nm17 » Sat Apr 14, 2018 1:48 pm

Thanks all, very interesting suggestions.

@fraser: I set the gain but it just does nothing, ie it reverts immediately back and disconnects etc. The calls to bridge are based on event call-backs (p22 API) so the minimal polling intervals are obeyed.

Only one stepper is relatively close to usb cables (approx 20cm distance). Others are far away and separated by aluminium and steel.

I have in the past suspected the usb hub and did voltage measuring, it used to produce what is required. It may be that in this specific case EMI is stronger and causes issues and otherwise all is fine (?).

I will try to get different usb cables and test again.

Thanks very much for useful advice.


Return to “C#.NET”

Who is online

Users browsing this forum: No registered users and 1 guest