[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [avrdude-dev] Win 32 port
From: |
Jan-Hinnerk Reichert |
Subject: |
Re: [avrdude-dev] Win 32 port |
Date: |
Thu, 12 Feb 2004 21:31:02 +0100 |
User-agent: |
KMail/1.5.4 |
On Thursday 12 February 2004 18:27, Martin Thomas wrote:
> > On Thursday 12 February 2004 15:51, Daniel Williamson wrote:
> Did you test the latest ("0.4") version of the W32 port? It still
> needs testing but worked with my pony-stk200 PPI (W2k,
> P2/400, mega16, 14KB hex). There has been a problem with
> the delays.
> I don't know much about the correct timing with PPI interfaces
> but the problems is kind of solved by "defing":
> #define usleep(us) Sleep(us/1000*3)
First of all "us/1000" truncates the result. So you wait 4ms when you
should wait 4500us. So you change this to "(us+999)/1000"
> I could not find a uSec resolution delay in the WIN32-API.
> W32-Sleep gets the parameter in Milliseconds. But it seems to be
> "too fast" doubeling was not enough, multiply by 3 worked
> (flash and verify). I know: this is still no "clean" solution and
> may slow down things where it's not needed.
You could try to measure the real delay time with the high resolution
timer. This is available in all win32-variants, but does not work on
all (i.e not on older) hardware. (This timer is used in the original
usleep()-workaround.)
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/sysinfo/base/high_resolution_timer.asp
I would really like to identify the core of the problem instead of
just creating a workaround.
> In the "cywin-dll" code there is a workaround for
> the missing usleep but I've disabled this the WIN32 port.
> The "cygwin-dll" workaround also included a minimum delay
> value which is not used in the W32-port. It might be just one
> delay that is to short but I could not find the right one so
> far.
There are only two delays: one after the chip erase and one after the
page write.
> A cleaner solution might be a delay-calibration on startup.
> This might be a "nice" feature in the Linux/Unix version too.
This would work most of the time. However, it isn't a clean solution
to do delay-calibration in a multitasking OS.
Thanks for your effort so far :-)
Cheers
Jan-Hinnerk