ATMEGA3208 command line programming (from Linux)

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

Greetings all...

 

I have been following the online discussions about various methods of command line programming the mega core X devices for some time, and have had some success with various tools. I have done a project that uses a ATMEGA3208 device, and to date I have done all my programming from within Atmel Studio 7 (I had issues with MPLABX, under Linux, hanging up, and ran out of time to trouble-shoot).

 

We run Linux in Production, and thus I now need to program the ATMEGA3208 devices on the line, via a Linux terminal.

 

I can program successfully from Atmel Studio GUI (Windows VM), using an Atmel-ICE.
I can program successfully from MPLAB-IPE GUI (in Linux), using an Atmel-ICE or a PicKit4.
I can program successfully from Arduino GUI (in Linux), using Atmel-ICE(UPDI) option.

 

I cannot get any command line version to work, however. So frustrating.

 

Commands I am using:

java -jar /opt/microchip/mplabx/latest/mplab_platform/mplab_ipe/ipecmd.jar -PATMEGA3208 -TPAICE -M -Y -F"V107.hex"

java -jar /opt/microchip/mplabx/latest/mplab_platform/mplab_ipe/ipecmd.jar -PATMEGA3208 -TPPK4 -M -Y -F"V107.hex"
java -jar /opt/microchip/mplabx/latest/mplab_platform/mplab_ipe/ipecmd.jar -PATMEGA3208 -TPPK4 -M -Y -ORIUPDI -F"V107.hex"

Avrdude - this is not correct, as it needs to be atmelice_updi... but there is no option for that:

./avrdude -p m3208 -c atmelice_pdi -e -P usb -U flash:w:['V107.hex'] -B 5 -v -v

 

Re. MPLAB-IPE ipecmd.jar command: If you run it and print the list of supported devices, ipecmd.jar does not return a list that contains the Atmel-ICE. However, then documentation (Readme for IPECMD.htm) clearly lists it:
-TPPM3 to select the MPLAB PM3
-TPPK4 to select the MPLAB PICkit 4
<snip>
-TPAICE to select the Atmel ICE

 

And if I use -PKAICE, I do see the tool trying to do something... but it does not succeed.

 

Now, my preference is for avrdude with the Atmel-ICE, as I have maintained my own version for a while, as we added custom details for programming Atmel ATA8510 devices. But... I get a failure if I try to use avrdude (my version), even with the correct config file (I added the coreX details). I only have atmelice, atmelice_isp, atmelice_dw and atmelice-pdi. In all cases the tool says that the device does not have the matching interface, which is 100% correct, as it needs to be programmed via a UPDI interface.

 

So my main attack has been to figure out what the Arduino guys are doing with their Atmel-ICE(UPDI) option, which works perfectly from the GUI! I have the Arduino avrdude, as well as the custom code to build their version (from Github), but it has the same error? What exactly is Arduino running to do the programming? Anyone know?
 

This topic has a solution.

_____________

Regards

Sarlacii

Last Edited: Wed. Aug 11, 2021 - 08:18 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

For IPECMD you probably should  raise a support ticket with micrcochip.com. If they issued the utility they should be in a position to provide support.

sarlacii wrote:
But... I get a failure if I try to use avrdude (my version)
What version? And is it the latest? If not what happens if you try the latest?

 

(hint: a good way to get a pretty up to date avrdude is to install Arduino as it comes in the package).

This reply has been marked as the solution. 
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

FYI: If you are interested in a python-based command line programming utility, you could try pymcuprog: https://pypi.org/project/pymcuprog/

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

sarlacii wrote:
ATMEGA3208

...

But... I get a failure if I try to use avrdude (my version), even with the correct config file (I added the coreX details).

AVR Downloader/UploaDEr - Patches: patch #10000, Add support for extended UPDI... [Savannah]

...

Corrects signature on ATmega3208 and ATmega3209.

Debian doesn't have the most recent AVRDUDE :

Debian -- Details of package avrdude in buster

[avrdude] Index of /trunk/avrdude (1429 of 1453)

 

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

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

gchapman wrote:
Debian doesn't have the most recent AVRDUDE :
Is that really an issue? In the Linux world if a repo doesn't have something up to date then you just pull source and build it yourself.

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

This may help, have linux updi programming tools here, part of this project...

https://github.com/12oclocker/V-USB_TinyAvr

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

Debian doesn't have the most recent AVRDUDE

 It's been a long time since an AVRDUDE "release."
You probably would need to deal with the actual "current" trunk ( http://svn.savannah.gnu.org/view... ), or maybe just use the version packaged with Arduino.

 

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

sarlacii wrote:

I can program successfully from Arduino GUI (in Linux), using Atmel-ICE(UPDI) option.

Enable verbose output in Arduino, then you should see the avrdude incantation (https://forum.arduino.cc/t/how-t...) it uses. 

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

Support for ATmega3208 (and other UPDI devices) was added to the Avrdude source quite a while ago, but there has been no release since it was added. atmelice_updi has been added to the Avrdude source, so if you build it yourself you will get support for it. As mentioned earlier building Avrdude from source on Linux should be fairly easy.

 

Arduino does not do anything special when building Avrdude as far as I know. What error do you get? Could it be the signature, as mentioned by gchapman?

 

BUT, the easiest solution by far, would be to use pymcuprog, as mentioned by mraardvark. Just type "pip install pymcuprog", and you're ready to go.

 

 

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

clawson wrote:

For IPECMD you probably should  raise a support ticket with micrcochip.com. If they issued the utility they should be in a position to provide support.

 

sarlacii wrote:

But... I get a failure if I try to use avrdude (my version)

What version? And is it the latest? If not what happens if you try the latest?

 

 

(hint: a good way to get a pretty up to date avrdude is to install Arduino as it comes in the package).

 

Yes, correct, I have raised this with Microchip support. Will log a bug if it all makes sense.

 

Sorry, I did not provide versions, as I was just asking initial query, before going into details - i.e. am I missing something simple.

 

Long story short, I have a custom version of avrdude that I cloned from the original Savanna repo, via a Github project. Turns out the project stub I had as upstream was not maintained. So I have instead pulled the latest version based on what the Arduino guys use: git@github.com:facchinm/avrdude.git.

 

Once I compiled, I could do atmelice_updi, and it worked perfectly!

_____________

Regards

Sarlacii

Last Edited: Wed. Aug 11, 2021 - 08:09 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

je_ruud wrote:

Support for ATmega3208 (and other UPDI devices) was added to the Avrdude source quite a while ago, but there has been no release since it was added. atmelice_updi has been added to the Avrdude source, so if you build it yourself you will get support for it. As mentioned earlier building Avrdude from source on Linux should be fairly easy.

 

Arduino does not do anything special when building Avrdude as far as I know. What error do you get? Could it be the signature, as mentioned by gchapman?

 

BUT, the easiest solution by far, would be to use pymcuprog, as mentioned by mraardvark. Just type "pip install pymcuprog", and you're ready to go.

 

 

 

Well, shucks, I did not know about this Python module!?! Good grief. We actually run Python 3 for our test jigs, and so this makes it dead simple. Thank you so much!

 

(As ever, what a fantastic forum... always such good replies and none of the 'spite', unlike Stack Exchange, for example. Thank you everyone)

_____________

Regards

Sarlacii

Last Edited: Wed. Aug 11, 2021 - 08:12 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

westfw wrote:

Debian doesn't have the most recent AVRDUDE

 It's been a long time since an AVRDUDE "release."
You probably would need to deal with the actual "current" trunk ( http://svn.savannah.gnu.org/view... ), or maybe just use the version packaged with Arduino.

 

 

Yes, correct, in most distros I have found that avrdude is out of date. As such I have just stuck to pulling from Github, and compiling myself.

_____________

Regards

Sarlacii

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

clawson wrote:
up to date avrdude is to install Arduino as it comes in the pack

 

Correct, and so I did. But initially I did not notice that when I ran the avrdude command form the Arduino directory, I forgot to specify "-C ./avrdude.conf" and as such the tool still used my global conf file, which was missing the UPDI code! So silly, but with all the debug, I did not see it. Eventually I figured it out, and so learnt that the Arduino avrdude did in fact work. So I went to figure out why my Github upstream did not have the latest mods... .

_____________

Regards

Sarlacii