Author Topic: Programming AVR chips using .hex file without AVR programmer  (Read 11140 times)

0 Members and 1 Guest are viewing this topic.

Offline VEGETATopic starter

  • Super Contributor
  • ***
  • Posts: 1946
  • Country: jo
  • I am the cult of personality
    • Thundertronics
Programming AVR chips using .hex file without AVR programmer
« on: January 22, 2015, 08:55:52 pm »
Hi...

I have an issue where I have 2 identical boards containing ATMega644 (or ATMega644p) on them. One is working, the other have an issue with the ATMega644 software... Hence, the solution was to copy the program from the working and then burning it into the other.

I don't own the boards but the one who does have succeeded in copying the software from the working one and didn't succeed in burning it on the other one for some reason.

I read that Arduino boards can burn the software into other non-arduino chips... I can manage to get an arduino uno or mega from friends... will it do the job?

Notice that most tutorials that i read online is using the arduino sketch as the program... however, this is not what I want. I want to burn a .hex file to ATMega644 using an Arduino board.

I will gladly take your help xD
______

To solve this issue further on... I looked into using JTAG programmers to program any AVR chip. However, I have never used one  before and not quite sure it will work or not. So, do you know a sure JTAG one to work on ATMega644? the price and shipping?

well looks like avr dragon is the best right? who can ship it to me within a week or so?
______

Please give me a solution to this problem. I have never used an AVR or Arduino before (ehem... only PIC).

Thanks for your awesome help!!

Offline sleemanj

  • Super Contributor
  • ***
  • Posts: 3024
  • Country: nz
  • Professional tightwad.
    • The electronics hobby components I sell.
Re: Programming AVR chips using .hex file without AVR programmer
« Reply #1 on: January 22, 2015, 10:56:22 pm »
Just get a USBasp  (AVR ISP programmer) from ebay for a couple bucks.

Or if you insist, grab an arduino and set it up as an ISP programmer.

Then you can use avdude to upload your hex.
~~~
EEVBlog Members - get yourself 10% discount off all my electronic components for sale just use the Buy Direct links and use Coupon Code "eevblog" during checkout.  Shipping from New Zealand, international orders welcome :-)
 

Offline dannyf

  • Super Contributor
  • ***
  • Posts: 8221
  • Country: 00
Re: Programming AVR chips using .hex file without AVR programmer
« Reply #2 on: January 22, 2015, 11:35:27 pm »
Quote
Then you can use avdude to upload your hex.

"avdude", "upload" sound very porn, if you ask me.
================================
https://dannyelectronics.wordpress.com/
 

Offline VEGETATopic starter

  • Super Contributor
  • ***
  • Posts: 1946
  • Country: jo
  • I am the cult of personality
    • Thundertronics
Re: Programming AVR chips using .hex file without AVR programmer
« Reply #3 on: January 23, 2015, 10:59:13 am »
Just get a USBasp  (AVR ISP programmer) from ebay for a couple bucks.

Or if you insist, grab an arduino and set it up as an ISP programmer.

Then you can use avdude to upload your hex.

you sure this will work? or should I just buy AVR Dragon? the problem is that I need to do it quickly xD

Offline Flenser

  • Regular Contributor
  • *
  • Posts: 60
Re: Programming AVR chips using .hex file without AVR programmer
« Reply #4 on: January 23, 2015, 02:17:09 pm »
Quote
I can manage to get an arduino uno or mega from friends... will it do the job?

I've never done it, but I believe that an arduino will do the job, as described in this post
http://forum.arduino.cc/index.php?topic=125248.msg942450#msg942450

1) Upload ArduinoISP to the Arduino
2) Connect the Arduino to the Target Board's ISP signals
3) Generate the hex file to be loaded onto the Target Board
4) Use avrdude to send the hex file to the Arduino, which will program the Target Board

Your Arduino running the ArduinoISP is your AVR ISP programmer. It is connected to your PC. You run avrdude on your PC to control this programmer. avrdude sends the hex file to the programmer over the virtual serial port and the programmer writes it to the target using the ISP protocol.



 

Offline paulie

  • Frequent Contributor
  • **
  • !
  • Posts: 849
  • Country: us
Re: Programming AVR chips using .hex file without AVR programmer
« Reply #5 on: January 24, 2015, 04:24:09 pm »
Just get a USBasp  (AVR ISP programmer) from ebay for a couple bucks.

Or if you insist, grab an arduino and set it up as an ISP programmer.

Then you can use avdude to upload your hex.

you sure this will work? or should I just buy AVR Dragon? the problem is that I need to do it quickly xD

If you are like 99% of the noobs on internet forums I'm sure you would prefer to ignore this excellent advice from sleemanj and choose a more complicated, more expensive, less reliable method. Or maybe you are the rare case that does like to take the lowest cost easiest path.

Usually those $2 usbasp are by far the best solution in cases like this. Arduino as ISP or even just using a PC parallel port if available might be a faster but somewhat more involved solution. Anything else makes little sense.
 

Offline rob77

  • Super Contributor
  • ***
  • Posts: 2085
  • Country: sk
Re: Programming AVR chips using .hex file without AVR programmer
« Reply #6 on: January 24, 2015, 04:39:56 pm »
any arduino with the ISP sketch loaded will do the job - just use google ;) i'm using an Atmega8 loaded with it for programming other AVR chips with avrdude.
 

Offline VEGETATopic starter

  • Super Contributor
  • ***
  • Posts: 1946
  • Country: jo
  • I am the cult of personality
    • Thundertronics
Re: Programming AVR chips using .hex file without AVR programmer
« Reply #7 on: January 25, 2015, 08:46:20 pm »
Thanks for the replies. I will try ArduinoISP, I saw it online before posting but I wanted to make sure someone tried it.

About that 2$ usbasp, I really clarified that I don't have time for some circumstances... so buying it from ebay will surely take more than a week to arrive.

 

Offline paulie

  • Frequent Contributor
  • **
  • !
  • Posts: 849
  • Country: us
Re: Programming AVR chips using .hex file without AVR programmer
« Reply #8 on: January 25, 2015, 09:31:04 pm »
Not all Ebay is China. For example there are many usbasp sellers here in USA. Depending it only takes a day or two but cost is $4-$5. Still much quicker and cheaper than that dragon you targeted. But if you have an Arduino that is lowest cost and fastest solution.
 

Offline VEGETATopic starter

  • Super Contributor
  • ***
  • Posts: 1946
  • Country: jo
  • I am the cult of personality
    • Thundertronics
Re: Programming AVR chips using .hex file without AVR programmer
« Reply #9 on: January 30, 2015, 07:16:14 pm »
I will be buying USBasp. Now all I need is to know how to read the .hex file from the working chip... I guess avrdude or extreme burner does the job, right?

in extreme burner, there is flash/eeprom/fuses tabs to be read or written... should I read/write all of them? when I program PIC ones I do config fuses and stuff within the software itself (.hex).


Offline kolbep

  • Frequent Contributor
  • **
  • Posts: 598
  • Country: za
    • ShoutingElectronics.com
