patchAVR Downloader/UploaDEr - Patches: patch #9816, Implement new programmer type:...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

patch #9816: Implement new programmer type: linuxspi

Submitter:  Ralf Ramsauer <rralf>
Submitted:  Fri 14 Jun 2019 06:30:19 PM UTC
Votes: 200
 
Category:  None Priority:  5 - Normal
Status:  Done Privacy:  Public
Assigned to:  joerg_wunsch Open/Closed:  Closed

Sat 27 Nov 2021 08:22:59 PM UTC, comment #5: 

I also added Lars' patch in r1498.

I included a default port string now (the one which appears to be the default for my Raspberry Pi - yeah, finally able to test it), and I moved the ISP clock setting to the -B option as it is done for all other programmers. -b used to be used for RS232-attached programming dongles to really tell the RS232 baudrate. Additional advantage: -B can parse kHz and MHz suffix.

Finally, I changed the default bitclock to 200 kHz (so it fits the 1 MHz default CPU clock of most AVRs), improved documentation a bit (the texinfo file now has a full wiring example), and I implemented the configure logic in avrdude.conf so the default linuxspi entry is now automatically shipped if the option is enabled by configure. (We did similar already with the parport stuff in the past.)

So thanks to everyone.

Joerg Wunsch <joerg_wunsch>
Group administrator
Tue 22 Sep 2020 08:20:39 PM UTC, comment #4: 

I've used this patch for a while now, had some initial issues which I tracked down to this patch not setting the SPI mode, and if you are using SPI to communicate with as well, setting a incompatible SPI mode will cause this programmer being unable to communicate with the chip.

I fixed it by adding:
    uint32_t mode = SPI_MODE_0 | SPI_NO_CS;
    ret = ioctl(fd_spidev, SPI_IOC_WR_MODE32, &mode);
    if (ret == -1) {
        avrdude_message(MSG_INFO, "%s: error: Unable to set SPI mode %0X on %s\n", progname, mode, spidev);
        goto close_spidev;
    }


Before:
    fd_gpiochip = open(gpiochip, 0);

in linuxspi.c

Ya I know that's the worst patch ever :( I applied this to the 6.3 source and added a shit load of debug messages to figure out where the issue was, so my local source is a mess ;)

Lars Ollén <laeffe>
Sat 19 Sep 2020 09:34:01 PM UTC, comment #3: 

Applied in r1447, thanks! (Without own tests, don't have an RPi readily available where I could compile and use it.)

Thanks in particular for also providing documentation for it.

Joerg Wunsch <joerg_wunsch>
Group administrator
Tue 10 Mar 2020 03:44:42 PM UTC, comment #2: 

Fabian,

thank you very much for your comment and for testing my/our patch. I'd really wish that it would be integrated, but, to be honest, there was almost no reaction at all and avrdude seems to unfortunately be dead from a maintainer perspective. Sigh...

  Ralf

Ralf Ramsauer <rralf>
Tue 10 Mar 2020 03:30:25 PM UTC, comment #1: 

Just wanted to leave a comment to say, that I am using this to flash an
atmega328p via SPI from the raspberry pi and it works quite well. Did not
have any issues with it, yet :)

Fabian Viöl <sh3rm4n>
Fri 14 Jun 2019 06:30:19 PM UTC, original submission:  

This adds a new linuxspi programmer type. Analogously to linuxgpio, this
programmer uses the Linux-specific spidev device.

For accessing the reset pin, this programmer uses an additional GPIO pin using
the linux/gpio.h API. In contrast to the stateless and deprecated sysfs
interface, linux/gpio.h uses proper file descriptors for every pin, and
performs housekeeping when the device is closed. That saves some lines of code.

The programmer can be used as follows:
  avrdude -c linuxspi -P /dev/spidev:/dev/gpiochip[:resetpin] [...]

Separated by colons, the first part of the port (-P) argument denotes the
spidev device, the second one is the gpiochip that contains the reset pin, and
the optional third argument contains the pin number of the reset pin.

If not specified, the pin number defaults to the reset pin number defined in
avrdude.conf. Currently, this defaults to 25, which is connected to Pin 22 on a
Raspberry Pi.

Additionally, add some documentation.

Credits go to Kevin Cuzner, who started this fork ~5 years ago. I picked it up,
rebased it to the current mainline, massaged some parts of the code here and
there, fixed some minor bugs and switched to the linux/gpio.h GPIO accessors.

Signed-off-by: Ralf Ramsauer <ralf@vmexit.de>

Ralf Ramsauer <rralf>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attached Files
file #47099:  avrdude-linuxspi-V1.patch added by rralf (15KiB - text/x-patch)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by laeffe (Posted a comment)
  • -email is unavailable- added by joerg_wunsch (Posted a comment)
  • -email is unavailable- added by laeffe (Voted in favor of this item)
  • -email is unavailable- added by chrstphrchvz (Voted in favor of this item)
  • -email is unavailable- added by sh3rm4n (Posted a comment)
  • -email is unavailable- added by rralf (Submitted the item)
  • -email is unavailable- added by rralf
  • -email is unavailable- added by rralf
  •  

    There are 200 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

     

    Follow 12 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2021-11-27 joerg_wunsch StatusReady For Test Done
        Open/ClosedOpen Closed
    2020-09-22 joerg_wunsch StatusDone Ready For Test
        Open/ClosedClosed Open
    2020-09-19 joerg_wunsch StatusNone Done
        Assigned toNone joerg_wunsch
        Open/ClosedOpen Closed
    2020-07-05 laeffe Carbon-Copy- Added laeffe
    2020-06-14 chrstphrchvz Carbon-Copy- Added chrstphrchvz
    2019-06-14 rralf Attached File- Added avrdude-linuxspi-V1.patch, #47099
        Carbon-Copy- Added -email is unavailable-
        Carbon-Copy- Added -email is unavailable-

    Back to the top

    Powered by Savane 3.13-4448.
    Corresponding source code