How to do a complete CHIPERASE to unlock an ATTINY1606?

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

Hello,

I have set the lock fuse on an Attiny1606 for the first time; now I'm unable to unlock the chip again with a complete chip erase. From the older chips, e.g. Atmega328, I know the behaviour was that by simple re-flashing a locked chip the lock was removed too, but with the new ones I have learned that unlocking the chip is a bit more difficult task, looking at the datasheet.

 

I'm working with Visual Studio Code / Platform.IO as IDE and with a JTAG2UPDI programmer which works fine for the usual tasks, but I failed finding a way to do a complete chip erase. The  datasheet says:

 

"1. Enter the Chip Erase key by using the KEY instruction. See Table 30-5 for the CHIPERASE signature.

2. Optional: Read the Chip Erase (CHIPERASE) bit in the ASI Key Status (UPDI.ASI_KEY_STATUS) register to see that the key is successfully activated.
3. Write the signature to the Reset Request (RSTREQ) bit in the ASI Reset Request (UPDI.ASI_RESET_REQ) register. This will issue a System Reset.
4. Write 0x00 to the ASI Reset Request (UPDI.ASI_RESET_REQ) register to clear the System Reset.
5. Read the NVM Lock Status (LOCKSTATUS) bit from the ASI System Status (UPDI.ASI_SYS_STATUS) register.
6. The chip erase is done when LOCKSTATUS bit is ‘0’. If the LOCKSTATUS bit is ‘1’, return to step 5."

 

I have no clue how to this, neither from the IDE nor with avrdude CLI commands; can somebody point me in the right direction? 

Thanks a lot!

This topic has a solution.
Last Edited: Fri. Jun 3, 2022 - 09:43 AM
This reply has been marked as the solution. 
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

I am not an avrdude user, but I know you can do this with pymcuprog (https://pypi.org/project/pymcuprog/) using the --chip-erase-locked-device switch...

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

Thanks a lot! pymcuprog / pyupdi is a quite straightforward way too, although I haven't used it yet. But I will give it a try!

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

The  --chip-erase-locked-device option of pymcuprog works perfectly! Thanks again!

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

Good to hear!