Re: Programming AVR chips using .hex file without AVR programmer
« Reply #10 on: January 30, 2015, 07:41:44 pm »
Maybe when the other person was reading the code out, it may have had Code Protection turned on (if that is an option in AVRs (I am a pic man,so don't shoot me).

In that case he may have just been reading garbage out of the chip, and programming that garbage to the new chip, and that is why he was unable to get the destination chip to work.
====================================
www.ShoutingElectronics.com Don't just talk about Electronics, SHOUT ABOUT IT! Electronics Blog Site and Youtube Channel
 

Offline theatrus

  • Frequent Contributor
  • **
  • Posts: 352
  • Country: us
Re: Programming AVR chips using .hex file without AVR programmer
« Reply #11 on: February 01, 2015, 12:09:09 am »
I will be buying USBasp. Now all I need is to know how to read the .hex file from the working chip... I guess avrdude or extreme burner does the job, right?

in extreme burner, there is flash/eeprom/fuses tabs to be read or written... should I read/write all of them? when I program PIC ones I do config fuses and stuff within the software itself (.hex).

AVRs have programmable code protection support - if its enabled, you are not going to get valid code read out of the unit.
Software by day, hardware by night; blueAcro.com
 

Offline VEGETATopic starter

  • Super Contributor
  • ***
  • Posts: 1946
  • Country: jo
  • I am the cult of personality
    • Thundertronics
Re: Programming AVR chips using .hex file without AVR programmer
« Reply #12 on: February 02, 2015, 05:42:41 pm »
I will be buying USBasp. Now all I need is to know how to read the .hex file from the working chip... I guess avrdude or extreme burner does the job, right?

in extreme burner, there is flash/eeprom/fuses tabs to be read or written... should I read/write all of them? when I program PIC ones I do config fuses and stuff within the software itself (.hex).

AVRs have programmable code protection support - if its enabled, you are not going to get valid code read out of the unit.

well, that is new to me... any good suggestions? what about the universal programmer here:

can it read/write avr stuff?

Offline Jeroen3

  • Super Contributor
  • ***
  • Posts: 4078
  • Country: nl
  • Embedded Engineer
    • jeroen3.nl
Re: Programming AVR chips using .hex file without AVR programmer
« Reply #13 on: February 02, 2015, 05:49:23 pm »
Is your chip listed?
http://autoelectric.cn/MiniPro/MiniProSupportList.txt

This programmer is not going to help you if the read protection fuses are enabled.
 

Offline VEGETATopic starter

  • Super Contributor
  • ***
  • Posts: 1946
  • Country: jo
  • I am the cult of personality
    • Thundertronics
Re: Programming AVR chips using .hex file without AVR programmer
« Reply #14 on: February 02, 2015, 07:03:03 pm »
Is your chip listed?
http://autoelectric.cn/MiniPro/MiniProSupportList.txt

This programmer is not going to help you if the read protection fuses are enabled.

well, it is ATmega644 and it is listed. However, I don't know about those protection fuses... how to know about them?

I have ordered the 2$ USBASP to use it with AVRDUDE for sucking out the .hex from this ATmega and then to program other similar chips with it. << is this useless here too? xD

I wanted this programmer because it has a good range of supported stuff like EEPROMs.. I want to give it to my cousin for maintenance work.

Offline Jeroen3

  • Super Contributor
  • ***
  • Posts: 4078
  • Country: nl
  • Embedded Engineer
    • jeroen3.nl
Re: Programming AVR chips using .hex file without AVR programmer
« Reply #15 on: February 03, 2015, 06:35:48 am »
if I were you I would buy the 30$ AVR MKII ISP programmer.
You know for sure it works and 30% is not expensive.

I've got a few of those clone cheap dollar ones, they all need a fancy driver and are typically not as plug&play as the official one.
 

Offline rob77

  • Super Contributor
  • ***
  • Posts: 2085
  • Country: sk
Re: Programming AVR chips using .hex file without AVR programmer
« Reply #16 on: February 03, 2015, 08:29:14 am »
and what's wrong with the $6 arduino nano clone from china + isp sketch loaded ? it's far more versatile than any usbasp (you can use it for any micro-controller if you load the appropriate software into it)
 

Offline VEGETATopic starter

  • Super Contributor
  • ***
  • Posts: 1946
  • Country: jo
  • I am the cult of personality
    • Thundertronics
Re: Programming AVR chips using .hex file without AVR programmer
« Reply #17 on: February 03, 2015, 05:02:51 pm »
Hmmm... this one has the advantage of programming tons of other stuff, unlike MKII. Can someone verify for sure that it doesn't copy fuse protected AVRs? how to copy them anyway?

Offline Jeroen3

  • Super Contributor
  • ***
  • Posts: 4078
  • Country: nl
  • Embedded Engineer
    • jeroen3.nl
Re: Programming AVR chips using .hex file without AVR programmer
« Reply #18 on: February 03, 2015, 08:52:05 pm »
Can someone verify for sure that it doesn't copy fuse protected AVRs? how to copy them anyway?
The flash read protection fuses are designed to prevent ANY programmer from reading the flash.
Since the programmer controls some internal logic inside the chip doing the programming and reading of the flash, using a programmer to read protected flash will not work.
Unless you're going to explore glithing techniques to mess with the logic. You can try that until your retirement.

The typical approach to reading locked chips is to decap them, and shoot out the flash bits holding the lockbits.
 

Offline VEGETATopic starter

  • Super Contributor
  • ***
  • Posts: 1946
  • Country: jo
  • I am the cult of personality
    • Thundertronics
Re: Programming AVR chips using .hex file without AVR programmer
« Reply #19 on: February 04, 2015, 05:01:03 pm »
The typical approach to reading locked chips is to decap them, and shoot out the flash bits holding the lockbits.

Thanks for your reply, it really helped.

Hmmm and how can we do this thing xD?

Now I hope the chip is not protected... &__&


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf