Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Using this guide allows a Windows 8.1 machine, using a jtagice3 programmer, to flash the Zigduino platform with the OpenWSN Zigduino port firmware. No guarantees are made for other software or hardware although this will likely be similar.

AVR-GCC and AVRDUDE for Windows 

There are no official easy-to-use recent avr-gcc versions available. The easiest way to do work with AVR for Windows is using Atmel Studio, but which forces using their a big software solution, or using the outdated WinAVR tools, which is incompatible with more recent JTAG devices such as jtagice3.  In addition, most online resources are (partly) outdated, though still useful (See also: http://m8051.blogspot.be/2015/01/avrdude-on-windows-long-time-after.html ). This guide describes how to easily get a more recent version of AVRDUDE working with Windows. Alternatively, you can always compile the most recent version of AVRDUDE yourself (from http://www.nongnu.org/avrdude/ ) but this is a fairly painful process on an unconfigured Windows computer.

 

There is a recent avr-gcc version compiled for Windows which can be found here: http://andybrown.me.uk/downloads/ .

...

Code Block
> avrdude -v
avrdude: Version 6.1-svn-20131205, compiled on Dec 5 2013 at 17:34:22
Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
Copyright (c) 2007-2009 Joerg Wunsch
System wide configuration file is "C:\avr-gcc\bin\avrdude.conf"

JTAGICE3 with Windows

 

Unfortunately, AVRDUDE relies on the JTAGICE3 programmer to be connected to a Linux USB port such as LibUSB (source). In addition, depending on the firmware of the JTAGICE3 the USB descriptors might be totally different (source and source).

...

To fix this, download Zadig and run it. Select your JTAGICE3 from the list of devices and install the libusbK driver. 

Normally, now you should be now be able to use avrdude to flash your firmware using a JTAGICE3.

 

Tying it together – integrating it all and flashing the Zigduino firmware

...

Note that Sconscript needs a 'jtag=' command to work with a jtag programmer.  The variable included does not actually matter; the jtag port itself is automatically detected and will simply flash the board it is connected to. 

Adjusting fuses

If you need to adjust the fuses, simply go to the following code in Sconscript:

 

Code Block
firstline414
#============================ upload over JTAG ================================
def jtagUploadFunc(location):
if env['toolchain']=='armgcc':
if env['board'] in ['iot-lab_M3','iot-lab_A8-M3']:
return Builder(
action = os.path.join('bsp','boards',env['board'],'tools','flash.sh') + " $SOURCE",
suffix = '.phonyupload',
src_suffix = '.ihex',
)
# LOW: Transceiver osc as CLK (16Mhz when prescaler 0x0), maximum start-up delay
# HIGH: JTAG/OCD off, SPI on, WatchDog override off (can be enabled at runtime), Bootsize 512b,
# start bootsector at 0xfe00 (word address!), save EEPROM on reflash, start at addr 0000
# EXT: BrownOut at 1.9V
# Last fuse fd -> f5 due to immutable bits, otherwise avrdude gives a verification error
elif env['toolchain']=='avr':
return Builder(
action = 'avrdude -c jtag3isp -p m128rfa1 -B 1 -U flash:w:$SOURCE',
#+ ' -U lfuse:w:0xf7:m -U hfuse:w:0xd7:m -U efuse:w:0xf5:m', #if you need to do fuses
suffix = '.phonyupload',
src_suffix = '.ihex',

 

 

and uncomment the following line:

#+ ' -U lfuse:w:0xf7:m -U hfuse:w:0xd7:m -U efuse:w:0xf5:m', #if you need to do fuses

 

Remember that you only need to set the fuses once. Once changed, you can recomment the line again.


Alternative ports

If you have another board and want to use the same toolchain and programmer, you only need the Sconstruct and Sconscript files with some small additions.

...