Can I recover an ATtiny85 with a bad signature?

Go To Last Post
26 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I built a programmer using an Arduino Nano.  The 10uF cap is under the Nano.

 

Since building it, I have reprogrammed the AT85 a lot of times, and the programmer has worked fine.

Edit: To run the chip, I take it out of the programmer and put it on a breadboard.  Its program was working OK when single-stepping in AS-7, but the project was designed to work with a crystal (6553600 Hz).

I reset the AVRDude line in AT-7 Tools/External tools   to set the low-byte fuses to 0xe6 instead of e2, to accept the crystal, but the program download failed with a bad signature fault.

I googled the causes, and saw that it was due to programming it with no crystal connected, so I modified the programmer so I could connect a crystal and two 12pF caps, but it still gave the same error.

I then reverted to basics and reset the fuses for 'no crystal' and tried again, but I still got the signature problem.

I wrote a super-simple blink program, put an unused chip in the programmer, and programmed it with fuses set to 0xe2 (no crystal).  The program loaded without issue and ran correctly.

When I put the previously 'bad' chip in, it still gave signature issues.  Here's what it said ...

 

Note : apparently corrupted chip inserted

avrdude.exe: Version 6.3, compiled on Dec 16 2016 at 13:33:19
             Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
             Copyright (c) 2007-2014 Joerg Wunsch

             System wide configuration file is "C:\Program Files (x86)\Arduino\h
ardware\tools\avr\etc\avrdude.conf"

             Using Port                    : COM5
             Using Programmer              : stk500v1
             Overriding Baud Rate          : 19200
             AVR Part                      : ATtiny85
             Chip Erase delay              : 400000 us
             PAGEL                         : P00
             BS2                           : P00
             RESET disposition             : possible i/o
             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
          Polled
               Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW
 MaxW   ReadBack
----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
eeprom        65    12     4    0 no        512    4      0  4000  4500 0xff 0xff
flash         65     6    32    0 yes      8192   64    128 30000 30000 0xff 0xff
signature      0     0     0    0 no          3    0      0     0     0 0x00 0x00
lock           0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
lfuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
hfuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
efuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
calibration    0     0     0    0 no          1    0      0     0     0 0x00 0x00

             Programmer Type : STK500
             Description     : Atmel STK500 Version 1.x firmware
             Hardware Version: 2
             Firmware Version: 1.18
             Topcard         : Unknown
             Vtarget         : 0.0 V
             Varef           : 0.0 V
             Oscillator      : Off
             SCK period      : 0.1 us

avrdude.exe: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.03s

avrdude.exe: Device signature = 0x00ffff
avrdude.exe: Expected signature for ATtiny85 is 1E 93 0B
             Double check chip, or use -F to override this check.

avrdude.exe done.  Thank you.

Press any key to continue . . .

I re-ran the download several times without moving the chip or changing anything at all, and it was the same each time I attempted the download, it reported different signatures from the chip.

The second time I did the download, it said

avrdude.exe: Device signature = 0x00ff00

... and the third time, it said ...

avrdude.exe: Device signature = 0xff00ff

I compared the outputs electronically, and apart from the signature line above, everything else was identical.

Every time I put the good chip in, the download runs correctly, so I have no reason to suspect the programmer, although I reprogrammed it with the ISR software and checked out the wiring with a meter.

Somehow, three out of four AT85's have been messed up, each time by attempting to program them with the fuse set to 0xe6.  The fourth chip is still good, and accepts the program every time with fuses at 0xe2, but I don't dare to attempt a download to it with fuses 0xe6.

 

What's your opinion?  Can it be fixed?

This topic has a solution.
Last Edited: Mon. May 8, 2017 - 05:34 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

First that seems like an odd xtal freq 6.5MHz, low fuse E6 sets the tiny up to use a low freq xtal, like a watch xtal 32kHz.

The best way to recover is supply your tiny with a clock signal, program one of the timers on your nano to output a clock and feed it into xtal1 pin and see if you can erase it.

I have never used a xtal on a tiny85/45/25 as with only 5 i/o lines why waste two pins on a xtal. 

 

Jim

edit spelling

 

FF = PI > S.E.T

 

Last Edited: Thu. May 4, 2017 - 05:33 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Bookmark this site:  http://www.engbedded.com/fusecalc/

use it to verify your fuse settings before programming!

 

 

FF = PI > S.E.T

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thanks Jim, the reason for the xtal is that when the I/O clock is driven from 6553600Hz divided by 256, it gives a frequency of 25600 Hz, or exactly 256 cycles during the 10mS period that I'm interested in (one half-cycle of 50Hz UK mains).  I can spare the pins, because the only other pins being used are pin 7 (INT0, triggered by the zero-crossing) and pin 5 to drive a triac gate.

It's for a slow start for a 240V motor.

I suppose I  could program my remaining good chip to provide a clock, but in order to use an external clock, the fuses have to be set differently from for a crystal.  If I was able to reset the fuses, I would be able to reset them for the internal clock again, and at least I'd be back to square-1.  However, though I may well be wrong, I don't think the chip is taking new fuse settings.  It thinks it has a bad signature - leastways, AS-7 thinks so.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Well you told it to use an external clock, with out one, it can not be programmed, or signature read, or erased ect....   Use the nano, set up one of the timers to supply the clock so then you can erase the chip and reset the fuses to default, you should be able to recover the lost t85s.  There is a tutorial on how to recover lost avr's when the fuses are messed up in the tutorial forum.

 

Jim

 

 

FF = PI > S.E.T

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I'm close to giving up.  I don't know what to do next.  I'll tell you what I did, and you can tell me if I misunderstood the instructions.

I used a good AT85 to generate a clock signal of 1.38MHz, and I connected it as follows

"Good" T85 on breadboard                    "Bad" T85 in Arduino programmer
powered by USB1 on PC                        connected to USB2 on same PC
(USB = power cable only)                     (USB = Signal + power cable)

PB1 (1.38MHz) pin 6---------------------------- CKI (pin 2)
GND (pin 4)------------------------------------ GND(pin 4)

Connections checked with a meter before power applied.

GND connection probably superfluous, as both cable grounds go to PC

The fuses were set for NO crystal (fuse_low = 0xe6), baud rate was set low in AS-7 (b1200), and an attempt was made to write a simple blink program to the "bad" chip, which was receiving clock from "good" chip.  It took a long time to say ...


avrdude.exe: Version 6.3, compiled on Dec 16 2016 at 13:33:19
             Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
             Copyright (c) 2007-2014 Joerg Wunsch

             System wide configuration file is "C:\Program Files (x86)\Arduino\hardware\tools\avr\etc\avrdude.conf"

             Using Port                    : COM5
             Using Programmer              : stk500v1
             Overriding Baud Rate          : 1200
avrdude.exe: stk500_recv(): programmer is not responding
avrdude.exe: stk500_getsync() attempt 1 of 10: not in sync: resp=0x03
avrdude.exe: stk500_recv(): programmer is not responding
avrdude.exe: stk500_getsync() attempt 2 of 10: not in sync: resp=0x03
avrdude.exe: stk500_recv(): programmer is not responding
avrdude.exe: stk500_getsync() attempt 3 of 10: not in sync: resp=0x03
avrdude.exe: stk500_recv(): programmer is not responding
avrdude.exe: stk500_getsync() attempt 4 of 10: not in sync: resp=0x03
avrdude.exe: stk500_recv(): programmer is not responding
avrdude.exe: stk500_getsync() attempt 5 of 10: not in sync: resp=0x03
avrdude.exe: stk500_recv(): programmer is not responding
avrdude.exe: stk500_getsync() attempt 6 of 10: not in sync: resp=0x03
avrdude.exe: stk500_recv(): programmer is not responding
avrdude.exe: stk500_getsync() attempt 7 of 10: not in sync: resp=0x03
avrdude.exe: stk500_recv(): programmer is not responding
avrdude.exe: stk500_getsync() attempt 8 of 10: not in sync: resp=0x03
avrdude.exe: stk500_recv(): programmer is not responding
avrdude.exe: stk500_getsync() attempt 9 of 10: not in sync: resp=0x03
avrdude.exe: stk500_recv(): programmer is not responding
avrdude.exe: stk500_getsync() attempt 10 of 10: not in sync: resp=0x03

avrdude.exe done.  Thank you.

Press any key to continue . . .

The baud rate was set back to 19200, but this time, the programmer was responding.  Again, the baud rate from AS-7 is overridden by the CKI signal.


avrdude.exe: Version 6.3, compiled on Dec 16 2016 at 13:33:19
             Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
             Copyright (c) 2007-2014 Joerg Wunsch

             System wide configuration file is "C:\Program Files (x86)\Arduino\hardware\tools\avr\etc\avrdude.conf"

             Using Port                    : COM5
             Using Programmer              : stk500v1
             Overriding Baud Rate          : 19200
             AVR Part                      : ATtiny85
             Chip Erase delay              : 400000 us
             PAGEL                         : P00
             BS2                           : P00
             RESET disposition             : possible i/o
             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          Polled
               Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW MaxW   ReadBack
               ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
               eeprom        65    12     4    0 no        512    4      0  4000  4500 0xff 0xff
               flash         65     6    32    0 yes      8192   64    128 30000 30000 0xff 0xff
               signature      0     0     0    0 no          3    0      0     0     0 0x00 0x00
               lock           0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
               lfuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
               hfuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
               efuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
               calibration    0     0     0    0 no          1    0      0     0     0 0x00 0x00

             Programmer Type : STK500
             Description     : Atmel STK500 Version 1.x firmware
             Hardware Version: 2
             Firmware Version: 1.18
             Topcard         : Unknown
             Vtarget         : 0.0 V
             Varef           : 0.0 V
             Oscillator      : Off
             SCK period      : 0.1 us

avrdude.exe: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.03s

avrdude.exe: Device signature = 0xffffff (probably .reduced_core_tiny) (retrying)

Reading | ################################################## | 100% 0.03s

avrdude.exe: Device signature = 0xffffff (probably .reduced_core_tiny) (retrying)

Reading | ################################################## | 100% 0.03s

avrdude.exe: Device signature = 0xffffff (probably .reduced_core_tiny)
avrdude.exe: Yikes!  Invalid device signature.
             Double check connections and try again, or use -F to override this check.


avrdude.exe done.  Thank you.

Press any key to continue . . .

Well, it said to use -F, so I did.  It didn't help much, though.


avrdude.exe: Version 6.3, compiled on Dec 16 2016 at 13:33:19
             Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
             Copyright (c) 2007-2014 Joerg Wunsch

             System wide configuration file is "C:\Program Files (x86)\Arduino\h
ardware\tools\avr\etc\avrdude.conf"

             Using Port                    : COM5
             Using Programmer              : stk500v1
             Overriding Baud Rate          : 19200
             AVR Part                      : ATtiny85
             Chip Erase delay              : 400000 us
             PAGEL                         : P00
             BS2                           : P00
             RESET disposition             : possible i/o
             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
          Polled
               Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
               ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
               eeprom        65    12     4    0 no        512    4      0  4000  4500 0xff 0xff
               flash         65     6    32    0 yes      8192   64    128 30000 30000 0xff 0xff
               signature      0     0     0    0 no          3    0      0     0     0 0x00 0x00
               lock           0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
               lfuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
               hfuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
               efuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
               calibration    0     0     0    0 no          1    0      0     0     0 0x00 0x00

             Programmer Type : STK500
             Description     : Atmel STK500 Version 1.x firmware
             Hardware Version: 2
             Firmware Version: 1.18
             Topcard         : Unknown
             Vtarget         : 0.0 V
             Varef           : 0.0 V
             Oscillator      : Off
             SCK period      : 0.1 us

avrdude.exe: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.03s

avrdude.exe: Device signature = 0x000000 (retrying)

Reading | ################################################## | 100% 0.04s

avrdude.exe: Device signature = 0x000000 (retrying)

Reading | ################################################## | 100% 0.03s

