Hello,
I got some Atmega8 chips that i would like to use on standalone projects.
I followed this tutorial to burn the bootloader with AVR Studio and an Arduino UNO board Arduino Playground - Burn168
It said OK to everything, went pretty fast, but I couldn't use it.
I am trying to follow this tutorial now : Minimal Arduino with ATmega8 – todbot blog
When I try to program the chip, just reading signature ( which worked when it was fresh ) AVR Studio writes 'Entering programming mode ... FAILED!' with an error message asking to verify everything.
I see 0x00 0x00 0x00 next to 'read signature'
I'm a bit lost, did I break the chip ?
Thank you
Philippe
PS : I put another ATMEGA8 - 16PU in the UNO board
Anyway what would you suggest as best practice to do this ?
I have very small projects, like a camera remote I would like to run in standalone, so I bought a few ATTiny and Atmega chips, the AVRISP mkii, installed AVR studio etc ... but google will find thousands of ways for doing this, on breadboard, mugging the chip on Arduino board, use isp programmers ... it's kind of a nightmare for new users.
It looks even worse when you have an UNO, as you see lot of warnings that it won't work with optiboot, etc ...
Thank you
I suggest you use avrdude from a command-shell so you can better control what is happening. I also suggest working with either of the ATmega8 processors you described in the original post; the processors that do not seem to be working correctly.
First, make certain you can run avrdude from a command-shell. Open a command-shell and type "avrdude" and press Enter. Something similar to this should be displayed...
C:\ >avrdude
Usage: avrdude [options]
Options:
-p <partno> Required. Specify AVR device.
-b <baudrate> Override RS-232 baud rate.
-B <bitclock> Specify JTAG/STK500v2 bit clock period (us).
-C <config-file> Specify location of configuration file.
-c <programmer> Specify programmer type.
-D Disable auto erase for flash memory
-i <delay> ISP Clock Delay [in microseconds]
-P <port> Specify connection port.
-F Override invalid signature check.
-e Perform a chip erase.
-O Perform RC oscillator calibration (see AVR053).
-U <memtype>:r|w|v:<filename>[:format]
Memory operation specification.
Multiple -U options are allowed, each request
is performed in the order specified.
-n Do not write anything to the device.
-V Do not verify.
-u Disable safemode, default when running from a script.
-s Silent safemode operation, will not ask you if
fuses should be changed back.
-t Enter terminal mode.
-E <exitspec>[,<exitspec>] List programmer exit specifications.
-x <extended_param> Pass <extended_param> to programmer.
-y Count # erase cycles in EEPROM.
-Y <number> Initialize erase cycle # in EEPROM.
-v Verbose output. -v -v for more.
-q Quell progress output. -q -q for less.
-? Display this usage.
avrdude version 5.10, URL: <http://savannah.nongnu.org/projects/avrdude/>
Yes, i installed Crosspack for AVR dev on my Mac, in Terminal :
Usage: avrdude [options]
Options:
-p Required. Specify AVR device.
-b Override RS-232 baud rate.
-B Specify JTAG/STK500v2 bit clock period (us).
-C Specify location of configuration file.
-c Specify programmer type.
-D Disable auto erase for flash memory
-i ISP Clock Delay [in microseconds]
-P Specify connection port.
-F Override invalid signature check.
-e Perform a chip erase.
-O Perform RC oscillator calibration (see AVR053).
-U :r|w|v:[:format]
Memory operation specification.
Multiple -U options are allowed, each request
is performed in the order specified.
-n Do not write anything to the device.
-V Do not verify.
-u Disable safemode, default when running from a script.
-s Silent safemode operation, will not ask you if
fuses should be changed back.
-t Enter terminal mode.
-E [,] List programmer exit specifications.
-x <extended_param> Pass <extended_param> to programmer.
-y Count # erase cycles in EEPROM.
-Y Initialize erase cycle # in EEPROM.
-v Verbose output. -v -v for more.
-q Quell progress output. -q -q for less.
-? Display this usage.
Excellent. The next step is to construct a set of arguments that query the target (the ATmega8) for basic information. For example, this is how I query an ATtiny85 processor using a Pololu AVR Programmer...
avrdude -v -v -v -pattiny85 -cavrispv2 -P\.\COM8
You need to use "atmega8" for the part and I believe "avrispmkII" for the programmer. You will have to determine the correct value for the port (the "\.\COM8" in my example). Something similar to this...
I'm using dos command prompt on PC which has avrdude 5.10
It is giving me an timeout message, not sure what the right port is, I went to Device manager but didn't see the AVRISP anywhere.
It is connected via USB
Whew, what a long journey, finaly getting some results.
I uninstalled avr studio, reinstalled winavr, removed the jungo driver, installed the atmel driver from winavr/utils/libusb/bin
Now when typing the command I receive a bunch of infos, and it detects the ATMEGA8 ;))
It gives some errors at the end however.
I got my first chip bootloaded and running a sketch.
I setup the chip on a breadboard ( http://itp.nyu.edu/physcomp/Tutorials/ArduinoBreadboard )
Then I used Arduino IDE to burn a bootloader via AVRISPmkii
Then I used Arduino IDE to upload sketch to the empty UNO board, from which I used RX+TX to program the Atmega8
However, it didn't work with the chip I had problems with in first instance, is there a way to recover it ?
Thank you
I uninstalled avr studio, reinstalled winavr, removed the jungo driver
Ugh. I had forgotten about the annoying Jungo driver and avrdude not playing well together. Sorry about that.
It sounds like you have gotten past this problem...
Is that true?
However, it didn't work with the chip I had problems with in first instance, is there a way to recover it ?
Maybe. You need to determine the fuse-bit settings. If everything is working correctly, running the simple avrdude command I showed earlier outputs something like this at the end...
Yes, Jungo driver problem is the past now :)) very easy to switch for avrdude or avr studio now, by changing the mkii driver in Windows device manager, it takes a few seconds. I hope to write a little illustrated tutorial about this annoying issue.
And thank you for the avrdude suggestion, this is what made me find out the conflict between libusb and jungo, after that it went all very easy using Arduino ide to burn the bootloader, and upload a sketch.
My next lesson is to program a chip without a bootloader, I have a few attiny13 I would like to use.
About the hardware setup, can all the chips work with a 16mhz crystal ? I understand you can configure them for using their internal oscillator, I just don't know what difference it makes, sorry for lack of knowledge.
pimousse:
And thank you for the avrdude suggestion, this is what made me find out the conflict between libusb and jungo, after that it went all very easy using Arduino ide to burn the bootloader, and upload a sketch.
Glad to know you are making progress!
My next lesson is to program a chip without a bootloader, I have a few attiny13 I would like to use.
I've had a great deal of success programming ATtiny85, ATtiny84, and ATtiny2313 processors without a bootloader.
About the hardware setup, can all the chips work with a 16mhz crystal?
All the processors I've used are able to work with an external 16 MHz crystal.
I understand you can configure them for using their internal oscillator, I just don't know what difference it makes, sorry for lack of knowledge.
You can. The internal oscillator is nice for power-saving applications or applications where you need the extra two I/O pins. The downside is the accuracy. From the factory, the oscillator is calibrated to ±10%. It's fairly easy to calibrate it to ±1% (or better if the voltage and ambient temperature are fairly stable).
Honestly, because it was the first time, I am sure I did exactly as it is described, word for word, nothing fancy, especialy at this level.
I don't know for you, but I think on my side the mistake was using the UNO to burn the bootloader, I think it was not using the crystal or something like that from what I read.
I was suggested to try to use an external clock at 1Mh to communicate back with my device.
I'm sorry if I'm not very helpful.
Regards,
pimousse:
Honestly, because it was the first time, I am sure I did exactly as it is described, word for word, nothing fancy, especialy at this level.
But that's the problem. The tutorial does not indicate which value goes to which place. Even if you follow the instructions precisely, you have a fifty-fifty chance of making a mistake.
I'm sorry if I'm not very helpful.
No need for you to apologize!
I was suggested to try to use an external clock at 1Mh to communicate back with my device.
That is (sort of) worth trying. Not the "external clock" part but the lower frequency part.
If the fuse bytes are swapped, the the clock is set to "Ext Crystal/Resonator Low Freq". The datasheet mentions a "32.768kHz watch crystal" when the clock is set to that value. I assume that means that you would connect a watch crystal on the XTAL pins (with capacitors). You will also have to lower the frequency of your programmer.