PORTS Forum
Ports and Interfaces => USB => Topic started by: doctormano on January 11, 2017, 03:23:26 pm
-
Hello,
I have a device that could be powered by batteries or USB. If no batteries are present, USB enumeration is 100% and device manager shows the virtual com port. However if unit is already powered by batteries, USB enumeration fails 50-70% of times. The unit is event driven so it isn't busy at all. When it fails device manager shows unknown device.
Attached a USB beagle to check the data flow and it lots of sync problems. Does anyone know why this maybe happening? See beagle output below.
Thanks in advance for your help.
# Level Sp Index m:s.ms.us Dur Len Err Dev Ep Record Summary
0 0 0:00.000.000 Capture started (Aggregate) [01/10/17 14:17:37]
0 1 0:00.000.023 <Unreset> / <Target connected>
0 2 0:00.003.019 1.999.989.250 s [62648 SYNC ERRORS] [Periodic Timeout]
0 3 0:02.003.030 1.397.959.666 s [43782 SYNC ERRORS]
0 4 0:03.401.030 <Reset> / <Target disconnected>
0 5 0:05.944.161 <Unreset> / <Target connected>
0 6 0:05.949.172 100.077.229 ms [3289 SYNC ERRORS]
0 7 0:06.049.288 <Reset> / <Target disconnected>
0 8 0:06.099.569 <Unreset> / <Target connected>
0 9 0:06.100.490 31.829.270 ms [74 SYNC ERRORS]
0 10 0:06.132.323 61.895 us 9 B C CORRUPTED packet 06 00 01 00 00 40 00 DD 94
0 11 0:06.132.494 35.270 us [12 SYNC ERRORS]
0 12 0:06.132.533 61.875 us 9 B C CORRUPTED packet 06 00 01 00 00 40 00 DD 94
0 13 0:06.132.610 31.645 us [10 SYNC ERRORS]
0 14 0:06.132.645 61.833 us 9 B C CORRUPTED packet 06 00 01 00 00 40 00 DD 94
0 15 0:06.133.494 499.064.791 ms [1000 SYNC ERRORS]
0 16 0:06.633.260 <Reset> / <Target disconnected>
0 17 0:06.688.124 <Unreset> / <Target connected>
0 18 0:06.688.565 100.275.812 ms [212 SYNC ERRORS]
0 19 0:06.788.844 61.895 us 9 B C CORRUPTED packet 06 00 01 00 00 40 00 DD 94
0 20 0:06.788.921 31.645 us [10 SYNC ERRORS]
0 21 0:06.788.956 61.833 us 9 B C CORRUPTED packet 06 00 01 00 00 40 00 DD 94
0 22 0:06.789.035 31.645 us [10 SYNC ERRORS]
0 23 0:06.789.070 61.854 us 9 B C CORRUPTED packet 06 00 01 00 00 40 00 DD 94
0 24 0:06.789.577 500.064.916 ms [1002 SYNC ERRORS]
0 25 0:07.289.831 <Reset> / <Target disconnected>
0 26 0:07.344.696 <Unreset> / <Target connected>
0 27 0:07.345.648 99.836.229 ms [210 SYNC ERRORS]
0 28 0:07.445.488 61.895 us 9 B C CORRUPTED packet 06 00 01 00 00 40 00 DD 94
0 29 0:07.445.661 35.250 us [12 SYNC ERRORS]
0 30 0:07.445.700 61.895 us 9 B C CORRUPTED packet 06 00 01 00 00 40 00 DD 94
0 31 0:07.445.776 31.645 us [10 SYNC ERRORS]
0 32 0:07.445.812 61.833 us 9 B C CORRUPTED packet 06 00 01 00 00 40 00 DD 94
0 33 0:07.446.661 499.064.770 ms [1000 SYNC ERRORS]
0 34 0:07.946.380 <Reset> / <Target disconnected>
0 35 0:08.001.244 <Unreset> / <Target connected>
0 36 0:08.001.731 100.223.187 ms [212 SYNC ERRORS]
0 37 0:08.101.958 61.833 us 9 B C CORRUPTED packet 06 00 01 00 00 40 00 DD 94
0 38 0:08.102.035 31.645 us [10 SYNC ERRORS]
0 39 0:08.102.070 61.854 us 9 B C CORRUPTED packet 06 00 01 00 00 40 00 DD 94
0 40 0:08.102.147 31.645 us [10 SYNC ERRORS]
0 41 0:08.102.182 61.895 us 9 B C CORRUPTED packet 06 00 01 00 00 40 00 DD 94
0 42 0:08.106.603 1.759.804.645 s [55131 SYNC ERRORS]
0 43 0:09.866.438 <Reset> / <Target disconnected>
0 44 0:23.947.729 <Unreset> / <Target connected>
0 45 0:23.951.834 95.091.687 ms [1652 SYNC ERRORS]
0 46 0:24.056.964 <Reset> / <Target disconnected>
0 47 0:24.103.316 <Unreset> / <Target connected>
0 48 0:24.103.774 32.294.145 ms [76 SYNC ERRORS]
0 49 0:24.136.072 61.979 us 9 B C CORRUPTED packet 06 00 01 00 00 40 00 DD 94
0 50 0:24.136.149 31.645 us [10 SYNC ERRORS]
0 51 0:24.136.184 62.000 us 9 B C CORRUPTED packet 06 00 01 00 00 40 00 DD 94
0 52 0:24.136.261 31.645 us [10 SYNC ERRORS]
0 53 0:24.136.297 61.895 us 9 B C CORRUPTED packet 06 00 01 00 00 40 00 DD 94
0 54 0:24.136.778 500.064.895 ms [1002 SYNC ERRORS]
0 55 0:24.637.021 <Reset> / <Target disconnected>
0 56 0:24.691.885 <Unreset> / <Target connected>
0 57 0:24.692.849 99.887.395 ms [210 SYNC ERRORS]
0 58 0:24.792.740 61.979 us 9 B C CORRUPTED packet 06 00 01 00 00 40 00 DD 94
0 59 0:24.792.862 35.250 us [12 SYNC ERRORS]
0 60 0:24.792.901 62.104 us 9 B C CORRUPTED packet 06 00 01 00 00 40 00 DD 94
0 61 0:24.792.977 31.645 us [10 SYNC ERRORS]
0 62 0:24.793.013 61.916 us 9 B C CORRUPTED packet 06 00 01 00 00 40 00 DD 94
0 63 0:24.793.862 499.064.770 ms [1000 SYNC ERRORS]
0 64 0:25.293.778 <Reset> / <Target disconnected>
0 65 0:25.348.642 <Unreset> / <Target connected>
0 66 0:25.348.932 100.477.250 ms [212 SYNC ERRORS]
0 67 0:25.449.413 62.083 us 9 B C CORRUPTED packet 06 00 01 00 00 40 00 DD 94
0 68 0:25.449.490 31.645 us [10 SYNC ERRORS]
0 69 0:25.449.526 61.875 us 9 B C CORRUPTED packet 06 00 01 00 00 40 00 DD 94
0 70 0:25.449.602 31.645 us [10 SYNC ERRORS]
0 71 0:25.449.638 61.979 us 9 B C CORRUPTED packet 06 00 01 00 00 40 00 DD 94
0 72 0:25.449.945 500.064.895 ms [1002 SYNC ERRORS]
0 73 0:25.950.329 <Reset> / <Target disconnected>
0 74 0:26.005.193 <Unreset> / <Target connected>
0 75 0:26.006.016 100.525.770 ms [212 SYNC ERRORS]
0 76 0:26.106.545 62.083 us 9 B C CORRUPTED packet 06 00 01 00 00 40 00 DD 94
0 77 0:26.106.622 31.645 us [10 SYNC ERRORS]
0 78 0:26.106.657 61.916 us 9 B C CORRUPTED packet 06 00 01 00 00 40 00 DD 94
0 79 0:26.106.734 31.645 us [10 SYNC ERRORS]
0 80 0:26.106.770 61.895 us 9 B C CORRUPTED packet 06 00 01 00 00 40 00 DD 94
0 81 0:26.107.028 1.998.588.270 s [62512 SYNC ERRORS] [Periodic Timeout]
0 82 0:28.110.630 835.283.979 ms [26293 SYNC ERRORS]
0 83 0:28.945.942 <Reset> / <Target disconnected>
0 84 0:29.622.313 <Unreset> / <Target connected>
0 85 0:29.637.207 110.107.333 ms [1888 SYNC ERRORS]
0 86 0:29.757.352 <Reset> / <Target disconnected>
0 87 0:29.803.743 <Unreset> / <Target connected>
0 394 2:14.886.497 <Reset> / <Target disconnected>
0 395 2:18.153.563 <Unreset> / <Target connected>
0 396 2:18.253.981 <Reset> / <Target disconnected>
0 397 2:18.308.845 <Unreset> / <Target connected>
0 398 2:18.309.262 32.006.875 ms [33 SOF] [Frames: 454 - 486]
0 399 2:18.341.646 11.416 us 8 B I 0 0 SETUP txn 80 06 00 01 00 00 40 00
0 402 2:18.341.661 11.416 us 8 B I 0 0 SETUP txn 80 06 00 01 00 00 40 00
0 405 2:18.341.676 11.437 us 8 B I 0 0 SETUP txn 80 06 00 01 00 00 40 00
0 408 2:18.342.267 500.066.250 ms [501 SOF] [Frames: 487 - 987]
0 409 2:18.842.515 <Reset> / <Target disconnected>
0 410 2:18.897.380 <Unreset> / <Target connected>
0 411 2:18.898.340 99.995.458 ms [4702 SYNC ERRORS]
0 412 2:18.998.365 <Reset> / <Target disconnected>
0 413 2:19.053.229 <Unreset> / <Target connected>
0 414 2:19.053.357 100.015.500 ms [101 SOF] [Frames: 1198 - 1298]
0 415 2:19.153.933 47.104 us 0 B 0 0 Set Address Address=31
0 425 2:19.154.370 10.004.083 ms [11 SOF] [Frames: 1299 - 1309]
0 426 2:19.164.459 107.791 us 18 B 31 0 Get Device Descriptor Index=0 Length=18
0 445 2:19.165.123 199.729 us 67 B 31 0 Get Configuration Descriptor Index=0 Length=255
0 469 2:19.165.371 2.833 us [1 SOF] [Frame: 1310]
0 470 2:19.165.391 113.645 us 26 B 31 0 Get String Descriptor Index=3 Length=255
0 489 2:19.165.570 99.854 us 4 B 31 0 Get String Descriptor Index=0 Length=255
0 508 2:19.165.734 133.500 us 50 B 31 0 Get String Descriptor Index=2 Length=255
0 527 2:19.165.932 50.666 us 0 B 31 0 Control Transfer (STALL) Index=0 Length=10
0 536 2:19.166.371 13.004.479 ms [14 SOF] [Frames: 1311 - 1324]
0 537 2:19.179.376 76.375 us 18 B 31 0 Get Device Descriptor Index=0 Length=18
0 551 2:19.179.491 107.083 us 9 B 31 0 Get Configuration Descriptor Index=0 Length=9
0 570 2:19.179.639 191.437 us 67 B 31 0 Get Configuration Descriptor Index=0 Length=67
0 594 2:19.179.937 198.104 us 67 B 31 0 Get Configuration Descriptor Index=0 Length=265
0 618 2:19.180.251 62.854 us 0 B 31 0 Set Configuration Configuration=1
0 628 2:19.180.373 1.002.958 ms [2 SOF] [Frames: 1325 - 1326]
0 629 2:19.181.305 127.229 us 7 B 31 0 Control Transfer 00 C2 01 00 00 00 08
0 647 2:19.181.475 53.583 us 0 B 31 0 Control Transfer
0 657 2:19.181.752 108.708 us 7 B 31 0 Control Transfer 00 C2 01 00 00 00 08
0 676 2:19.181.919 108.562 us 7 B 31 0 Control Transfer 00 C2 01 00 00 00 08
0 695 2:19.182.373 588.077.395 ms [589 SOF] [Frames: 1327 - 1915]
0 696 2:19.770.813 81.104 us 7 B 31 0 Control Transfer 00 C2 01 00 00 00 08
0 710 2:19.771.448 2.812 us [1 SOF] [Frame: 1916]
0 711 2:19.771.458 76.312 us 7 B 31 0 Control Transfer 00 C2 01 00 00 00 08
0 725 2:19.772.448 9.004.041 ms [10 SOF] [Frames: 1917 - 1926]
0 726 2:19.782.208 53.958 us 0 B 31 0 Control Transfer
0 736 2:19.770.759 4.415.354 ms 31 1 [150 IN-NAK] [Periodic Timeout]
0 737 2:19.775.459 4.666 us 31 2 [1 IN-NAK] [Periodic Timeout]
0 738 2:19.782.449 1.999.256.395 s [2000 SOF] [Frames: 1927 - 1878] [Periodic Timeout]
-
It looks like the device has a hard time recovering from a USB reset initiated by the host when the device has been powered for some time. I would start looking there in the device firmware.
-
I would put an o'scope on the power line to the micro.
Looks like the impedance of the batteries/supply is to high causing the voltage to collapse at USB reset.
What is actually different from the hardware power perspective? Different regulators involved?
-
Thanks for the response. There is only one regulator providing power to the micro. When USB is connected, it goes through a switching transistor to switch power from batteries to USB. Bypassing this and keeping the micro's input voltage at 3.3 volts doesn't make any difference in the enumeration frequency. Still fails when batteries are present. Monitored the voltage via scope and there is no dip in the voltage when USB cable is connected.
-
Thanks for all inputs. Will look into the USB reset to see if there is anything that might explain this issue.
-
This definitely seems like an issue related to power, though not necessarily voltage. If it's feasible, you should try to measure both current and voltage, and do it at the input to the micro (after all of the switching transistors and regulators and filters and whatever have done their job). It's even possible you're losing voltage or limiting current through the switching transistor when the batteries are there but not when USB power is there (depending on how the circuitry is designed).