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

0 Members and 1 Guest are viewing this topic.

Offline Psi

  • Super Contributor
  • ***
  • Posts: 9961
  • Country: nz
Re: ATmega8 with arduino as ISP programming issues...
« Reply #50 on: July 18, 2012, 02:11:18 pm »
Looks like it's communicating with thin air.
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 #51 on: July 18, 2012, 02:12:46 pm »
Looks like it's communicating with thin air.

Which is the opposite of what I want :P

I noticed in the help menu, an option to erase chip...  Should I give this a go?
 

Offline TerminalJack505

  • Super Contributor
  • ***
  • Posts: 1310
  • Country: 00
Re: ATmega8 with arduino as ISP programming issues...
« Reply #52 on: July 18, 2012, 02:13:01 pm »
That's weird.  It didn't read any of the fuse settings and the signature is blank.  I'm pretty sure that's how you read the fuse bits.

You might have some options you can set via the 'params' command as well since your Arduino is emulating an AVR ISP.

There's a timing-related parameter in there that I've had to change a few times.
 

Offline GabYoung92Topic starter

  • Regular Contributor
  • *
  • Posts: 138
  • Country: au
Re: ATmega8 with arduino as ISP programming issues...
« Reply #53 on: July 18, 2012, 02:14:29 pm »
That's weird.  It didn't read any of the fuse settings and the signature is blank.  I'm pretty sure that's how you read the fuse bits.

You might have some options you can set via the 'params' command as well since your Arduino is emulating an AVR ISP.

There's a timing-related parameter in there that I've had to change a few times.

I'm all ears to try anything.
 

Offline TerminalJack505

  • Super Contributor
  • ***
  • Posts: 1310
  • Country: 00
Re: ATmega8 with arduino as ISP programming issues...
« Reply #54 on: July 18, 2012, 02:17:41 pm »
Try dumping some of the flash memory.  I'm just curious if you're really communicating with the chip.
 

Offline GabYoung92Topic starter

  • Regular Contributor
  • *
  • Posts: 138
  • Country: au
Re: ATmega8 with arduino as ISP programming issues...
« Reply #55 on: July 18, 2012, 02:20:11 pm »
Try dumping some of the flash memory.  I'm just curious if you're really communicating with the chip.

ATmega8 chip I got today:
Code: [Select]
avrdude> dump flash
>>> dump flash
0000  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
0010  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
0020  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
0030  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|

avrdude>

ATmega8 chip I bought a couple of days ago:
Code: [Select]
avrdude> dump flash
>>> dump flash
0000  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
0010  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
0020  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
0030  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|

avrdude>
 

Offline Psi

  • Super Contributor
  • ***
  • Posts: 9961
  • Country: nz
Re: ATmega8 with arduino as ISP programming issues...
« Reply #56 on: July 18, 2012, 02:26:09 pm »
Does your computer have a printer port (LPT)

You can pretty much wire them up pin for pin to any AVR and reprogram it with avrdude

avrdude -i 20 -p m8 -P lpt1 -c bsd -e -U flash:w:mycode.hex

You need to get 5V from somewhere else though, there is no 5V out on a printer port sadly.

The pinouts can be found here
http://www.pocketmagic.net/wp-content/uploads/2009/02/avr-bsd.png
The labels given (MISO etc.) are the slave micro pins. so just match them up 1:1

The 4 resistors can be anything less than 1K, i normally use 220R or sometimes leave them out completely (risky).

« Last Edit: July 18, 2012, 02:36:51 pm by Psi »
Greek letter 'Psi' (not Pounds per Square Inch)
 

Offline TerminalJack505

  • Super Contributor
  • ***
  • Posts: 1310
  • Country: 00
Re: ATmega8 with arduino as ISP programming issues...
« Reply #57 on: July 18, 2012, 02:34:54 pm »
So what does the 'parms' command return?  There's a 'SCK period' setting.  My ISP returns 10.37 us.  I'm curious what yours is.

Code: [Select]
~ > avrdude -p m8 -c avrispmkII -P usb -t

avrdude: AVR device initialized and ready to accept instructions

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

avrdude: Device signature = 0x1e9307
avrdude> parms
>>> parms
Vtarget         : 5.0 V
SCK period      : 10.37 us
avrdude>
 

