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

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:

11 Likes

@Dave,

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

1 Like

This is awesome! Thank you for putting this together.

@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

@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

1 Like

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

1 Like

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,

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

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:

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:

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

1 Like

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!

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

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

1 Like

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
3 Likes

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ā€¦

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.

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

  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?

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.