Programming ATMega328P (Arduino) from Eclipse

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

I've been out of the AVR/embedded loop for a little while, so bear with me as I re-learn some of the basics...

 

I'm trying to program an ATMega328P (on an Arduino board but through the ISP port) via an AVRISP mark 2 programmer. I'm connecting from Eclipse.

I've installed the AVR plugin for Eclipse and WinAVR.

 

When I try to connect, I get an error "Could not understand the output from AVRdude".

 

I directed the output to the console:

Launching /usr/bin/avrdude -cavrispmkII -pm16 
Output:

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.00s

avrdude: Device signature = 0x1e950f (probably m328p)
avrdude: Expected signature for ATmega16 is 1E 94 03
         Double check chip, or use -F to override this check.

avrdude done.  Thank you.

avrdude finished


Launching /usr/bin/avrdude -cavrispmkII -px128a3 
Output:

avrdude: stk500v2_command(): error in CMD_XPROG_SETMODE: Unknown
avrdude: stk600_xprog_program_enable(): CMD_XPROG_SETMODE(XPRG_MODE_PDI) failed
avrdude: initialization failed, rc=-1
         Double check connections and try again, or use -F to override
         this check.

avrdude: stk500v2_command(): error in CMD_XPROG: Unknown
avrdude: stk600_xprog_program_disable(): XPRG_CMD_LEAVE_PROGMODE failed

avrdude done.  Thank you.

avrdude finished

One possibility is that I need to update firmware for the programmer, but hoping that's not the case.

 

Thoughts?

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

pkafig wrote:
I'm trying to program an ATMega328P

pkafig wrote:

Launching /usr/bin/avrdude -cavrispmkII -px128a3 

pkafig wrote:

Launching /usr/bin/avrdude -cavrispmkII -pm16 

So what happens when you try to program an M328?  rather then an XM128 or M16?

 

Jim

 

 

(Possum Lodge oath) Quando omni flunkus, moritati.

"I thought growing old would take longer"

 

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

Hi Jim,

 

I thought that's what I'm doing. Please see attached.

 

I don't know why it would expect something else.

 

Thanks,

Paul

Attachment(s): 

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

pkafig wrote:

I'm connecting from Eclipse.

I've installed the AVR plugin for Eclipse and WinAVR.

Why not just use AS7, as WinAVR must be at least 15 years old, buggy and obsolete!

If your a linux user, then get MPLAB X as it supports linux and the toolchains are current.

 

Jim

 

 

(Possum Lodge oath) Quando omni flunkus, moritati.

"I thought growing old would take longer"

 

Last Edited: Wed. Nov 11, 2020 - 04:10 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

That may be the best options for now; I'll give that a try. Really like Eclipse, but I'm sure AS7 has good features as well. Thanks for the advice :-)

 

Best regards,

Paul

 

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

pkafig wrote:
Really like Eclipse,

Nice to know that someone likes it.

 

If someone ever posted a link to a reliable AVR installation,   I might have a go.

 

Attempted NXP and ST.   Given up in horror.    Even though these are supported by their manufacturers.

 

It should be pretty straightforward to configure the Tools correctly for AVR.    Just without any realistic support.

David.

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

That image looks like it may be from Ubuntu. Remove eclipse. It is doing nothing to help. Also, remove the modem manager if you use an Arduino (which shows up as a modem and will get unwanted attention at powerup).

 

sudo snap remove eclipse
sudo apt-get purge modemmanager

 

put the toolchain and a few extras in (packages are the easy way)

 

sudo apt-get install git make avrdude gcc-avr binutils-avr gdb-avr avr-libc python3-pip

 

You can edit the source with gedit or other editors; I use VSCode nowadays (I just use it as an editor that somewhat intelligently lints my code, sort of like a grammar checker).

 

sudo apt-get install code

 

The main thing is learning how to do a Makefile, something like this.

 

https://github.com/epccs/RPUno/blob/master/BlinkLED/Makefile

 

Though that project is old, and the VSCode setup for it is now broken. Maybe that is what went wrong with eclipse, but you should concentrate on learning how to do the Makefile, not the IDE. In other words, VSCode is not the objective; learning more than how to edit with it is a waste of your time, just like learning eclipse.

 

https://www.gnu.org/software/make/manual/make.html

 

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

pkafig,

 

Did the -pm328 ucontroller designation work with avrdude?

 

I assume that you would like to use Eclipse as a development environment under Linux.  If you have it installed and want to configure it, take a look at https://protostack.com.au/2010/1... for some general direction.  Some people got it to work to generate AVR code under Linux but never got source level debugging to work.

 

Since I develop micro controller code as a hobby in simple applications (data logger, sound generation, LIPO battery discharger to storage level, etc), I still use Eclipse and find Atmel 'legacy' controllers (m328, t84, t861) sufficient for my applications.  I also use Eclipse  plugins to generate C programs, java programs and XML applications on a PC and find the consistent GUI environment helpful.  Many years ago we used Eclipse at work for many applications (IBMs System Architect) and had a focus group that met over noon hour to learn how to use it and answer questions.  It did not hurt that the company paid for an IBM representative to support custom applications of their Eclipse based  products.

 

Alan

Last Edited: Thu. Nov 12, 2020 - 02:04 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

deleted accidental self-reply. 

Can't keep my thumb near the touch pad on my tablet as I type or it moves the cursor or does other strange things.

 

Alan

Last Edited: Thu. Nov 12, 2020 - 05:09 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

pkafig wrote:

Hi Jim,

 

I thought that's what I'm doing. Please see attached.

 

I don't know why it would expect something else.

 

Thanks,

Paul

If you are still having problems with avrdude choosing the m16 cpu, check out this link https://www.avrfreaks.net/commen... to correct the problem (initial project defaults to the mega 16 cpu).

 

Alan

 

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

Thanks for the tips, Alan. I'll check them out.