'particle usb dfu' inconsistency

I'm using an E0 dev board at the moment preparing for production. I'm in the process of writing the setup script to update and flash the devices as they come off the line. From a rough overview, I'm using the following sequence:

particle usb list
... Ensure device detected before proceeding
particle usb dfu
particle update
... delay for device reboot
particle usb list
... Ensure device detected before proceeding
... Record device ID from response for activation and tracking purposes
particle usb dfu
particle serial flash --usb PROD-FIRMWARE.bin

At first I had issues across the board with 'particle usb', but based on another forum post I removed existing drivers and installed using Zadig 2.4. Now usb commands appear to work... sometimes.

I am seeing very inconsistent results with 'particle usb dfu'. In a test I just ran the first attempt at 'particle usb dfu' failed. A second 'particle usb dfu' actually succeeded, but reported that it failed (success measured by the fact that the signal LED changed to yellow). A third 'particle usb dfu' instantly reported back "Done."

I have run other tests previously where 5 commands in a row failed and I ended up using the RESET/MODE buttons to enter DFU mode.

Other notes: I am testing with a 3G E0. I am only powering through USB (so it doesn't have enough power to connect to the network and is therefore blinking green.) Nothing else is connected to the dev kit aside from "E0 USB" and antenna. I used the work-around with the buttons to at least get the firmware updated so it shouldn't be deprecated firmware.

Is there any existing explanation for this behavior? How would you recommend further troubleshooting?

Edited for readability.

Does adding the --all option or explicitly adding the device ID of the previously listed device change anything?

No apparent change in behavior. The lines below were all performed in series without delay or any other change.

C:\Users\brendan\Downloads>particle usb dfu --all
Request timeout

C:\Users\brendan\Downloads>particle usb dfu --all
Request timeout

C:\Users\brendan\Downloads>particle usb dfu --all
Request timeout

C:\Users\brendan\Downloads>particle usb -v dfu --all
Sending a command to the device...
Request timeout
VError: Request timeout
at Timeout.req.reqTimer.setTimeout (C:\Users\brendan\AppData\Local\particle\node_modules\particle-cli\node_modules\particle-usb\lib\device-base.js:318:36)
at ontimeout (timers.js:498:11)
at tryOnTimeout (timers.js:323:5)
at Timer.listOnTimeout (timers.js:290:5)

C:\Users\brendan\Downloads>particle usb -v dfu --all
Sending a command to the device...
Request timeout
VError: Request timeout
at Timeout.req.reqTimer.setTimeout (C:\Users\brendan\AppData\Local\particle\node_modules\particle-cli\node_modules\particle-usb\lib\device-base.js:318:36)
at ontimeout (timers.js:498:11)
at tryOnTimeout (timers.js:323:5)
at Timer.listOnTimeout (timers.js:290:5)

C:\Users\brendan\Downloads>particle usb list
[2e001c000947373334363431] (Electron)

C:\Users\brendan\Downloads>particle usb -v dfu 2e001c000947373334363431
Sending a command to the device...
Request timeout
VError: Request timeout
at Timeout.req.reqTimer.setTimeout (C:\Users\brendan\AppData\Local\particle\node_modules\particle-cli\node_modules\particle-usb\lib\device-base.js:318:36)
at ontimeout (timers.js:498:11)
at tryOnTimeout (timers.js:323:5)
at Timer.listOnTimeout (timers.js:290:5)

C:\Users\brendan\Downloads>particle usb -v dfu 2e001c000947373334363431
Sending a command to the device...
IN control transfer failed: LIBUSB_ERROR_NOT_FOUND
VError: IN control transfer failed: LIBUSB_ERROR_NOT_FOUND
at wrapUsbError (C:\Users\brendan\AppData\Local\particle\node_modules\particle-cli\node_modules\particle-usb\lib\usb-device-node.js:39:10)
at Device._dev.controlTransfer (C:\Users\brendan\AppData\Local\particle\node_modules\particle-cli\node_modules\particle-usb\lib\usb-device-node.js:107:25)
at C:\Users\brendan\AppData\Local\particle\node_modules\particle-cli\node_modules\usb\usb.js:139:43
at _combinedTickCallback (internal/process/next_tick.js:132:7)
at process._tickCallback (internal/process/next_tick.js:181:9)
caused by: Error: LIBUSB_ERROR_NOT_FOUND
at Device.usb.Device.controlTransfer (C:\Users\brendan\AppData\Local\particle\node_modules\particle-cli\node_modules\usb\usb.js:136:12)
at _promise.default (C:\Users\brendan\AppData\Local\particle\node_modules\particle-cli\node_modules\particle-usb\lib\usb-device-node.js:105:17)
at new Promise ()
at new F (C:\Users\brendan\AppData\Local\particle\node_modules\particle-cli\node_modules@babel\runtime-corejs2\node_modules\core-js\library\modules_export.js:36:28)
at UsbDevice.transferIn (C:\Users\brendan\AppData\Local\particle\node_modules\particle-cli\node_modules\particle-usb\lib\usb-device-node.js:104:12)
at Electron._sendServiceRequest (C:\Users\brendan\AppData\Local\particle\node_modules\particle-cli\node_modules\particle-usb\lib\device-base.js:910:22)
at Electron._checkNextRequest (C:\Users\brendan\AppData\Local\particle\node_modules\particle-cli\node_modules\particle-usb\lib\device-base.js:593:10)
at Electron._process (C:\Users\brendan\AppData\Local\particle\node_modules\particle-cli\node_modules\particle-usb\lib\device-base.js:508:14)
at Timeout.setTimeout [as _onTimeout] (C:\Users\brendan\AppData\Local\particle\node_modules\particle-cli\node_modules\particle-usb\lib\device-base.js:891:12)
at ontimeout (timers.js:498:11)

C:\Users\brendan\Downloads>particle usb -v dfu 2e001c000947373334363431
Sending a command to the device...
Done.

Have you tried another USB cable?

Iā€™ve been using the cable supplied with the dev kit. I just switched to a Zagg cable I have on hand and saw the same results. Switched to the other USB port on this laptop and same results.

I appear to be having a similar experience with ā€˜particle usb resetā€™. The only time it has worked so far is after the device was in DFU mode. However, ā€˜particle usb listā€™ works every single time.

If you are on Windows, this is most likely a drivers issue. Please use the driver installer bundled with CLI or you can download it manually from here making sure that both targets (Uninstall and Install) are selected.

I did as you suggested and uninstalled/installed the drivers from the link you posted. Rebooted the machine. Same behavior. Once it eventually does go into DFU mode it seems to take other commands well, but getting it into DFU mode when it is in ā€œLooking for Cellularā€ is still very inconsistent.

Edit: I followed the same suggestion on a second PC and am getting the same results with this board. I also fired up an E0 LTE board with the first PC and am seeing exactly the same behaviorā€¦

I installed Ubuntu 18 LTS on computer 1, installed Particle CLI and Iā€™m seeing exactly the same behaviorā€¦

Has no one else experienced this? Iā€™ve tried two more E0 devices with the same experience.

I also tried working through the Particle Workbench in VSCode and had exactly the same behavior.

I wrote a script to loop the DFU attempt with a 2 second delay. It consistently takes 25-50 attempts to finally get it into DFU mode.

Output:

Device ID: 330047000647373336373936
Attempting to enter DFU Mode.
Attempt 1
Request timeout
Attempt 2
Request timeout
Attempt 3
Request timeout
Attempt 4
Request timeout
Attempt 5
Request timeout
Attempt 6
Request timeout
Attempt 7
Request timeout
Attempt 8
Memory allocation error
Attempt 9
Memory allocation error
Attempt 10
Memory allocation error
Attempt 11
Memory allocation error
Attempt 12
Memory allocation error
Attempt 13
Memory allocation error
Attempt 14
Memory allocation error
Attempt 15
Memory allocation error
Attempt 16
Memory allocation error
Attempt 17
Memory allocation error
Attempt 18
Memory allocation error
Attempt 19
Memory allocation error
Attempt 20
Memory allocation error
Attempt 21
Memory allocation error
Attempt 22
Memory allocation error
Attempt 23
Memory allocation error
Attempt 24
Memory allocation error
Attempt 25
Memory allocation error
Attempt 26
Memory allocation error
Attempt 27
Memory allocation error
Attempt 28
Memory allocation error
Attempt 29
Memory allocation error
Attempt 30
Memory allocation error
Attempt 31
Memory allocation error
Attempt 32
Memory allocation error
Attempt 33
Memory allocation error
Attempt 34
Memory allocation error
Attempt 35
Memory allocation error
Attempt 36
Memory allocation error
Attempt 37
Done.
DFU Mode success.
Updating device firmware.
Update successful.
Device ID: 330047000647373336373936
Attempting to enter DFU Mode.
Attempt 1
Request timeout
Attempt 2
Request timeout
Attempt 3
Request timeout
Attempt 4
Request timeout
Attempt 5
Request timeout
Attempt 6
Request timeout
Attempt 7
Request timeout
Attempt 8
Memory allocation error
Attempt 9
Memory allocation error
Attempt 10
Memory allocation error
Attempt 11
Memory allocation error
Attempt 12
Memory allocation error
Attempt 13
Memory allocation error
Attempt 14
Memory allocation error
Attempt 15
Memory allocation error
Attempt 16
Memory allocation error
Attempt 17
Memory allocation error
Attempt 18
Memory allocation error
Attempt 19
Memory allocation error
Attempt 20
Memory allocation error
Attempt 21
Memory allocation error
Attempt 22
Memory allocation error
Attempt 23
Memory allocation error
Attempt 24
Memory allocation error
Attempt 25
Memory allocation error
Attempt 26
Memory allocation error
Attempt 27
Memory allocation error
Attempt 28
Unable to connect to the device 330047000647373336373936. Make sure the device is connected to the host computer via USB
Attempt 29
Done.
DFU Mode success.

@ScruffR @cullenshane @avtolstoy

So I might have solved this on Ubuntu 18.04 on accident. Iā€™m on a 64-bit architecture, but while troubleshooting another application I installed lib32z1 and lib32ncurses5. Now all particle usb commands are working fine first tryā€¦

Iā€™m going to continue some further testing, but wanted to go ahead and post this update.

2 Likes

Thatā€™s likely a coincidence. I would appreciate if you could test this PR and check whether it helps.