How to update the official Arduino Wifi Shield

02 Nov

How to update the official Arduino Wifi Shield

I spent most of yesterday eve at Bitraf trying to make the official Arduino Wifi Shield behave properly as there is a bug in the firmware that it comes with. One of the Bitraf members has a cool project that involves remote control of servos. He planned to use the Wifi Shield, but it kept loosing it's connection at random intervals - no pattern to it.

As I have the same shield, I tried to figure out how to download and install the new firmware from GitHub. I couldn't find any good description on how to do it, so here's how I did it on OSX. It'll be quite similar on Windows and Linux.

1st Download the files from GitHub

Go to https://github.com/arduino/wifishield and either download the ZIP, or use GIT if you're familiar with that. If you're using git, open terminal and navigate to the folder you want the repository in. Here's how I did it:

mkdir wifishield
cd wifishield/
git init
git remote add wifishield https://github.com/arduino/wifishield.git
git pull wifishield
git checkout master

The installer expects the files to be inside the Arduino-app folder. Copy wifiHD.hex, wifiHD.elf and the other files from the wifishield/firmware/binary folder into /Applications/Arduino.app/Contents/Resources/Java/hardware/arduino/firmwares/wifi-shield/ (or where you have your Arduino app).

 

2nd Grab the Device Firmware Updater

Next is getting the software we'll be using since AVRDUDE does not work with the 32UC3-chip in the wifi-shield. Check out this page http://arduino.cc/en/Hacking/DFUProgramming8U2 for details on installing this on your specific platform. For OSX, it should have been easy like this:

sudo port install dfu-programmer

However, instead we got this:

Error: The installed version of Xcode (2.0orlower) is too old to use on the installed OS version. Version 4.1 or later is recommended on Mac OS X 10.8. So off we went to Apple to get the new version.

Apparently Apple thinks that minutes after releasing XCode 4.6 was a great time for maintenance. Yay... Some hours later, the download commenced and we got it installed. Next we had to install the XCode command line tools we were finally ready to go...

3rd Set the jumper

Plug the USB Mini cable into the shield. You should not upgrade the shield while it's mounted on an Arduino.

To program the shield, you'll need to enable a jumper. This puts the chip in DFU-mode that enables reprogramming it. There is no "J3" marking (mentioned in documentation) on the shield, but there is also only one jumper there so you can't go wrong. Just place it across the two pins and you're ready to go. If you fail to set this jumper, you'll see an error "dfu-programmer: no device present" since there is no programable device connected.

 

4th Upload!

You'll use a script from the GitHub download to do the actual uploading: https://github.com/arduino/wifishield/blob/master/firmware/scripts/ArduinoWifiShield_upgrade_mac.sh Move to the correct folder and then run the script as below:

cd /Fra PC/arduino/wifishield/firmware/scripts/ArduinoWifiShield_upgrade.sh
sudo sh ArduinoWifiShield_upgrade_mac.sh -a /Applications/Arduino.app/Contents/Resources/Java/ -f shield

Explanation: "sudo" means run as the computers registered superuser to avoid any permission-related problems. Your Mac will ask for your admin password when you run this. "sh" is short for "shell" and means that the following file-name should be executed as a script. "-a" and what comes after sets the path to the Arduino app and finally -> "-f" tells if you want to upgrade the shield-software or the main CPU it runs on. Unless something goes wrong, you'll see a message saying that says "Validating" and that it's no less than 101.44% finished grin

 

5th Remove the jumper

Once the upgrade goes through, remove the jumper and set it on just a single pin. That's it. Not hard once you know how to do it and have all the required software installed. It's however a far cry from the simplicity we're used to with Arduino. Maybe they'll find a smoother way to solve this? Also something VERY interesting we discovered that isn't documented - if you have connection problems with this shield, make sure you don't use/set PIN 9! It's not documented as being in use, but something definitely goes on with this pin. The PIN also has it's own LED (marked L9) on the shield and it flickers weakly during use of the shield so something undocumented is going on there.

I have to say that while it's fantastic to have an officially supported Wifi shield, I don't really appreciate that it takes up the PWM pins 10, 11 and apparently 9 as well. I'd much prefer I2C or a more configurable solution like for instance the Adafruit Wave Shield offers. Marking what pins are used directly on the PCB is also a great help for users.

We also figured that the Atmega 32UC3 chips are not too expensive, but the WiFi chip on this shield is $20 even in fairly big quantities. While this makes the shield quite expensive, it's probably worth it's steep EUR 69 price. Keep in mind though - with an Arduino UNO, the total setup is 89 EUR ($115). A Raspberry PI and a wifi dongle is much cheaper. In fact - you can even get Adafruit's complete PI-kit for only $105! Have a look at the picture above comparing both solutions and you'll see that they're both small in size, so depending on your need - maybe it's not an Arduino you need?


Here's some useful links I found while researching this:
http://mitchtech.net/arduino-usb-hid-keyboard/ (good info on the DFU programmer)
http://arduino.cc/en/Hacking/DFUProgramming8U2 (Official page on installing DFU for other platforms)

UPDATE: here's a link to Massimo's writeup

 

6 Responses to How to update the official Arduino Wifi Shield

  1. Massimo Banzi 03 November 2012 at 12:26 pm #

    Thanks for the tutorial
    We did write one but I just found out it was never published. Apologies for that, we’ll publish it monday.

    A few clarifications are needed:
    * unfortunately , on Arduino Uno and similar boards, the SPI bus used by the shield is shared with the PWM pins. It’s a design issue with the processor. on other boards this is not an issue because the SPI connection is taken from the ICSP connector and not directly from 12,11,10,9 (like on very old eth shields)
    I2C wouldn have limited the speed of communication a bit too much.

    L9 is there for “historical reasons”  but it’s not used. we’ll update that in the future.

    On the issue of price… this comparison with the RPi is not correct for a number of reasons:

    1. Arduino and RPi are two different projects with different aims and different structures (they are a foundation and Arduino supports itself by royalties on hardware sales)
    2. Arduino provides a full platform with HW, SW, API, Libraries, Documentation (even if sometimes bugs show up)and tutorials directed at an audience of non experts. RPi is at the moment still for experts… and only makes hw.
    3. Arduino uses manufacturers located in Europe and the USA. It’s clearly more expensive but we hope that people will appreciate that we haven’t shipped all jobs to China.. The RPi is bringing production back to the UK, I applaud them for that, i’m sure it’s going to impact price at some point.
    3. Arduino pays parts at market prices (i.e. ATMEL doesn’t provide us with any “strategic” pricing) so our boards are more expensive than boards that are subsidised by silicon vendors. I have no information on RPi to make a comparison on this aspect.
    4. Arduino works with distributors connected with the local communities spread across the world. The pricing contains a fair share for these companies that are made by makers to service local makers. I have no information on RPi to make a comparison on this aspect.
    5. Arduino is fully open source and this has also its downsides as we automatically create a lot of competitors for us the day after we release a product. We are happy to provide the community with a lot of work and opportunities so that we can all grow together.


    Our objective is to help people learn about microcontrolers so that they can make amazing projects. Sometimes we have to sacrifice price to other things we think are important (providing the full end to end experience, keep some manufacturing closer to home and the rest)

    We think RPi is an amazing project and we believe it will have an impact on society but they are working on something different than us.

    When making comparisons please compare oranges with oranges smile

  2. Jens Brynildsen 03 November 2012 at 3:45 pm #

    Thanks for clarifying Massimo, much appreciated!

    I fully agree that this is two very different projects and as you explained so well - on many levels. There will however still be some overlap (especially when using the Adafruit distro + cobbler) so I just wanted to point out that the PI could be a good solution for some kinds of projects.

    But regarding #3 - seriously? Doesn’t Atmel see the value of a whole generation of geeks growing up with their hardware? Crazy…

    J

  3. Eric Weddington 05 November 2012 at 6:26 am #

    Regarding #3 above, yes we DO see the value! Atmel has been sponsoring the Arduino areas at Maker Faires in New York and Bay Area, and more importantly, we’re working with Massimo on a number of things, including pricing…

    Massimo is absolutely correct about comparing Arduino and the RPi board correctly. Arduino enables a much bigger community of users, because of the software that it provides, that helps non-engineers to create projects with embedded systems. The RPi still requires users to be knowledgeable in Linux, which can be a barrier to entry to non-engineers.

    Eric Weddington
    Marketing Manager
    Open Source & Community
    Atmel
    Creator of WinAVR

  4. Chris Misztur 08 November 2012 at 11:30 pm #

    Thanks for the write up.  Very concise!

    Odd thing: I ran the shell script with the J3 connected and I got the ‘no device present’ message.  Then I unconnected J3 and tried again.  It seemed to work fine.  Now I connected the J3 and tried the shell script and it worked…. 

    Is there a way to verify the firmware version on the shield?

    -chris

  5. Steve Wright 09 November 2012 at 1:29 pm #

    Hi,
    Did this make the shield reliable?
    I’ve used this shield on a Uno board and I also have a Diamondback board and neither have been reliable. I got both to work using v1.0.1 with the changes from http://www.sundh.com/blog/2012/02/make-wishield-work-in-latest-arduino-ide/
    Running the webserver it would just fail to connect at random intervals on both boards.
    Thanks
    Steve

  6. Jensa 12 November 2012 at 1:37 pm #

    @Steve Yes it did. Very reliable now.

    @chris The script will first upload and then verify the upload, so you’ll get good feedback as to how it went (if all goes well)

    @Eric Great to hear. I’d guess that Atmel has caused serious dents in the PIC-market thanks to Arduino? smile

    Regarding the PI vs Arduino. It’s certainly a different device. I don’t disagree with that at all, but the price makes it an interesting alternative for those capable to use the more advanced features of it. I still think it’s a very valid comparison. At my office, we use it as a webserver for controlling various hardware and it’s rock stable like Linux should be.

    BTW: Cooking hacks has a cool shield that let you combine Arduino shields with the PI: http://www.cooking-hacks.com/index.php/documentation/tutorials/raspberry-pi-to-arduino-shields-connection-bridge

    J

  7.