I suggest excluding the .git folder when making the zip file.
I knew it was there but was too lazy to remove it. To do that I have to make a copy of the folder and then compress that. Plus you don't see the folder in the normal Mac browser. Next time.
Why do you disable interrupts in program?
When I switched to bit-banging, somewhat reluctantly, I wanted to make sure the bits were clocked out at a constant rate. It may nor may not be necessary. It works with it in.
In startProgramming, the quick RESET pulse is done with interrupts enabled. That should probably be changed to interrupts disabled. I think the goal is to reset the processor fast enough that it does not have time to do anything interesting.
In startProgramming, the quick RESET pulse is currently one millisecond. Two microseconds should be sufficient and is probably more appropriate.
Well in ArduinoISP, which I glanced at for inspiration in this part, it has:
digitalWrite(RESET, HIGH);
pinMode(SCK, OUTPUT);
digitalWrite(SCK, LOW);
delay(50);
digitalWrite(RESET, LOW);
I though 50 mS was way over spec so I cut it down.
But you are probably right. I turned off interrupts and cut it back to 2 uS. That would be about the minimum for programming a 1 Mhz processor, and probably a bit short if someone happens to be running under that. (edit) Made it 5 uS. After all the datasheet says:
In this case, RESET must be given a positive pulse of at least two CPU clock cycles duration after SCK has been set to “0”.
After all "at least" means 2 clock cycles or more.
In startProgramming, BB_MOSI is explicitly set to an OUTPUT. Is that necessary? Which is necessary because, in this sketch, SPI to the target is bit-banged.
Thanks for the suggestions. At least you found nothing major.
