Command line programmer for XMEGA

Go To Last Post
30 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi,

I am searching for a command line tool which can program an ATXMEGA128A1. I would prefer to use the AvrISPmkII programmer.

For 'simple' ATMegas I used to take the STK500.exe from the AVR-Studio. But even in V4.16 it doesn't support any XMEGA. :cry:

AVRDude seems to be a bit better. But how can I program all of the five fuse bits? The command line interface only supports the low, high and extended fuse bytes.

Does anyone here has already some experiences?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:
AVRDude seems to be a bit better. But how can I program all of the five fuse bits? The command line interface only supports the low, high and extended fuse bytes.
Are you sure? Some time ago I hacked some avrdude code, and I seem to remember that there were provisions in the source code to support more than three fuse bytes for the Xmegas. Looking into /etc/avrdude.conf I also see that there are six fuse definitions for the ATXMEGA128A1.

Stealing Proteus doesn't make you an engineer.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Yes, you are right.

But a test results in the following error message:

avrdude.exe: stk500v2_program_enable(): program enable instruction not defined for part "ATXMEGA128A1"

Any ideas what's going wrong?

Edit: I guess it is because the AVRISPmkII does not know that it should use PDI instead of ISP. Am I right? Is there no PDI support by AVRDude?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I have re-tested this with a new AVRDUDE (avrdude.exe: Version 5.6, compiled on Mar 5 2009 at 09:59:30) which came with the new WinAVR-20090313. But I still have no success.

My suspicion is that the XMEGA-support by AVRDUDE is restricted to STK600. Can anyone confirm this?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:

Can anyone confirm this?

You should be able to - the entire program is open source.

(but it may be quicker to email Joerg!)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

How did you tell avrdude to use USB port on Windows ?
I have AvrISPmkII also and I failed.
I tried "-P usb:1", "-P usb", "-P usb:xx", etc with no success

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

denden wrote:
How did you tell avrdude to use USB port on Windows ?
On my desk '-P usb' works to address the AVRISPmkII.

Byt the way: I didn't get an answer by Joerg. But the new AVR Studio 4.16 SP1 can help me out. Quote from the release notes:

Quote:
New Features
AVR ISP mkII command line SW support for XMEGA device family
I will test this soon...

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi, sorry for digging out this thread. But what software does atmel mean with

Quote:
New Features
AVR ISP mkII command line SW support for XMEGA device family

STK500.exe (which actually is the programmer for the AVR ISP mkII) doesnt support ATxmegas.
and STK600.exe doesnt work with AVR ISP mkII.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Back from vacation I encounter the same problem.

As a workaround I used the JTagMKII (jtagiceii.exe) to program the XMEGA (128A1) by command line interface.

But I still haven't found a corresponding command line tool for the AVRISPmkII. Although the (old) AVR Studio 4.16 SP1 announced this in its feature list.

Does anyone have a command line programmer which supports XMEGA PDI programming with AVRISPmkII?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I even mailed atmel because of that, but somehow they don't understand what I want. Furthermore I don't even understand what they want ;)

Quote:
AVRISP mkII support Xmega with PDI interface. And now command line tools only support ISP programming, not PDI programming. Hope this can clarify this issue.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Funny answer by Atmel... :-(

What about avrdude?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Avrdude doesn't support PDI as far as I know. JTAG Programming of xmega devices should work.

I again mailed to atmel and found out, that you need STK500.exe v2.3 but in the current AVR Studio 4.17 package there is no STK500.exe in version 2.3 but in version 2.2.1.
Can you confirm that? (Just right click STK500.exe and select "Version" and then "File Version".

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

It works!

STK500.exe v2.3 is shipped with AVR Studio 4.17. But right-clicking on stk500.exe does not give the correct version number. Just enter 'stk500.exe' without any parameters in the console (cmd.exe) and then you will see:

Quote:
STK500 command line programmer, v 2.3 Atmel Corp (C) 2004-2009

Try this:

Quote:
stk500.exe -cUSB -dATxmega128A1 -md -e -ifYourHexFile.hex -pf -vf

This works! The funny thing is that 'ATxmega128A1' ist not in the device list (which you get by typing 'stk500.exe -?'). But nevertheless '-dATxmega128A1' works! :D

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Wouh! Thanks for trying :-) Good news.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Just found this thread.
Tells me exactly what I need to know.
Does anyone know how to set the fuses using this method.

Thanks.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0
C:\Program Files\Atmel\AVR Tools\STK500>stk500 -h
STK500 command line programmer, v 2.2 Atmel Corp (C) 2004-2005.

Command Line Switches:
    [-d device name] [-m s|p] [-if infile] [-ie infile] [-of outfile]
    [-oe outfile] [-s] [-O address] [-Sf addr] [-Seaddr] [-e] [-p f|e|b]
    [-r f|e|b] [-v f|e|b] [-l value] [-L value] [-y] [-f value] [-E value]
    [-F value] [-G value] [-q] [-Y] [-Z address] [-c port] [-ut value]
    [-Wt value] [-ua value] [-wt] [-wa] [-b h|s] [-! freq] [-t] [-I freq]
    [-J] [-h] [-?]

Examples:
    STK500.EXE -dATmega128 -e -ifFlash.hex -pf -vf
    STK500.EXE -dATmega128 -fF73A -FF73A -EFF -GFF

    Note that there are no spaces between switches and their parameters
    and that hexadecimal values do not have a '0x' prefix.

Parameters:
d   Device name. For a list of supported devices use STK500.EXE -?
m   Select programming mode; serial (s) or parallel/high-voltage (p).
    Serial mode is the default mode if this parameter is ommitted.
if  Name of FLASH input file. Required for programming or verification
    of the FLASH memory. The file format is Intel Extended HEX.
ie  Name of EEPROM input file. Required for programming or verification
    of the EEPROM memory. The file format is Intel Extended HEX.
of  Name of flash output file. Required for readout of the FLASH memory.
    The file format is Intel Extended HEX.
oe  Name of EEPROM output file. Required for readout of the EEPROM
    memory. The file format is Intel Extended HEX.
s   Read signature bytes.
O   Read oscillator callibration byte. 'address' is the address of the
    calibration byte as decribed in the data sheet of the device.
Sf  Write oscillator call. byte to FLASH memory. 'addr' is byte address
Se  Write oscillator call. byte to EEPROM memory. 'addr' is byte address
e   Erase device. If applied with another programming parameter, the
    device will be erased before any other programming takes place.
p   Program device; FLASH (f), EEPROM (e) or both (b). Corresponding
    input files are required.
r   Read out device; FLASH (f), EEPROM (e) or both (b). Corresponding
    output files are required
v   Verify device; FLASH (f), EEPROM (e) or both (b). Can be used with
    -p or stand alone. Corresponding input files are required.
l   Set lock byte. 'value' is an 8-bit hex. value.
L   Verify lock byte. 'value' is an 8-bit hex. value to verify against.
y   Read back lock byte.
f   Set fuse bytes. 'value' is a 16-bit hex. value describing the
    settings for the upper and lower fuse.
E   Set extended fuse byte. 'value' is an 8-bit hex. value describing the
    extend fuse settings.
F   Verify fuse bytes. 'value' is a 16-bit hex. value to verify against.
G   Verify extended fuse byte. 'value' is an 8-bit hex. value describing
    the extend fuse settings.
q   Read back fuse bytes.
af  FLASH address range. Specifies the address range of operations. The
    default is the entire FLASH. Addresses are byte oriented.
ae  EEPROM address range. Specifies the address range of operations.
    The default is the entire EEPROM. Byte addresses.
Y   Perform the oscillator calibration sequence. See appnote AVR053 for more
    information.
Z   Loads a value from an EEPROM location prior to chip erase which then
    can be programmed into FLASH or EEPROM using the S option. Address is
    a decimal value. See appnote AVR053 for more information.
c   Select communication port; 'COM1' to 'COM8' for STK500 or AVRISP, 'USB'
    or 'USB:' for AVRISP mkII. If this parameter is ommitted the
    program will scan the COM ports for STK500/AVRISP only.
ut  Set target voltage VTARGET in Volts. 'value' is a floating point
    value between 0.0 and 6.0, describing the new voltage.
ua  Set adjustable voltage AREF in Volts. 'value' is a floating point
    value between 0.0 and 6.0, describing the new voltage.
wt  Get current target voltage VTARGET.
wa  Get current adjustable voltage AREF.
Wt  Verify that VTARGET is within 5% of the given value. 'value' is a
    floating point value between 0.0 and 6.0.
b   Get revisions; hardware revision (h) and software revision (s).
!   Set oscillator frequency; 'freq' can be whole Hz, or kHz or MHz
t   Get oscillator frequency.
I   Set ISP frequency; 'freq' can be whole Hz, or kHz or MHz
J   Get ISP frequency.
g   Silent operation.
z   Not used. Supported for backwards compability.
h   Help information (overrides all other settings)

Supported devices:
    To display supported devices type "STK500.EXE -?"

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thank you.
In the example I'm doing there are 5 fuses:
Fuse0 0xFF
Fuse1 0x00
Fuse2 0x7a
Fuse4 0xF2
Fuse5 0xF2

How would I do this?

Thanks

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

A very good question! Until recently the AVR only had a maximum of three fuse bytes (low, high and extended) and in the output above you have:

C:\Program Files\Atmel\AVR Tools\STK500>Stk500.exe -h | grep -i fuse
f   Set fuse bytes. 'value' is a 16-bit hex. value describing the
    settings for the upper and lower fuse.
E   Set extended fuse byte. 'value' is an 8-bit hex. value describing the
    extend fuse settings.
F   Verify fuse bytes. 'value' is a 16-bit hex. value to verify against.
G   Verify extended fuse byte. 'value' is an 8-bit hex. value describing
    the extend fuse settings.
q   Read back fuse bytes.

No mention in that of how FIVE fuse bytes might be handled.

Note, however, that my installed copy is 2.2, not 2.3 so maybe the new version has added more command lie options to cope?

Cliff

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thanks.
I was using AVdude. This copes with five fuses no problems but I was having other problems.
I switched to AVRStudio and now it seems I can't program the fuses using Command lines.

PS Great little place Finchingfield.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:

PS Great little place Finchingfield

It is until the coach loads of tourists turn up and prevent you getting parked! ;-)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Discoved what to do.
For fuses 4 and 5 you use -XE

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Here is the exact output of the above mentioned command with STK500 v2.3

C:\Program Files\Atmel\AVR Tools\STK500>stk500 -h | grep -i fuse
f   Set fuse bytes. 'value' is a 16-bit hex. value describing the
    settings for the upper and lower fuse.
E   Set extended fuse byte. 'value' is an 8-bit hex. value describing the
    extend fuse settings.
XE  Set xmega fuse bytes 4 and 5. 'value' is a 16-bit hex. value describing the
    settings for last 2 xmega fuses.
XV  Verify xmega fuse bytes 4 and 5. 'value' is a 16-bit hex value to verify
F   Verify fuse bytes. 'value' is a 16-bit hex. value to verify against.
G   Verify extended fuse byte. 'value' is an 8-bit hex. value describing
    the extend fuse settings.
q   Read back fuse bytes.

C:\Program Files\Atmel\AVR Tools\STK500>stk500
STK500 command line programmer, v 2.3 Atmel Corp (C) 2004-2009.

Use -h for help.

C:\Program Files\Atmel\AVR Tools\STK500>
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

SPAM removed

While there is life, there is hope.
www.stkshop.net
MSN:leestone@live.cn
Yahoo Messenger:leestone@live.cn
ICQ:567343184

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

ce wrote:
STK500.exe v2.3 is shipped with AVR Studio 4.17.
The STK500.exe that I found on a 4.17/666 installation is still v2.2. The same version is installed with v4.18/692.

Any tips on where I get v2.3? I need it to be able to program xmega chips using an AVRISP2 via the command line.

Don Kinzer
ZBasic Microcontrollers
http://www.zbasic.net

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Perhaps here, under "Command-Line Tools"?
http://www.atmel.no/beta_ware/

(haven't gone through the download to see what is there)

Or here:
https://www.avrfreaks.net/index.p...

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thanks, but no joy. The one in the Command-Line Tools is v2.2 and the other one is v1.2.

Don Kinzer
ZBasic Microcontrollers
http://www.zbasic.net

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:

the other one is v1.2.

LOL--sorry about that. The 'Freaks page has a very recent date and that threw me off.

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Has anyone found v2.3?

I need to set fuse bits and program my XMega128A1 with my AVRISPMKII via the command line.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

aamicron wrote:
Has anyone found v2.3
Yes. I should have posted this solution earlier. Sorry.

Firstly, I completely removed AVR Studio (using Add/Remove Software). Then, I checked the "Program Files/Atmel/AVR Tools/STK500" directory and found that there was still a STK500.exe in that directory so I deleted everyting in that directory manually. Next, I installed v4.18 and SP1. After this, I found that the STK500.EXE version was v2.3.

Don Kinzer
ZBasic Microcontrollers
http://www.zbasic.net

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

That worked. Thanks!