avrdude.exe: Device signature = 0x000000
avrdude.exe: Yikes!  Invalid device signature.
avrdude.exe: Expected signature for ATtiny85 is 1E 93 0B
avrdude.exe: safemode: Verify error - unable to read lfuse properly. Programmer may not be reliable.
avrdude.exe: safemode: To protect your AVR the programming will be aborted

avrdude.exe done.  Thank you.

Press any key to continue . . .

Following these failures, I tried to program a good chip to use the crystal.  I set the fuses (low byte) to 0xe6, plugged the crystal and two 12pF caps into the programmer, disconnected it from the other chip on the breadboard, set the baud rate to 19200 and removed the -F, and uploaded the simple blink program to it.  The chip had been working immediately before (without the crystal), and all connections were carefully checked with a meter before connecting the USB lead, but it still failed with a signature problem - so now, I have four bad chips - and no idea what went wrong on the last attempt.  According to the instructions, I really thought it should have worked.

 

Question : The data sheet says that fuse signals are all inverted - low active.  When the datasheet says, in Table 6-1: Device Clocking Options Select,

"Low-Frequency Crystal Oscillator : CKSEL[3:0] = 0110

I don't suppose that should be inverted to 1001?  (clutching at straws!)

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

If you accidentally (or on purpose) also enabled debugWire or disabled the reset pin then you cannot recover the chip without high voltage programming.

John Samperi

Ampertronics Pty. Ltd.

https://www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Try to use this programming software instead: https://microtherion.github.io/ScratchMonkey/

It's the one I use, put it on your nano programmer (I suppose you are using ArduinoISP, right?) .

It has the advantage of supplying a clock line for targets that have been programmed to use an external clock.

 

This note may be relevant to your case, since you programed the fuses for low freq. crystal:

Curiously, and somewhat inexplicably to me, I have found that when Low Frequency Crystal Oscillator mode (CKSEL[3:0] = 6) is selected, connecting the clock signal to XTAL1 did not work, but connecting to XTAL2 did work, so you may want to try this as well.

 

edit: anyway, as explained in post #2, 0xe6 is the wrong setting, you should use 0xfd, (external crystal @3.0-8.0MHz, slowly rising power). See tables 6-12 and 6-13 in the datasheet.

Last Edited: Fri. May 5, 2017 - 12:27 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

So I understand, John, but whatever has happened, I certainly didn't do it knowingly.  I was really very careful to make the last attempt "by the book" - though this is my first foray into MCU programming, so it is possible I misunderstood the book. 

Do you know the answer to my question above?  The book says that all fuses are active low, but it also says that to enable the crystal, CKSEL[3:0] must be 0110.  I don't suppose there's any chance that they mean that the bits must be "inactive, active, active, inactive" - in other words, 1001?  When they say a bit must be set to 1, does that mean it must be active or inactive?  That's one misunderstanding I could easily have made.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

ElTangas, thanks very much.  I'll give that a go this evening.  I'd do it now, but life is getting in the way!  I guess there is an extra wire to connect from the Nano to the CKI of the chip?  Also, when I made the attempt with providing a clock signal from another AT85, it was connected to CKI.  It didn't occur to me to try connecting it to CKO - but I'll give that a go too.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Yeah, there is an extra wire, there are connection diagrams in the site. An connecting to CKO doesn't really make sense, but the guy says it may work, so...

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

If you set it to 32KHz xtal mode try injecting a weak signal..I had some chip & tried many times--no luck, then setting it to around 300mv, it picked it up and came back to life (so I could fix the fuses).  The internal clock circuitry differs between chips & even within the same chip type--as "improvements" are made to chip fabrication.

When in the dark remember-the future looks brighter than ever.   I look forward to being able to predict the future!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

It may be faster to get a new chip for now and BEFORE you attempt any changes to the fuses ask here first, if this chip can be salvaged, and it should be, it can be done later on.

 

As I said above we don't know exactly what changes were done to the fuses, accidentally or otherwise, and as you can't read the chip we are just wasting time.

 

Some changes to the fuses are irreversible with ISP and MUST HAVE a high voltage programmer like a REAL STK500. It is possible that several fuses are bad.

John Samperi

Ampertronics Pty. Ltd.

https://www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi John, you said "It may be faster to get a new chip for now".  Please re-read the bottom comment of my post #6.  The chip I used was a new one.  I ran it first with a simple two-line blink program with fuses set to e2 (no crystal), and the upload worked correctly, and the program ran correctly on the chip.  Then I disconnected the USB (to take down power), plugged in the crystal and two 12pF caps (as specified on the crystal datasheet), set fuses (low byte) to 0xe6 in the AVRDude parameter line in AS-7 Tools/External Tools/Arguments, and re-uploaded the two-line blink program - and it failed with "bad signature".  And having already rendered three other chips uncommunicative, believe me, I was super careful to do it by the book, and to check and double check all connections with a continuity checker before plugging the USB into the programmer again.

 

The crystal connector is like this... and there's a photo of it in my post #1 above.  As you see, when the crystal and caps are removed,  those connections to the chip are open circuit.

The frequency of the crystal caused some comment, but was explained in post #4.  At 6.5MHz, it is in the same ballpark as the internal 8MHz.

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

As mentioned, low=0xE6 sets the low-frequency oscillator, which expects a 'watch' crystal in the neighbourhood of 32.768 kHz.  This is a peculiar mode for the oscillator, and it will not operate outside of a fairly narrow range of frequencies, and a fairly narrow range of low amplitude signal input.

 

The best way to recover from this is to use a real 32 kHz crystal.  You>>can<< proceed by injecting a 32 kHz clock into XTAL1, but >>it must<< be a very low amplitude sine wave centred on Vcc/2.  Unless you have a signal generator, or can cobble together a sine wave generator using another AVR and a simple R/C filter (or some discrete components), it likely won't work.  Spend 10 cents and by a 32.768 crystal. It will come in handy the next time you make this mistake ;-)

 

Note that 0xE6 also sets a very slow startup time of fully 1 second.  This may make it difficult to program if your programmer and software can't accommodate such a long delay.

 

The good news is that CKDIV8 is not programmed, so the actual clock speed will be the real crystal speed, about 32 kHz.

 

Note, however, that the programming speed has to be less than 1/4 the clock speed, so you'll need to ensure the programming speed is >>less than<< 8 kHz.

 

Another option is to use HVSP.  You can breadboard this:

https://www.google.ca/search?q=mighty+ohm+hvsp

 

"Experience is what enables you to recognise a mistake the second time you make it."

"Good judgement comes from experience.  Experience comes from bad judgement."

"Wisdom is always wont to arrive late, and to be a little approximate on first possession."

"When you hear hoofbeats, think horses, not unicorns."

"Fast.  Cheap.  Good.  Pick two."

"We see a lot of arses on handlebars around here." - [J Ekdahl]

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thanks joeymorin.  El Tangas recommended scratchmonkey, and I have been trying - without much success - to install it.  It uses a pin of the Arduino to supply a clock signal to the target chip.  When it is properly installed, Tools/Programmer (in the Arduino IDE) shows ScratchMonkey in the menu, but so far, I can't make that happen. 

 

What you just told me about the crystal was an eye-opener for me.  Re-reading the datasheet in the light of what you said, I think I can see my error.

It says ...

 

... and that line with "110" for the frequency I need (3-8MHz) is where I got the "6" from in my fuse settings of "e6" - but that 6 needs a left-shift.  Then Table 6-13 shows that CKSEL[0] must be a 1, so I should have been using fuse settings of ed, not e6.  In fact, the setting I have - e6 - gives CKSEL[3:1] = 011, and that doesn't correspond with any frequency, although Table 6-1 says

CKSEL[3:0] = 0110 is for a low-frequency crystal.

 

Now that I've realised that, I can see a way out.  I'll have to order a 32k crystal, though, as you said - and wait for it.  Bummer!

In the meantime, I'll try to get ScratchMonkey installed on the Arduino IDE (and on the Nano).  I've been trying for a while, so that may turn into yet another plea for help.  It has facilities for an HVSP, so I think I may give that a go, with 12V from a battery.  There is one available about 2/3 the size of an AAA cell, used in remotes, doorbell buttons, etc.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Be careful about that 12V battery.  It is 12V >>nominal<<.  Open circuit voltage of a fresh battery is likely to be above 13V, or even 13.5V or higher.  The tiny is rated for no more than 12.5V on the reset pin during HVSP.

 

Better to use a regulated voltage source, such as a 12V SMPS.
 

Also, if you have a cheap or broken quartz clock, or at least one you don't care about, you can harvest the 32.768 kHz crystal from the clock movement and avoid the wait.

 

Just to be clear, HVSP does >>not<< require a working system clock, since the method provides its own clock on SCI/PB3.  So you wouldn't need a watch crystal if you go with HVSP.

"Experience is what enables you to recognise a mistake the second time you make it."

"Good judgement comes from experience.  Experience comes from bad judgement."

"Wisdom is always wont to arrive late, and to be a little approximate on first possession."

"When you hear hoofbeats, think horses, not unicorns."

"Fast.  Cheap.  Good.  Pick two."

"We see a lot of arses on handlebars around here." - [J Ekdahl]

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Many thanks joeymorin.  Ki0bk clearly knew what the fault was, and had given me the information, but it took your input before I properly understood what he was driving at.  I guess I needed somebody to say "It won't work the way you're doing it".  I've ordered a 32k crystal, and it is due on Wed/Thurs.

I understand your warning about the HV source.  I have one of these batteries to hand, and it measures 12.05V open circuit.  My concern was rather that its voltage my be insufficient when it is loaded - but one way or another, I'll work out a suitable 12V supply.  Thanks again for passing on your knowledge.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Current into /RESET during HVSP is in the neighbourhood of 250 μA.  Software I wrote years ago documents this, although I can't for the life of me find where in the datasheet that is quoted.  It's possible I arrived at that figure experimentally, but the comments in my code say "maximum programming current of 250 μA specified in the datasheet"

 

So if your battery can source 250 μA without dropping below 11.5V (minimum for reliable HVSP), you should be fine.

"Experience is what enables you to recognise a mistake the second time you make it."

"Good judgement comes from experience.  Experience comes from bad judgement."

"Wisdom is always wont to arrive late, and to be a little approximate on first possession."

"When you hear hoofbeats, think horses, not unicorns."

"Fast.  Cheap.  Good.  Pick two."

"We see a lot of arses on handlebars around here." - [J Ekdahl]

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

El Tangas, did you install ScratchMonkey on a Windows PC, or on Linux/Unix/Solaris?  I have spent considerable time trying to install it on a PC, but I can't make it work.  If the installation is successful, I should see scratchmonkey under Tools/Programmers in the Arduino IDE - but nomatter what I do, I can't make that happen.  If you use a Unix-like OS, do you know anybody who has successfully installed it on a PC?  I have Windows-7 Pro SP1.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I also use win 7. The problem is that some newer version of the Arduino IDE somehow broke the ScratchMonkey installation. You can still flash it in the nano and communicate directly with it using avrdude, it uses stk500v2 protocol. I think you already learned how to use avrdude command line from previous posts.

Tomorrow I'll investigate further if I have time.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

El Tangas, thanks for that.  It appears to have flashed (didn't give any errors).  The pins are as follows (H=High; L-Low)

       L   L   L   L   L   L   L   L   L   L   L   L   H   H   H
     --*---*---*---*---*---*---*---*---*---*---*---*---*---*---*--
    | D12 D11 D10  D9  D8  D7  D6  D5  D4  D3  D2 GND RST RXO Tx1 |
    |-----                                                        |
    |USB  |                  Arduino Nano                         |
    |-----                                                        |
    | D13 3V3 REF  A0  A1  A2  A3  A4  A5  A6  A7  5V RST GND VIN |
     --*---*---*---*---*---*---*---*---*---*---*---*---*---*---*--
       L  3.3  L   L   L   L   L   H   L   L   L   H   H   L   H

I had expected to see a frequency running on one of them, but there was none.  Maybe it's only when it is trying to program a target chip.

As for the AVRdude command line, yes, I think I'm OK with that now.  Although I flashed scratchmonkey onto the Nano using the Arduino IDE, I intended to use AS-7 to send code to my target chip.  However, what programmer do I tell it to use?  It seems that a distinction is made between Arduino as ISP and Scratchmonkey, as shown in the picture below.  I gather the various features of scratchmonkey need to be switched on somehow.  The "Programmers.txt" file in

scratchmonkey/hardware/scratchmonkey lists them all, and the installation instructions show that they should be recognised by the Arduino IDE...

... but I don't have that, so I can't select those programmers - and certainly not from AS-7.

The file lists several protocols...

scratchmonkey.protocol=scratchmonkey
scratchmonkey_hvsp.protocol=scratchmonkey_hvsp
scratchmonkey_hvpp.protocol=scratchmonkey_pp
scratchmonkey_stk500v2.protocol=stk500v2
scratchmonkey_stk500v2_hvsp.protocol=stk500hvsp
scratchmonkey_stk500v2_hvpp.protocol=stk500pp

 

Last Edited: Mon. May 8, 2017 - 01:21 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The first 3 protocols are special and require a patched version of avrdude (I never used them). The last 3 protocols are just regular ones that are recognized by the standard avrdude:

 

stk500v2 - normal serial programming

stk500hvsp - high voltage serial programming (requires RESET connected to 12V)

stk500pp - high voltage parallel programming (requires RESET connected to 12V, and 8 data pins, not supporter by tiny 85)

 

So in studio 7, you need to modify the command line that invokes avrdude to use these protocols, that is for example, -cstk500v2 instead of -cstk500v1.

 

Also, I see you figured out how to install the programmer in the Arduino IDE, but in case someone else needs to do that, the answer is here: https://forum.arduino.cc/index.php?topic=435815.0

 

Basically, you need to create the directory:

{sketch_folder}\hardware\scratchmonkey\avr

and put inside the "programmers.txt" file and an empty "boards.txt" file.

This reply has been marked as the solution. 
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

It took a lot of iterations, copying the programmers.txt file to various places, but finally, I have scratchmonkey in the tools/programmers menu.

"boards.txt" was what made the final difference.

However ... (there's always a "but") ... when I tried to send a simple blink script to what I believe to be a good AT85, the IDE said

exit status 1
#error Unknown Arduino platform, help me define the correct pin layout

When I tried to send the sketch from AS-7, it said

avrdude.exe: stk500v2_ReceiveMessage(): timeout
avrdude.exe: stk500v2_ReceiveMessage(): timeout

While I was looking around to try to figure all this out, I came across a file  in ...

C:\Users\Mik\AppData\Local\Arduino15\packages\attiny\hardware\avr\1.0.2\variants\tiny8\pins_arduino.h

I thought of using it, but scratchmonkey must use some pins differently - for example, it uses pins for a clock signal for the target chip and for the HVSP - which are the object of this exercise.

If scratchmonkey had simply installed and integrated with the IDE, that might well have been a solution, but right now, it's all looking more complicated that I had expected.  Maybe my best option is to wait for the watch crystal, and see if my chips come back to life when I plug it in.  I'm hoping that will provide the chip with the right environment to suit its fuses.

 

El Tangas, I appreciate the time you have spent on this.  Thank you.

 

Last Edited: Mon. May 8, 2017 - 04:14 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

While waiting for the watch crystal, I programmed yet another new chip to use the crystal I already have (6.5536MHz) using the correct fuse setting this time (fuse low = 0xed), and it worked.

For the benefit of anybody else who finds this thread in a search for inspiration, the clock signals are very nearly sinusoidal, at crystal frequency (of course), and measure

CKO : 1.09V p-p

CKI  : 0.77V p-p

 

My thanks to everybody who helped me along the way.  I'm marking this thread resolved.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

It's been a couple of years since I last use Scratchmonkey, it was easy to setup back then. It seems nowadays, because of the new version of the program, or the Arduino IDE, or both, thinks got complicated. Oh, well... maybe I'll try to set it up myself and then write a tutorial, one of these days.

 

You will still need some luck with the crystal, though. It won't be so easy as it seems, because the MCU frequency is very low as mentioned in post #15.