Author Topic: ATmega8 with arduino as ISP programming issues...  (Read 72116 times)

0 Members and 1 Guest are viewing this topic.

Offline GabYoung92Topic starter

  • Regular Contributor
  • *
  • Posts: 138
  • Country: au
Re: ATmega8 with arduino as ISP programming issues...
« Reply #25 on: July 18, 2012, 12:46:07 pm »
I have to wonder if your Arduino has lost it's 'programmer' firmware.  Have you tried re-uploading it?

Shouldn't have... I've reaupload the ArduinoISP sketch again and reconnected up the ATmega8 via http://arduino.cc/en/Tutorial/ArduinoISP  (bottom left image)

Code: [Select]
avrdude -p m8 -c arduino -P COM7 -t

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.01s

avrdude: Device signature = 0x1e950f
avrdude: Expected signature for ATMEGA8 is 1E 93 07
         Double check chip, or use -F to override this check.

avrdude done.  Thank you.

Yup it's reading the signature of the arduino 328p chip, not the ATmega8...  should I be using any other commands for AVRdude?

Bit of a bummer really... New chip, got to upload once, now same issues.  Should have burnt the bootloader?
 

Offline TerminalJack505

  • Super Contributor
  • ***
  • Posts: 1310
  • Country: 00
Re: ATmega8 with arduino as ISP programming issues...
« Reply #26 on: July 18, 2012, 12:53:17 pm »
It's interesting that your config file is using a slower upload speed than the webpage you linked to.

Your config has this:

atmega8u.upload.speed=19200

...and one of the pages has this:

atmega8noxtal.upload.speed=38400

Have you tried both just in case?

The only other thing I can think of is there's an issue with the reset line.  Maybe the Arudino programmer isn't pulling it low.
 

Offline GabYoung92Topic starter

  • Regular Contributor
  • *
  • Posts: 138
  • Country: au
Re: ATmega8 with arduino as ISP programming issues...
« Reply #27 on: July 18, 2012, 12:59:15 pm »
It's interesting that your config file is using a slower upload speed than the webpage you linked to.

Your config has this:

atmega8u.upload.speed=19200

...and one of the pages has this:

atmega8noxtal.upload.speed=38400

Have you tried both just in case?

The only other thing I can think of is there's an issue with the reset line.  Maybe the Arudino programmer isn't pulling it low.

Yes, I had changed the speed.

Using 38400, The error led just lights and I get:
avrdude: stk500_getsync(): not in sync: resp=0x66

Using 19200, There is programming via the status led, and I get:
avrdude: verification error, first mismatch at byte 0x00c0
         0x64 != 0x60
avrdude: verification error; content mismatch

Using 9600, I get a solid error status and:
avrdude: stk500_getsync(): not in sync: resp=0xff


 

Offline TerminalJack505

  • Super Contributor
  • ***
  • Posts: 1310
  • Country: 00
Re: ATmega8 with arduino as ISP programming issues...
« Reply #28 on: July 18, 2012, 01:05:32 pm »
I notice that you said you didn't burn a boot loader.  I haven't looked too close but the fuse bits in that config look like they are setup for a boot loader.
 

Offline GabYoung92Topic starter

  • Regular Contributor
  • *
  • Posts: 138
  • Country: au
Re: ATmega8 with arduino as ISP programming issues...
« Reply #29 on: July 18, 2012, 01:12:16 pm »
I notice that you said you didn't burn a boot loader.  I haven't looked too close but the fuse bits in that config look like they are setup for a boot loader.

No, I haven't burnt one.  I was going to avoid burning one as I was going to upload the program to the chip and put it into a board stuck in my power supply so I didn't see the point of using it.  Also I don't have any 16Mhz X-TAL, so i was trying to use the internal clock as timing is not critical. 


Also, Thanks for your help. I hope I'm not making you pull your hair out :P
 

Offline TerminalJack505

  • Super Contributor
  • ***
  • Posts: 1310
  • Country: 00
Re: ATmega8 with arduino as ISP programming issues...
« Reply #30 on: July 18, 2012, 01:13:15 pm »
Quote
I've attached extra code to set digital pin 0 (pin2) to high.  I'm still only reading 0.1V on that pin.    I'll pull all the wires out and start again?

Is this the pin that connects to the ATmega8's RESET# pin?  Is this change something you did in the Arduino ISP code?
 