Offline GabYoung92Topic starter

  • Regular Contributor
  • *
  • Posts: 138
  • Country: au
Re: ATmega8 with arduino as ISP programming issues...
« Reply #58 on: July 18, 2012, 02:38:20 pm »
Does your computer have a printer port (LPT)

You can pretty much wire them up pin for pin to any AVR and reprogram it with avrdude

avrdude -i 20 -p m8 -P lpt1 -c bsd -e -U flash:w:mycode.hex

The pinouts can be found here
http://www.pocketmagic.net/wp-content/uploads/2009/02/avr-bsd.png
The labels given (MISO etc.) are the slave micro pins. so just match them up 1:1

You need to get 5V from somewhere else though, there is no 5V out on a printer port sadly.

I'll have to try that tomorrow on another computer (My laptop doesn't have a LPT).  Power will be no problem

TerminalJack505:

Code: [Select]
avrdude> parms
>>> parms
Vtarget         : 0.0 V
Varef           : 0.0 V
Oscillator      : Off
SCK period      : 0.1 us
avrdude>

A whole load of nothing...  by the looks of it.  Using my DMM, GND to VCC has 5.14V




http://www.logikdev.com/2011/02/15/reset-clock-fuse-bits-on-avr/
I know that's not for my chip, but maybe?
 

Offline TerminalJack505

  • Super Contributor
  • ***
  • Posts: 1310
  • Country: 00
Re: ATmega8 with arduino as ISP programming issues...
« Reply #59 on: July 18, 2012, 02:39:57 pm »
Just realized that I gave you the wrong commands for reading the fuses.  Try these...

dump lfuse 0 1
dump hfuse 0 1
dump lock 0 1

 

Offline GabYoung92Topic starter

  • Regular Contributor
  • *
  • Posts: 138
  • Country: au
Re: ATmega8 with arduino as ISP programming issues...
« Reply #60 on: July 18, 2012, 02:41:00 pm »
Just realized that I gave you the wrong commands for reading the fuses.  Try these...

dump lfuse 0 1
dump hfuse 0 1
dump lock 0 1

Code: [Select]
avrdude> dump lfuse 0 1
>>> dump lfuse 0 1
0000  00                                                |.               |

avrdude> dump hfuse 0 1
>>> dump hfuse 0 1
0000  00                                                |.               |

avrdude> dump lock 0 1
>>> dump lock 0 1
0000  00                                                |.               |

avrdude>
 

Offline TerminalJack505

  • Super Contributor
  • ***
  • Posts: 1310
  • Country: 00
Re: ATmega8 with arduino as ISP programming issues...
« Reply #61 on: July 18, 2012, 02:45:03 pm »
Those fuse settings aren't right, obviously.

That SCK period may be too fast.  Try changing it with the SCK command.

Code: [Select]
sck 11
 

Offline GabYoung92Topic starter

  • Regular Contributor
  • *
  • Posts: 138
  • Country: au
Re: ATmega8 with arduino as ISP programming issues...
« Reply #62 on: July 18, 2012, 02:47:28 pm »
Those fuse settings aren't right, obviously.

That SCK period may be too fast.  Try changing it with the SCK command.

Code: [Select]
sck 11

I wired up an ATmega8515 and I'm getting the same thing.  Maybe it's the arduino or the protocol that's causing errors?

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

avrdude: please define PAGEL and BS2 signals in the configuration file for part
ATMEGA8515
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 ATMEGA8515 is 1E 93 06
avrdude> sig
>>> sig

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

Device signature = 0x000000

avrdude> part
>>> part

AVR Part                      : ATMEGA8515
Chip Erase delay              : 9000 us
PAGEL                         : P00
BS2                           : P00
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    0      0  9000  9000 0xff 0
xff
  flash         33     6    64    0 yes      8192   64    128  4500  4500 0xff 0
xff
  lfuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0
x00
  hfuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0
x00
  lock           0     0     0    0 no          1    0      0  4500  4500 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>
« Last Edit: July 18, 2012, 02:49:54 pm by GabYoung92 »
 

Offline TerminalJack505

  • Super Contributor
  • ***
  • Posts: 1310
  • Country: 00
