avrdude-dev
[Top][All Lists]
Advanced

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

Re: [avrdude-dev] Updated patch for Linux sysfs GPIO programmer type


From: Radoslav Kolev
Subject: Re: [avrdude-dev] Updated patch for Linux sysfs GPIO programmer type
Date: Sat, 5 Jan 2013 00:37:20 +0200

On Wed, Jan 2, 2013 at 10:39 PM, Joerg Wunsch <address@hidden> wrote:
>> Also, I've included the changes to the documentation (man
>> page, info page and NEWS file) as you requested some time ago.
>
> That's fine, yes.  (Please avoid putting unrelated changes into a
> patch though.  I've rather fixed the small typo separately.)

OK, agreed.

>> Please, have a look at the attached preliminary version and let me
>> know if it fits the requirements to be included in the official
>> avrdude release.
>
> From an eyeball-review, it looks mostly good, thanks!
>
> Two minor remarks:
>
> . Better use 2013 as the copyright year for new files ;), and there's
>   no need to attribute new files (like the header file) to Brian Dean
>   rather than yourself (or any actual contributors).

I have fixed these.

> . I'd prefer to reverse the autoconf logic for the enable option, so
>   it is disabled by default.  The feature is only useful for a small
>   subset of AVRDUDE users anyway, and all those who are candidate
>   users of it are likely to compile their own version from sources
>   anyway, so they can manually enable it without problems.

Actually, I had changed it to disabled by default a long time ago, but
had forgotten to update the description and it still said (default),
it's fixed now.

Before sending a final revised version of the patch I have some questions.

First, the patch increases the maximum pin number in config_gram.y to
255, since it's normal for modern SoCs to have a large number of
GPIOs. Just wanted to point it out in case you've missed it and would
prefer this as a separate patch/change, since it's not directly
related to the new programmer type.

The second thing also concerns pin numbers. As far as my understanding
goes, if a pin is not specified in a certain programmer entry in the
configuration file it will default to 0, which means not
available/used by this programmer. The problem is that GPIO numbering
in Linux starts from zero, so it's actually a valid value. To work
around this now the pin numbers specified in the config file are
actually off by one. For example if you mean GPIO5 (from the point of
view of Linux's sysfs interface) in avrdude.conf you have to put 6 as
the value.

That's kind of annoying and I would like to fix it somehow. Ideally,
if the default not assigned pin value was -1 and not 0 that would
solve it, but I have no idea how this will influence the rest of the
code. Another way would be to just assume that miso, mosi, reset and
sck pins are set in the config file and use their value, even if it's
zero. If any of those pins is not assigned there isn't much chance
programming will work anyway, but I didn't see an easy way to make
these parameters required just for a single programmer type.

The other change I'm thinking of is to set all pins as inputs after
programming is finished. Currently i've copied the behaviour of the
serial bit bang programmers which is to raise RESET high. At least for
MOSI and SCK I think configuring them as inputs will be better. This
way even if there are no buffer/current limiting resistors the chances
of burning a GPIO due to overcurrent is lowered. Reset should also
normally be pulled high somewhere on the board being programmed. Now
after programming is finished the GPIO is holding the RESET line high.
But if there's a reset button on the board, which pulls it low (like
there is on Arduinos for example) and its pressed with the ISP cable
still connected then it can cause problems.

What do you recommend for the above?

Best regards,
Rado



reply via email to

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