avrdude-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [avrdude-dev] universal part autodetection


From: Jan-Hinnerk Reichert
Subject: Re: [avrdude-dev] universal part autodetection
Date: Sat, 13 Dec 2003 22:33:48 +0100
User-agent: KMail/1.5.4

On Saturday 13 December 2003 20:09, Michael Mayer wrote:
> I reworked the way to autodetect the used part.
>
> Yesterday Brian said:
> > I kind've like the idea of auto detection, where applicable.  The
> > STK500 is kind've special since you need to know certain part
> > parameters to send to the STK500 before you can actually even
> > enter programming mode in order to read the signature bytes. 
> > However, it may be possible to tell the STK500 the part is any
> > old chip, simply for the purposes of reading the signature bytes,
> > then re-initialize the STK500 session using the actual part that
> > we queried.
>
> Now I'm doing it this way. After startup, the first part in the
> partlist is chosen as a dummy part just to be able to initialize
> the programmer and read the signature. The signature is evaluated,
> the right part is chosen and the program continues as usual.
>
> Now the overall structure of main.c is left intact and only minor
> changes in avrpart.c and pgm.c are necessary. It is still needed to
> split pgm->initialize into to parts, the real programmer
> initialization and the selection of the used part.
>
> Now it should be possible to get part autodetection working for all
> types of programmers in a very easy way. FYI I send a patch against
> the latest cvs version from 2ed Dec. Dispite it works for me, this
> patch is not a clean one, it is not intended to be applied to your
> "real" sources. I just want to show you the way I'm doing
> autodetection now and ask for comments about it.

Here are my 2 cent ;-)

1) Move all the detect programmer and read capabilities stuff to 
avr_open(). Store the supported types in an array (global variable).

2) Move the (real) select type and programming enable to 
avr_programming_enable(). Call pgm->programming_enable() somewhere 
from main.c or avr.c.

3) Make a new function avr_autodetect_part() and add autodetect_part() 
to the optional part of the programmer-structure.

4) Let the programmer decide how it does autodetection. There is no 
need to fetch a default-device in main.c.

If you want to support non-bootloader programmers that might use this 
protocol:

5) Sent 'T'-command with a valid value (one returned by 't') and 'P', 
before reading the signature.

BTW: Are you sure that avr_read_signature2() works? AFAIK, the bit 
shifts are done before the value is cast to int.

/Jan-Hinnerk

PS: Take your time. I doubt that the changes will go in before the 
next release of WinAVR (i.e. this year). IMHO there is not enough 
time to do the necessary thinking and testing. Nevertheless, I think 
that autodetection should go in soon ;-)





reply via email to

[Prev in Thread] Current Thread [Next in Thread]