System designTroubleshooting

Camera firmware update fails at USB reset: cable and re-enumeration

Why a camera firmware update fails at the mid-update USB reset with a Protocol error, and how the cable, the port and device re-enumeration fix it.

LumaSpec Vision11 min read Share on LinkedIn

On this page 9 sections
  1. 01Why does the camera disappear at 30 percent during the update?
  2. 02What does the Protocol error from UVCIOC_CTRL_QUERY mean?
  3. 03Is the cable why the update fails at the reset?
  4. 04Which USB port should the camera be in for the update?
  5. 05Why does recovery mode work when the serial-number update fails?
  6. 06How do you re-acquire the device after the reset in your own script?
  7. 07The update reached 100 percent and then timed out — did it work?
  8. 08How do you stop the next update failing at the reset?
  9. 09Questions

A USB 3 camera firmware update should take a few minutes. When it stops near the 30 percent mark, throws a Protocol error out of UVCIOC_CTRL_QUERY and then reports that it cannot find a device in firmware-update mode, the flash image is almost never at fault: the camera dropped off the bus at the updater's built-in reset and the host never re-detected it. The failure hits depth cameras and area scan cameras alike, on desktop hosts and embedded controller boards. The sections below walk it in the order you will meet it — what the reset does, what the error means, why the cable and the port decide most cases, why recovery mode works, how to reopen the device in your own script, and how to confirm the flash took.

Why does the camera disappear at 30 percent during the update?

The updater deliberately resets the camera at roughly the 30 percent stage, which disconnects it from the USB bus; the flash continues only if the host re-detects the device, and when re-detection fails the tool reports that no device in update mode can be found.

An update runs across two states. The tool writes the first block while the camera is still a normal camera, then commands it into the update state. That command is a device reset: the camera leaves the bus, re-attaches as different hardware, and the tool keeps flashing what it finds. The break lands at about the 30 percent mark of the progress bar.

The device that returns is not the device that left. In one captured enumeration, the camera answered before the update with serial 203522250838 and a USB type of 3.2; after the reset, the same unit enumerated under a recovery name with a separate firmware-update ID, 210523066031. When nothing comes back, the run ends with a message like Failed to locate a device in FW update mode. The image was never questioned; the re-enumeration failed. If the camera stays invisible after an update rather than mid-update, start with camera not detected after a firmware update: recovery on the first host.

What does the Protocol error from UVCIOC_CTRL_QUERY mean?

Protocol error is the Linux USB stack returning errno EPROTO (71): a low-level transaction to the camera failed, and at the reset that means the device stopped answering on the bus rather than rejecting the firmware image.

The updater drives the camera through UVC extension-unit controls, and each control read or write is an ioctl on the video device node — UVCIOC_CTRL_QUERY is the call this failure prints. When the camera detaches, the next transfer has nothing to land on; the kernel answers EPROTO, the tool logs the failed ioctl, searches for an update-mode device, finds none and exits.

The error ranks the causes for you. A bad image is refused before any writing starts, with the file named — not with a bus error at 30 percent. A Protocol error at the reset is a link problem: cable, port or enumeration. Watch it live by running the update with a second terminal open on lsusb: the camera vanishes at the reset, and on a healthy run a new device arrives within a second or two. lsusb -t prints the negotiated rate per node — 5000M is SuperSpeed, 480M means the link fell back to USB 2, which takes you to the cable below.

Is the cable why the update fails at the reset?

Yes — in most field cases it is. The camera has to survive a disconnect and a reconnect at SuperSpeed, and a charge-only or USB 2-grade cable makes that reconnection fail outright or drop to 480 Mbit/s, where the update cannot resume.

The reset is the hardest thing a USB link does short of unplugging: the device re-attaches, the host resets the port, and the pair renegotiate SuperSpeed at 5 Gbit/s. A charge-only cable carries just the USB 2 pair and leaves the SuperSpeed pairs open; a thin data lead passes enumeration on the bench and drops bulk traffic the moment the update leans on it. Machine vision cameras are the wrong place to find that out, because their streams already consume most of the link:

data rate = width × height × bytes per pixel × frame rate 12 Mbyte per frame = 4000 × 3000 pixels × 1 byte 360 MB/s = 12 MB × 30 fps 2.88 Gbit/s = 360 MB/s × 8 bits per byte

Worked example, on a camera from our catalog. The LS-CMR-0166 prints 12 MP, a 4000 × 3000 resolution and 30 fps on its data sheet. Mono 8-bit at that resolution and rate is 360 MB/s, or 2.88 Gbit/s; USB 2 High-Speed offers 480 Mbit/s, one sixth of that. A cable that lets the camera re-attach at 480 Mbit/s hands the tool a device it can see but cannot use.

Decision: run every update on the 1 m USB 3 data cable shipped with the camera — not the 30 cm lead from a phone kit, not a thick-jacketed charge cable. If the update has to run where the camera lives, admit a longer USB 3 data cable only after watching it hold 5000M with the streams running. Camera data cables cover fixed and drag-chain installs:

Cables3 m USB3.0 camera cable, high-flex (drag chain) (LS-CBL-0219)LS-CBL-0219$62.00View partBuild a system with it

Any USB 3 area scan camera can hit the same wall at the reset, for example:

Area scan camerasHikrobot MV-CT0MU0060/R/NN/NN 6 MP Area Scan Camera, 3rd Gen., USB3.0, Mono, BASEMV-CT0MU0060/R/NN/NN
Sensor format
1/1.8"
Lens mount
C-mount
$969.00View part
Area scan cameras12 MP USB3 area scan camera, IMX226, 1/1.7" rolling shutter, 30 fps, 4000 × 3000 resolution (LS-CMR-0166)LS-CMR-0166
Sensor format
1/1.7"
Interface
USB3
$560.00View part

Which USB port should the camera be in for the update?

Plug straight into a blue USB 3 socket on the board itself — the blue tongue is the standard marker for a SuperSpeed port — and take every hub, extension and front-panel adapter out of the path.

Hubs re-enumerate devices through their own silicon, and a bus-powered hub can sag exactly when the camera draws inrush current after the reset. Every extension coupler adds a pair of contacts degrading a 5 Gbit/s signal. Front-panel headers add an internal cable you cannot inspect. On the embedded controller boards where this failure is common, use a root port of the board's xHCI controller.

The captured failure ran from inside a container on such a board. A container changes nothing about USB signaling, but re-enumeration creates a new device node, and the container may hold access only to the old one. Give it the whole USB bus rather than a single device node, and if re-detection still fails, run the update on the host — the flash sequence is identical. An extension lead that carries still captures can still drop a loaded link: an extension cable that fails only under the depth stream is the same mechanism, and why a 3D camera disconnects over USB mid-run covers the drops you see afterwards.

Why does recovery mode work when the serial-number update fails?

In recovery mode the camera boots already in the update state, so the updater flashes it without the mid-update disconnect and re-detection that is failing — the same signed image travels a simpler, one-device path.

After a failed reset the camera usually stays on the update side and enumerates as a recovery device; that is what the captured enumeration showed, and why the recovery flash then ran to 100 percent. Nothing has to cross a reset the host cannot complete. Recovery is the vendor's own route for this state, not a workaround — when a flash is cut off mid-write, the same route is what brings a camera back, as DFU recovery steps that work shows. Read depth camera firmware update by DFU before you start.

How do you re-acquire the device after the reset in your own script?

Re-enumerate from scratch after the reset, match the device by its update serial number, and open a fresh handle — reusing the pre-reset device pointer after the camera enters the update state corrupts the connection and kills the update.

When the vendor CLI keeps crashing, wrapping the SDK's update calls in a short script of your own is a reasonable route, and the handle is the trap. The object you opened before the update points at a device node that ceased to exist at the reset; calling through it after the switch sends ioctls into a dead node and the connection goes bad. Drop it and start over:

  1. Enumerate, and open the camera by its normal serial number.
  2. Start the update, and expect the disconnect at about the 30 percent mark.
  3. Poll enumeration about once per second for up to 60 seconds.
  4. Match the arriving device on the update serial number — not the old serial, not its position in the list.
  5. Open a fresh handle to that device, and finish the flash through it.
  6. Re-enumerate once more at the end and read the firmware version before reporting success.

If the camera re-appears on the bus but stays dead to controls, the USB link checks after a cable swap cover the bus side before you blame the code.

The update reached 100 percent and then timed out — did it work?

Yes: when the flash itself reports 100 percent and done, the image is on the device, and the timeout is only the tool giving up on the post-flash re-enumeration — enumerate again and read the firmware version field.

That is exactly what the captured log showed. The recovery flash printed 100 percent, then Waiting for new device and a timeout; the next enumeration showed the camera back under its normal serial, reporting firmware 05.14.00.00 — the version the image carried. Confirm three things and move on: the normal serial is back, the firmware version equals the image you flashed, and lsusb -t shows the link again at 5000M. If the version is unchanged, the flash never landed — return to recovery mode.

How do you stop the next update failing at the reset?

Run every update with the supplied 1 m USB 3 cable in a blue root port, close every viewer and stream first, and have your script re-enumerate by update serial number — that combination clears the reset failure in nearly every case.

Work down this list before you start:

  • Cable: the supplied 1 m USB 3 data cable — no extensions, no hubs, no front-panel adapters.
  • Port: a blue USB 3 root port on the board; 5000M in lsusb -t.
  • Exclusive access: viewers closed, streams stopped, one process owning the camera.
  • Both identifiers written down first: the normal serial and the update serial number.
  • Power: stable, and untouched once writing starts.
  • Script: re-enumerates by update serial number and opens a fresh handle after the reset.
  • Attempts: two tries on the serial-number path, then recovery — not ten.
  • Laser projectors on 3D cameras can fire during update cycles with no image streaming; keep eyes out of the beam.

If the update is one step in a bigger build, the 3D sensors and area scan cameras finders and the vision system configurator cover the rest of the station, and the systems topic page collects more field fixes of this kind. A camera wedged in recovery that will not re-flash is a support case — contact us and we will work through it with you.

Questions

Can I update over a USB 2 cable if the camera still enumerates?

No. Enumeration proves almost nothing: a USB 2 High-Speed link carries 480 Mbit/s, and a USB 3 camera that falls back to it after the reset loses the bandwidth and timing the update needs, so the tool finds a device it cannot use. Check lsusb -t before you start — the camera must sit on a 5000M branch. If it prints 480M, change the cable and start the run again from the beginning.

Is it safe to power-cycle the camera when the update stops at the reset?

Yes, at that point. A run that dies at the 30 percent reset has already moved the camera into the update state; unplugging and replugging leaves it as a recovery device, which you then flash directly. The only moment to keep hands off is while a flash is actively writing — an interrupted write, not a replug at a stall, is what strands a camera in recovery.

How many failed attempts before switching to recovery mode?

Two. Fix the cable and the port, and retry the serial-number update once with a fresh enumeration before it. If the second run stops at the same place, stop retrying: the camera is already sitting in the update state, and flashing it as a recovery device writes the same signed image without depending on the reset your host cannot complete.

Where does the update serial number come from?

From the camera itself, before you start. Run the SDK enumeration command once with the camera live and write down two values: the normal serial number and the separate firmware-update ID the device carries in update mode. After the reset the camera stops answering to its normal serial, so that second value is the only reliable match for the device your script must reopen.

Will a longer USB 3 cable make the update more reliable?

No — grade fails here, not length. A 3 m USB 3 data cable in good condition carries an update with margin, while a 30 cm charge-only lead fails one. Use the supplied 1 m cable for updates, and admit a longer cable only after watching it hold 5000M with the camera's streams running.

Why does the updater fail inside a container but work on the host?

The container changes nothing about USB signaling; it changes what your process sees. Re-enumeration builds a new device node and fires a hotplug notification, and either can fail to reach inside, so the updater waits for a camera the host can already see. Grant access to the whole USB bus rather than one node, or run the update on the host — the flash sequence is identical.