Author Topic: Bit-banging HVPP  (Read 2675 times)

0 Members and 1 Guest are viewing this topic.

Offline rexxarTopic starter

  • Frequent Contributor
  • **
  • Posts: 439
  • Country: us
    • Forever Tinkering
Bit-banging HVPP
« on: May 01, 2014, 10:02:21 pm »
Hi all, I borked the microcontroller in my project a few weeks back by programming the fuse bits wrong. Since I have zero money right now, I'm rather interested in reviving it so I can continue development.

I have an Arduino Leonardo that I've been using as an ISP programmer, so I searched to see if I could use it as a high voltage programmer, and I came across Scratch Monkey, which is supposed to emulate an STK500 in ISP, HVSP, or HVPP modes. Unfortunately, I can't get it to do anything, so I decided that since I just need to reprogram three fuse bytes, I'd just manually drive all the pins and essentially bit-bang the HVPP protocol.

So far, I've not gotten it to work, and I'd like some help debugging.

First off, is this even feasible? How precise does timing have to be for HVPP? Is 1uS between commands too slow?

I'm also confused about actually writing the bytes. The datasheet says that writing 1 clears a bit, and 0 programs it. Does that mean that I have to send, say, 0xE2 as 1110 0010 or do I need to invert it? I'm fairly sure I'm supposed to put the most significant bit on D7, is that correct?

I've noticed that on the PWM pins, when you hold it high or low (which one it is depends on the pin), it seems to actually put a PWM value there instead of hard on or off. I worked around that by writing a 255 or 0 PWM value, but has anyone else noticed this behavior, or is there something wrong?

If this turns out to be possible, I might make the code nice and allow for variable byte inputs, but for now it's just a long, long string of digitalWrites with hardcoded values  ;D
 

Offline nerdyHippy

  • Contributor
  • Posts: 37
  • Country: us
Re: Bit-banging HVPP
« Reply #1 on: May 02, 2014, 03:02:49 pm »
Awhile back somebody made a 100% manual system for programming AVR using toggle switches, which would imply that for regular programming there isn't a minimum frequency requirement. I'd imagine that HVPP is the same.
 

Offline amyk

  • Super Contributor
  • ***
  • Posts: 8389
Re: Bit-banging HVPP
« Reply #2 on: May 03, 2014, 12:35:10 am »
There's a maximum speed but no minimum. For HVPP the oscillator doesn't even need to be running, it behaves more like an EEPROM.

Manual HVPP has been done before: http://www.avrfreaks.net/index.php?name=PNphpBB2&file=viewtopic&t=19386
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf