Unbrick an ATtiny13a at 128khz

Silly me... I tried to flash an ATtiny13A and set the speed at 128khz.
It worked ! But now, I'm unable to flash it again...

To unbrick it, I used my USBTinyISP with AVRDude, and added an argument to the command line to restore the default fuses:

avrdude -c usbtiny -p t13 -e -Uhfuse:w:0xFF:m -Ulfuse:w:0x6A:m -B250

And it worked!

The magic here is to use a low bit clock period (250us).

Going further...

But I even have a better news ! You can use platformio to flash the ATtiny13A at 128Khz !

Just change the platformio.ini file :

platform = atmelavr
board = attiny13
board_f_cpu = 128000L
upload_protocol = usbtiny
extra_scripts = extra_script.py
upload_flags = -B 250

And create the extra_script.py file with the following content:

# Fuses for ATTiny13A @ 128Khz
Import('env')
env.Replace(FUSESCMD="avrdude $UPLOADERFLAGS -B 250 -e -Uhfuse:w:0xFF:m -Ulfuse:w:0x7B:m")

Then, you can set the fuses with

pio run --target fuses

and flash you program with

pio run --target upload