Atprogram with atmel ICE

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

Hello sorry if this is in the wrong place but i have exhausted myself trying to figure this out.

I have an Atmel ICE programming an ATmega88PA. I am normally running STK500.exe with an AVRISP mkII but have been unable to use this method with windows 10. I am trying with an Atmel ICE and atprogram but i am unable to get this programmed correctly.

 

"atprogram.exe" -t atmelice -i ISP -d ATmega88PA program -f "File.hex" -ee -f "File.eep"

 

I am sure i have made a mistake somewhere in this but i have been unable to find anything that could help.

 

Any help would be greatly appreciated. 

 

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

What does not work?

 

Make sure you do a --chiperase before program if there's already stuff on the device...

:: Morten

 

(yes, I work for Microchip, yes, I do this in my spare time, now stop sending PMs)

 

The postings on this site are my own and do not represent Microchip’s positions, strategies, or opinions.

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

My chip erase is successful

 "atprogram.exe" -t atmelice -i ISP -d ATmega88PA chiperase

 

But when trying to program using the .hex and .eep file I just get[ERROR] An error occurred executing a command (program): Unknown file format. Specify a valid format with the --format option.

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

Have a look at the first few lines in File.hex and File.eep then. Are they actually Intel Hex or something else?

 

You'd hope to see something looking like...

D:\junkavr\testGCC\testGCC\Debug>head testGCC.eep
:00000001FF

D:\junkavr\testGCC\testGCC\Debug>head testGCC.hex
:100000004FC0000055C0000053C0000051C00000A8
:100010004FC000004DC000004BC0000049C00000B0
:1000200047C0000045C0000043C0000041C00000C0
:100030003FC000003DC000003BC0000039C00000D0
:1000400037C0000035C0000033C0000031C00000E0
:100050002FC000002DC000002BC0000029C00000F0
:1000600027C0000025C0000023C0000021C0000000
:100070001FC000001DC000001BC0000019C0000010
:1000800017C0000015C0000013C0000011C0000020
:100090000FC000000DC000000BC0000009C0000030

 

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

Yep both files look like that.

The .eep and .hex files have been used for years on STK500.exe with AVRISP mkII with no problems at all but are not working with atprogram and Atmel ICE

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

atprogram does not recognize .eep as a valid file format, you need to tell it it's a hex file with --format hex -f file.eep

or rename it to file_eep.hex

Jim

 

 

FF = PI > S.E.T

 

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

matt9martin wrote:
I am normally running STK500.exe with an AVRISP mkII but have been unable to use this method with windows 10.
AVR Studio 4 can run on Windows 10 though Jungo is a concern.

Sep'20 :

Earlier are Feb'18 and Nov'15.

 

"Dare to be naïve." - Buckminster Fuller

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

ki0bk wrote:
atprogram does not recognize .eep as a valid file format,
Good Lord - of all the people in the world who might know what format to expect in a .EEP file you might have thought Atmel would know ?!?

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

Well, we do now wink(as of 7 minutes ago)

:: Morten

 

(yes, I work for Microchip, yes, I do this in my spare time, now stop sending PMs)

 

The postings on this site are my own and do not represent Microchip’s positions, strategies, or opinions.

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

clawson wrote:
of all the people in the world who might know what format to expect in a .EEP file you might have thought Atmel would know ?!?

I guess atprogram is considered just a dumb command-line utility, and they put the "intelligence" to add the --format hex in Studio ?

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

Studio does not use atprogram

:: Morten

 

(yes, I work for Microchip, yes, I do this in my spare time, now stop sending PMs)

 

The postings on this site are my own and do not represent Microchip’s positions, strategies, or opinions.

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

meolsen wrote:

Studio does not use atprogram

Dare I ask "why ever not?". As it stands you're presumably maintaining two parallel developments of software doing virtually the same thing. 

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

Nope, they are both frontends to atbackend, where most of the meat is... 

 

Why would a whole IDE frontend talk to a programming only CLI?

 

Actually just had to check, atprogram is ... 5700 lines of python code (i.e not very dense), mostly dealing with managing the resources in the atbackend process (a TCF concept for those that wants to go down that rabbit hole). A atprogram command ranges from 39 lines (reset) to 553 (info).

:: Morten

 

(yes, I work for Microchip, yes, I do this in my spare time, now stop sending PMs)

 

The postings on this site are my own and do not represent Microchip’s positions, strategies, or opinions.

Last Edited: Wed. Jan 26, 2022 - 10:42 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

meolsen wrote:
Well, we do now wink(as of 7 minutes ago)

Thanks Morten!  

 

FF = PI > S.E.T

 

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

I have finally been able to get it working

"atprogram.exe" -t atmelice -i ISP -d ATmega88PA chiperase program -f "HEX.hex" program -ee --format hex -f "EEP.eep" write -fs --values 48DEFF write -lb --values C0

 

The problem i now have is that it is running to slow. 3x slower than when using STK500.exe and AVRISP mkII. Any idea how this could be made faster

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

matt9martin wrote:
Any idea how this could be made faster
pymcuprog?

https://github.com/microchip-pic-avr-tools/pymcuprog#readme

 

edit : oops (no mega88PA)

https://github.com/microchip-pic-avr-tools/pymcuprog/tree/main/pymcuprog/deviceinfo/devices

 

"Dare to be naïve." - Buckminster Fuller

Last Edited: Thu. Jan 27, 2022 - 02:46 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

Increase the clock rate of ISP? Merge the chiperase and program command (instead of chiperase program, do program --chiperase).

  -cl --clock <arg>          The frequency to use for communication with a
                             device (hz, khz, mhz, default hz). E.g. -cl 10mhz

 

:: Morten

 

(yes, I work for Microchip, yes, I do this in my spare time, now stop sending PMs)

 

The postings on this site are my own and do not represent Microchip’s positions, strategies, or opinions.

Last Edited: Thu. Jan 27, 2022 - 02:52 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

meolsen wrote:
Increase the clock rate of ISP?
Concur

Pololu - 5.7. Programming faster

 

"Dare to be naïve." - Buckminster Fuller

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

matt9martin wrote:
The problem i now have is that it is running to slow. 3x slower than when using STK500.exe and AVRISP mkII. Any idea how this could be made faster

Program the fuses first to set a higher clock rate, ie. clkdiv8 disable, then set ISP speed higher for the rest of the programming....

 

FF = PI > S.E.T

 

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

ki0bk wrote:
Program the fuses first to set a higher clock rate, ie. clkdiv8 disable, then set ISP speed higher for the rest of the programming....

Good point!

Also IIRC the clock setting might be sticky on the Atmel-ICE, so always best to specify it explicitly anyway.

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

Some of the time is spent bringing atbackend up and down. If you are doing a lot of programming you can start the backend manually to have it running continuously, and then connect to it with atprogram using the --host and --port options.