Offline Psi

  • Super Contributor
  • ***
  • Posts: 10181
  • Country: nz
Re: ATmega8 with arduino as ISP programming issues...
« Reply #31 on: July 18, 2012, 01:16:16 pm »
How come the high fuse bits are set C2

Quote
atmega8u.bootloader.high_fuses=0xc2
atmega8u.bootloader.low_fuses=0xe4

C2 = 1100 0010

This sets CKOPT to 0 (programmed)

ATMega8 datasheet says CLOPT should be un-programmed when using internal RC clock

Un-programmed is the default so this may explain why it worked the first time.

The low fuse value E4 seems ok, but it does set CKSEL to 0100 which for internal RC is 8mhz which i had issues with.

Greek letter 'Psi' (not Pounds per Square Inch)
 

Offline GabYoung92Topic starter

  • Regular Contributor
  • *
  • Posts: 138
  • Country: au
Re: ATmega8 with arduino as ISP programming issues...
« Reply #32 on: July 18, 2012, 01:17:34 pm »
Quote
I've attached extra code to set digital pin 0 (pin2) to high.  I'm still only reading 0.1V on that pin.    I'll pull all the wires out and start again?

Is this the pin that connects to the ATmega8's RESET# pin?  Is this change something you did in the Arduino ISP code?

The arduino has the arduinoISP sketch on it. I was trying to upload my code to the ATmega8 chip using the arduino as the ISP. I added code into my program to switch HIGH an unused digital pin (pin 0, physical pin 2) on the ATmega8 chip to do some debugging.  Pin 1 of the chip is the Reset pin, pin 2 is digital pin 0.  There is no shorts between these two pins. 
 

Offline GabYoung92Topic starter

  • Regular Contributor
  • *
  • Posts: 138
  • Country: au
Re: ATmega8 with arduino as ISP programming issues...
« Reply #33 on: July 18, 2012, 01:19:10 pm »
How come the high fuse bits are set C2

Quote
atmega8u.bootloader.high_fuses=0xc2
atmega8u.bootloader.low_fuses=0xe4

C2 = 1100 0010

This sets CKOPT to 0 (programmed)

ATMega8 datasheet says CLOPT should be un-programmed when using internal RC clock

Un-programmed is the default so this may explain why it worked the first time.

The low fuse value E4 seems ok, but it does set CKSEL to 0100 which for internal RC is 8mhz which i had issues with.

I see where you are coming from.  So I'm guessing I need to obtain an external oscillator and reprogram the high fuses or erase the device?
 

Offline TerminalJack505

  • Super Contributor
  • ***
  • Posts: 1310
  • Country: 00
Re: ATmega8 with arduino as ISP programming issues...
« Reply #34 on: July 18, 2012, 01:21:03 pm »
Quote
The arduino has the arduinoISP sketch on it. I was trying to upload my code to the ATmega8 chip using the arduino as the ISP. I added code into my program to switch HIGH an unused digital pin (pin 0, physical pin 2) on the ATmega8 chip to do some debugging.  Pin 1 of the chip is the Reset pin, pin 2 is digital pin 0.  There is no shorts between these two pins.

Ah.  I see.

I notice that you said you didn't burn a boot loader.  I haven't looked too close but the fuse bits in that config look like they are setup for a boot loader.

No, I haven't burnt one.  I was going to avoid burning one as I was going to upload the program to the chip and put it into a board stuck in my power supply so I didn't see the point of using it.  Also I don't have any 16Mhz X-TAL, so i was trying to use the internal clock as timing is not critical. 


Also, Thanks for your help. I hope I'm not making you pull your hair out :P

No problem.  I'm probably not going to be of much help since I've never tried using a Arduino for ISP before. 

I'm guessing you don't happen to have an AVR ISPMKII, JTAG ICE or Dragon?
 

Offline GabYoung92Topic starter

  • Regular Contributor
  • *
  • Posts: 138
  • Country: au
Re: ATmega8 with arduino as ISP programming issues...
« Reply #35 on: July 18, 2012, 01:27:52 pm »
Quote
I'm guessing you don't happen to have an AVR ISPMKII, JTAG ICE or Dragon?

unfortunately not.  That's why I'm using the Arduino :P   

Just gave a quick ebay search.  Should I get myself a one hung low one to play around with or go the extra and get a brand name one?
 