Re: ATmega8 with arduino as ISP programming issues...
« Reply #63 on: July 18, 2012, 02:50:08 pm »
Could be.  That page you linked to used a setting of 1000 for the SCK parm.  You might try that.  That setting basically controls how fast the programmer talks to the chip so 0.1us may be to fast.  I'm using 10us on my programmer.  1000us should work for any clock speed.
 

Offline GabYoung92Topic starter

  • Regular Contributor
  • *
  • Posts: 138
  • Country: au
Re: ATmega8 with arduino as ISP programming issues...
« Reply #64 on: July 18, 2012, 02:55:16 pm »
Those fuse settings aren't right, obviously.

That SCK period may be too fast.  Try changing it with the SCK command.

Code: [Select]
sck 11

Code: [Select]
avrdude> sck 11
>>> sck 11

avrdude: stk500_setparm(): (a) protocol error, expect=0x14, resp=0x12
avrdude (sck): failed to set SCK period (rc = -2)
avrdude>

Plus, the heartbeat, error and programming leds are all on now.

I don't know..  I think I may leave this for now and give the LPT port a go later on.

 

Offline TerminalJack505

  • Super Contributor
  • ***
  • Posts: 1310
  • Country: 00
Re: ATmega8 with arduino as ISP programming issues...
« Reply #65 on: July 18, 2012, 02:58:27 pm »
I bet the Arduino ISP firmware doesn't support that option.  The timing is probably hardcoded.

Did you check the status of the RESET# pin on the ATmega8 while you where in avrdude?  It should be low.
 

Offline GabYoung92Topic starter

  • Regular Contributor
  • *
  • Posts: 138
  • Country: au
Re: ATmega8 with arduino as ISP programming issues...
« Reply #66 on: July 18, 2012, 03:01:45 pm »
I bet the Arduino ISP firmware doesn't support that option.  The timing is probably hardcoded.

Did you check the status of the RESET# pin on the ATmega8 while you where in avrdude?  It should be low.

While avrdude is running.  The programing led is on, and I'm getting (DMM) 0V on the reset pin of the ATmega8 chip.  With reference to VCC, the RESET pin is -5.1 volts, so low.


Something I've just noticed...

Code: [Select]
avrdude> parms
>>> parms
Vtarget         : 0.0 V
Varef           : 0.0 V
Oscillator      : Off
SCK period      : 0.1 us

Oscillator is off.. should that be?
 

Offline TerminalJack505

  • Super Contributor
  • ***
  • Posts: 1310
  • Country: 00
Re: ATmega8 with arduino as ISP programming issues...
« Reply #67 on: July 18, 2012, 03:10:15 pm »
I'm guessing we're not using avrdude correctly for the ISP 'programmer'. 

Just for grins you might try this as well when you launch avrdude...

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

The oscillator option probably works like the STK500 where you can have it (the STK500 board) generate a clock for the MCU.  You don't want that in this case.
 

Offline GabYoung92Topic starter

  • Regular Contributor
  • *
  • Posts: 138
  • Country: au
Re: ATmega8 with arduino as ISP programming issues...
« Reply #68 on: July 18, 2012, 03:17:27 pm »
I'm guessing we're not using avrdude correctly for the ISP 'programmer'. 

Just for grins you might try this as well when you launch avrdude...

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

The oscillator option probably works like the STK500 where you can have it (the STK500 board) generate a clock for the MCU.  You don't want that in this case.

Changing the -c param causes the error LED to light and I just receive a timeout message.  I've found using -c with AVRisp is the only way to get avrdude communicating through the arduinoISP. (Not sure if it is actually working, but the terminal seems to like it). 

I've got a feeling that the chip has been programmed to use an external clock which I think may explain why they are not responding as expected. 

I will give the printer port a go tomorrow.  Thanks guys!

 
 

Offline TerminalJack505

  • Super Contributor
  • ***
  • Posts: 1310
  • Country: 00
Re: ATmega8 with arduino as ISP programming issues...
« Reply #69 on: July 18, 2012, 03:26:40 pm »
Quote
I've got a feeling that the chip has been programmed to use an external clock which I think may explain why they are not responding as expected.

Have you tried hooking up a crystal and capacitors to the XTAL1 and XTAL2 pins?
 

Offline Erwin Ried

  • Regular Contributor
  • *
  • Posts: 201
  • Country: no
Re: ATmega8 with arduino as ISP programming issues...
« Reply #70 on: July 19, 2012, 01:12:14 am »
I'm guessing we're not using avrdude correctly for the ISP 'programmer'. 

Just for grins you might try this as well when you launch avrdude...

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

The oscillator option probably works like the STK500 where you can have it (the STK500 board) generate a clock for the MCU.  You don't want that in this case.

Changing the -c param causes the error LED to light and I just receive a timeout message.  I've found using -c with AVRisp is the only way to get avrdude communicating through the arduinoISP. (Not sure if it is actually working, but the terminal seems to like it). 

I've got a feeling that the chip has been programmed to use an external clock which I think may explain why they are not responding as expected. 

I will give the printer port a go tomorrow.  Thanks guys!

 

Buy a cheap USB ISP programmer in ebay, I got mine at 4 usd with the cable and shipment ( http://www.ebay.com/itm/USB-ASP-ISP-Programmer-Adapter-10-Pin-Cable-For-ATMega8-AVRDude-CAN-PWM-Series-/140784185108?pt=LH_DefaultDomain_0&hash=item20c7642f14 ). I use khazama programmer to upload the code, no commands and let your arduino to be free :D

My website: http://ried.cl
 

Offline GabYoung92Topic starter

  • Regular Contributor
  • *
  • Posts: 138
  • Country: au
Re: ATmega8 with arduino as ISP programming issues...
« Reply #71 on: July 19, 2012, 01:18:56 am »
Just bought the programmer... Now to wait till it arrives :P



TerminalJack505,
I don't have any spare ones, however I could pull one out of an old device.  Should I try and find a certain frequency?


And I'm unable to use the parallel port :(
 

Offline TerminalJack505

  • Super Contributor
  • ***
  • Posts: 1310
  • Country: 00
Re: ATmega8 with arduino as ISP programming issues...
« Reply #72 on: July 19, 2012, 01:27:39 am »
Just bought the programmer... Now to wait till it arrives :P



TerminalJack505,
I don't have any spare ones, however I could pull one out of an old device.  Should I try and find a certain frequency?


And I'm unable to use the parallel port :(

The more I think about it, the more I suspect the 'programmer'.  Especially considering it didn't work with the 8515.  Assuming, of course, we were invoking avrdude correctly for that particular programmer.
 

Offline GabYoung92Topic starter

  • Regular Contributor
  • *
  • Posts: 138
  • Country: au
Re: ATmega8 with arduino as ISP programming issues...
« Reply #73 on: July 19, 2012, 02:09:58 am »
Ok I found a LPT header in my tower, grabed pin diagrams and hooked it up as per a previous post. 

I've tried to install the giveio but...

Code: [Select]
H:\avr\bin>install_giveio
Copying the driver to the windows directory
target file: C:\Windows\giveio.sys
        1 file(s) copied.
Remove a running service if needed...
Installing Windows NT/2k/XP driver: giveio
installing giveio from C:\Windows\giveio.sys... ok.
starting giveio... start failed (status 1275):
This driver has been blocked from loading

ERROR: Installation of giveio failed

I am running windows7 64bit.  I've given a quick google search and most things I've read say it doesn't work on 64bit.  Is there any other program I could use or would it be best to wait until my programmer arrives?
(http://www.ebay.com/itm/USB-ASP-ISP-Programmer-Adapter-10-Pin-Cable-For-ATMega8-AVRDude-CAN-PWM-Series-/140784185108?pt=LH_DefaultDomain_0&hash=item20c7642f14)
 

Offline Psi

  • Super Contributor
  • ***
  • Posts: 9961
  • Country: nz
Re: ATmega8 with arduino as ISP programming issues...
« Reply #74 on: July 19, 2012, 02:20:24 am »
Just to test it you could boot that PC on a ubuntu linux live cd.

sudo su

apt-get install avrdude

avrdude -i 20  -p m8 -P /dev/parport0 -E noreset -c bsd -e -U flash:w:mycode.hex


If you're wondering what the "-E no reset" does it just means the mcu will start running once avrdude finishes.
(Otherwise avrdude sets the port back how it found it, which in linux is with reset held low)
« Last Edit: July 19, 2012, 02:30:04 am by Psi »
Greek letter 'Psi' (not Pounds per Square Inch)
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf