Page 1 of 1

Patch for AVRDOPER HVSP mode

Posted: Tue Mar 24, 2009 11:27 pm
by Sebastian
Hi,

I noticed that AVRDOPER had some problems on programming some TINY13 chips that I was able to program using my STK500 without errors. When using the AVRDROPER, programming worked fine but I got verify errors on various bytes.

I checked the programming sequence and found that some clock pulses are below the minimum of 220ns given in the datasheet. So I changed hvprog.c and added some nop's to get correct clock pulses. With that modification, all of my TINY13s could be programmed without any errors.

Regards,
Sebastian

Patch:

--------8<-------------
--- firmware/hvprog.c 2008-11-27 11:02:29.000000000 +0100
+++ firmware/hvprog.c.new 2009-03-22 02:19:55.000000000 +0100
@@ -105,6 +105,9 @@
PORT_OUT(HWPIN_HVSP_SII) = port;
PORT_PIN_SET(HWPIN_HVSP_SCI);
cnt = 8;
+ /* waste some time for better timing accuracy */
+ asm volatile("nop" ::);
+ asm volatile("nop" ::);
+ asm volatile("nop" ::);
PORT_PIN_CLR(HWPIN_HVSP_SCI);
do{
r <<= 1;
@@ -119,13 +122,28 @@
port &= ~((1<<PORT_BIT(HWPIN_HVSP_SII)) | (1<<PORT_BIT(HWPIN_HVSP_SDI)));
ctlLines <<= 1;
data <<= 1;
+ asm volatile("nop" ::);
+ asm volatile("nop" ::);
PORT_PIN_CLR(HWPIN_HVSP_SCI);
}while(--cnt);
PORT_OUT(HWPIN_HVSP_SII) = port;
/* clock out two zeros */
PORT_PIN_SET(HWPIN_HVSP_SCI);
+ asm volatile("nop" ::);
+ asm volatile("nop" ::);
+ asm volatile("nop" ::);
PORT_PIN_CLR(HWPIN_HVSP_SCI);
+ asm volatile("nop" ::);
+ asm volatile("nop" ::);
+ asm volatile("nop" ::);
PORT_PIN_SET(HWPIN_HVSP_SCI);
+ asm volatile("nop" ::);
+ asm volatile("nop" ::);
+ asm volatile("nop" ::);
PORT_PIN_CLR(HWPIN_HVSP_SCI);
return r;
}

Re: Patch for AVRDOPER HVSP mode

Posted: Sat Apr 11, 2009 6:44 pm
by christian
Thanks for the patch! This will be in the next release of AVR-Doper.