Offline TerminalJack505

  • Super Contributor
  • ***
  • Posts: 1310
  • Country: 00
Re: ATmega8 with arduino as ISP programming issues...
« Reply #36 on: July 18, 2012, 01:28:29 pm »
...I'm slowly reading through those webpages you linked to.

Apparently avrdude will talk to the Arduino ISP using the AVR ISP mkII protocol.

If so then you should be able to run:

avrdude -p m8 -c avrispmkII -P com7 -t

...to get into terminal mode.  You might try it and see if you can talk to the device and read the fuse bits.
 

Offline TerminalJack505

  • Super Contributor
  • ***
  • Posts: 1310
  • Country: 00
Re: ATmega8 with arduino as ISP programming issues...
« Reply #37 on: July 18, 2012, 01:31:18 pm »
Quote
Just gave a quick ebay search.  Should I get myself a one hung low one to play around with or go the extra and get a brand name one?

Personally, for the money I'd get an Atmel brand.  That's a topic that will start a war of religions, though, so that's just between you and me.   :D
 

Offline Psi

  • Super Contributor
  • ***
  • Posts: 10181
  • Country: nz
Re: ATmega8 with arduino as ISP programming issues...
« Reply #38 on: July 18, 2012, 01:33:07 pm »
I see where you are coming from.  So I'm guessing I need to obtain an external oscillator and reprogram the high fuses or erase the device?
I'm not sure, CKOPT just adds a capacitor to ground for doing an external RC osc. It may still work with it enabled.

I've not used Arduinos before, only raw AVRs with avrdude. So i'm not sure exactly how the arduino ide fits into things but..

I can't see it ever working until avrdude finds the correct signature.
From your post on the previous page we can see it's finding the programmer mcu and not the ATMega8.
So there must be a setting wrong somewhere.

However.
Quote
avrdude: verification error, first mismatch at byte 0x00c0
         0x64 != 0x60
avrdude: verification error; content mismatch
This text you posted indicates that the programming has actually started but has encountering a mismatch error. Which would indicate that the signature was correct (or it wouldn't have started)

So i'm quite confused.
But if i had to guess i'd say your ATmega8 is still ok and running off the internal RC oscillator correctly.
If a clock fuse had been set wrong and the RC osc stopped working you wouldn't be getting mismatch errors.
« Last Edit: July 18, 2012, 01:37:21 pm by Psi »
Greek letter 'Psi' (not Pounds per Square Inch)
 

Offline GabYoung92Topic starter

  • Regular Contributor
  • *
  • Posts: 138
  • Country: au
Re: ATmega8 with arduino as ISP programming issues...
« Reply #39 on: July 18, 2012, 01:34:02 pm »
...I'm slowly reading through those webpages you linked to.

Apparently avrdude will talk to the Arduino ISP using the AVR ISP mkII protocol.

If so then you should be able to run:

avrdude -p m8 -c avrispmkII -P com7 -t

...to get into terminal mode.  You might try it and see if you can talk to the device and read the fuse bits.

Using -c arduino I get incorect signature (the 328p responds)

Using -c avrispmkII I get a solid error led and:

avrdude -p m8 -c avrispmkII -P com7 -t
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout



Quote
Just gave a quick ebay search.  Should I get myself a one hung low one to play around with or go the extra and get a brand name one?

Personally, for the money I'd get an Atmel brand.  That's a topic that will start a war of religions, though, so that's just between you and me.   :D

Fair enough.  I may get a cheapie for now.  Then later down the track get a proper programmer. 
 

Offline GabYoung92Topic starter

  • Regular Contributor
  • *
  • Posts: 138
  • Country: au
Re: ATmega8 with arduino as ISP programming issues...
« Reply #40 on: July 18, 2012, 01:39:00 pm »
PSI, that's what has had my confused.

It needs an upload bitrate of 19200 to work at all, status lights display programming correctly, it's just the verification that's the issue.

 

Offline TerminalJack505

  • Super Contributor
  • ***
  • Posts: 1310
  • Country: 00
Re: ATmega8 with arduino as ISP programming issues...
« Reply #41 on: July 18, 2012, 01:41:00 pm »
Quote
Using -c avrispmkII I get a solid error led and:

avrdude -p m8 -c avrispmkII -P com7 -t
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout

You might need to use either the -b option or the -B option.  Either that or the -P option will be something different.

For now try using -B...

avrdude -p m8 -c avrispmkII -P com7 -B 100 -t
 

Offline Psi

  • Super Contributor
  • ***
  • Posts: 10181
  • Country: nz
Re: ATmega8 with arduino as ISP programming issues...
« Reply #42 on: July 18, 2012, 01:42:31 pm »
So you get the avrdude progress bar ####### etc...
It just says mismatch during the read back part?
Greek letter 'Psi' (not Pounds per Square Inch)
 

Offline GabYoung92Topic starter

  • Regular Contributor
  • *
  • Posts: 138
  • Country: au
Re: ATmega8 with arduino as ISP programming issues...
« Reply #43 on: July 18, 2012, 01:45:50 pm »
TerminalJack505,

Code: [Select]
avrdude -p m8 -c avrispmkII -P com7 -B 100 -t
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
^C

Psi,

No there's no progress bar (I'm assuimging you mean in the Arduino IDE)  Just going straight to and error.


