help regarding burning the code into atmega 168

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

guys, my objective was to burn the hex file into my microcontroller atmega 168.
i wrote the code in avrstudio
and i have a usbasp programmer ckt.
i need to burn the code into the microcontroller
i also had khazama software but it didnt seem to work properly
can smeone tell me exactly in steps what i hav to do if i hav to burn my code into at168 using avr dude through usbasp programmer??

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

Do it directly from studio. No extra software is needed.

Jim

 

Until Black Lives Matter, we do not have "All Lives Matter"!

 

 

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

not even avr dude?
and can u tell me how can i do it from studio?

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

You just need this command :

avrdude -c usbasp -p ATmega168 -U flash:w:hexfile.hex

You can add avrdude to your Tools menu in Studio 6 and specify your hexfile name by hand. Unfortunately the AS6 macros do not work, otherwise you would simply put the $(TargetName) in the arguments.

David.

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

What! Studio6 does not offer a direct "Program Target" (Menu or Toolbar button)?

Jim

 

Until Black Lives Matter, we do not have "All Lives Matter"!

 

 

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

Quote:
What! Studio6 does not offer a direct "Program Target" (Menu or Toolbar button)?

Yes it does, Jim. But are you sure it supports the USBasp programmer? [Hint, hint...]

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

I thought that Studio uses AVRDUDE as the underlying programming interface. If so, unless its crippled in Studio, you ought to be able to access any programmer from Studio that you can by command line.

Let me guess ... It is crippled?

Jim

 

Until Black Lives Matter, we do not have "All Lives Matter"!

 

 

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

Studio 6 uses official Atmel programmers e.g. Dragon, JTAGICE-mkII etc in exactly the same way that Studio 4 only supports Atmel programmers.

The underlying Visual Studio has a whole list of IDE macros e.g. $(ItemFileName), $(ProjectFileName), ...

Of course, the useful macros are not implemented. If they were, then adding an External Tool would be really convenient. (like how macros work in IAR, Rowley, CodeVision, ...)

All the same, you can always have a hard-coded batch file.

David.

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

Quote:
I thought that Studio uses AVRDUDE as the underlying programming interface.

It does not.

Studio in it's different incarnations has supported Atmels own tool, using Atmels own protocols (e.g. protocols named "STK500", "STK500V2" etc).

USBasp is not an official Atmel tool. AFAIK it does not use any of Atmels own protocols.

The AVRDUDE programming software is also separate from Atmel. One interesting property of AVRDUDE is that it supports many different protocols, some being Atmels own. Another interesting feature is that AVRDUDE is cross-platform. You can try it out on your Mac if you like..

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

And of course I'm always dumbfounded as to why people use anything but the Studio programming interface when they are using Studio and real Atmel tools. Go figgure....

I have NEVER used anything but Studio in 12 years.

John Samperi

Ampertronics Pty. Ltd.

https://www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

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

Quote:

And of course I'm always dumbfounded as to why people use anything but the Studio programming interface when they are using Studio and real Atmel tools. Go figgure....

I lost you. Since when did USBasp become "a real Atmel tool", John?

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

david.prentice wrote:
You can add avrdude to your Tools menu in Studio 6 and specify your hexfile name by hand. Unfortunately the AS6 macros do not work, otherwise you would simply put the $(TargetName) in the arguments.

David.


David,

I just tested these arguments to avrdude in AS6 and they worked just fine.

-v -v -p m1280 -c arduino -P COM3 -b 57600 -D -Uflash:w:"$(ProjectDir)Debug\$(ItemFileName).hex":i

Attachment(s): 

"I may make you feel but I can't make you think" - Jethro Tull - Thick As A Brick

"void transmigratus(void) {transmigratus();} // recursio infinitus" - larryvc

"It's much more practical to rely on the processing powers of the real debugger, i.e. the one between the keyboard and chair." - JW wek3

"When you arise in the morning think of what a privilege it is to be alive: to breathe, to think, to enjoy, to love." -  Marcus Aurelius

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

Personally after reading all the replies in this thread I was confused.* Imagine how the OP must be. Let's Start over again.

ankit0916 wrote:
guys, my objective was to burn the hex file into my microcontroller atmega 168.
i wrote the code in avrstudio
and i have a usbasp programmer ckt.
i need to burn the code into the microcontroller
i also had khazama software but it didnt seem to work properly
can smeone tell me exactly in steps what i hav to do if i hav to burn my code into at168 using avr dude through usbasp programmer??

First off, David's example command will work from a command prompt.

avrdude -c usbasp -p ATmega168 -U flash:w:hexfile.hex

Secondly, Can you tell us what version of Studio you are using? This will help us to give you more correct answers

Thirdly, if you are using Atmel Studio 6 then see my last post. You will have to edit the avrdude arguments for your needs. We can help with that too.

*No disprespect meant or implied guys.

"I may make you feel but I can't make you think" - Jethro Tull - Thick As A Brick

"void transmigratus(void) {transmigratus();} // recursio infinitus" - larryvc

"It's much more practical to rely on the processing powers of the real debugger, i.e. the one between the keyboard and chair." - JW wek3

"When you arise in the morning think of what a privilege it is to be alive: to breathe, to think, to enjoy, to love." -  Marcus Aurelius

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

i am using avr studio 4

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

The $(ItemFileName) refers to the current context window.

So Larry's example will work if you happen to have the Properties window in focus and you happen to be burning the Debug rather than Release version.
If you had "module.c" in focus, avrdude will fail to find "module.c.hex".

IMHO, your best bet is to buy a real Atmel programmer if you want to just click on "Start without Debugging"

David.

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

I don't know enough about AS4 to be able to tell you how to use, or if you can use, external tools such as avrdude from within AS4.

Did you try David's example command from a command prompt.

"I may make you feel but I can't make you think" - Jethro Tull - Thick As A Brick

"void transmigratus(void) {transmigratus();} // recursio infinitus" - larryvc

"It's much more practical to rely on the processing powers of the real debugger, i.e. the one between the keyboard and chair." - JW wek3

"When you arise in the morning think of what a privilege it is to be alive: to breathe, to think, to enjoy, to love." -  Marcus Aurelius

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

AS4 has no conception of Project macros at all. So you would always have to supply the correct HEX filename.

However with any version of Windows you can create a batch file that contains the complex avrdude command syntax. Then all you have to do is click on the batch file and supply the HEX filename.

Using Makefile is another alternative. You configure once. You have all the complex commands called for you when required.

David.

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

Quote:
Since when did USBasp become "a real Atmel tool", John?
Isn't it at least AVRProg compatible? (AVR910?? Don't know)

Anyway I was referring to other threads where people have real Atmel tools or compatible and still use some strange programming interface rather than Studio.

John Samperi

Ampertronics Pty. Ltd.

https://www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

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

AvrProg became fairly obsolete when they ran out of special ID numbers. It is only because the Atmel Tool bootloaders used this AVR910 protocol that AvrProg was installed with Studio 4.

AVRs have always been easy to program with simple hardware programmers. Hence many programmers, many high-level protocols.

Other manufacturers probably have less third party tools. No one notices a problem. e.g. any third party tools mimic the manufacturer. If a manufacturer supplies an IDE, it supports its own products. If a manufacturer only wants to use Windoze, it only supplies Windoze software.

In an ideal world all tools would work on all platforms and never have any bugs.

All the same, if you want to use a $3.99 usbasp, you just write a "prog_m168.bat" and accept a little inconvenience.

Yes, there are GUIs that can control a usbasp. None of them are perfect either.

David.

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

david.prentice wrote:
In an ideal world all tools would work on all platforms and never have any bugs.

David.


Amen.

Sometimes I use my AVRisp mkii clone with avrdude other times with Studio. The LUFA software provides a build for one or the other but not both and each requires a different driver. Therefore, for me, the avrdude build makes more sense as I can call avrdude from AS6, as a tool, or from the command line and not have to reprogram the clone.

If you only use AS (whatever version) then a real Atmel tool or compatible clone makes complete sense.

But when it boils down to money, most students are going to use the cheapest programmer they can find that will work. At $3-$4 US with free shipping the USBasp clones do the job.

I feel Atmel has done a reasonably good job of giving alternative methods of programming, at least with my experience of AS6. These methods are not perfect, but they are workable. I don't think they will be ironed out in the first non-beta release of AS6 though.

Atmel are you listening?

"I may make you feel but I can't make you think" - Jethro Tull - Thick As A Brick

"void transmigratus(void) {transmigratus();} // recursio infinitus" - larryvc

"It's much more practical to rely on the processing powers of the real debugger, i.e. the one between the keyboard and chair." - JW wek3

"When you arise in the morning think of what a privilege it is to be alive: to breathe, to think, to enjoy, to love." -  Marcus Aurelius

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

You can drive your AVRISP-2 with avrdude and with Studio.

Simply install LibUSB-Win32

David.

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

It doesn't work with a clone and LUFA firmware. Dean has told me that he is working on a fix to that.

If you have a procedure to accomplish this please let me know.

Thanks,
Larry

"I may make you feel but I can't make you think" - Jethro Tull - Thick As A Brick

"void transmigratus(void) {transmigratus();} // recursio infinitus" - larryvc

"It's much more practical to rely on the processing powers of the real debugger, i.e. the one between the keyboard and chair." - JW wek3

"When you arise in the morning think of what a privilege it is to be alive: to breathe, to think, to enjoy, to love." -  Marcus Aurelius

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

What doesn't work with the LUFA firmware, Studio 5.1/6? Both should work with the normal Atmel Jungo USB driver at the latest LUFA trunk code.

- Dean :twisted:

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

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

abcminiuser wrote:
What doesn't work with the LUFA firmware, Studio 5.1/6? Both should work with the normal Atmel Jungo USB driver at the latest LUFA trunk code.

- Dean :twisted:


The clone works fine with the Jungo USB driver in AS6 as long as the LUFA AVRisp mkii clone firmware is built with the #LUFA_OPTS += -D LIBUSB_DRIVER_COMPAT commented out.

The issue remains that even if I use the libusb-win32 filter for the clone I can not use avrdude with that build.

If I build with the above line uncommented I am able to use avrdude. AS6 complains that I need a firmware upgrade with this build and, of course, that fails.

My question is:

Do I still have the choice of AS6 compatibility or avrdude compatibility but not both as you told me in the past?

"I may make you feel but I can't make you think" - Jethro Tull - Thick As A Brick

"void transmigratus(void) {transmigratus();} // recursio infinitus" - larryvc

"It's much more practical to rely on the processing powers of the real debugger, i.e. the one between the keyboard and chair." - JW wek3

"When you arise in the morning think of what a privilege it is to be alive: to breathe, to think, to enjoy, to love." -  Marcus Aurelius

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

Quote:

Do I still have the choice of AS6 compatibility or avrdude compatibility but not both as you told me in the past?

Yes, it looks like it - I just tried the latest libUSB-Win32 filter driver without success.

One solution I saw on the internet the other day was this one:

https://github.com/madworm/avris...

Which uses a reset of the AVR via the /RESET line to switch between modes. I'll ponder this and see if there's a better long-term solution.

- Dean :twisted:

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

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

That looks very interesting, I'll give it a try.

Thanks Dean

"I may make you feel but I can't make you think" - Jethro Tull - Thick As A Brick

"void transmigratus(void) {transmigratus();} // recursio infinitus" - larryvc

"It's much more practical to rely on the processing powers of the real debugger, i.e. the one between the keyboard and chair." - JW wek3

"When you arise in the morning think of what a privilege it is to be alive: to breathe, to think, to enjoy, to love." -  Marcus Aurelius