Menu

#19 Debugging 4-page erase devices (tiny841, tiny1634, ...) - Change on device-descriptor

v1.0_(example)
open
nobody
5
2014-10-23
2014-10-23
No

Since the new tiny841 was very interesting to me I bought some and got exploring. But soon I found out that it was not supported by AVaRICE (at least not until now ;-).
First I tried making an device-descriptor by myself. But this didn't work out. Maybe I screwed up there. But in the end I simply traced the usb communication on a Windows-PC (at work) and then found out that there was a different format used for the device-descriptor as it is used in AVaRICE up-to now. I think this ist mostly due to the 4-Page Erase logic of the tiny841. I think this same method is also used on the tiny1634 and tiny441. Essentially an erase always erases 4 flash-pages so that the page-buffer has to be filled 4 times in order to write the the same amount as was erased before. (I guess the only advance is in saving some registers for holding that page-buffer).
So since breakpoints on those debugWire-devices is merely a break-instruction the flash has to be reprogrammed whenever a new breakpoint is set. For that the Debug-Hardware needs to now that the page-buffer doesn't cover the entire erase-window.

So I basically copied the raw-data of the usb-commands and inserted a device-specific command sequence in the setDeviceDescriptor function. This is very ugly and should probably be moved to somewhere else. But I think it should be somebody who has a deeper understanding of the software, as it might involve extending that device-descriptor-table.

Anyways that patch works for me.

1 Attachments

Discussion


Log in to post a comment.