Recover a ATtiny40 with AVRISP mkii from the RSTDISBL bit

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

So here is one more that have a issue with the RSTDISBL bit (I think).

Bakground :

Total newbie tries to adjust a board for driving solenoids that is fitted with PLD (PEEL20CG10A) for the logic. The board is supplied with 12- 24 V.

The board is to be uppgrade with option for a toggled input.

Attempts have been done with replace the PEEL20CG10A with atmels ATF750C -> http://www.atmel.com/Images/doc0....

It have the same footprint and pinout and also T and D flipflop. On the breadboard it worked by when it was soldered on the board it didn't work.

After wasted 3 weeks on cupl I start digging on digi-key. Found a MCU that almost that could replace the PLD. Ground and VCC was on the right pins.

Starting the google crash cource on c and avr programming and hardware ended upp with avr studio 6 and avrisp mkii for the TPI support. Now after 1 week fiddling I can't program or read the device.
When trying to read or program the AVRISP start to a rapid red blinking.

The documentation say it's a shortcut on the target. No progress after re solder the wires on 14,13,12 (reset, TPIData, CLK).

When I fiddling around in avrstudio 6 I see that all Fuses CKOUT, WDTON, RSTDISBL is set? (filled with green couler).

I can't rec cal that I have set those fuses. For me it's must be the darn studio it self that have set those. (perhaps it though .. I have it with this continues reprogramming for every row code and now I gonna make it hard for this young player ....)

Anyway I want to give this HVSP a try before desoldering this soic20 and replace with a new one.
With 1,27 pin pitch it's easy to put to much heat so the pad will loosen from the pcb.

From what I understand I must add 9-12 V continuous on the reset pin under the programming procedure.

(copied from datasheet)

18.3.1 Enabling
The following sequence enables the Tiny Programming Interface:
"¢ Apply 5V between VCC and GND
"¢ Depending on the method of reset to be used:
"“ Either: wait tTOUT (see Table 20-4 on page 155) and then set the RESET pin low. This will reset the
device and enable the TPI physical layer. The RESET pin must then be kept low for the entire
programming session
"“ Or: if the RSTDISBL configuration bit has been programmed, apply 12V to the RESET pin. The RESET
pin must be kept at 12V for the entire programming session
"¢ Wait tRST (see Table 20-4 on page 155)
"¢ Keep the TPIDATA pin high for 16 TPICLK cycles

Right ?

Any chance that the AVRRISP will damage by this ?

I understand I must desolder the reset wire on the connector that is connected to AVRISP cable connector.

As I have never done electronics I haven't not much stuff so at the moment my voltage supply is old emulator to some link sys rounter. It have the spec it should be 12 but when I measure it's near 16V.

So to reduce the voltage I thought of this ..

ground -- 5k pot---X----1,8kOhm----16V

Adjust the put so I get around 10V on X and connect reset pin on this point.

The reset pin (14) is not used on the board it's just soldered to a pad.

Any thoughts of this ?

My wiring (It have been working for a week)

Attiny     ->  AVRISP mkii

Reset pin  ->  Reset
TPIData    ->  MISO
CLK        ->  CLK
GND        ->  GND
VCC        ->  VCC
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You can't just pick a few sentences out of the data sheet and think that that will be enough to accomplish HV programming. Compare the complete sections on ISP programming and HV programming and you will likely see a lot of differences in algorithms/protocols.

Bottom line: You can not use an AVRISP mk II to do high voltage programming. For all that I know it is a lot more than just 12 Volts on RESET that differs "ordinary low-voltage ISP programming" from high-voltage programming.

As of January 15, 2018, Site fix-up work has begun! Now do your part and report any bugs or deficiencies here

No guarantees, but if we don't report problems they won't get much of  a chance to be fixed! Details/discussions at link given just above.

 

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington] "Words represent concepts. Use the wrong words, communicate the wrong concept." [J Morin] "Persistence only goes so far if you set yourself up for failure." [Kartman]

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

Dam (eller h*lve..te på svenska) ... So it's time to warm up the solder iron again...

Just to 100% clear .. the boxes after the fuses (especially RSTDISBL)in avr studio6 should never be filled with green. If they are the programmer will write a 0 on that bit so it will bet set. Default with no filled boxes it writes 1 on that bit.

But do you think the AVR ISP will be broken if I try it ?

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

I think that you can connect all the other leads from AVRISP-2 except RST.
Attach RST to +12V.
Program with the AVRISP-2 as normal.

Untested.

Obviously anything else connected to RST pin must be able to withstand +12V.

Personally, I think that anyone who uses RSTDISBL deserves everything that is thrown at them.

I would just bin the Tiny40 and start with a fresh one.

Oh, you are not alone. Many readers appear to have a strong desire to shoot themselves in their own feet!

David.

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

Quote:

But do you think the AVR ISP will be broken if I try it ?

I don't know. But letting 12 Volts near the mkII seems like a risk to me. I have no idea what the mkII might have to protect it (e.g. clamping diodes and stuff).

As of January 15, 2018, Site fix-up work has begun! Now do your part and report any bugs or deficiencies here

No guarantees, but if we don't report problems they won't get much of  a chance to be fixed! Details/discussions at link given just above.

 

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington] "Words represent concepts. Use the wrong words, communicate the wrong concept." [J Morin] "Persistence only goes so far if you set yourself up for failure." [Kartman]

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

JohanEkdahl wrote:
You can't just pick a few sentences out of the data sheet and think that that will be enough to accomplish HV programming. Compare the complete sections on ISP programming and HV programming and you will likely see a lot of differences in algorithms/protocols.

Bottom line: You can not use an AVRISP mk II to do high voltage programming. For all that I know it is a lot more than just 12 Volts on RESET that differs "ordinary low-voltage ISP programming" from high-voltage programming.

The OP has not stated what device they are trying to program, but if it uses TPI as suggested, there is apparently no difference between normal TPI and HV TPI, apart from the need to apply a higher voltage to the reset pin in order to enter programming mode. The datasheet excerpt indicates this.

Edit: Ah, I see, ATtiny40. Right there in the subject line...

JJ

"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]

 

Last Edited: Fri. Apr 12, 2013 - 08:07 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

david.prentice wrote:
Personally, I think that anyone who uses RSTDISBL deserves everything that is thrown at them.
I just used RSTDISBL on a project that included an ATtiny85. What I got was a sixth I/O pin. What do you think I deserved? :)
Quote:
Many readers appear to have a strong desire to shoot themselves in their own feet!
FWIW, I a sport two heavily scarred feet. One scar is from the first time I programmed RSTDISBL :)

JJ

"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

Maybe you are right ... But in this case I haven't set the darn bit. Hmm .. maybe I should bin the workstation in the same process.

It could also be so that the AVR Studio don't acurrate if the bit is set or not if it can't read the device.

If you check this clip https://www.youtube.com/watch?v=...

Avr studio 6 but here you clearly see a bock/mark (can't find the right word at moment).
In my case the box is filled with green. When clicking it is turn blank.

On the other hand he is using version 6 (i 6.1) and alos doing ISP when I does TPI but why should it different?

My point is that it could be some other failure with the chip and not necessary set bit on the disable reset fuse...

Anyone have else have 6.1 that could verify if it different visual on ISP compare TPI ore this filled green box mean something else .. (Or I could dig the manual by my self)...

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

This is error mesg I get when I try to read the device in AVRS6

Unable to enter programming mode.

Please verify device selection, interface settings, target power and connections to the target device.

When skipping the read device button and go direct to

Memories -> Program

Erasing device failed
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Bah ... Should we try ? ...

Yes we should ....

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

Only you know what you have connected to Tiny40's RST pin. If you are happy that nothing will get damaged, apply +12V and program as normal.

Most people have set fuses wrong at some point. They all swear blind that the fuses changed by magic. You will learn with experience.

Good luck.

David.

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

Okey here is the resault ...

By putting 12 v on reset pin I manage to read the device.

Now the boxes after fuses works as aspected .. you can set a checkmark and uncheck it .. no the green filled box as before.

So if you can't read the device you get at a green filled box that will be clear if you click on it.

After unchecking the bit boxes .. program ... read the target again .. no fuse boxes is checked.

Attached the reset cable again to AVRISP .. can't read ..

Redone the 12v on reset pin again and back to AVRISP .. can't program.

Must mean that AVRISP can't pull the reset pin low anymore. Broken ? or broken flat cable from AVRISP.

Or broken chip ?

Will pick the AVRISP apart and check the flat flex cable ...

Just for the record. When you have the reste line to +12 (in my case it was 11,6) the MCU will not run until you remove the 12V.

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

pernils wrote:
Just for the record. When you have the reste line to +12 (in my case it was 11,6) the MCU will not run until you remove the 12V.
That is correct:
Quote:
14.3.2 Disabling
Provided that the NVM enable bit has been cleared, the TPI is automatically disabled if the RESET pin is released to inactive high state or, alternatively, if VHV is no longer applied to the RESET pin.

If the NVM enable bit is not cleared a power down is required to exit TPI programming mode.

See NVMEN bit in “TPISR – Tiny Programming Interface Status Register” on page 107.

JJ

"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

pernils wrote:
As I have never done electronics I haven't not much stuff so at the moment my voltage supply is old emulator to some link sys rounter. It have the spec it should be 12 but when I measure it's near 16V.
Cheaper adapters are basically a transformer, a rectifier (half-wave or bridge), and a filter capacitor. An adapter of this type will only give you the rated voltage when the load draws the rated current. At lighter loads, the voltage will be higher... at heavier loads it will be lower. However, except under conditions of very light or no loads, the output will likely be very rippled. A mulitmeter won't show this, only an o-scope.

If you have a 7812 or similar, the 16V unloaded output of your adapter will get you a clean 12V output. Adding another capacitor to the input of the 7812 isn't a bad idea. I don't know how sensitive TPI is to ripple on the reset pin.

Quote:
So to reduce the voltage I thought of this ..

ground -- 5k pot---X----1,8kOhm----16V

Adjust the put so I get around 10V on X and connect reset pin on this point.

That will change under load. Mind you, the reset pin probably presents a load of about 50kOhm, so it won't change by much.
Quote:
Any thoughts of this ?
To protect the programmer, you'll need to convert the logic low state on the line that drive's the target's reset pin to the 12V programming voltage. Use an few transistors and resistors:
            +5V from prog                +12V
                  ^                        ^
        __________|           _____________|
       |          |          |             |
      100K     |  /          |          |  /
       |       | /          100K        | /
       |       |L            |          |L
prog <---10K---|             |----------|
reset          |\            |          |\
               | \           1K         | \
               |  \          |          |  \
                  |          |             |
                  |       |  /             |
                  1K      | /              |
                  |       |/               |--> target
                  |-------|                |    reset
                  |       |<               \  
                  |       | \              /   
                  |       |  \         1K  \  
                 100K        |             /   
                  |          |             \   
                  |__________|_____________|   
                                           | 
                                          GND

Don't forget to bypass this when programming with non-TPI devices.

JJ

"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

Yepp asumed that it was something like that .. The spec voltage is with spec current.

After testing some stuff .. (the flat ribbon cable was okey) I have discovered that AVRISP will not pulling the reset line low and therefore will not read the device.
I have only used the AVRISP for 1 week on the same chip ..
It seems that is broken on that NPN mosfet or what it is that pulls the reset line low.
Or it could be a faulty firmware.

So at the moment I will have a separate reset button (connect reset pin to ground).

I have read somewhere that you could reinstall firmware with pushing a button inside the unit .. but this new modell doesn't have this button.

Butt one thing I don't like is that the ribbon cable is squeezed between sharp edges inside the casing so I could be chance it have cut the wire but when probing it outside the case it shown as functional.

Hmm time is 23:27 .. time to go to bed.

Thanks you guys ..

and if someone have some idea .. make a post ....

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

Have a look at this thread too. I am having the same one time programmable effect on my attiny40s too.

https://www.avrfreaks.net/index.p...

The thread seems to suggest the latest Atmel Studio 6.1 software is at fault. This seems to match my findings. I have been programming without issue until I upgraded to 6.1 beta and I have had no use for the fuses yet so I know I wasn't in there messing with them.

I just wish the tools weren't so limited. The MKII does not do high voltage programming and the STK600 does not program in circuit. This gap in the solution is a real pain.

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

Quote:
Use an few transistors and resistors:
Thanks for the schematic joey. But don't you think the 1k at the right is a too strong? Wouldn't it bring target reset low when prog reset is high? Ideally it should be floating at that state.

Assuming like 10k pullup on target reset to 5V, shouldn't the right 1k be at least 100k? Or?

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

snigelen wrote:
Quote:
Use an few transistors and resistors:
Thanks for the schematic joey. But don't you think the 1k at the right is a too strong? Wouldn't it bring target reset low when prog reset is high? Ideally it should be floating at that state.

Assuming like 10k pullup on target reset to 5V, shouldn't the right 1k be at least 100k? Or?

Yes, that was a typo. Note it is the only resistor drawn in ASCII... never changed it from my first attempt in my text editor :)

Good catch. The pullup on RESET is between 30K and 60K, typically 50K. Depending on Vcc, the RESET pin has a high-side threshold of between about 45% and 60% of Vcc, so 100K would be borderline. 470K should be fine.

JJ

"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

Surely you are asking for trouble if you create a +12V output from an AVRISP-2.

If you ever do RSTDISBL fuse, you clear it as a one-off with +12V. Subsequently using the AVRISP-2 in the regular way.

I can see little reason to ever use RSTDISBL except as the final build of a Tiny40. This is harder with a 6-pin Tiny4 because you have so few GPIO pins.

Having made a mistake with a $1 or $0.40 chip, it seems unwise to risk damaging a $34 AVRISP-2. The cost is irritating but the delivery time for any replacement is more inconvenient.

Oh, any fuse setting/clearing in the +12V mode should be no different to the regular mode.

David.

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

david.prentice wrote:
Surely you are asking for trouble if you create a +12V output from an AVRISP-2.
Yes, that would be blood from a stone, wouldn't it? The discussion has not been about extracting 12V out of an AVRISP-2, but about allowing an AVRISP-2 to switch safely an external 12V source.
Quote:
If you ever do RSTDISBL fuse, you clear it as a one-off with +12V. Subsequently using the AVRISP-2 in the regular way.
Not always. I regularly program RSTDISBL on ATtiny24/45/85. You can't simulate everything. At some point you need to test the physical device, in it's intended circuit environment. Debugging and testing can require multiple HV programming cycles. At $0.40 cents at a time, that adds up.

My cost? Five dollars worth of parts out of my bin. Now I have an HVSP for 8-pin ATtinys, as a shield for an Arduino. No need for an external 12V source, either. It's generated by a charge pump. Hole in your foot? Press a button. I haven't fried an Arudino yet.

JJ

"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

joeymorin wrote:
The pullup on RESET is between 30K and 60K, typically 50K. Depending on Vcc, the RESET pin has a high-side threshold of between about 45% and 60% of Vcc, so 100K would be borderline. 470K should be fine.
Actually, when RSTDISBL is programmed, isn't the internal pull-up disabled after reset? In truth, the above circuit was a back-of-the napkin ASCII offering. As mentioned in a previous reply, I use a home-brew HVSP/ISP programmer, based on a 328p in the form of an Arduino Uno R3. Three I/O pins are used to control a network of 4 transistors and 7 resistors to permit 4 states on the target's reset pin: 0V, 5V, 12V, and open-collector. I just tested an ATtiny85 on that programmer, and indeed the pullup is disabled when RSTDISBL is programmed. I don't know about devices with TPI, but I expect it's the same.

I don't imagine it should pose a problem, as dropping RESET to GND at the end of a programming cycle won't do anything harmful. Even if the programming cycle was used to unprogram RSTDISBL, fuse bit latching will prevent a LOW level on RESET from actually causing a reset until you exit programming mode.

JJ

"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

But you want the programmer to affect the target system as little as possible when not programming. Say you have disabled reset and you use that IO as a button input with pullup. Then it will not work with the 1k pulldown (unless you have a very strong pullup on the button), so you have to disconnect the programmer (at least the 12V reset circuit) to be able to run your program on the MCU.

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

snigelen wrote:
But you want the programmer to affect the target system as little as possible when not programming. Say you have disabled reset and you use that IO as a button input with pullup. Then it will not work with the 1k pulldown (unless you have a very strong pullup on the button), so you have to disconnect the programmer (at least the 12V reset circuit) to be able to run your program on the MCU.
Did you miss my last response to you? 470K. In any case, you wouldn't have to disconnect the programmer nor the 12V circuit, just the 12 volt supply.

In any case, this was only intended as a way to get the OP out of a bind by changing fuses via HV programming under control of the programmer, not as a proper upgrade to the programmer.

JJ

"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

joeymorin wrote:
Did you miss my last response to you? 470K.
No I read it. I just misunderstood your last post. So 470k it is.

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

I could confirm that avr studio 6.1 is a bit buggy with TPI and avrisp mkii.

See also this thread https://www.avrfreaks.net/index.p...

I haven't done anything for 3-4 days. But now when I fired up my workstation and try to write to the device it actually works.

Strange ...

But it was a one timer ... Have to fall back with external reset button ....