Society of Robots - Robot Forum

Software => Software => Topic started by: pocoffey on August 21, 2008, 09:48:40 PM

Title: Problems programming the $50 robot
Post by: pocoffey on August 21, 2008, 09:48:40 PM
Hello,
     I'm building the $50 robot, and I've build the circuit and tested it with a multimeter so I think that's good. The problem is when I try to write the program to the ATMega8. So to start I have the AVR usb programmer and when I connect the power I have 2 green leds on the programmer itself. Inside of AVR studio in the AVRISP MK II window, under the program tab, I have ATMega8 (my chip says on it ATMega8-16PU) selected under device. Under Fuses I have 3 selected:
Boot flash section size=1024 words Boot start address=$0C00
Brown out detection level at VCC=2.7V
Int RC Osc. 1 Mhz; Startup time: 6ck + 64ms

Under the Lockbits tab I have the following selected:
   Mode 1: Number memory lock features enabled.
   Application protection mode 1:...
   Boot loader protection mode 1:...
in the output box it says:
   Setting mode and device parameters.. OK!
   Entering programming mode.. OK!
   Reading lockbits .. 0xFF .. OK!
   Leaving programming mode.. OK!

Under the Advanced tab I can hit the read button next to the signature box and I get this code:
0x1C 0x91 0x05
Warning: Signature does not match selected device
Also, the Calibrate for frequency drop down is set for 1Mhz, the lowest setting.
in the output box it says:
Setting mode and device parameters.. OK!
   Entering programming mode.. OK!
   Reading signature .. 0x1C, 0x91, 0x05 .. OK!
   Leaving programming mode.. OK!

Under the board tab, I have the VTarget set to 5.4(I can't change it anyway so it probably doesn't matter) and the ISP frequency set to 125Khz.

All that said, back under the program tab, I select the photovore program under the flash section. All I did was compile the program, I made no changes. When I hit program, the ouput box says:
   Setting mode and device parameters.. OK!
   Entering programming mode.. OK!
   Erasing device.. OK!
   Programming Flash.. FAILED!
   Leaving programming mode.. OK!
And for the life of me I have no idea why. Some searching on the forums lead me to set the ISP frequency to 125khz, but that hasn't fixed it. Anyone got any ideas? Google seems pretty sparse on solutions that I can understand, although a number of people have had that warning about signature not matching their device, but they usually get all 0's for a signature. Btw if you haven't guessed I'm new to this, so please forgive my ignorance.
Title: Re: Problems programming the $50 robot
Post by: pomprocker on August 22, 2008, 10:12:08 AM
try erasing/resetting your atmega8

you should not need any lock bits or boot lock bits set.

if you're not using a bootloader then you should unprogram the bootrst fuse.

unprogram/disable brown out detection

1MHz 6ck + 64ms is perfect.


Can you expand the window where you select all the fuses and take a screen shot for us and then attach to a post using the additional options link below.
Title: Re: Problems programming the $50 robot
Post by: Admin on August 22, 2008, 12:21:37 PM
What happens when you push 'Read Signature'?
Title: Re: Problems programming the $50 robot
Post by: pocoffey on August 22, 2008, 07:29:53 PM
Hey guys thanks for your responses. I tried unselecting the fuses and lockbits, but it won't let me. And as far as reading the signature, check out the screen shots. I was curious that when I clicked verify for the flash program that it said the flash byte address is wrong, see the second screen shot. Any other suggestions?
Title: Re: Problems programming the $50 robot
Post by: Admin on August 22, 2008, 10:10:00 PM
First, reduce the Oscillator Calibration byte to something much smaller, like 115.2kHz.

Also, try the newest version of AVR Studio:
http://www.atmel.com/dyn/resources/prod_documents/aStudio4b589.exe

I've never seen this error before, try copy/pasting it in google and see what you find . . .

Are you sure you are using ATmega8? (sorry, but I'm running out of ideas!)
Title: Re: Problems programming the $50 robot
Post by: pomprocker on August 22, 2008, 10:49:32 PM
Hey guys thanks for your responses. I tried unselecting the fuses and lockbits, but it won't let me. And as far as reading the signature, check out the screen shots. I was curious that when I clicked verify for the flash program that it said the flash byte address is wrong, see the second screen shot. Any other suggestions?


you can't deselect a lock bit. you have to erase/reset the chip to clear them.
Title: Re: Problems programming the $50 robot
Post by: pocoffey on August 25, 2008, 06:47:58 AM
Hey Guys, sorry for the late reply but work has been keeping me busy. Anyway so when I get home I'm going to try the latest version of AVR studio, but I'm running 4.13 and I think the latest is 4.14 so I don;t hold out much hope that will solve the problem. As far as the oscillator speed, that was a pull down menu and the lowest I could set it was 1 MHz, and the chip says ATMega8 on it. Is there another way to set the oscillator speed? Also when I get home I'll try poking around to see how to reset the chip, and see if that clears the lockbits. Could this be caused by a bad micro controller? Any suggestions would be helpful :-D
Title: Re: Problems programming the $50 robot
Post by: Admin on August 25, 2008, 07:39:02 AM
Quote
As far as the oscillator speed, that was a pull down menu and the lowest I could set it was 1 MHz
This isn't correct. Are you sure you are setting the Oscillator Calibration byte and NOT an oscillator fuse in the fuses menu?
Title: Re: Problems programming the $50 robot
Post by: pocoffey on August 25, 2008, 10:25:11 AM
I'm pretty sure, the first screen shot I posted above was the Advanced tab. You can see in the Oscillator Calibration Byte section, that the frequency is a pull down menu. And the lowest value in the menu is 1Mhz.
Title: Re: Problems programming the $50 robot
Post by: Admin on August 25, 2008, 05:20:46 PM
oops sorry I'm being dumb :-X

what I *meant* to say was change 'ISP Frequency', not oscillation calibration byte . . .

sorry!
Title: Re: Problems programming the $50 robot
Post by: pocoffey on August 27, 2008, 07:33:10 PM
okay I double checked and the ISP Frequency is 125 KHz. And I've upgraded to version 4.14. Still doesn't work, I took a screen shot of what happens when I try to verify, about the wrong flash address. What does that mean?
Title: Re: Problems programming the $50 robot
Post by: Admin on August 27, 2008, 07:53:08 PM
What does it say in the Main tab when you click Read Signature?
Title: Re: Problems programming the $50 robot
Post by: pocoffey on August 27, 2008, 09:24:36 PM
it gives 3 hex numbers and says Warning signature does not match selected device. I've attached a screen shot.
Title: Re: Problems programming the $50 robot
Post by: Admin on August 27, 2008, 09:34:57 PM
Hmmmmm try a few other ISP Frequencies, but it still probably won't work.

I have three theories:
bad wiring
low voltage on batteries
fried chip

If the other two check out, you'll just have to buy another one . . . might as well get an ATmega168 while you're at it ;D
Title: Re: Problems programming the $50 robot
Post by: Novice1 on August 06, 2009, 09:22:52 AM
Try Studio 4.16, anyways, the ISP frequency should be lower than 1/5 the target CPU frequency. You probably do not have a fried chip because the only way for that to happen is if you soldered with it on the circuit which is very unlikelly because even then it takes a while