AVR Studio 6 Command Line Programming

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

I recently started using AVR Studio 6 to maintain a legacy project. I like to use the command line tools to program boards since it is much quicker and easier to automate than using the GUI. Having to upgrade the firmware on my JTAGICE mkII (and maybe Win 7 x64?) has broken the jtagiceii.exe application I used to use from the AS 4 days.

I'm putting together a script for using atprogram.exe that comes with AVR Studio 6 but the documentation on it seems lacking. I know what the appropriate command line to use is in order to program fuse bytes, but the question is what order are they supposed to be specified in? Is it 0xEEHHLL (E=extended, H=high, L=low), 0xHHLLEE, 0xLLEEHH, or something else? Looking around Google and the forums here didn't seem to turn anything up on this matter.

I'm using the ATmega644PA if it matters; the datasheet seems to suggest the last option (LLEEHH) but I'd like confirmation from someone because it appears I've already bricked one processor by taking a guess at it. (By bricked I mean, I can't talk to the AVR via JTAG OR ISP and also get strange serial output.)

Any advice is appreciated!

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

Well, if you are thinking of using the ATPROGRAM WRITE command, then doing ATPROGRAM READ on a device with known fuse settings should reveal something. I am assuming that thr Wise Atmel Programmers are outputting the fuses gotten with READ in the same order as they expect them when using WRITE.

Then you can do the right write, right? :D

Another option might be to ditch ATPROGRAM and use AVRDUDE.

As of January 15, 2018, Site fix-up work has begun! Now do your part and report any bugs or deficiencies here

No guarantees, but if we don't report problems they won't get much of  a chance to be fixed! Details/discussions at link given just above.

 

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington] "Words represent concepts. Use the wrong words, communicate the wrong concept." [J Morin] "Persistence only goes so far if you set yourself up for failure." [Kartman]

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

An excellent suggestion, Johan. I'll give that a shot when I get my hands on a new, functional board.

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

It should be lowest fuse address to highest. Note that in the XMEGA's case, FUSEBYTE3 is not used in the chip for some reason, but the value still needs to be included (and set to 00) in the command to atprogram.

- Dean :twisted:

Make Atmel Studio better with my free extensions. Open source and feedback welcome!

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

Also, if you give the exact command you used I can replicate it here and see if there's a way to restore the chip without having to resort to voodoo.

- Dean :twisted:

Make Atmel Studio better with my free extensions. Open source and feedback welcome!

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

Hi, can anyone maybe post an example of how to read or write the fuse bits on an xmega chip. The atprogram -? does not show anything on the fuse bits. Or can it only program the fuse bits using a normal program command and the .elf file?
Is there maybe a better documentation on the atprogram.exe that what is in the -? part.

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

Quote:

The atprogram -? does not show anything on the fuse bits.

Yes it's help is truly hopeless. Try instead:

atprogram help write

(it has two levels of help and how you access one is not entirely clear from the other).

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

Tried for Xmeag128A1

atprogram -t avrdragon -i jtag -d atxmega128a1 read -fs

SUT = 0MS
atprogram -t avrdragon -i jtag -d atxmega128a1 write -fs --values ff71fe00fefa
SUT = 4MS
atprogram -t avrdragon -i jtag -d atxmega128a1 write -fs --values ff71fe00f6fa
SUT = 64MS
atprogram -t avrdragon -i jtag -d atxmega128a1 write -fs --values ff71fe00f2fa
to set BOOTRST
atprogram -t avrdragon -i jtag -d atxmega128a1 write -fs --values ff71be00f2fa

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

atprogram -t avrdragon -i jtag -d atmega2560 read -fs

to program CKDIV8
atprogram -t avrdragon -i jtag -d atmega2560 write -fs --values 6299ff

to unprogram CKDIV8
atprogram -t avrdragon -i jtag -d atmega2560 write -fs --values E299ff

fuses are read and written in the order
for Mega
LOW - HIGH - EXTENDED
for Xmega
FB0 - FB1 - FB2 - FB3 - FB4 - FB5

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

this information is very useful for beginners like me but
i have doubt in offset option because i want to program dfu, usb-msc bootloader and my apps. how should i set offset option.
i am using studio6 with at32uc3a0512 and avrdragon.

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

You should not have to worry about an offset when using a tool such as atprogram as the .hex file you are programming wil already have been built with an offset to the bootloader area at the link stage.

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

clawson wrote:
You should not have to worry about an offset when using a tool such as atprogram as the .hex file you are programming wil already have been built with an offset to the bootloader area at the link stage.

i am trying DFU-USB MSC bootloader in atmel stduio6 for AT32uc3A0512. When cmd line programming .hex file flashed and user configuration word written but fuse bytes didn't written(Error message came as: Region to be programmed lies outside flash address space. (Error code: 1)). I have attached .cmd script file, if any mistake inside the file, guide me to clear error and make it possible to work bootloader.

Attachment(s): 

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

parthi2 wrote:
clawson wrote:
You should not have to worry about an offset when using a tool such as atprogram as the .hex file you are programming wil already have been built with an offset to the bootloader area at the link stage.

i am trying DFU-USB MSC bootloader in atmel stduio6 for AT32uc3A0512. When cmd line programming .hex file flashed and user configuration word written but fuse bytes didn't written(Error message came as: Region to be programmed lies outside flash address space. (Error code: 1)). I have attached .cmd script file, if any mistake inside the file, guide me to clear error and make it possible to work bootloader.

i cleared that error by directly giving address of FGPFRLO due to this dfu-Msc bootloader with example is successfully flashed into the controller,but when i upgrade new application using avr32fwupgrade.uc3 file the new apps didn't upgraded. Then i tried bootloader through avr32program command it works good and it upgrades the new apps. So anyone kindly tell bugs...

Attachment(s):