Not sure what I've done now, but all I'm getting is an invalid signature error. 
 

Offline TerminalJack505

  • Super Contributor
  • ***
  • Posts: 1310
  • Country: 00
Re: ATmega8 with arduino as ISP programming issues...
« Reply #44 on: July 18, 2012, 01:47:50 pm »
You might try this then...

avrdude -p m8 -c avrispmkII -P com7 -b 19200 -t
 

Offline GabYoung92Topic starter

  • Regular Contributor
  • *
  • Posts: 138
  • Country: au
Re: ATmega8 with arduino as ISP programming issues...
« Reply #45 on: July 18, 2012, 01:52:38 pm »
You might try this then...

avrdude -p m8 -c avrispmkII -P com7 -b 19200 -t

I just get:
Code: [Select]
avrdude: stk500v2_ReceiveMessage(): timeout
However....

Code: [Select]
C:\Users\Gabriel Young\Desktop\Freetronics\arduino-1.0.1\hardware\tools\avr\bin>
avrdude -p m8 -c AVRisp -P com7 -b 9600 -t
avrdude: stk500_getsync(): not in sync: resp=0xff

avrdude done.  Thank you.


C:\Users\Gabriel Young\Desktop\Freetronics\arduino-1.0.1\hardware\tools\avr\bin>
avrdude -p m8 -c AVRisp -P com7 -b 38400 -t
avrdude: stk500_getsync(): not in sync: resp=0x66

avrdude done.  Thank you.


C:\Users\Gabriel Young\Desktop\Freetronics\arduino-1.0.1\hardware\tools\avr\bin>
avrdude -p m8 -c AVRisp -P com7 -b 19200 -t

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.08s

avrdude: Device signature = 0x000000
avrdude: Yikes!  Invalid device signature.
         Double check connections and try again, or use -F to override
         this check.


avrdude done.  Thank you.
 

Offline TerminalJack505

  • Super Contributor
  • ***
  • Posts: 1310
  • Country: 00
Re: ATmega8 with arduino as ISP programming issues...
« Reply #46 on: July 18, 2012, 01:57:06 pm »
Well, you might as well use the -F option just so you can maybe get a little peek at what it's connecting to.
 

Offline GabYoung92Topic starter

  • Regular Contributor
  • *
  • Posts: 138
  • Country: au
Re: ATmega8 with arduino as ISP programming issues...
« Reply #47 on: July 18, 2012, 02:00:38 pm »
Well, you might as well use the -F option just so you can maybe get a little peek at what it's connecting to.

Code: [Select]
avrdude -p m8 -c AVRisp -P com7 -b 19200 -t -F

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.07s

avrdude: Device signature = 0x000000
avrdude: Yikes!  Invalid device signature.
avrdude: Expected signature for ATMEGA8 is 1E 93 07
avrdude> ?
>>> ?
Valid commands:

  dump   : dump memory  : dump <memtype> <addr> <N-Bytes>
  read   : alias for dump
  write  : write memory : write <memtype> <addr> <b1> <b2> ... <bN>
  erase  : perform a chip erase
  sig    : display device signature bytes
  part   : display the current part information
  send   : send a raw command : send <b1> <b2> <b3> <b4>
  parms  : display adjustable parameters (STK500 only)
  vtarg  : set <V[target]> (STK500 only)
  varef  : set <V[aref]> (STK500 only)
  fosc   : set <oscillator frequency> (STK500 only)
  sck    : set <SCK period> (STK500 only)
  spi    : enter direct SPI mode
  pgm    : return to programming mode
  help   : help
  ?      : help
  quit   : quit

