Tutorial: Installing DFU-Driver on Windows [24 Feb 2015]


#1

So it seems like some :spark: owners want to go slightly advanced but instructions for installing the DFU-driver is a little vague.

How to put your core in DFU-mode


  1. Press on BOTH buttons
  2. Release only the Reset button
  3. Release the Mode button once the core start blinking yellow
  4. This will be the dfu-mode :smile:

Pre-check!


If you have somehow done this process previously but is unable to use dfu-util successfully, you will need to uninstall the DFU-driver 1st

  1. Put your core in DFU-mode
  2. Open Control Panel
  3. Look for something like libusbk USB devices
  4. Right-click and press ‘uninstall’. Make sure you 'check' the > ‘delete the driver software’


Installing DFU-driver

  1. Place the :spark: core in DFU mode

  2. Run Zadig program
    - Go to http://zadig.akeo.ie/
    - Under ‘downloads’ grab the (windows vista and above or windows xp)

  3. In Zadig, Click on ‘Options’ --> ‘List all devices’

  1. Select ‘CORE DFU’ and ‘libusbK’ for the driver. Press ‘Install Driver’

So far, ‘libusbK’ is proven working with the :spark: core

  1. It will show ‘Driver installed successfully!!!’ (ok not so many ! :))


Using DFU-UTIL to test that driver works


WARNING: Make sure you are using DFU-Util 0.8

https://s3.amazonaws.com/spark-assets/dfu-util-0.8-binaries.tar.xz
MD5 hash: 9a7b0594881c9ba8480bdc9956b5b01a

  1. Launch ‘cmd’ (make sure your path is that where dfu-util.exe is)

  2. Type dfu-util -l

  3. You should see:

Adding DFU-util to Windows path


Follow the instructions here: http://windowsitpro.com/systems-management/how-can-i-add-new-folder-my-system-path

This will allow DFU-util to be executed globally in command prompt.

*If you miss out this step, Spark-cli will be grumpy!


Updated on: 24 Feb 2015

Thanks @peetersm for testing and proving this method works :smiley:


Spark by hand + JTAG help
I2c Code works on a WebIDE build but not a local build
[Solved] Doing deep update
How to install patch in Tiny wifi spark core?
[Resolved] Core stuck in flashing green mode
Help programming cc3000 with dfu util. thanks
Adventures in Troubleshooting: Spark Core edition [Achievement Unlocked!]
Trouble Connecting Core
Spark Core - Local control
Breathing Cyan but could not connect using Tinker and USB [Solved]
Solid Purple LED
Photon compile in the cloud
[Old Spark core] Unable to setup device
Wifi Connected but Photon status is offline [SOLVED]
Why I can't see my Core with DFU-util?
Why I can't see my Core with DFU-util?
Cannot claim Photon - SOLVED
Spark Core worked well but now is solid magenta
Will not complete setup via app [SOLVED]
Serial port times out after setup
[SOLVED]Photon does not create access point
[SOLVED]Photon Hard Fault, Cannot connect via serial in DFU-Mode
Photon setup flashing cyan with a "quick red burst" (now orange burst) [Solved]
[SOLVED] CLI Wont Recognise Photon in DFU Mode
Cannot open DFU device! Electron
Electron using 3rd party SIM blinking green
Electron - Unable to detect any devices in DFU Mode
How to run a newly flashed program?
Particle Electron Device Drivers
Trying to build with the develop branch locally
Why I can't see my Core with DFU-util?
Breathing Magenta
How to see the firmware version and how to update it to most current version
Serial port times out after setup
Help with setting up Photon (stuck in safe-mode)
Can Detect WiFi but Can't Connect to Cloud
Particle and dfu install issues
Reading i2c IR temperature sensor
Dfu-util not recognised for Sparkcore
Unable to connect core to cloud
Photon Troubleshooting Guide (as of Firmware v0.4.6)
AVOID factory reset - What to do with unexpected LED behavior on a Photon
DFU-UTIL Issues
Photon Setup - Particle Android app freezes while displaying "Connecting to Photon"
Hard Fault blinking red sos, can't get into safe mode
Error writing firmware... dfu-util not installed
DFU mode and device not found
Photon flashing cyan with red bursts [SOLVED]
Failure Assertion on Electron What should I do?
Photon can only enter DFU mode with D7 dimly lit, unable to enter other mode
DFU installation failed
Problems connecting cores
New core. Unable to connect. Flashing green
Problem connecting to WiFi
Functioning with wifi and internet drops
Spark Setup not working
Can not connect to Wifi, LED blinks red, cyan and yellow
#2

@Dave,

Not sure if this Tutorial is worthy to be linked at the github readme than the generic Zadig guide :smile:


Solid Magenta after a reboot
#3

This is awesome! Thank you for putting this together.


#4

@kennethlimcp

I have got all the way to using DFU-util. I have downloaded the archive file. What now? I have run the dfu-util.exe but it doesn’t do much. It just flashes a command prompt window up very quickly and then removes it?

Help, Ken

Thank you

Julian


#5

@Julian,

to use the DFU-util, you will need to fire up a command prompt :wink:

using the start button, type “cmd” and hit enter.

I can’t remember if dfu-util is a global application when properly install but it should be.

try:

dfu-util -l

and it should show a list of connected DFU-util devices :wink:

Let me know if it doesn’t work. It’s good for me to test em out and improve the Tutorial if needed.

I would, however, recommend installing Spark-CLI once you are done with DFU-util as it’s super useful and comprehensive!

You can search the tutorials for the installation guide as well


#6

To make it global you will probably need to add to the path. there is no easy “install” its just a zip file.

there is 2 options, one way is to copy the 3 or 4 dfu files to the same folder as the bin file you will be flashing and run it straight from there, or you will need to set up path variables…

This video shows how to set up a local build environment, and there is a small part that covers path variables and where to set them. in the comments of the video on youtube there is a line of paths to add… just add the dfu-util relevent one instead of all of them. and look out for the - that the webpage adds when you copy… its caught a few people out


#7

Hi @Hootie81, Thanks for your message. I spent an hour and a half last night dong the first 7 mins of the video. I am determined to complete it. I have got to the path variables part. could you explain a little more what you mean by [quote=“Hootie81, post:6, topic:3518”]
there is 2 options, one way is to copy the 3 or 4 dfu files to the same folder as the bin file
[/quote]
The same folder as which bin file? and

The DFU relevent one what? Could you give an example?

Many thanks,


#8

Hey @Julian, what’s the problem you are resolving?

I can tell you how to make the dfu-util a global command in cmd for windows if that’s what you are solving


#9

Hi @kennethlimcp, I am trying to install CLI on my machine so that I can try it out. I have been following the great video but got to the bit about path variables and didn’t quite know what to do.

Should I be trying to install CLI on my PC or should I stick to the web based IDE? I understood there were many and various benefits from using the CLI.

I don’t understand why this is quite as hard to do as it seems (maybe I am making hard work of it) in so much as when you run an arduino that is locally compiled from the arduino software. Is there some reason that spark core can not put together a similar package? Or is the spark core CLI different to the arduino IDE and I am getting them mixed up and maybe I can not see the benefit of the CLI. BTW is there a video of the CLI in action?
These are probably silly questions and I am no doubt exposing my ignorance but hey, what the heck! :smile:


#10

If you are installing CLI, you can follow my tutorial above and use the :spark: cloud to compile your code folder and return a .bin file.

It’s not thay complicated. If you need, I can guide you offline :wink:

That video is not about the CLI. It is setting up GCC (I think) to compile code locally.

We make use of CLI to send the code we write locally and compile in the :cloud:


#11

Sorry for the delay in replying, been traveling home :slight_smile:

The Spark is alot more complicated than the arduino… they have lots and lots of code to make everything easy for us, as they need to interface a couple of very complicated chips the STM32 and the CC3000. The web IDE does a really good job at hiding all that from us, much like the arduino program does for the arduino.

When you type your code in the Web IDE, spark build it compiles it into a ‘bin’ file. then it connects through the web to your core and says “hey i have a new ‘bin’ file for you, here it is” and sends it wirelessly which is about as easy as it gets.

The CLI has advantages too… is quick and simple, with just a few words you can re-flash your core. When you use the CLI its also sending a bin file to the spark core, thats a binary file and just lots and lots of 1’s and 0’s. some of the bin files are known by the CLI… like tinker, so you can just put

spark flash 0123456789ABCDEFGHI tinker

and it will know what bin file to flash to your spark core, still wirelessly too. or you could put --usb at the end and do it through USB, which as I’m sure you know dfu-util comes in to it all.

If you create a folder on your PC… c:\spark and copy the dfu-util files into it (4 of them in the win32 folder of the zip file, if you run windows) then you can copy your bin file into there and run the CLI from that folder. The bin file you can get from the Web IDE look for the cloud next to your ‘current app’ or you can specify a folder on your computer to compile using

 spark compile my_project_folder --saveTo firmware.bin

this will give you the bin file to flash (called firmware.bin) This is where the CLI is best, its easier to compile a folder of files this way instead of adding each one individually to the web IDE.

personally I’m really liking netbeans, once its set up and you know how to add libraries its easy and alot quicker flashing through USB. it has some good tracing things too… when you right click you can select ‘go to declaration’ and see what the function is expecting to receive. and it also highlights bad code as you write it… its kind of compiling and highlighting errors as you go so to speak. plus its all done offline, which is great because where i work the internet sucks and i cant make the online build work!

to make using the dfu-util easier you can add “path variables” that means you can use the CLI from any folder on your computer without needing to have the dfu files in that particular folder. for example if you have 3 or 4 projects in 3 or 4 different folders you would probably need to add the dfu files to each folder…

What OS are you running? we can guide you through it step by step


#12

I got to the point FW is loaded. But at the end, this show “error” messages. Is this normal ??

File downloaded successfully
Transitioning to dfuMANIFEST state
Error during download get_status
Flashed!


#13

That’s a known issue with DFU but it doesn’t affect anything so simply ignore the error :slight_smile:


#14

Yep that’s totally normal :slight_smile:

its possible to add some data to the bin file to get rid of the error, but its not really worth the hassle


#15

Just in case you are interested, this dfu command will add the bits to the firmware.bin file to get rid of the error. it adds some info about the dfu device, the vendor (1d50) and product (607f). this can be used to stop the wrong device being flashed if you have multiple dfu devices.

dfu-suffix -v 1d50 -p 607f -a firmware.bin

#16

I get this:

Copyright 2005-2008 Weston Schmidt, Harald Welte and OpenMoko Inc.
Copyright 2010-2012 Tormod Volden and Stefan Schmidt
This program is Free Software and has ABSOLUTELY NO WARRANTY
Please report bugs to dfu-util@lists.gnumonks.org

Filter on vendor = 0x1d50 product = 0x607f
Opening DFU capable USB device… ID 1d50:607f
Run-time device DFU version 011a
Found DFU: [1d50:607f] devnum=0, cfg=1, intf=0, alt=0, name="@Internal Flash /0x08000000/20001Ka,108001Kg"
Claiming USB DFU Interface…
Setting Alternate Setting #0
Determining device status: state = dfuERROR, status = 10
dfuERROR, clearing status
error clear_status
Error writing firmware…


#17

What are you attempting to do? Seems to ve working correctly but need to know more information of what you are doing to help you further.


Core blinking white and not booting up
#18

I am trying to run the command:
spark flash --usb cc3000


#19
  1. Is the core in DFU mode? (Yellowing flashing)

2.) What does dfu-util -l say?

3.) Did the firmware download when you sent the command?


#20

Ken,
I had the yellow blinking issue today. It suddenly happened for 2 of my 3 cores! Your tutorial helped me a lot though it took over 3 hours to sift through information in many pages.

Please add a line or two on installing dfu-util ( I did not use the hash for xp). Also my dfu-util -l did not print exactly the same print as yours which scared me a bit.
Also add the same info to this page: https://github.com/spark/spark-cli

Thanks.