0

USBtinyISP Bug reading flash >64kb
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

USBtinyISP Bug reading flash >64kb

by ra_ on Fri Nov 25, 2011 5:01 am

Hi!

We probably encountered a bug, although we are not sure whether the problem is in the USBtinyISP firmware and/or in the USBtinyISP specific part of avrdude.
We stumbled across this while trying to download a bootloader to a ATmega1284p with avrdude and the USBtinyISP programmer. Writing the bootloader worked, but the verification failed.
After some investigation we found that the writing actually did work, but reading back the data is broken. After 64kb of data it starts reading from byte 0 again. So with 128kb flash it returns the first 64kb twice.
Trying to hunt that bug down we looked at the USBtinyISP firmware and avrdude source, but unfortunately we are not able to provide a clean fix - but we got a dirty one. (;
(I couldn't attach the patch to this post, so here it is inline)
Code: Select all | TOGGLE FULL SIZE
--- avrdude-5.11.1/usbtiny.c   2011-09-15 16:37:05.000000000 +0200
+++ avrdude-5.11.1.fix/usbtiny.c   2011-11-25 09:29:04.392417554 +0100
@@ -552,7 +556,7 @@
   /* Optional Functions */
   pgm->powerup           = NULL;
   pgm->powerdown   = usbtiny_powerdown;
-  pgm->paged_load   = usbtiny_paged_load;
+  //pgm->paged_load   = usbtiny_paged_load;
   pgm->paged_write   = usbtiny_paged_write;
   pgm->set_sck_period   = usbtiny_set_sck_period;
   pgm->setup            = usbtiny_setup;


Not using the optimized load function makes reading about factor 8 slower, but it works at least.

Digging deeper into the USB internals we gave up yesterday and decided to not invest any more time. If anyone is interested in more information from our debugging hell, don't hesitate.. (:
ra_
 
Posts: 6
Joined: Mon Oct 27, 2008 4:41 pm

Re: USBtinyISP Bug reading flash >64kb

by ra_ on Fri Dec 16, 2011 9:07 pm

The website[0] has been updated[1] and now states: "Works with any AVR ISP chip with 64K of flash (or less) - does not work with Atmega1281/1280/2561/2560"

[0] http://www.ladyada.net/make/usbtinyisp/
[1] http://web.archive.org/web/201105191625 ... sbtinyisp/
ra_
 
Posts: 6
Joined: Mon Oct 27, 2008 4:41 pm

Please be positive and constructive with your questions and comments.