Use the 'part' command to display valid memory types for use with the
'dump' and 'write' commands.

avrdude> sig
>>> sig

Reading | ################################################## | 100% 0.08s

Device signature = 0x000000

avrdude> part
>>> part

AVR Part                      : ATMEGA8
Chip Erase delay              : 10000 us
PAGEL                         : PD7
BS2                           : PC2
RESET disposition             : dedicated
RETRY pulse                   : SCK
serial program mode           : yes
parallel program mode         : yes
Timeout                       : 200
StabDelay                     : 100
CmdexeDelay                   : 25
SyncLoops                     : 32
ByteDelay                     : 0
PollIndex                     : 3
PollValue                     : 0x53
Memory Detail                 :

                         Block Poll               Page                       Pol
led
  Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadB
ack
  ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ------
---
  eeprom         4    20   128    0 no        512    4      0  9000  9000 0xff 0
xff
  flash         33    10    64    0 yes      8192   64    128  4500  4500 0xff 0
x00
  lfuse          0     0     0    0 no          1    0      0  2000  2000 0x00 0
x00
  hfuse          0     0     0    0 no          1    0      0  2000  2000 0x00 0
x00
  lock           0     0     0    0 no          1    0      0  2000  2000 0x00 0
x00
  calibration    0     0     0    0 no          4    0      0     0     0 0x00 0
x00
  signature      0     0     0    0 no          3    0      0     0     0 0x00 0
x00

avrdude>
 

Offline TerminalJack505

  • Super Contributor
  • ***
  • Posts: 1310
  • Country: 00
Re: ATmega8 with arduino as ISP programming issues...
« Reply #48 on: July 18, 2012, 02:06:35 pm »
That's encouraging.  Try the following...

dump lfuse 0 0
dump hfuse 0 0
dump lock 0 0
dump signature 0 3

 

Offline GabYoung92Topic starter

  • Regular Contributor
  • *
  • Posts: 138
  • Country: au
Re: ATmega8 with arduino as ISP programming issues...
« Reply #49 on: July 18, 2012, 02:08:09 pm »
That's encouraging.  Try the following...

dump lfuse 0 0
dump hfuse 0 0
dump lock 0 0
dump signature 0 3

I'm hoping that I have done this correctly:

Code: [Select]
avrdude -p m8 -c AVRisp -P com7 -b 19200 -t -F

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.08s

avrdude: Device signature = 0x000000
avrdude: Yikes!  Invalid device signature.
avrdude: Expected signature for ATMEGA8 is 1E 93 07
avrdude> dump lfuse 0 0
>>> dump lfuse 0 0

avrdude> dump hfuse 0 0
>>> dump hfuse 0 0

avrdude> dump lock 0 0
>>> dump lock 0 0

avrdude> dump signature 0 3
>>> dump signature 0 3
0000  00 00 00                                          |...             |

avrdude> sig
>>> sig

Reading | ################################################## | 100% 0.07s

Device signature = 0x000000

avrdude> part
>>> part

AVR Part                      : ATMEGA8
Chip Erase delay              : 10000 us
PAGEL                         : PD7
BS2                           : PC2
RESET disposition             : dedicated
RETRY pulse                   : SCK
serial program mode           : yes
parallel program mode         : yes
Timeout                       : 200
StabDelay                     : 100
CmdexeDelay                   : 25
SyncLoops                     : 32
ByteDelay                     : 0
PollIndex                     : 3
PollValue                     : 0x53
Memory Detail                 :

                         Block Poll               Page                       Pol
led
  Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadB
ack
  ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ------
---
  eeprom         4    20   128    0 no        512    4      0  9000  9000 0xff 0
xff
  flash         33    10    64    0 yes      8192   64    128  4500  4500 0xff 0
x00
  lfuse          0     0     0    0 no          1    0      0  2000  2000 0x00 0
x00
  hfuse          0     0     0    0 no          1    0      0  2000  2000 0x00 0
x00
  lock           0     0     0    0 no          1    0      0  2000  2000 0x00 0
x00
  calibration    0     0     0    0 no          4    0      0     0     0 0x00 0
x00
  signature      0     0     0    0 no          3    0      0     0     0 0x00 0
x00

avrdude>
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf