summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUwe Hermann <uwe@hermann-uwe.de>2012-07-28 17:39:38 +0200
committerUwe Hermann <uwe@hermann-uwe.de>2012-07-28 23:39:47 +0200
commit1fd698dcf076c62e53e089be50572efae6b68f15 (patch)
tree1fbd789b3eedac1abf93582115e32a5f17ec7e2a
parent77adad943111ab064f01838033dc9c94152f46c7 (diff)
downloadlibsigrokdecode-1fd698dcf076c62e53e089be50572efae6b68f15.tar.gz
libsigrokdecode-1fd698dcf076c62e53e089be50572efae6b68f15.zip
srd: avr_isp: Improve Chip Erase handling.
-rw-r--r--decoders/avr_isp/pd.py11
1 files changed, 10 insertions, 1 deletions
diff --git a/decoders/avr_isp/pd.py b/decoders/avr_isp/pd.py
index 4b496e0..9ecc280 100644
--- a/decoders/avr_isp/pd.py
+++ b/decoders/avr_isp/pd.py
@@ -116,9 +116,18 @@ class Decoder(srd.Decoder):
self.xx, self.yy, self.zz, self.mm = 0, 0, 0, 0
def handle_cmd_chip_erase(self, cmd, ret):
- # TODO
+ # Chip erase (erases both flash an EEPROM).
+ # Upon successful chip erase, the lock bits will also be erased.
+ # The only way to end a Chip Erase cycle is to release RESET#.
self.putx([0, ['Chip erase']])
+ # TODO: Check/handle RESET#.
+
+ # Sanity check on reply.
+ bit = (ret[2] & (1 << 7)) >> 7
+ if ret[1] != 0xac or bit != 1 or ret[3] != cmd[2]:
+ self.putx([1, ['Warning: Unexpected bytes in reply!']])
+
def handle_cmd_read_fuse_bits(self, cmd, ret):
# Read fuse bits.
self.putx([0, ['Read fuse bits: 0x%02x' % ret[3]]])