[Particle Official] Windows 10 Full CLI and DFU Setup


#1

Prerequisites

For Node/NPM installation follow this mini-tutorial.

  • Particle CLI: v1.8.17 link install this after installing Node and NPM

Note: All of these steps involving a terminal/command prompt are done via Windows 10 command prompt. Also, has been tested and working on Windows 7.

Step 1

At this point you should check to see if your Node and NPM versions are working. As stated in the mini-tutorial from above, if you issue
node -v
and
npm -v
it should output the version of each of those packages you have installed.

Once, those are installed and working, you should
issue
particle help or particle login to see if the particle-cli is properly installed.

Step 2

Installing the Particle Driver

You’ll need to install the Windows driver. Download it here.

Unzip the file. It is fine to unzip this as a default into your Downloads folder.

On Windows10, go to the Device Manager and double-click on
your Particle device under Other Devices (on Windows 10 your Particle device may be listed under Ports (COM & LPT)).

Click Update Driver, and select Browse for driver software on your computer.


On the next screen click Let me pick from a list of drivers...

On this screen below, click the Have Disk button to open the directory to find photon.cat.
Navigate to your Downloads folder, or wherever you unzipped the drivers, by clicking the browse button.


After loading in the photon.cat file you should be able to scroll the left list and find Particle and click that. After clicking, on the right you should an option for the Photon to be a driver. Click that and press NEXT.

This should be the screen you see after pressing NEXT. After seeing this screen you should press OK and you should be done with this part.

Your device should now show up in Device Manager like this (below).

Step 3

Download dfu-util and install it

  • The dfu-util you need lives (here) <-- download link

After that downloads, you should unzip all the tar files (preferably using 7-Zip). It will be .tar.xz extension so it will require 2 unzips via 7-Zip to get to the root of the base file.

Once everything is unzipped it is best to move the dfu-util-0.8-binaries folder the C:\ of your windows machine to get an easier access to win32-mingw32, which lives inside that folder, for a later step.

After moving to C:\ you should go to My Computer and right click to pull up Properties

Once you’re on that screen click on Advanced system settings button. It should pull up your System properties.

  • In the Advanced section, click the Environment Variables button.

  • Finally, in the Environment Variables window, highlight the Path variable in the User variables for you section and click the Edit button.

  • Reference the photo and line of text below. Each different directory is separated with a semicolon as shown below. Ours is the last set of text after the last semicolon ( ; )
    C:\Program Files;C:\Winnt;C:\Winnt\System32;C:\dfu-util-0.8-binaries\win32-mingw32

Press OK, then at the next screen press APPLY followed by OK. Then close that larger window.

Now, go to the folder in the C:\ and into the folder where win32-mingw32 is located and then right click the file build-mingw32-libusb and click OPEN. It should run via the command prompt and then close automatically.

Step 4

Install Zadig Utility

  • Follow this link to install zadig for Windows 10.
    Feel free to leave this in Downloads folder, but whenever you run it, run as administrator.

Once opened, click on Options on top tab and click LIST ALL DEVICES while your Photon is still in dfu mode. Clicke the dropdown menu and your Photon should show up as Photon DFU Mode (see below).

The left side box (left of green arrow) may have something weird inside of it or show (NONE) and this is fine. Just make the right side box shows WinUSB (v6 1.7600.16385) or something similar and then click Install Driver or Reinstall driver button. After installing, both sides should match in text. Now close zadig.

Go back to Device Manager and reset your Photon by clicking the reset button on it. Put the Photon back in to dfu-mode.

And under Universal Serial Bus devices you should click the dropdown button and you will see the Photon DFU Mode device. Once confirmed we can move on to the last step which is testing dfu out via the CLI.

Step 5

Go to command prompt and issue
particle update with the Photon in dfu-mode and it should update itself to our most stable firmware.

At this point you should be able to issue particle setup and other commands involving the serial and dfu functionality with ease.

##Done. :smile:


Unable to connect with spark app
Installing dfu-util files
Failed to claim device, server said { ok: false, errors: [ 'device does not exist'
Photon,Relay Shield and Nextion Touchscreen Based Aquaponics/Indoor Greenhouse
[SOLVED]Connecting a sparkio
Dfu-util not recognised for Sparkcore
Core blinking white and not booting up
Newbie: spark core locks me out
Photon Red blinking and white breathing
Particle blinking red and not detected via usb
[SOLVED] Photon Initial Setup Issues
Login Failed: ECONNREFUSED 127.0.0.1:8080
Can't Install Photon USB Driver in Windows Vista
Size of data use for Electron OTA programming
[Solved] Particle Dev CLI Serial Confusion - Uncaught Error: Invalid port specified: undefined
Cannot Get Photon to Connect to Wifi Inside Apartment Complex Network
Cannot install particle-cli on windows [SOLVED]
Which version of particle drivers to use?
[SOLVED]Photon DFU Mode Driver failed for Electron setup
[SOLVED] Unable to install particle-cli on Windows 10
[solved] "Fake" Firmware Download
#7

What should I do if Photon not listed as Unknown device in Device Manager?


#8

@tdphan make sure the device is in DFU mode (blinking yellow) and try other cables just in case the one is not working…


#9

Thanks for this guide! But I had trouble getting it to work and figured out why:

Two typos in Step 3: you have min32-mingw32 twice instead of “win32-mingw32” (including in the text intended for copy and pasting).

Took me a while to figure out what was wrong with my setup and why DFU wasn’t accessible (since it technically wasn’t in the PATH).


#10

thanks! Just updated it now! Great eye :eyes:


#11

My CLI install dies here:
npm ERR! serialport@2.0.5 install: node-pre-gyp install --fallback-to-build
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the serialport@2.0.5 install script ‘node-pre-gyp install --fallback-to-build’.

This is a clean install of Win10. Not much else happening on the machine just yet.

Thoughts?


#12

Could you try npm install -g serialport?


#13

Just tried that and got basically the same result.

So it looks like it’s trying to build something related to the serial port stuff. The install didn’t work, and it failed with a “python not found” error. I installed Python, and made it to a VC++ compiler problem/missing .NET framework (v2 of all things).

MSBUILD : error MSB3428: Could not load the Visual C++ component "VCBuild.exe". To fix this, 1) install the .NET Framew
ork 2.0 SDK, 2) install Microsoft Visual Studio 2005 or 3) add the location of the component to the system path if it is installed elsewhere.  [C:\Users\Mheere\AppData\Roaming\npm\node_modules\serialport\build\binding.sln]
gyp ERR! build error
gyp ERR! stack Error: `C:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exe` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onExit (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\build.js:2

#14

If you’re on Windows, would you be interested in trying this installer? It has worked beautifully for me in the past. Makes the installation painless. It allows you to choose what you want to install from a drop-down. If you select the CLI, you should be good to go.

Alternatively, there’s this more elaborate tutorial on how to install the CLI and its requirements:


#15

Thanks for the info! I will try the installer package, but I’m going to have to build a virtual machine for particle development 1st. There’s just too many out of date moving parts in this setup. No way I’m exposing my day to day machine to all these known bugs and security issues. Guess I’m stuck with the WebIDE and no serial support in the mean time.

Thanks again!


#16

A VM is never bad, although I haven’t had any issues with my setup yet. If you install it manually, you should be able to install newer versions of software.
Depending on what you want to use serial for, you could use another serial terminal. Putty works well on windows.


#17

Yeah, the serial issue is a separate problem. I can’t for the life of me get the photon to show up in device manager. I would probably use the Arduino IDE serial monitor if I could get the Photon to connect. I’m actually getting suspicions of the Photon itself because I have had no success in this department on either the new Windows machine or my Macbook.


#18

Well still no joy. I decided to go ahead and try the installer package on the host machine because I didn’t want to add a VM into the serial port issues.

Anyway, I installed everything in the toolchain package. Ran the firmware make. Rebooted. Tried to manually install the particle-cli (I noticed it failed in the toolchain with the same serial error).

No luck with any of it. I’m blowing this mess away and putting the Photon on the shelf. I’ll get back to it when the toolset comes even remotely close to the Arduino IDE…


#19

@TheMadTexan, I get a similar problem on Win10 which I recently upgraded to. @kennethlimcp, @Moors7, I get this when installing the latest CLI:

C:\Users\Paul\AppData\Roaming\npm\node_modules\serialport>node "C:\Program Files\nodejs\n
ode_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" build --fa
llback-to-build --module=C:\Users\Paul\AppData\Roaming\npm\node_modules\serialport\build\
Release\node-v14-win32-x64\serialport.node --module_name=serialport --module_path=C:\User
s\Paul\AppData\Roaming\npm\node_modules\serialport\build\Release\node-v14-win32-x64
child_process: customFds option is deprecated, use stdio instead.
Building the projects in this solution one at a time. To enable parallel build, please ad
d the "/m" switch.
  serialport.cpp
  serialport_win.cpp
  enumser.cpp
..\src\win\enumser.cpp(443): warning C4996: 'GetVersionExA': was declared deprecated [C:
\Users\Paul\AppData\Roaming\npm\node_modules\serialport\build\serialport.vcxproj]
          C:\Program Files (x86)\Windows Kits\8.1\Include\um\sysinfoapi.h(433) : see dec
  laration of 'GetVersionExA'
  disphelper.c
..\src\win\disphelper.c(1164): warning C4267: '=' : conversion from 'size_t' to 'UINT',
possible loss of data [C:\Users\Paul\AppData\Roaming\npm\node_modules\serialport\build\s
erialport.vcxproj]
     Creating library C:\Users\Paul\AppData\Roaming\npm\node_modules\serialport\build\Re
  lease\serialport.lib and object C:\Users\Paul\AppData\Roaming\npm\node_modules\serialp
  ort\build\Release\serialport.exp
  Generating code
  Finished generating code
  serialport.vcxproj -> C:\Users\Paul\AppData\Roaming\npm\node_modules\serialport\build\
  Release\\serialport.node
  Copying C:\Users\Paul\AppData\Roaming\npm\node_modules\serialport\build\Release\/seria
  lport.node to C:/Users/Paul/AppData/Roaming/npm/node_modules/serialport/build/Release/
  node-v14-win32-x64\serialport.node
          1 file(s) copied.
serialport@2.0.5 C:\Users\Paul\AppData\Roaming\npm\node_modules\serialport
├── bindings@1.2.1
├── sf@0.1.7
├── async@0.9.0
├── nan@2.0.9
├── debug@2.2.0 (ms@0.7.1)
└── optimist@0.6.1 (wordwrap@0.0.3, minimist@0.0.10)

I also noticed that the device driver for the Electron will not load in Win10.


#20


got me going on both win 8 and win 10

Microsoft Windows [Version 10.0.10586]
© 2015 Microsoft Corporation. All rights reserved.

C:\Users\Brian>node -v
v4.1.2

C:\Users\Brian>npm -v
2.14.4

C:\Users\Brian>particle --version
1.8.22

C:\Users\Brian>npm list serialport -g --depth=0
C:\Users\Brian\AppData\Roaming\npm
└── serialport@2.0.2


#21

I really appreciate all the suggestions folks. Great group you have here!

I still have to wonder why in the world this toolset has to be so damned complicated. It’s a command line for heaven’s sake. GCC, Python, Node.JS, Visual Studio, Java + Netbeans, and who knows what else thrown in for good measure? That’s just nuts.

I work for a software company and I can tell you from 1st hand experience that Particle isn’t doing themselves any favors leveraging so many parts. It may help to get some functionality out the door quickly in the short term, but it’s completely unsupportable and it’s a lousy experience for most users.

Anyway I’m sticking with my decision to shelve the Photon. It’s not that complicated to get WiFi working on a stock Arduino and make a few RESTful calls. At this point, the lousy dev environment is more than offsetting any advantage that the hardware has. That’s a shame too because the hardware, and the concept behind it, are beautiful!


#23

Any specific errors you’re seeing when doing any of the above? I’m sure we can help you out if you can give us some more details.


#24

For what it’s worth, I had to try 3 different USB cables before I found one which worked reliably with the Photon. I think that’s more an indication of the state of USB cables than the Photon though.

I tried this setup again this week. Looks like the serial library has been updated and it now installs without fuss using Node.js 4.2.6 I’d like to upgrade to Node 5.5 since it has a lot of security related fixes in it, but I really, really don’t want to break the CLI.


#25

I can’t make guarantees, but the CLI seems to work on 5.5 for me :slight_smile:


#26

Thanks for you response.

After basically cleaning up my machine, removing drivers, etc, I finally got it to work.

I also deleted my post because, well, it wasn’t helping anything.

I don’t have much to add on the process except to say that I think the documentation needs improvement.

Other than that, it is a really cool product. Just wish I didn’t burn a day getting it to work.