Sun 16 Jan 2011 04:25:02 AM UTC, original submission:
Dear AVRDude dudes,
First off, thanks for writing such an awesome tool - if it weren't for you, I wouldn't be able to tinker with AVRs. (What a sad and miserable life that would be! :-) )
In case you're interested, I've made a couple of changes/improvements I've made to the support for dangerousprototypes.com's Bus Pirate.
The first change is structural. During initialization, the previous buspirate.c (specifically, buspirate_enable() ) sent a reset command to the BP and parsed the resulting serial output to determine the versions of the BP hardware and firmware. This was then used to determine whether the binary SPI mode could be used for communication with the MCU. Unfortunately, this approach has been a source of ongoing compatibility issues due to small changes made to the BP user interface over the last few firmware revisions. Furthermore, the initial reset command will cause havoc with the next version of the BP hardware (v4), as it will cause the USB connection to the BP to disappear and reattach.
Following the suggestion of Ian Lesnet, the lead BP developer, I've therefore removed the initial reset, as well as any attempt to detect the BP hardware or firmware versions via the BP user interface. Instead, I've implemented a try-then-fallback approach that attempts to enter the binary SPI mode, then falls back to the original ascii mode in the event that this fails. Entering binary mode implicitly causes the BP to reset its internal mode settings, which is why the explicit reset is unnecessary, but a reset is still performed in the event that ascii mode is used. This change fixes all of the recent compatibility issues as all but the earliest firmware versions support the binary mode. (The extended option "ascii" can still be used to force the use of the legacy ascii SPI mode, if desired. However, ascii mode is likely to fail on BPs using recent firmware versions due again to small changes in the ascii user interface.)
The second change is a feature addition. Ian has added a new bulk SPI write command to the latest BP firmware version. The presence of this new command is determined during initialization (again by trial and error, this time in buspirate_start_spi_mode_bin() ) and, if found, a new buspirate_pagedwrite() function is enabled which makes use of this command which speeds up writes to AVR flash memory by about a factor of 4. I've created an additional extended option "nopagedwrite" which disables detection and use of this function in case it's not wanted, and added an appropriate entry to the manpage documenting this new option.
The attached patch includes these changes and is against the current svn trunk. If you're happy with the modifications, please let me know if there's anything I can do to make them appropriate for inclusion in the avrdude code base. I've done my best to keep the changes/additions in line with the existing style, but no-doubt there's plenty that could be done better.
Thanks again for all the hard work you guys have put in to opening up AVR programming to *nix users!
Tim
p.s. I posted this to the list a few weeks ago, but didn't actually assign a patch number - hence the double post.
|